#ifndef __PUGINFACTORY_HPP_ #define __PUGINFACTORY_HPP_ #include #include "Util/logger.h" #include #include #include "UtilBase.hpp" #include using namespace toolkit; using namespace std; namespace gsd { class PuginFactory { private: PuginFactory(){} public: using Ptr = std::shared_ptr; /** * @description: getPtr * @return {*} */ static std::shared_ptr getPtr(){ static std::shared_ptr PuginFactory_ = nullptr; if(PuginFactory_ == nullptr) PuginFactory_ = std::shared_ptr(new PuginFactory); return PuginFactory_; } /** * @description: * @return {*} */ bool Regist(const std::string& Type, std::function()> pFunc){ InfoL << Type << endl; if(pFunc == nullptr) return false; bool ret = _map.insert(std::make_pair(Type, pFunc)).second; return true; } /** * @description: getMap * @return {*} */ unordered_map()>> getMap(){ return _map; } /** * @description: ~PuginFactory * @return {*} */ ~PuginFactory(){ } protected: unordered_map()>> _map; }; } // namespace gsd #endif