- Main Page
- Classes
- Files
- Directories

- File List
- File Members

# fbxlistener.h

Go to the documentation of this file.

    00001 /****************************************************************************************
    00002
    00003    Copyright (C) 2013 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 #include <fbxsdk/core/fbxemitter.h>
    00019 #include <fbxsdk/core/fbxeventhandler.h>
    00020 #include <fbxsdk/core/base/fbxintrusivelist.h>
    00021
    00022 #include <fbxsdk/fbxsdk_nsbegin.h>
    00023
    00041 class FBXSDK_DLL FbxListener
    00042 {
    00043 public:
    00048
    00049     ~FbxListener();
    00051     FbxListener(){}
    00053
    00055
    00059
    00067     template <typename EventType,typename ListenerType> FbxEventHandler* Bind(FbxEmitter& pEmitter, void (ListenerType::*pFunc)(const EventType*))
    00068     {
    00069         FbxMemberFuncEventHandler<EventType,ListenerType>* eventHandler =
    00070             FbxNew< FbxMemberFuncEventHandler<EventType,ListenerType> >(static_cast<ListenerType*>(this),pFunc);
    00071         pEmitter.AddListener(*eventHandler);
    00072         mEventHandler.PushBack(*eventHandler);
    00073         return eventHandler;
    00074     }
    00075
    00083     template <typename EventType,typename ListenerType> FbxEventHandler* Bind(FbxEmitter& pEmitter, void (ListenerType::*pFunc)(const EventType*)const)
    00084     {
    00085         FbxConstMemberFuncEventHandler<EventType,ListenerType>* eventHandler =
    00086                     FbxNew< FbxConstMemberFuncEventHandler<EventType,ListenerType> >(static_cast<ListenerType*>(this),pFunc);
    00087         pEmitter.AddListener(*eventHandler);
    00088         mEventHandler.PushBack(*eventHandler);
    00089         return eventHandler;
    00090     }
    00091
    00099     template <typename EventType> FbxEventHandler* Bind(FbxEmitter& pEmitter, void (*pFunc)(const EventType*,FbxListener*))
    00100     {
    00101         FbxFuncEventHandler<EventType>* eventHandler =
    00102                         FbxNew< FbxFuncEventHandler<EventType> >(this, pFunc);
    00103         pEmitter.AddListener(*eventHandler);
    00104         mEventHandler.PushBack(*eventHandler);
    00105         return eventHandler;
    00106     }
    00107
    00111     void Unbind(const FbxEventHandler* aBindId);
    00113
    00114 private:
    00115     typedef FbxIntrusiveList<FbxEventHandler, FbxEventHandler::eListener> EventHandlerList;
    00116     EventHandlerList mEventHandler;
    00117 };
    00118
    00119 #include <fbxsdk/fbxsdk_nsend.h>
    00120
    00121 #endif /* _FBXSDK_CORE_LISTENER_H_ */