- Main Page
- Classes
- Files
- Directories
- Examples

- File List
- File Members

# fbxemitter.h

Go to the documentation of this file.

    00001 /****************************************************************************************
    00002
    00003    Copyright (C) 2012 Autodesk, Inc.
    00004    All rights reserved.
    00005
    00006    Use of this software is subject to the terms of the Autodesk license agreement
    00007    provided at the time of installation or download, or which otherwise accompanies
    00008    this software in either electronic or hard copy form.
    00009
    00010 ****************************************************************************************/
    00011
    00013 #ifndef _FBXSDK_CORE_EMITTER_H_
    00014 #define _FBXSDK_CORE_EMITTER_H_
    00015
    00016 #include <fbxsdk/fbxsdk_def.h>
    00017
    00018 // Local includes
    00019 #include <fbxsdk/core/fbxeventhandler.h>
    00020
    00021 // FBX include
    00022 #include <fbxsdk/core/sync/fbxsync.h>
    00023 #include <fbxsdk/core/base/fbxintrusivelist.h>
    00024
    00025 #include <fbxsdk/fbxsdk_nsbegin.h>
    00026
    00027 class FbxListener;
    00028
    00054 class FBXSDK_DLL FbxEmitter
    00055 {
    00056 public:
    00057
    00059     FbxEmitter();
    00060
    00062     ~FbxEmitter();
    00063
    00069     void AddListener(FbxEventHandler& pHandler);
    00070
    00075     void RemoveListener(FbxEventHandler& pHandler);
    00076
    00078     template <typename EventType>
    00079
    00088     void Emit(const EventType& pEvent) const
    00089     {
    00090         if ( mData )
    00091         {
    00092             EventHandlerList::iterator itBegin = mData->mEventHandler.Begin();
    00093             EventHandlerList::iterator itEnd = mData->mEventHandler.End();
    00094             for (EventHandlerList::iterator it = itBegin; it!=itEnd; ++it)
    00095             {
    00096                 if ((*it).GetHandlerEventType() == pEvent.GetTypeId())
    00097                     (*it).FunctionCall(pEvent);
    00098             }
    00099         }
    00100     }
    00101
    00103 //
    00104 //  WARNING!
    00105 //
    00106 //  Anything beyond these lines may not be documented accurately and is
    00107 //  subject to change without notice.
    00108 //
    00110
    00111 protected:
    00112 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00113     typedef FbxIntrusiveList<FbxEventHandler, FbxEventHandler::eEmitter> EventHandlerList;
    00114
    00115     struct Data
    00116     {
    00117         EventHandlerList mEventHandler;
    00118     };
    00119
    00120     Data* mData;
    00121 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00122 };
    00123
    00124 #include <fbxsdk/fbxsdk_nsend.h>
    00125
    00126 #endif /* _FBXSDK_CORE_EMITTER_H_ */