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
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();
526 ON__UINT32
DataCRC(ON__UINT32 current_remainder)
const;
633 const wchar_t* string_value
int ReadObject(ON_Object **ppObject)
bool WriteObject(const ON_Object *)
bool ReadObjectUserData(ON_Object &object)
bool WriteObjectUserData(const ON_Object &object)
ON_ClassId(const char *sClassName, const char *sBaseClassName, ON_Object *(*create)(), const char *sUUID)
unsigned int ClassIdVersion() const
const char * BaseClassName() const
const ON_ClassId * BaseClass() const
ON_ClassId(const char *sClassName, const char *sBaseClassName, ON_Object *(*create)(), bool(*copy)(const ON_Object *, ON_Object *), const char *sUUID)
static int IncrementMark()
static const ON_ClassId * LastClassId()
const char * ClassName() const
static int Purge(int mark)
ON_BOOL32 IsDerivedFrom(const ON_ClassId *potential_parent) const
static void Dump(ON_TextLog &dump)
ON_Object * Create() const
static bool PurgeAfter(const ON_ClassId *pClassId)
static const ON_ClassId * ClassId(ON_UUID class_uuid)
static const ON_ClassId * ClassId(const char *sClassName)
int GetUserStrings(ON_ClassArray< ON_UserString > &user_strings) const
virtual unsigned int SizeOf() const
bool SetUserString(const wchar_t *key, const wchar_t *string_value)
virtual ON_BOOL32 IsValid(ON_TextLog *text_log=NULL) const =0
ON_BOOL32 IsKindOf(const ON_ClassId *pClassId) const
virtual ON_UUID ModelObjectId() const
virtual void Dump(ON_TextLog &) const
ON_Object(const ON_Object &)
bool CopyFrom(const ON_Object *src)
void MoveUserData(ON_Object &source_object)
void CopyUserData(const ON_Object &source_object)
ON_UserData * GetUserData(const ON_UUID &userdata_uuid) const
int SetUserStrings(int count, const ON_UserString *user_strings, bool bReplace)
virtual ON_BOOL32 Read(ON_BinaryArchive &binary_archive)
virtual ON_BOOL32 Write(ON_BinaryArchive &binary_archive) const
void TransformUserData(const ON_Xform &xform)
ON_BOOL32 DetachUserData(ON_UserData *pUserData)
bool GetUserString(const wchar_t *key, ON_wString &string_value) const
int UserStringCount() const
ON_BOOL32 AttachUserData(ON_UserData *pUserData)
ON_Object & operator=(const ON_Object &)
int GetUserStringKeys(ON_ClassArray< ON_wString > &user_string_keys) const
virtual void MemoryRelocate()
ON_UserData * FirstUserData() const
virtual ON__UINT32 DataCRC(ON__UINT32 current_remainder) const
virtual void DestroyRuntimeCache(bool bDelete=true)
virtual ON::object_type ObjectType() const
ON_wString m_string_value
void Dump(ON_TextLog &text_log) const
bool Write(ON_BinaryArchive &) const
bool Read(ON_BinaryArchive &)