00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00028 #ifndef _RTXCPPBASETYPE_H_
00029 #define _RTXCPPBASETYPE_H_
00030
00031 #include "rtxsrc/rtxCppContext.h"
00032
00033 class OSMessageBufferIF;
00034
00041 class EXTERNRTX OSBaseType {
00042 protected:
00043 OSBOOL mbOwnMemory;
00044 public:
00045 OSBaseType() : mbOwnMemory(FALSE) {}
00046 virtual ~OSBaseType() {}
00047
00048 virtual int encodeXML (OSMessageBufferIF& msgbuf,
00049 const OSUTF8CHAR* elemName, const OSUTF8CHAR* nsPrefix)
00050 { return 0; }
00051
00052 virtual int decodeXML (OSMessageBufferIF& msgbuf,
00053 const OSUTF8CHAR* elemName = 0)
00054 { return 0; }
00055
00063 inline void setOwnMemory (OSBOOL bvalue=TRUE) { mbOwnMemory=bvalue; }
00064 #ifdef FASTMM
00065 void* operator new (size_t size, OSCTXT* pctxt) {
00066 return rtxMemAlloc (pctxt, size);
00067 }
00068 void operator delete (void* ptr, OSCTXT* pctxt) {
00069 rtxMemFreePtr (pctxt, ptr);
00070 }
00071 void operator delete (void* ptr) {}
00072 void destruct (OSCTXT* pctxt) {
00073 this->~OSBaseType(); rtxMemFreePtr (pctxt, this);
00074 }
00075 #define OSNEW(pctxt,type) (pctxt)new type
00076 #else
00077 #define OSNEW(pctxt,type) new type
00078 #endif
00079 } ;
00080
00081 #endif