16 #ifndef __OMNETPP_CCLASSDESCRIPTOR_H
17 #define __OMNETPP_CCLASSDESCRIPTOR_H
20 #include "cownedobject.h"
22 #include "opp_string.h"
48 FD_ISCOWNEDOBJECT = 0x10,
50 FD_ISREPLACEABLE = 0x40,
51 FD_ISRESIZABLE = 0x80,
56 std::string baseClassName;
58 int inheritanceChainLength = 1;
59 int extendscObject = -1;
63 static std::string long2string(
long l);
64 static long string2long(
const char *s);
65 static std::string ulong2string(
unsigned long l);
66 static unsigned long string2ulong(
const char *s);
67 static std::string int642string(int64_t l);
68 static int64_t string2int64(
const char *s);
69 static std::string uint642string(uint64_t l);
70 static uint64_t string2uint64(
const char *s);
71 static std::string bool2string(
bool b);
72 static bool string2bool(
const char *s);
73 static std::string double2string(
double d);
74 static double string2double(
const char *s);
75 static std::string simtime2string(
SimTime t) {
return t.
ustr();}
77 std::string enum2string(
int e,
const char *enumName)
const;
78 intval_t string2enum(
const char *s,
const char *enumName)
const;
79 static std::string oppstring2string(
const char *s) {
return s?s:
"";}
80 static std::string oppstring2string(
const opp_string& s) {
return s.c_str();}
81 static std::string oppstring2string(
const std::string& s) {
return s;}
82 static void string2oppstring(
const char *s, opp_string& str) {str = s?s:
"";}
83 static void string2oppstring(
const char *s, std::string& str) {str = s?s:
"";}
84 static const char **mergeLists(
const char **list1,
const char **list2);
93 cClassDescriptor(
const char *className,
const char *baseClassName=
nullptr);
136 bool extendsCObject()
const;
141 std::string getNamespace()
const;
147 int getInheritanceChainLength()
const;
153 virtual const char **getPropertyNames()
const = 0;
162 virtual const char *getProperty(
const char *propertyname)
const = 0;
167 virtual int getFieldCount()
const = 0;
173 virtual const char *getFieldName(
int field)
const = 0;
180 virtual int findField(
const char *fieldName)
const;
188 virtual unsigned int getFieldTypeFlags(
int field)
const = 0;
192 bool getFieldIsArray(
int field)
const {
return getFieldTypeFlags(field) & FD_ISARRAY;}
193 bool getFieldIsCompound(
int field)
const {
return getFieldTypeFlags(field) & FD_ISCOMPOUND;}
194 bool getFieldIsPointer(
int field)
const {
return getFieldTypeFlags(field) & FD_ISPOINTER;}
195 bool getFieldIsCObject(
int field)
const {
return getFieldTypeFlags(field) & (FD_ISCOBJECT|FD_ISCOWNEDOBJECT);}
196 bool getFieldIsCOwnedObject(
int field)
const {
return getFieldTypeFlags(field) & FD_ISCOWNEDOBJECT;}
197 bool getFieldIsEditable(
int field)
const {
return getFieldTypeFlags(field) & FD_ISEDITABLE;}
198 bool getFieldIsReplaceable(
int field)
const {
return getFieldTypeFlags(field) & FD_ISREPLACEABLE;}
199 bool getFieldIsResizable(
int field)
const {
return getFieldTypeFlags(field) & FD_ISRESIZABLE;}
205 virtual const char *getFieldDeclaredOn(
int field)
const;
213 virtual const char *getFieldTypeString(
int field)
const = 0;
219 virtual const char **getFieldPropertyNames(
int field)
const = 0;
227 virtual const char *getFieldProperty(
int field,
const char *propertyname)
const = 0;
233 virtual int getFieldArraySize(any_ptr
object,
int field)
const = 0;
243 virtual void setFieldArraySize(any_ptr
object,
int field,
int size)
const = 0;
266 virtual std::string getFieldValueAsString(
any_ptr object,
int field,
int i)
const = 0;
276 virtual void setFieldValueAsString(
any_ptr object,
int field,
int i,
const char *value)
const = 0;
285 virtual cValue getFieldValue(
any_ptr object,
int field,
int i)
const = 0;
295 virtual void setFieldValue(
any_ptr object,
int field,
int i,
const cValue& value)
const = 0;
302 virtual const char *getFieldStructName(
int field)
const = 0;
310 virtual any_ptr getFieldStructValuePointer(
any_ptr object,
int field,
int i)
const = 0;
320 virtual void setFieldStructValuePointer(
any_ptr object,
int field,
int i,
any_ptr ptr)
const = 0;