FUtils/FUObjectType.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2005-2006 Feeling Software Inc.
00003     MIT License: http://www.opensource.org/licenses/mit-license.php
00004 */
00005 /*
00006     We use references to static objects so that the order of initialization shouldn't matter.
00007 */
00008 
00014 #ifndef _FU_OBJECT_TYPE_H_
00015 #define _FU_OBJECT_TYPE_H_
00016 
00025 class FCOLLADA_EXPORT FUObjectType
00026 {
00027 private:
00028     const FUObjectType* parent;
00029 #ifdef _DEBUG
00030     const char* typeName;
00031 #endif
00032 
00033 public:
00040     FUObjectType(const char* typeName);
00041 
00047     FUObjectType(const FUObjectType& parent, const char* typeName);
00048 
00052     const FUObjectType& GetParent() const { return (parent != NULL) ? *parent : *this; }
00053 
00060     bool Includes(const FUObjectType& otherType) const;
00061 
00065     inline bool operator==(const FUObjectType& otherType) const { return &otherType == this; }
00066 
00070     inline bool operator!=(const FUObjectType& otherType) const { return &otherType != this; }
00071 };
00072 
00078 #define DeclareObjectType \
00079 private: \
00080     static class FUObjectType __classType; \
00081 public: \
00082     static const FUObjectType& GetClassType() { return __classType; } \
00083     virtual const FUObjectType& GetObjectType() const { return __classType; } \
00084 private:
00085 
00093 #define ImplementObjectType(ClassName, ParentClassName) \
00094     FUObjectType ClassName::__classType(ParentClassName::GetClassType(), #ClassName) \
00095 
00096 #endif // _FU_OBJECT_TYPE_H_

Generated on Fri May 12 16:44:39 2006 for FCollada by  doxygen 1.4.6-NO