00001
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef RtcModuleProfile_h
00028 #define RtcModuleProfile_h
00029
00030
00031 #include "rtm/RTC.h"
00032
00033
00034 #include <map>
00035 #include <string>
00036
00037
00038 #include "rtm/idl/RTCProfileSkel.h"
00039 #include "rtm/idl/RTCProfileStub.h"
00040 #include "rtm/idl/RTCBaseSkel.h"
00041 #include "rtm/idl/RTCBaseStub.h"
00042
00043
00044 namespace RTM {
00045 using namespace std;
00046
00052 typedef enum RtcModuleProfileType {
00053 RTC_MODULE_NAME,
00054 RTC_MODULE_DESC,
00055 RTC_MODULE_VERSION,
00056 RTC_MODULE_AUTHOR,
00057 RTC_MODULE_COMPANY,
00058 RTC_MODULE_CATEGORY,
00059 RTC_MODULE_COMP_TYPE,
00060 RTC_MODULE_ACT_TYPE,
00061 RTC_MODULE_MAX_INST,
00062 RTC_MODULE_LANG,
00063 RTC_MODULE_LANG_TYPE,
00064 RTC_MODULE_SPEC_END
00065 };
00066
00067
00073 typedef struct RtcModuleProfSpec {
00074 RtcModuleProfileType type;
00075 char* value;
00076 };
00077
00078
00079 typedef map<string, int>::value_type TypeMapValue;
00080
00084 static TypeMapValue CompTypes[] = {
00085 TypeMapValue("STATIC", STATIC),
00086 TypeMapValue("UNIQUE", UNIQUE),
00087 TypeMapValue("COMMUTATIVE", COMMUTATIVE)
00088 };
00089
00093 static TypeMapValue ActTypes[] = {
00094 TypeMapValue("PERIODIC", PERIODIC),
00095 TypeMapValue("SPORADIC", SPORADIC),
00096 TypeMapValue("EVENT_DRIVEN", EVENT_DRIVEN),
00097 };
00098
00102 static TypeMapValue LangTypes[] = {
00103 TypeMapValue("COMPILE", COMPILE),
00104 TypeMapValue("SCRIPT", SCRIPT),
00105 };
00106
00107
00108
00114 class RtcModuleProfile
00115 {
00116 public:
00117
00121 RtcModuleProfile();
00122
00128 RtcModuleProfile(RtcModuleProfSpec *spec);
00129
00130
00131 RTCProfile getProfile();
00132
00138 bool initSpec(RtcModuleProfSpec *spec);
00139
00140
00141
00147 bool setImplementationId(const char* implementation_id);
00148 const char* getImplementationId(){return m_Profile.implementation_id;};
00149
00155 bool setInstanceId(const char* instance_id);
00156 const char* getInstanceId(){return m_Profile.instance_id;};
00157
00165 bool setDescription(const char* desc);
00166 const char* getDescription() {return m_Profile.description;};
00167
00168
00174 bool setVersion(const char* version);
00175 const char* getVersion() {return m_Profile.version;};
00176
00177
00183 bool setAuthorName(const char* author_name);
00184 const char* getAuthorName() {return m_Profile.maker;};
00185 bool setAuthorCompany(const char* author_company);
00186 const char* getAuthorCompany() {return m_Profile.maker;};
00187
00188
00189
00190
00191
00192
00193
00194
00195 bool setCategory(const char* category);
00196 const char* getCategory() {return m_Profile.category;};
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212 bool setComponentType(RTComponentType type);
00213 bool setComponentType(const char *type_str);
00214 RTComponentType getComponentType() {return m_Profile.component_type;};
00215
00216
00231 bool setActivityType(RTCActivityType type);
00232 bool setActivityType(const char *type_str);
00233 RTCActivityType getActivityType() {return m_Profile.activity_type;};
00234
00235
00242 bool setMaxInstance(int max);
00243 bool setMaxInstance(const char *max_str);
00244 int getMaxInstance() {return m_Profile.max_instance;};
00245
00246
00252 bool setLanguage(const char* langugae);
00253 const char* getLanguage() {return m_Profile.language;};
00254
00255
00264 bool setLanguageType(RTCLangType type);
00265 bool setLanguageType(const char *type_str);
00266 RTCLangType getLanguageType() {return m_Profile.language_type;};
00267
00268
00274 bool setIconImage(const char* image);
00275 const char* getIconImage() {return NULL;};
00276
00277 bool appendInPortProfile(const PortProfile port_profile);
00278 PortProfile getInPortProfile(const char* name);
00279 PortProfileList getInPortProfileList();
00280
00281 bool appendOutPortProfile(const PortProfile port_profile);
00282 PortProfile getOutPortProfile(const char* name);
00283 PortProfileList getOutPortProfileList();
00284
00285
00286
00287 private:
00288 void RtcModuleProfile::initTable();
00289
00290
00291 RTCProfile m_Profile;
00292
00293 map<string, int> m_CompTypeMap;
00294 map<string, int> m_ActTypeMap;
00295 map<string, int> m_LangTypeMap;
00296 int m_CompTypeSize;
00297 int m_ActTypeSize;
00298 int m_LangTypeSize;
00299
00300 typedef bool (RtcModuleProfile::*SpecInitFunc)(const char* );
00301 SpecInitFunc _init_func[RTC_MODULE_SPEC_END];
00302
00303 };
00304
00305
00306 };
00307
00308
00309 #endif // RtcModuleProfile_h