#ifndef __PLUGINSUBSCRIBER_HPP_ #define __PLUGINSUBSCRIBER_HPP_ #include #include "PuginFactory.hpp" namespace gsd { /** * @brief PluginSubscriber * */ template class PluginSubscriber{ struct Register { // Register Register(){ char *Name = nullptr; Name = abi::__cxa_demangle(typeid(T).name(), nullptr, nullptr, nullptr); std::string pluginName; if(Name != nullptr){ pluginName = Name; free(Name); } PuginFactory::getPtr()->Regist(pluginName, getObjectPtr); } }; /** * @description: * @return {*} */ static std::shared_ptr getObjectPtr(){ return T::getPtr(); } private: Register register_; }; } // namespace gsd #endif