Base class to emit event with the specified event type.
The event type could be a specific class which derived from KFbxEvent. Please read KFbxEmitter::Emit() for more details. Event emitter contains a list of event handlers. FBX object could be used as emitter, since KFbxObject is derived from KFbxEmitter. Before using emitter to emit an event, one or more event handlers must be added to the handlers list of current emitter. In other words, it's "bind event handlers to emitter". There are two ways to bind event handlers to emitter.
Definition at line 82 of file kfbxemitter.h.
#include <kfbxemitter.h>
Classes |
|
struct | KFbxEmitterData |
Public Member Functions |
|
KFbxEmitter () | |
Constructor. |
|
~KFbxEmitter () | |
Destructor. |
|
void | AddListener (KFbxEventHandler &pHandler) |
The specified event handler will be added to
the handlers list of current emitter. |
|
void | RemoveListener (KFbxEventHandler &pHandler) |
The specified event handler will be removed
from the handlers list of current emitter. |
|
template<typename EventType > | |
void | Emit (const EventType &pEvent) const |
Emit an event with the specified the event
type. |
|
Protected Types |
|
typedef
KIntrusiveList < KFbxEventHandler, KFbxEventHandler::eNODE_EMITTER > |
EventHandlerList |
Protected Attributes |
|
KFbxEmitterData * | mData |
typedef KIntrusiveList<KFbxEventHandler,
KFbxEventHandler::eNODE_EMITTER> EventHandlerList
[protected] |
Definition at line 143 of file kfbxemitter.h.
KFbxEmitter | ( | ) |
Constructor.
~KFbxEmitter | ( | ) |
Destructor.
void AddListener | ( | KFbxEventHandler & | pHandler | ) |
The specified event handler will be added to the handlers list of current emitter.
Bind the specified event handler to current emitter actually.
pHandler | the event handler will be added to the handlers list of current emitter. |
void RemoveListener | ( | KFbxEventHandler & | pHandler | ) |
The specified event handler will be removed from the handlers list of current emitter.
pHandler | the event handler will be removed from the handlers list of current emitter. |
void Emit | ( | const EventType & | pEvent | ) | const [inline] |
Emit an event with the specified the event type.
One the event is emitted, the listener to this event will receive a signal.
pEvent | specify the event type to emit. pEvent could be a specific class which derived from KFbxEvent, such as KFbxObjectPropertyChanged. |
KFbxObject::Emit(KFbxObjectPropertyChanged(*pProperty));
Definition at line 116 of file kfbxemitter.h.
{ if ( mData ) { kfbxmp::KFbxMutexHelper lLock( mData->mMutex ); EventHandlerList::iterator itBegin = mData->mEventHandler.Begin(); EventHandlerList::iterator itEnd = mData->mEventHandler.End(); for (EventHandlerList::iterator it = itBegin; it!=itEnd; ++it) { if ((*it).GetHandlerEventType() == pEvent.GetTypeId()) (*it).FunctionCall(pEvent); } } }
KFbxEmitterData*
mData [protected] |
Reimplemented in KFbxCache.
Definition at line 151 of file kfbxemitter.h.