00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00017 #ifndef _FU_OBJECT_TYPE_H_
00018 #define _FU_OBJECT_TYPE_H_
00019
00030 class FCOLLADA_EXPORT FUObjectType
00031 {
00032 private:
00033 const FUObjectType* parent;
00034 const char* typeName;
00035
00036 public:
00043 FUObjectType(const char* typeName);
00044
00050 FUObjectType(const FUObjectType& parent, const char* typeName);
00051
00055 const FUObjectType& GetParent() const { return (parent != NULL) ? *parent : *this; }
00056
00063 bool Includes(const FUObjectType& otherType) const;
00064
00068 inline bool operator==(const FUObjectType& otherType) const { return &otherType == this; }
00069
00073 inline bool operator!=(const FUObjectType& otherType) const { return &otherType != this; }
00074
00077 inline const char* GetTypeName() const { return typeName; }
00078 };
00079
00086 #define DeclareObjectType(_ParentClass) \
00087 private: \
00088 static class FUObjectType __classType; \
00089 typedef _ParentClass Parent; \
00090 public: \
00091 static const FUObjectType& GetClassType() { return __classType; } \
00092 virtual const FUObjectType& GetObjectType() const { return __classType; } \
00093 virtual void Release(); \
00094 private:
00095
00102 #define ImplementObjectType(ClassName) \
00103 FUObjectType ClassName::__classType(Parent::GetClassType(), #ClassName); \
00104 void ClassName::Release() { Detach(); delete this; }
00105
00107 #define ImplementObjectTypeT(ClassName) \
00108 template <> \
00109 FUObjectType ClassName::__classType(Parent::GetClassType(), #ClassName); \
00110 template <> \
00111 void ClassName::Release() { Detach(); delete this; }
00112
00122 #define ImplementObjectType_NoDefaultRelease(ClassName) \
00123 FUObjectType ClassName::__classType(Parent::GetClassType(), #ClassName);
00124
00125 #endif // _FU_OBJECT_TYPE_H_