bd823d87d845121ca73e684ece954bac504f0604
[platform/upstream/iotivity.git] / service / protocol-plugin / plugin-manager / src / Plugin.h
1 //******************************************************************
2 //
3 // Copyright 2014 Samsung Electronics All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //      http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 /// @file Plugin.h
22
23 /// @brief
24
25
26 #ifndef __Plugin_H__
27 #define __Plugin_H__
28
29 #define TRUE 1
30 #define FALSE 0
31
32 #ifdef HAVE_CONFIG_H
33 #include <config.h>
34 #endif
35 #include <stdio.h>
36 #include <stdlib.h>
37 #include <stdarg.h>
38 #include <string.h>
39 #include <ctype.h>
40 #ifdef HAVE_GETTEXT
41 #include <locale.h>
42 #endif
43 #include <assert.h>
44 #include <cpluff.h>
45
46 #include <string>
47 #include <map>
48 #include <vector>
49
50 namespace OIC
51 {
52
53     typedef std::string AttributeValue;
54
55
56     /**
57     *   @brief  This class provides information of each plugin installed.
58     *
59     *
60     */
61     class Plugin
62     {
63
64
65         public:
66
67
68             /**
69             * Constructor for Plugin.
70             *
71             */
72             Plugin(void);
73
74
75             /**
76             * Virtual destructor.
77             */
78             virtual ~Plugin(void);
79
80             /**
81             * Get unique ID of the plug-in
82             *
83             * @return unique id string of the pluin. if ID is not exist, it return ""
84             */
85             std::string getID(void);
86
87
88             /**
89             * Get version of the plug-in
90             *
91             * @return version information string of the plugin. if Version is not exist, it return ""
92             *
93             */
94             std::string getVersion(void);
95
96
97             /**
98             * Get name of the plug-in
99             *
100             * @return name string of the plugin. if Name is not exist, it return ""
101             */
102             std::string getName(void);
103
104
105             /**
106             * Get provider name of the plug-in
107             *
108             * @return provider name of the plugin. if ProviderName is not exist, it return ""
109             *
110             */
111             std::string getProviderName(void);
112
113
114             /**
115             * Get value for the attributes
116             *
117             * @param attribute attriubute string to get value
118             * @return value of the attribute. if "attribute" is not exist, it return ""
119             *
120             */
121             std::string getValueByAttribute(const std::string attribute);
122
123
124             /**
125             * Set key, value. key is attribute name.
126             *
127             * @param key is atrribute name.
128             * @param value for the attribute.
129             * @return void
130             *
131             */
132             void setValue(const std::string key, const std::string value);
133
134
135             /**
136             * Check whether the plugin same or not.
137             *
138             * @param plugin
139             * @return true if same, else return false
140             *
141             */
142             bool operator==(Plugin &plugin);
143
144             /**
145             * Get supported resourc type
146             *
147             *
148             * @return vector of surported resource type
149             */
150             std::vector<std::string> getSupportedType(void);
151             /**
152             * Add supported resource type for a plugin
153             *
154             * @param resource type string
155             * @return void
156             *
157             */
158             void addSupportedType(const std::string rscType);
159
160         private:
161             std::map<std::string, AttributeValue> m_attributeMap;
162             std::vector<std::string> m_supportedType;
163     };
164
165 }
166
167
168 #endif //__Plugin_H__