00001
00002
00003
00004 #ifndef DORT_INT_H
00005 #define DORT_INT_H
00006
00007
00008
00009 #ifdef DO_IMPLEMENT_DORTINTERNAL
00010 #define DO_IMPLEMENTING // If app has not defined it already
00011 #endif
00012 #include "dynobj/DynObj.h"
00013
00014
00015 class DoModuleC;
00016 struct DortInternalI;
00017
00018
00019 DO_DECL_TYPE_INFO(DoModuleC,DOMODULEC_TYPE_ID);
00020 DO_DECL_TYPE_INFO(DortInternalI,DORTINTERNALI_TYPE_ID);
00021
00022
00023
00024
00025 #define NOT_EVT_ON_DYNOBJ_DESTROY (NOT_EVT_MAIN_APP_FIRST+0)
00026
00027
00028 class DynObjLibI;
00029
00032
00033 class DoModuleC : public DynI {
00034 public:
00035 DoModuleC() : m_plib(0), m_pmod_data(0), m_plib_base((const char*)-1) { }
00036 virtual DynObjType* docall doGetType( const DynI **pself=0 ) const;
00037
00041 virtual DynObjType* docall FindTypeFromVPTR( void** vtbl ){ return NULL; }
00042 virtual DynObjType* docall FindTypeFromName( const char *type, const char *header=NULL ){ return NULL; }
00043 virtual DynObjType* docall FindTypeFromId( int type_id ){ return NULL; }
00045
00046 DynObjLibI *m_plib;
00047 doModuleData *m_pmod_data;
00048 const char *m_plib_base;
00049
00050
00051 bool operator == (DynObjLibI* plib){ return m_plib==+plib; }
00052 };
00053
00054
00055 struct DortInternalI {
00059 virtual void docall OnObjectCreate( DynObj *pdo, DoModuleC *pmod ) = 0;
00060 virtual void docall OnObjectDestroy( DynObj *pdo, DoModuleC *pmod ) = 0;
00061 virtual void docall TempDisableCreate( bool disable ) = 0;
00062
00063 virtual bool docall RegisterModule( DoModuleC *pmi ) = 0;
00064 virtual bool docall UnRegisterModule( DoModuleC *pmi ) = 0;
00065 virtual DoModuleC* docall GetModuleByIndex( int ix ) = 0;
00066
00067
00068 virtual bool docall RegisterTypeVTable( void **vtbl, DynObjType *pdt ) = 0;
00069 virtual bool docall UnRegisterTypeVTable( void **vtbl ) = 0;
00070
00071
00072 virtual int docall MergeTypes( doModuleData *pmod_data ) = 0;
00073 virtual bool docall UnMergeTypes( doModuleData *pmod_data ) = 0;
00074
00075
00076 virtual bool docall IsValidType( DynObjType *pdt ) = 0;
00077
00078
00079 virtual DoModuleC* docall GetModuleByAddr( const void* paddr ) = 0;
00080 virtual DoModuleC* docall GetModuleForType( DoModuleC* pmod_caller, int type_id ) = 0;
00081
00082
00083 virtual void docall SetModuleTempPermissions( DynObjLibI *plib, const void* paddr, int flags ) = 0;
00084 virtual void docall ResetModuleTempPermissions( ) = 0;
00085
00086 virtual bool docall TrackDynObj( DynObj *pdo, NotifiableI *pni, bool begin_track, DynObjType *pdt=NULL ) = 0;
00087
00088
00089
00090 virtual int docall AllocTypeItemTypeId( ) = 0;
00091
00092
00093 virtual void* docall MainAlloc( int size ) = 0;
00094 virtual bool docall MainFree( void* pmem ) = 0;
00095
00097
00101
00102
00103 static inline int GetCurrentModule_Helper(){ return 1; }
00104
00105
00106 inline DoModuleC* GetCurrentModule( ){
00107
00108 int (*pf)() = &GetCurrentModule_Helper;
00109 const void *paddr = *(void**)&pf;
00110 return GetModuleByAddr( paddr );
00111 }
00112
00114
00115 };
00116
00117
00118
00119 #ifdef DO_IMPLEMENT_DORTINTERNAL
00120
00121
00122 DynObjType g_do_vtype_DoModuleC("DoModuleC","DynI",DOMODULEC_TYPE_ID,0,sizeof(DoModuleC),NULL,NULL,__FILE__);
00123 DynObjType* DoModuleC::doGetType( const DynI **pself ) const {
00124 if(pself) *pself=(const DynI*)(const void*)this;
00125 return &g_do_vtype_DoModuleC;
00126 }
00127 DynObjType g_do_vtype_DortInternalI("DortInternalI","VObj",DORTINTERNALI_TYPE_ID,0,sizeof(DortInternalI),NULL,NULL,__FILE__);
00128 #endif //DO_IMPLEMENT_...
00129
00130
00131 #endif // DORT_INT_H
00132