fbxsdk/core/fbxemitter.h Source File

fbxemitter.h
Go to the documentation of this file.
1 /****************************************************************************************
2 
3  Copyright (C) 2014 Autodesk, Inc.
4  All rights reserved.
5 
6  Use of this software is subject to the terms of the Autodesk license agreement
7  provided at the time of installation or download, or which otherwise accompanies
8  this software in either electronic or hard copy form.
9 
10 ****************************************************************************************/
11 
13 #ifndef _FBXSDK_CORE_EMITTER_H_
14 #define _FBXSDK_CORE_EMITTER_H_
15 
16 #include <fbxsdk/fbxsdk_def.h>
17 
20 
21 #include <fbxsdk/fbxsdk_nsbegin.h>
22 
23 class FbxListener;
24 
50 {
51 public:
54  void AddListener(FbxEventHandler& pHandler);
55 
58  void RemoveListener(FbxEventHandler& pHandler);
59 
64  template <typename EventType> void Emit(const EventType& pEvent) const
65  {
66  if( !mData ) return;
67  EventHandlerList::iterator itBegin = mData->mEventHandlerList.Begin();
68  EventHandlerList::iterator itEnd = mData->mEventHandlerList.End();
69  for( EventHandlerList::iterator it = itBegin; it != itEnd; ++it )
70  {
71  if ((*it).GetHandlerEventType() == pEvent.GetTypeId())
72  {
73  (*it).FunctionCall(pEvent);
74  }
75  }
76  }
77 
78 /*****************************************************************************************************************************
79 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
80 *****************************************************************************************************************************/
81 #ifndef DOXYGEN_SHOULD_SKIP_THIS
82  FbxEmitter();
83  ~FbxEmitter();
84 
85 protected:
86  typedef FbxIntrusiveList<FbxEventHandler, FbxEventHandler::eEmitter> EventHandlerList;
87  struct EventData { EventHandlerList mEventHandlerList; };
88  EventData* mData;
89 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
90 };
91 
92 #include <fbxsdk/fbxsdk_nsend.h>
93 
94 #endif /* _FBXSDK_CORE_EMITTER_H_ */
void Emit(const EventType &pEvent) const
Emit an event with the specified the event type.
Definition: fbxemitter.h:64
FBX SDK environment definition.
Event handler class contains a listener and a callback function.
Base class to emit event with the specified event type.
Definition: fbxemitter.h:49
#define FBXSDK_DLL
Definition: fbxarch.h:170
FBX SDK listener class.
Definition: fbxlistener.h:41