| 1 | /**************************************************************************************** |
| 2 | |
| 3 | Copyright (C) 2015 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 | |
| 12 | //! \file fbxqueryevent.h |
| 13 | #ifndef _FBXSDK_CORE_QUERY_EVENT_H_ |
| 14 | #define _FBXSDK_CORE_QUERY_EVENT_H_ |
| 15 | |
| 16 | #include <fbxsdk/fbxsdk_def.h> |
| 17 | |
| 18 | #include <fbxsdk/core/fbxevent.h> |
| 19 | |
| 20 | #include <fbxsdk/fbxsdk_nsbegin.h> |
| 21 | |
| 22 | /** A query event is something that is emitted by an entity, with the goal of being filled by someone that listen to it. |
| 23 | * You can see that like a form that you send to some people. If those people know how to fill the form, they fill it and return |
| 24 | * it to you with the right information in it. A query event is emitted, and plug-in who are listening to that type of query, |
| 25 | * fill the data that can be accessed by the query emitter. |
| 26 | */ |
| 27 | template <typename QueryT> class FbxQueryEvent : public FbxEvent<FbxQueryEvent<QueryT> > |
| 28 | { |
| 29 | public: |
| 30 | /** |
| 31 | *\name Public interface |
| 32 | */ |
| 33 | //@{ |
| 34 | /** Constructor. |
| 35 | * \param pData The requested data. |
| 36 | */ |
| 37 | explicit FbxQueryEvent(QueryT* pData):mData(pData){} |
| 38 | |
| 39 | /** Accessor to a mutable reference to the data. Event are usually const and can't be modified by listener. |
| 40 | * This special type of event can have is content modified via this accessor. |
| 41 | * \return A mutable reference the requested data. |
| 42 | */ |
| 43 | QueryT& GetData()const { return *mData; } |
| 44 | //@} |
| 45 | |
| 46 | private: |
| 47 | mutable QueryT* mData; |
| 48 | |
| 49 | private: |
| 50 | virtual const char* GetEventName() const { FBX_ASSERT(false); return "" ; } |
| 51 | static const char* FbxEventName() { FBX_ASSERT(false); return "" ; } |
| 52 | friend class FbxEvent< FbxQueryEvent<QueryT> >; |
| 53 | }; |
| 54 | |
| 55 | #include <fbxsdk/fbxsdk_nsend.h> |
| 56 | |
| 57 | #endif /* _FBXSDK_CORE_QUERY_EVENT_H_ */ |
| 58 | |