diff options
Diffstat (limited to 'src/sim')
-rw-r--r-- | src/sim/builder.hh | 40 | ||||
-rw-r--r-- | src/sim/system.hh | 4 |
2 files changed, 42 insertions, 2 deletions
diff --git a/src/sim/builder.hh b/src/sim/builder.hh index 2997fe5c3..aa0e3d17c 100644 --- a/src/sim/builder.hh +++ b/src/sim/builder.hh @@ -179,5 +179,45 @@ SimObjectClass the##OBJ_CLASS##Class(CLASS_NAME, \ /* see param.hh */ \ DEFINE_SIM_OBJECT_CLASS_NAME(CLASS_NAME, OBJ_CLASS) +/* Macros that use the namespace for sinic... yuk. */ +#define BEGIN_DECLARE_SIM_OBJECT_PARAMS_WNS(NAME_SPACE, OBJ_CLASS) \ +class NAME_SPACE##OBJ_CLASS##Builder : public SimObjectBuilder \ +{ \ + public: + +#define END_DECLARE_SIM_OBJECT_PARAMS_WNS(NAME_SPACE, OBJ_CLASS) \ + \ + NAME_SPACE##OBJ_CLASS##Builder(const std::string &iniSection); \ + virtual ~NAME_SPACE##OBJ_CLASS##Builder() {} \ + \ + NAME_SPACE::OBJ_CLASS *create(); \ +}; + +#define BEGIN_INIT_SIM_OBJECT_PARAMS_WNS(NAME_SPACE, OBJ_CLASS) \ + NAME_SPACE::OBJ_CLASS##Builder::OBJ_CLASS##Builder(const std::string &iSec) \ + : SimObjectBuilder(iSec), + + +#define END_INIT_SIM_OBJECT_PARAMS_WNS(NAME_SPACE, OBJ_CLASS) \ +{ \ +} + +#define CREATE_SIM_OBJECT_WNS(NAME_SPACE, OBJ_CLASS) \ +NAME_SPACE::OBJ_CLASS *NAME_SPACE##OBJ_CLASS##Builder::create() + +#define REGISTER_SIM_OBJECT_WNS(NAME_SPACE, CLASS_NAME, OBJ_CLASS) \ +SimObjectBuilder * \ +new##NAME_SPACEi##OBJ_CLASS##Builder(const std::string &iniSection) \ +{ \ + return new NAME_SPACE##OBJ_CLASS##Builder(iniSection); \ +} \ + \ +SimObjectClass the##NAME_SPACE##OBJ_CLASS##Class(CLASS_NAME, \ + new##NAME_SPACE##OBJ_CLASS##Builder); \ + \ +/* see param.hh */ \ +DEFINE_SIM_OBJECT_CLASS_NAME(CLASS_NAME, NAME_SPACE##OBJ_CLASS) + + #endif // __BUILDER_HH__ diff --git a/src/sim/system.hh b/src/sim/system.hh index c138d2ee4..11f4f0c90 100644 --- a/src/sim/system.hh +++ b/src/sim/system.hh @@ -141,7 +141,7 @@ class System : public SimObject * up in the specified symbol table. */ template <class T> - T *System::addFuncEvent(SymbolTable *symtab, const char *lbl) + T *addFuncEvent(SymbolTable *symtab, const char *lbl) { Addr addr = 0; // initialize only to avoid compiler warning @@ -155,7 +155,7 @@ class System : public SimObject /** Add a function-based event to kernel code. */ template <class T> - T *System::addKernelFuncEvent(const char *lbl) + T *addKernelFuncEvent(const char *lbl) { return addFuncEvent<T>(kernelSymtab, lbl); } |