| 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 fbxloadingstrategy.h |
| 13 | #ifndef _FBXSDK_CORE_LOADING_STRATEGY_H_ |
| 14 | #define _FBXSDK_CORE_LOADING_STRATEGY_H_ |
| 15 | |
| 16 | #include <fbxsdk/fbxsdk_def.h> |
| 17 | |
| 18 | #ifndef FBXSDK_ENV_WINSTORE |
| 19 | |
| 20 | #include <fbxsdk/core/fbxplugin.h> |
| 21 | #include <fbxsdk/core/fbxplugincontainer.h> |
| 22 | |
| 23 | #include <fbxsdk/fbxsdk_nsbegin.h> |
| 24 | |
| 25 | /** |
| 26 | * Abstract class used to implemented some plug-in loading strategy. |
| 27 | * A loading strategy dictate how some plug-ins will be loaded for instance. |
| 28 | * We could have a simple strategy that loads only a single dll on PC. |
| 29 | * We could also implement a strategy that load multiple dlls from a directory. |
| 30 | */ |
| 31 | class FBXSDK_DLL FbxLoadingStrategy : public FbxPluginContainer |
| 32 | { |
| 33 | public: |
| 34 | /** Result state of loading plug-in. |
| 35 | */ |
| 36 | enum EState |
| 37 | { |
| 38 | eAllLoaded, //!< All plug-in are loaded. |
| 39 | eNoneLoaded, //!< No plug-in is loaded, i.e., there is not plug-in to load. |
| 40 | eAllFailed, //!< All plug-in are failed to load. |
| 41 | eSomeFailed //!< Some plug-ins are loaded but some are failed. |
| 42 | }; |
| 43 | |
| 44 | /** |
| 45 | *\name Public interface |
| 46 | */ |
| 47 | //@{ |
| 48 | /** Execute the operation of loading the plug-in(s). The way it is executed is determined by the specific implementations. |
| 49 | * \param pData Plug in data that can be access inside the plug-ins. |
| 50 | * \return If the plugin loading is successful return \c true, otherwise return \c false. |
| 51 | */ |
| 52 | EState Load(FbxPluginData& pData); |
| 53 | |
| 54 | /** Execute the operation of unloading the plug-in(s). The way it is executed is determined by the specific implementations. |
| 55 | */ |
| 56 | void Unload(); |
| 57 | //@} |
| 58 | |
| 59 | protected: |
| 60 | /** |
| 61 | *\name User implementation |
| 62 | */ |
| 63 | //@{ |
| 64 | /** Called by the Load method, it contains the specific user implementation strategy to load the desired plug-in(s). |
| 65 | * \param pData Plug in data that can be access inside the plug-ins. |
| 66 | * \return If the plugin loading is successful return \c true, otherwise return \c false |
| 67 | */ |
| 68 | virtual bool SpecificLoad(FbxPluginData& pData) = 0; |
| 69 | |
| 70 | /** Called by the Unload method, it contains the specific user implementation strategy to unload the desired plug-in(s). |
| 71 | */ |
| 72 | virtual void SpecificUnload(FbxPluginData& pData) = 0; |
| 73 | //@} |
| 74 | |
| 75 | //! Whether the plugin is loaded or not. |
| 76 | EState mPluginsLoadedState; |
| 77 | |
| 78 | private: |
| 79 | FbxPluginData mData; |
| 80 | }; |
| 81 | |
| 82 | #include <fbxsdk/fbxsdk_nsend.h> |
| 83 | |
| 84 | #endif /* !FBXSDK_ENV_WINSTORE */ |
| 85 | |
| 86 | #endif /* _FBXSDK_CORE_LOADING_STRATEGY_H_ */ |
| 87 | |