00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef __XVR2_DS_OBJECT_H__
00015 #define __XVR2_DS_OBJECT_H__
00016 #include<xvr2/Object.h>
00017 #include<xvr2/String.h>
00018 #include<xvr2/DSO.h>
00019 #include<xvr2/CoreExceptions.h>
00020
00021 namespace xvr2 {
00022
00023
00024
00025
00026
00027 class DSObjectFactory : public Object {
00028 private:
00029 protected:
00030 public:
00031 template<class T>
00032 static T *create(DSO *dso, const String &createfuncname = "__xvr2_create_dsobject"){
00033 T *obj = 0;
00034 T *(*dso_create)();
00035 dso_create = (T * (*)())dso->getSymbol(createfuncname);
00036 obj = dso_create();
00037 return obj;
00038 }
00039 template<class T>
00040 static void destroy(DSO *dso, T *obj, const String &destroyfuncname = "__xvr2_destroy_dsobject"){
00041 void (*dso_destroy)(T *);
00042 dso_destroy = (void (*)(T *))dso->getSymbol(destroyfuncname);
00043 dso_destroy(obj);
00044 }
00045 };
00046
00047 }
00048
00049 #endif