diff --git a/code/nel/tools/pipeline/pipeline_library/pipeline_interface.h b/code/nel/tools/pipeline/pipeline_library/pipeline_interface.h index 3249902f4..5ab09db18 100644 --- a/code/nel/tools/pipeline/pipeline_library/pipeline_interface.h +++ b/code/nel/tools/pipeline/pipeline_library/pipeline_interface.h @@ -32,6 +32,7 @@ // STL includes // NeL includes +#include // Project includes @@ -53,11 +54,15 @@ public: IPipelineInterface() { } virtual ~IPipelineInterface() { } - IPipelineInterface *getInstance(); + static IPipelineInterface *getInstance(); virtual NLMISC::CConfigFile &getConfigFile() = 0; + virtual void registerClass(const std::string &className, NLMISC::IClassable* (*creator)(), const std::string &typeidCheck) throw(NLMISC::ERegistry) = 0; + }; /* class IPipelineInterface */ +#define PIPELINE_REGISTER_CLASS(_class_) PIPELINE::IPipelineInterface::getInstance()->registerClass(#_class_, _class_::creator, typeid(_class_).name()); + } /* namespace PIPELINE */ #endif /* #ifndef PIPELINE_PIPELINE_INTERFACE_H */ diff --git a/code/nel/tools/pipeline/pipeline_library/process_plugin.h b/code/nel/tools/pipeline/pipeline_library/process_plugin.h index b1683a726..ceffc67dc 100644 --- a/code/nel/tools/pipeline/pipeline_library/process_plugin.h +++ b/code/nel/tools/pipeline/pipeline_library/process_plugin.h @@ -32,6 +32,7 @@ // STL includes // NeL includes +#include // Project includes @@ -47,7 +48,7 @@ namespace PIPELINE { * The master service may dispatch these seperately to different slave services to executa a single process sheets using multiple process plugins. * This enables creating seperate plugins for different file formats for the same process, to allow handling files from different modeling packages on different build servers. */ -class IProcessPlugin +class IProcessPlugin : public NLMISC::IClassable { protected: // pointers diff --git a/code/nel/tools/pipeline/pipeline_plugin_max/pipeline_plugin_max.cpp b/code/nel/tools/pipeline/pipeline_plugin_max/pipeline_plugin_max.cpp index cb5faf202..5ca71cc17 100644 --- a/code/nel/tools/pipeline/pipeline_plugin_max/pipeline_plugin_max.cpp +++ b/code/nel/tools/pipeline/pipeline_plugin_max/pipeline_plugin_max.cpp @@ -35,6 +35,8 @@ #include "nel/misc/debug.h" // Project includes +#include "../pipeline_library/pipeline_interface.h" +#include "process_max_shape.h" using namespace std; // using namespace NLMISC; @@ -43,9 +45,17 @@ namespace PIPELINE { // ****************************************************************** -class CPipelinePluginMaxNelLibrary : public NLMISC::INelLibrary { - void onLibraryLoaded(bool /* firstTime */) { nldebug("Library loaded: CPipelinePluginMax"); } - void onLibraryUnloaded(bool /* lastTime */) { nldebug("Library unloaded: CPipelinePluginMax"); } +class CPipelinePluginMaxNelLibrary : public NLMISC::INelLibrary +{ + void onLibraryLoaded(bool /* firstTime */) + { + nldebug("Library loaded: CPipelinePluginMax"); + PIPELINE_REGISTER_CLASS(CProcessMaxShape); + } + void onLibraryUnloaded(bool /* lastTime */) + { + nldebug("Library unloaded: CPipelinePluginMax"); + } }; NLMISC_DECL_PURE_LIB(CPipelinePluginMaxNelLibrary) diff --git a/code/nel/tools/pipeline/pipeline_plugin_max/process_max_shape.h b/code/nel/tools/pipeline/pipeline_plugin_max/process_max_shape.h index 88bb103ff..62388b050 100644 --- a/code/nel/tools/pipeline/pipeline_plugin_max/process_max_shape.h +++ b/code/nel/tools/pipeline/pipeline_plugin_max/process_max_shape.h @@ -34,6 +34,7 @@ // NeL includes // Project includes +#include "../pipeline_library/process_plugin.h" namespace PIPELINE { @@ -43,7 +44,7 @@ namespace PIPELINE { * \author Jan Boon (Kaetemi) * CProcessMaxShape */ -class CProcessMaxShape +class CProcessMaxShape : public IProcessPlugin { protected: // pointers @@ -54,6 +55,8 @@ protected: public: CProcessMaxShape(); virtual ~CProcessMaxShape(); + + NLMISC_DECLARE_CLASS(CProcessMaxShape) }; /* class CProcessMaxShape */ } /* namespace PIPELINE */ diff --git a/code/nel/tools/pipeline/pipeline_service/pipeline_interface_impl.cpp b/code/nel/tools/pipeline/pipeline_service/pipeline_interface_impl.cpp index bdac390ad..a340a7b71 100644 --- a/code/nel/tools/pipeline/pipeline_service/pipeline_interface_impl.cpp +++ b/code/nel/tools/pipeline/pipeline_service/pipeline_interface_impl.cpp @@ -34,6 +34,7 @@ #include #include #include +#include // Project includes @@ -58,6 +59,13 @@ NLMISC::CConfigFile &CPipelineInterfaceImpl::getConfigFile() return NLNET::IService::getInstance()->ConfigFile; } +void CPipelineInterfaceImpl::registerClass(const std::string &className, NLMISC::IClassable* (*creator)(), const std::string &typeidCheck) throw(NLMISC::ERegistry) +{ + NLMISC::CClassRegistry::registerClass(className, creator, typeidCheck); + RegisteredClasses.push_back(className); + nldebug("Registered class '%s'", className.c_str()); +} + } /* namespace PIPELINE */ /* end of file */ diff --git a/code/nel/tools/pipeline/pipeline_service/pipeline_interface_impl.h b/code/nel/tools/pipeline/pipeline_service/pipeline_interface_impl.h index e12c54afb..3fdb6d2a1 100644 --- a/code/nel/tools/pipeline/pipeline_service/pipeline_interface_impl.h +++ b/code/nel/tools/pipeline/pipeline_service/pipeline_interface_impl.h @@ -30,6 +30,8 @@ #include // STL includes +#include +#include // NeL includes @@ -46,6 +48,8 @@ namespace PIPELINE { */ class CPipelineInterfaceImpl : public IPipelineInterface { +public: + std::vector RegisteredClasses; protected: // pointers // ... @@ -57,6 +61,7 @@ public: virtual ~CPipelineInterfaceImpl(); virtual NLMISC::CConfigFile &getConfigFile(); + virtual void registerClass(const std::string &className, NLMISC::IClassable* (*creator)(), const std::string &typeidCheck) throw(NLMISC::ERegistry); }; /* class CPipelineInterfaceImpl */ } /* namespace PIPELINE */ diff --git a/code/nel/tools/pipeline/pipeline_service/pipeline_service.cpp b/code/nel/tools/pipeline/pipeline_service/pipeline_service.cpp index 9dcd4633d..674c7b080 100644 --- a/code/nel/tools/pipeline/pipeline_service/pipeline_service.cpp +++ b/code/nel/tools/pipeline/pipeline_service/pipeline_service.cpp @@ -50,6 +50,7 @@ // Project includes #include "pipeline_workspace.h" #include "database_status.h" +#include "pipeline_interface_impl.h" // using namespace std; using namespace NLMISC; @@ -108,6 +109,7 @@ UFormLoader *s_FormLoader = NULL; CPipelineWorkspace *s_PipelineWorkspace = NULL; CTaskManager *s_TaskManager = NULL; CDatabaseStatus *s_DatabaseStatus = NULL; +CPipelineInterfaceImpl *s_PipelineInterfaceImpl = NULL; EState s_State = STATE_IDLE; CMutex s_StateMutex; @@ -273,6 +275,8 @@ public: s_DatabaseStatus = new CDatabaseStatus(); + s_PipelineInterfaceImpl = new CPipelineInterfaceImpl(); + // Load libraries const CConfigFile::CVar &usedPlugins = ConfigFile.getVar("UsedPlugins"); s_LoadedLibraries.reserve(usedPlugins.size()); @@ -311,6 +315,9 @@ public: } s_LoadedLibraries.clear(); + delete s_PipelineInterfaceImpl; + s_PipelineInterfaceImpl = NULL; + delete s_DatabaseStatus; s_DatabaseStatus = NULL;