- Main Page
- Classes
- Files
- Directories
- Examples

- File List
- File Members

# fbxlistener.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_LISTENER_H_
    00014 #define _FBXSDK_CORE_LISTENER_H_
    00015
    00016 #include <fbxsdk/fbxsdk_def.h>
    00017
    00018 // Local includes
    00019 #include <fbxsdk/core/fbxemitter.h>
    00020 #include <fbxsdk/core/fbxeventhandler.h>
    00021
    00022 // FBX include
    00023 #include <fbxsdk/core/base/fbxintrusivelist.h>
    00024
    00025 #include <fbxsdk/fbxsdk_nsbegin.h>
    00026
    00044 class FBXSDK_DLL FbxListener
    00045 {
    00046 public:
    00051
    00052     ~FbxListener();
    00054     FbxListener(){}
    00056
    00058
    00062
    00070     template <typename EventType,typename ListenerType> FbxEventHandler* Bind(FbxEmitter& pEmitter, void (ListenerType::*pFunc)(const EventType*))
    00071     {
    00072         FbxMemberFuncEventHandler<EventType,ListenerType>* eventHandler =
    00073             FbxNew< FbxMemberFuncEventHandler<EventType,ListenerType> >(static_cast<ListenerType*>(this),pFunc);
    00074         pEmitter.AddListener(*eventHandler);
    00075         mEventHandler.PushBack(*eventHandler);
    00076         return eventHandler;
    00077     }
    00078
    00086     template <typename EventType,typename ListenerType> FbxEventHandler* Bind(FbxEmitter& pEmitter, void (ListenerType::*pFunc)(const EventType*)const)
    00087     {
    00088         FbxConstMemberFuncEventHandler<EventType,ListenerType>* eventHandler =
    00089                     FbxNew< FbxConstMemberFuncEventHandler<EventType,ListenerType> >(static_cast<ListenerType*>(this),pFunc);
    00090         pEmitter.AddListener(*eventHandler);
    00091         mEventHandler.PushBack(*eventHandler);
    00092         return eventHandler;
    00093     }
    00094
    00102     template <typename EventType> FbxEventHandler* Bind(FbxEmitter& pEmitter, void (*pFunc)(const EventType*,FbxListener*))
    00103     {
    00104         FbxFuncEventHandler<EventType>* eventHandler =
    00105                         FbxNew< FbxFuncEventHandler<EventType> >(this, pFunc);
    00106         pEmitter.AddListener(*eventHandler);
    00107         mEventHandler.PushBack(*eventHandler);
    00108         return eventHandler;
    00109     }
    00110
    00114     void Unbind(const FbxEventHandler* aBindId);
    00116
    00117 private:
    00118     typedef FbxIntrusiveList<FbxEventHandler, FbxEventHandler::eListener> EventHandlerList;
    00119     EventHandlerList mEventHandler;
    00120 };
    00121
    00122 #include <fbxsdk/fbxsdk_nsend.h>
    00123
    00124 #endif /* _FBXSDK_CORE_LISTENER_H_ */