Added: Access to config file from pipeline plugin.

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 13 years ago
parent 1802d9c091
commit a007f7f2c9

@ -31,7 +31,8 @@
// STL includes // STL includes
// NeL includes // NeL includes
// #include <nel/misc/debug.h> #include <nel/misc/app_context.h>
#include <nel/misc/debug.h>
// Project includes // Project includes
@ -42,6 +43,12 @@ namespace PIPELINE {
void fksjdlfkjdskfljdsklfjdslkfjdsf() { } void fksjdlfkjdskfljdsklfjdslkfjdsf() { }
IPipelineInterface *IPipelineInterface::getInstance()
{
nlassert(NLMISC::INelContext::isContextInitialised());
return static_cast<IPipelineInterface *>(NLMISC::INelContext::getInstance().getSingletonPointer("IPipelineInterface"));
}
} /* namespace PIPELINE */ } /* namespace PIPELINE */
/* end of file */ /* end of file */

@ -35,6 +35,10 @@
// Project includes // Project includes
namespace NLMISC {
class CConfigFile;
}
namespace PIPELINE { namespace PIPELINE {
/** /**
@ -48,6 +52,10 @@ class IPipelineInterface
public: public:
IPipelineInterface() { } IPipelineInterface() { }
virtual ~IPipelineInterface() { } virtual ~IPipelineInterface() { }
IPipelineInterface *getInstance();
virtual NLMISC::CConfigFile &getConfigFile() = 0;
}; /* class IPipelineInterface */ }; /* class IPipelineInterface */
} /* namespace PIPELINE */ } /* namespace PIPELINE */

@ -31,9 +31,9 @@
// STL includes // STL includes
// NeL includes // NeL includes
// #include <nel/misc/debug.h>
#include <nel/misc/app_context.h> #include <nel/misc/app_context.h>
#include <nel/misc/debug.h> #include <nel/misc/debug.h>
#include <nel/net/service.h>
// Project includes // Project includes
@ -44,14 +44,18 @@ namespace PIPELINE {
CPipelineInterfaceImpl::CPipelineInterfaceImpl() CPipelineInterfaceImpl::CPipelineInterfaceImpl()
{ {
nlassert(NLMISC::INelContext::isContextInitialised()); nlassert(getInstance() == NULL);
nlassert(NLMISC::INelContext::getInstance().getSingletonPointer("IPipelineInterface") == NULL);
NLMISC::INelContext::getInstance().setSingletonPointer("IPipelineInterface", this); NLMISC::INelContext::getInstance().setSingletonPointer("IPipelineInterface", this);
} }
CPipelineInterfaceImpl::~CPipelineInterfaceImpl() CPipelineInterfaceImpl::~CPipelineInterfaceImpl()
{ {
NLMISC::INelContext::getInstance().releaseSingletonPointer("IPipelineInterface", this);
}
NLMISC::CConfigFile &CPipelineInterfaceImpl::getConfigFile()
{
return NLNET::IService::getInstance()->ConfigFile;
} }
} /* namespace PIPELINE */ } /* namespace PIPELINE */

@ -55,6 +55,8 @@ protected:
public: public:
CPipelineInterfaceImpl(); CPipelineInterfaceImpl();
virtual ~CPipelineInterfaceImpl(); virtual ~CPipelineInterfaceImpl();
virtual NLMISC::CConfigFile &getConfigFile();
}; /* class CPipelineInterfaceImpl */ }; /* class CPipelineInterfaceImpl */
} /* namespace PIPELINE */ } /* namespace PIPELINE */

@ -275,6 +275,7 @@ public:
// Load libraries // Load libraries
const CConfigFile::CVar &usedPlugins = ConfigFile.getVar("UsedPlugins"); const CConfigFile::CVar &usedPlugins = ConfigFile.getVar("UsedPlugins");
s_LoadedLibraries.reserve(usedPlugins.size());
for (uint i = 0; i < usedPlugins.size(); ++i) for (uint i = 0; i < usedPlugins.size(); ++i)
{ {
CLibrary *library = new CLibrary(); CLibrary *library = new CLibrary();
@ -303,6 +304,13 @@ public:
} }
NLMISC::CAsyncFileManager::terminate(); NLMISC::CAsyncFileManager::terminate();
for (std::vector<NLMISC::CLibrary *>::iterator it = s_LoadedLibraries.begin(), end = s_LoadedLibraries.end(); it != end; ++it)
{
(*it)->freeLibrary();
delete (*it);
}
s_LoadedLibraries.clear();
delete s_DatabaseStatus; delete s_DatabaseStatus;
s_DatabaseStatus = NULL; s_DatabaseStatus = NULL;

Loading…
Cancel
Save