Go to the
documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00013 #ifndef _FBXSDK_CORE_EMITTER_H_
00014 #define _FBXSDK_CORE_EMITTER_H_
00015
00016 #include <fbxsdk/fbxsdk_def.h>
00017
00018 #include <fbxsdk/core/base/fbxintrusivelist.h>
00019 #include <fbxsdk/core/fbxeventhandler.h>
00020
00021 #include <fbxsdk/fbxsdk_nsbegin.h>
00022
00023 class FbxListener;
00024
00049 class FBXSDK_DLL FbxEmitter
00050 {
00051 public:
00054 void AddListener(FbxEventHandler& pHandler);
00055
00058 void RemoveListener(FbxEventHandler& pHandler);
00059
00064 template <typename EventType> void Emit(const EventType& pEvent) const
00065 {
00066 if( !mData ) return;
00067 EventHandlerList::iterator itBegin = mData->mEventHandlerList.Begin();
00068 EventHandlerList::iterator itEnd = mData->mEventHandlerList.End();
00069 for( EventHandlerList::iterator it = itBegin; it != itEnd; ++it )
00070 {
00071 if ((*it).GetHandlerEventType() == pEvent.GetTypeId())
00072 {
00073 (*it).FunctionCall(pEvent);
00074 }
00075 }
00076 }
00077
00078
00079
00080
00081 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00082 FbxEmitter();
00083 ~FbxEmitter();
00084
00085 protected:
00086 typedef FbxIntrusiveList<FbxEventHandler, FbxEventHandler::eEmitter> EventHandlerList;
00087 struct EventData { EventHandlerList mEventHandlerList; };
00088 EventData* mData;
00089 #endif
00090 };
00091
00092 #include <fbxsdk/fbxsdk_nsend.h>
00093
00094 #endif