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 #include <fbxsdk/core/fbxdatatypes.h>
00020 #include <fbxsdk/core/sync/fbxsync.h>
00021
00022 #include <fbxsdk/fbxsdk_nsbegin.h>
00023
00042 class FBXSDK_DLL FbxEventBase
00043 {
00044 public:
00049
00050 virtual ~FbxEventBase();
00052
00056 virtual int GetTypeId() const = 0;
00057
00061 virtual const char* GetEventName() const = 0;
00062
00063 protected:
00064 static int GetStaticTypeId(char const*);
00065 };
00066
00067
00068
00069
00070 #define FBXSDK_EVENT_DECLARE(Class) \
00071 public: virtual const char* GetEventName() const { return FbxEventName(); } \
00072 private: static const char* FbxEventName() { return #Class; } \
00073 friend class FbxEvent<Class>; \
00074
00075
00076
00077
00078
00079 #define FBXSDK_EVENT_TYPE_DECLARE(Class, FBXType) \
00080 public: virtual const char* GetEventName() const { return FbxEventName(); } \
00081 private: \
00082 static const char* FbxEventName() { \
00083 static FbxString lEventName = FbxString(#Class) + FbxString("<") + \
00084 FbxGetDataTypeFromEnum(FbxTypeOf(*((FBXType const*)0))).GetName() + ">"; \
00085 \
00086 return lEventName.Buffer(); \
00087 } \
00088 friend class FbxEvent< Class<FBXType> >;
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099 #define FBXSDK_EVENT_TEMPLATE_HEADER(ClassName, TemplateName)\
00100 template < class TemplateName, const char* T > \
00101 class ClassName: public FbxEvent< ClassName <TemplateName,T> >\
00102 {\
00103 public: virtual const char* GetEventName() const {return FbxEventName();}\
00104 private: static const char* FbxEventName() {\
00105 static FbxString lEventName = (FbxString(#ClassName) +"<"+ FbxString(T) +">");\
00106 return lEventName.Buffer();\
00107 }\
00108 friend class FbxEvent< ClassName<TemplateName, T> >;
00109
00110
00111
00112
00113 #define FBXSDK_EVENT_TEMPLATE_FOOTER()\
00114 };
00115
00133
00134
00135
00136 template<typename T> class FbxEvent : public FbxEventBase
00137 {
00138 public:
00140 virtual ~FbxEvent(){}
00141
00145 static void ForceTypeId(int pTypeId)
00146 {
00147
00148
00149
00150 smTypeId = pTypeId;
00151 }
00152
00157 virtual int GetTypeId() const
00158 {
00159 return GetStaticTypeId();
00160 }
00161
00165 static int GetStaticTypeId()
00166 {
00167 if( !smTypeId )
00168 {
00169 if( !smTypeId )
00170 {
00171
00172
00173 smTypeId = FbxEventBase::GetStaticTypeId(T::FbxEventName());
00174 }
00175 }
00176
00177 return smTypeId;
00178 }
00179
00180 private:
00182 static int smTypeId;
00183 };
00184
00185
00186 template<typename T> int FbxEvent<T>::smTypeId = 0;
00187
00188 #include <fbxsdk/fbxsdk_nsend.h>
00189
00190 #endif