Go to the
documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00013 #ifndef _FBXSDK_CORE_EVENT_H_
00014 #define _FBXSDK_CORE_EVENT_H_
00015
00016 #include <fbxsdk/fbxsdk_def.h>
00017
00018 #include <fbxsdk/core/fbxpropertytypes.h>
00019
00020 #include <fbxsdk/fbxsdk_nsbegin.h>
00021
00040 class FBXSDK_DLL FbxEventBase
00041 {
00042 public:
00047
00048 virtual ~FbxEventBase();
00050
00054 virtual int GetTypeId() const = 0;
00055
00059 virtual const char* GetEventName() const = 0;
00060
00061 protected:
00062 static int GetStaticTypeId(const char*);
00063 };
00064
00065
00066
00067
00068 #define FBXSDK_EVENT_DECLARE(Class) \
00069 public: virtual const char* GetEventName() const { return FbxEventName(); } \
00070 private: static const char* FbxEventName() { return #Class; } \
00071 friend class FbxEvent<Class>; \
00072
00073
00074
00075
00076
00077 #define FBXSDK_EVENT_TYPE_DECLARE(Class, FBXType) \
00078 public: virtual const char* GetEventName() const { return FbxEventName(); } \
00079 private: \
00080 static const char* FbxEventName() { \
00081 static FbxString lEventName = FbxString(#Class) + FbxString("<") + \
00082 FbxGetDataTypeFromEnum(FbxTypeOf(*((const FBXType *)0))).GetName() + ">"; \
00083 \
00084 return lEventName.Buffer(); \
00085 } \
00086 friend class FbxEvent< Class<FBXType> >;
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097 #define FBXSDK_EVENT_TEMPLATE_HEADER(ClassName, TemplateName)\
00098 template < class TemplateName, const char* T > \
00099 class ClassName: public FbxEvent< ClassName <TemplateName,T> >\
00100 {\
00101 public: virtual const char* GetEventName() const {return FbxEventName();}\
00102 private: static const char* FbxEventName() {\
00103 static FbxString lEventName = (FbxString(#ClassName) +"<"+ FbxString(T) +">");\
00104 return lEventName.Buffer();\
00105 }\
00106 friend class FbxEvent< ClassName<TemplateName, T> >;
00107
00108
00109
00110
00111 #define FBXSDK_EVENT_TEMPLATE_FOOTER()\
00112 };
00113
00131
00132
00133
00134 template<typename T> class FbxEvent : public FbxEventBase
00135 {
00136 public:
00138 virtual ~FbxEvent(){}
00139
00143 static void ForceTypeId(int pTypeId)
00144 {
00145
00146
00147
00148 smTypeId = pTypeId;
00149 }
00150
00155 virtual int GetTypeId() const
00156 {
00157 return GetStaticTypeId();
00158 }
00159
00163 static int GetStaticTypeId()
00164 {
00165 if( !smTypeId )
00166 {
00167 if( !smTypeId )
00168 {
00169
00170
00171 smTypeId = FbxEventBase::GetStaticTypeId(T::FbxEventName());
00172 }
00173 }
00174
00175 return smTypeId;
00176 }
00177
00178 private:
00180 static int smTypeId;
00181 };
00182
00183
00184 template<typename T> int FbxEvent<T>::smTypeId = 0;
00185
00186 #include <fbxsdk/fbxsdk_nsend.h>
00187
00188 #endif