00001
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef RtcModuleProfile_h
00031 #define RtcModuleProfile_h
00032
00033
00034 #include "rtm/RTC.h"
00035
00036
00037 #include <map>
00038 #include <string>
00039
00040
00041 #include "rtm/idl/RTCProfileSkel.h"
00042 #include "rtm/idl/RTCProfileStub.h"
00043 #include "rtm/idl/RTCBaseSkel.h"
00044 #include "rtm/idl/RTCBaseStub.h"
00045
00046
00047 namespace RTM {
00048 using namespace std;
00049
00055 typedef enum RtcModuleProfileType {
00056 RTC_MODULE_NAME,
00057 RTC_MODULE_DESC,
00058 RTC_MODULE_VERSION,
00059 RTC_MODULE_AUTHOR,
00060 RTC_MODULE_COMPANY,
00061 RTC_MODULE_CATEGORY,
00062 RTC_MODULE_COMP_TYPE,
00063 RTC_MODULE_ACT_TYPE,
00064 RTC_MODULE_MAX_INST,
00065 RTC_MODULE_LANG,
00066 RTC_MODULE_LANG_TYPE,
00067 RTC_MODULE_SPEC_END
00068 };
00069
00070
00076 typedef struct RtcModuleProfSpec_t {
00077 RtcModuleProfileType type;
00078 char* value;
00079 } RtcModuleProfSpec;
00080
00081
00082 typedef map<string, int>::value_type TypeMapValue;
00083
00087 static TypeMapValue CompTypes[] = {
00088 TypeMapValue("STATIC", STATIC),
00089 TypeMapValue("UNIQUE", UNIQUE),
00090 TypeMapValue("COMMUTATIVE", COMMUTATIVE)
00091 };
00092
00096 static TypeMapValue ActTypes[] = {
00097 TypeMapValue("PERIODIC", PERIODIC),
00098 TypeMapValue("SPORADIC", SPORADIC),
00099 TypeMapValue("EVENT_DRIVEN", EVENT_DRIVEN),
00100 };
00101
00105 static TypeMapValue LangTypes[] = {
00106 TypeMapValue("COMPILE", COMPILE),
00107 TypeMapValue("SCRIPT", SCRIPT),
00108 };
00109
00110
00111
00117 class EXPORTS RtcModuleProfile
00118 {
00119 public:
00120
00124 RtcModuleProfile();
00125
00131 RtcModuleProfile(RtcModuleProfSpec *spec);
00132
00133
00134 RTCProfile getProfile();
00135
00141 bool initSpec(RtcModuleProfSpec *spec);
00142
00143
00144
00150 bool setImplementationId(const char* implementation_id);
00151 const char* getImplementationId(){return m_Profile.implementation_id;};
00152
00158 bool setInstanceId(const char* instance_id);
00159 const char* getInstanceId(){return m_Profile.instance_id;};
00160
00168 bool setDescription(const char* desc);
00169 const char* getDescription() {return m_Profile.description;};
00170
00171
00177 bool setVersion(const char* version);
00178 const char* getVersion() {return m_Profile.version;};
00179
00180
00186 bool setAuthorName(const char* author_name);
00187 const char* getAuthorName() {return m_Profile.maker;};
00188 bool setAuthorCompany(const char* author_company);
00189 const char* getAuthorCompany() {return m_Profile.maker;};
00190
00191
00192
00193
00194
00195
00196
00197
00198 bool setCategory(const char* category);
00199 const char* getCategory() {return m_Profile.category;};
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215 bool setComponentType(RTComponentType type);
00216 bool setComponentType(const char *type_str);
00217 RTComponentType getComponentType() {return m_Profile.component_type;};
00218
00219
00234 bool setActivityType(RTCActivityType type);
00235 bool setActivityType(const char *type_str);
00236 RTCActivityType getActivityType() {return m_Profile.activity_type;};
00237
00238
00245 bool setMaxInstance(int max);
00246 bool setMaxInstance(const char *max_str);
00247 int getMaxInstance() {return m_Profile.max_instance;};
00248
00249
00255 bool setLanguage(const char* langugae);
00256 const char* getLanguage() {return m_Profile.language;};
00257
00258
00267 bool setLanguageType(RTCLangType type);
00268 bool setLanguageType(const char *type_str);
00269 RTCLangType getLanguageType() {return m_Profile.language_type;};
00270
00271
00277 bool setIconImage(const char* image);
00278 const char* getIconImage() {return NULL;};
00279
00280 bool appendInPortProfile(const PortProfile port_profile);
00281 PortProfile getInPortProfile(const char* name);
00282 PortProfileList getInPortProfileList();
00283
00284 bool appendOutPortProfile(const PortProfile port_profile);
00285 PortProfile getOutPortProfile(const char* name);
00286 PortProfileList getOutPortProfileList();
00287
00288
00289
00290 private:
00291 void RtcModuleProfile::initTable();
00292
00293
00294 RTCProfile m_Profile;
00295
00296 map<string, int> m_CompTypeMap;
00297 map<string, int> m_ActTypeMap;
00298 map<string, int> m_LangTypeMap;
00299 int m_CompTypeSize;
00300 int m_ActTypeSize;
00301 int m_LangTypeSize;
00302
00303 typedef bool (RtcModuleProfile::*SpecInitFunc)(const char* );
00304 SpecInitFunc _init_func[RTC_MODULE_SPEC_END];
00305
00306 };
00307
00308
00309 };
00310
00311
00312 #endif // RtcModuleProfile_h