23 #if !defined(OPENNURBS_OBJECT_INC_)
24 #define OPENNURBS_OBJECT_INC_
57 const char* sClassName,
58 const char* sBaseClassName,
64 const char* sClassName,
65 const char* sBaseClassName,
82 const char* sClassName
105 static int IncrementMark();
106 static int CurrentMark();
131 static int Purge(
int mark);
132 static bool PurgeAfter(
const ON_ClassId* pClassId);
144 const char* ClassName()
const;
148 const char* BaseClassName()
const;
161 ON_BOOL32 IsDerivedFrom(
186 unsigned int ClassIdVersion()
const;
194 char m_sClassName[80];
195 char m_sBaseClassName[80];
206 void ConstructorHelper(
207 const char* sClassName,
208 const char* sBaseClassName,
216 unsigned int m_class_id_version;
235 #define ON_CLASS_ID( cls ) ON_ClassId::ClassId( #cls )
249 ON_UUID ON_GetMostRecentClassIdCreateUuid();
266 #define ON_OBJECT_DECLARE( cls ) \
268 static void* m_s_##cls##_ptr; \
270 static const ON_ClassId m_##cls##_class_id; \
273 static cls * Cast( ON_Object* ); \
277 static const cls * Cast( const ON_Object* ); \
281 virtual const ON_ClassId* ClassId() const; \
285 virtual ON_Object* DuplicateObject() const; \
288 static bool Copy##cls( const ON_Object*, ON_Object* ); \
294 cls * Duplicate() const; \
306 #define ON_VIRTUAL_OBJECT_IMPLEMENT( cls, basecls, uuid ) \
307 void* cls::m_s_##cls##_ptr = 0;\
308 const ON_ClassId cls::m_##cls##_class_id(#cls,#basecls,0,0,uuid);\
309 cls * cls::Cast( ON_Object* p) {return(cls *)Cast((const ON_Object*)p);} \
310 const cls * cls::Cast( const ON_Object* p) {return(p&&p->IsKindOf(&cls::m_##cls##_class_id))?(const cls *)p:0;} \
311 const ON_ClassId* cls::ClassId() const {return &cls::m_##cls##_class_id;} \
312 ON_Object* cls::DuplicateObject() const {return 0;} \
313 bool cls::Copy##cls( const ON_Object*, ON_Object* ) {return false;} \
314 cls * cls::Duplicate() const {return static_cast<cls *>(DuplicateObject());}
321 #define ON_OBJECT_IMPLEMENT( cls, basecls, uuid ) \
322 void* cls::m_s_##cls##_ptr = 0;\
323 static ON_Object* CreateNew##cls() {return new cls();} \
324 const ON_ClassId cls::m_##cls##_class_id(#cls,#basecls,CreateNew##cls,cls::Copy##cls,uuid);\
325 cls * cls::Cast( ON_Object* p) {return(cls *)Cast((const ON_Object*)p);} \
326 const cls * cls::Cast( const ON_Object* p) {return(p&&p->IsKindOf(&cls::m_##cls##_class_id))?(const cls *)p:0;} \
327 const ON_ClassId* cls::ClassId() const {return &cls::m_##cls##_class_id;} \
328 ON_Object* cls::DuplicateObject() const {cls* p = new cls(); if (p) *p=*this; return p;} \
329 bool cls::Copy##cls( const ON_Object* src, ON_Object* dst ){cls* d;const cls* s;if (0!=(s=cls::Cast(src))&&0!=(d=cls::Cast(dst))) {d->cls::operator=(*s);return true;}return false;} \
330 cls * cls::Duplicate() const {return static_cast<cls *>(DuplicateObject());}
332 #define ON__SET__THIS__PTR(ptr) if (ptr) *((void**)this) = ptr
349 #if defined(ON_DLL_TEMPLATE)
353 #pragma warning( push )
354 #pragma warning( disable : 4231 )
356 #pragma warning( pop )
369 bool ON_IsNotValid();
422 void EmergencyDestroy();
440 void MemoryRelocate();
492 ON_BOOL32 IsValid(
ON_TextLog* text_log = NULL )
const = 0;
513 unsigned int SizeOf()
const;
526 ON__UINT32 DataCRC(ON__UINT32 current_remainder)
const;
599 ON::object_type ObjectType()
const;
633 const wchar_t* string_value
651 int SetUserStrings(
int count,
const ON_UserString* user_strings,
bool bReplace );
689 int GetUserStringKeys(
697 int UserStringCount()
const;
728 ON_BOOL32 AttachUserData(
749 ON_BOOL32 DetachUserData(
776 void PurgeUserData();
798 void TransformUserData(
851 void DestroyRuntimeCache(
bool bDelete =
true );
ON_wString m_string_value
int ReadObject(ON_Object **ppObject)
bool WriteObject(const ON_Object *)
bool WriteObjectUserData(const ON_Object &object)
bool ReadObjectUserData(ON_Object &object)