iotivity 0.9.0
[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         public:
64             /**
65             * Constructor for Plugin.
66             *
67             */
68             Plugin(void);
69
70
71             /**
72             * Virtual destructor.
73             */
74             virtual ~Plugin(void);
75
76             /**
77             * Get unique ID of the plug-in
78             *
79             * @return unique id string of the pluin. if ID is not exist, it return ""
80             */
81             std::string getID(void);
82
83
84             /**
85             * Get version of the plug-in
86             *
87             * @return version information string of the plugin. if Version is not exist, it return ""
88             *
89             */
90             std::string getVersion(void);
91
92
93             /**
94             * Get name of the plug-in
95             *
96             * @return name string of the plugin. if Name is not exist, it return ""
97             */
98             std::string getName(void);
99
100
101             /**
102             * Get provider name of the plug-in
103             *
104             * @return provider name of the plugin. if ProviderName is not exist, it return ""
105             *
106             */
107             std::string getProviderName(void);
108
109
110             /**
111             * Get value for the attributes
112             *
113             * @param attribute attriubute string to get value
114             * @return value of the attribute. if "attribute" is not exist, it return ""
115             *
116             */
117             std::string getValueByAttribute(const std::string attribute);
118
119             /**
120             * Check whether the plugin same or not.
121             *
122             * @param plugin
123             * @return true if same, else return false
124             *
125             */
126             bool operator==(Plugin &plugin);
127
128         private:
129             friend class CpluffAdapter;
130             friend class FelixAdapter;
131               /**
132             * Set key, value. key is attribute name.
133             *
134             * @param key is atrribute name.
135             * @param value for the attribute.
136             * @return void
137             *
138             */
139             void setValue(const std::string key, const std::string value);
140
141             std::map<std::string, AttributeValue> m_attributeMap;
142             std::vector<std::string> m_supportedType;
143     };
144
145 }
146
147
148 #endif //__Plugin_H__