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

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

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

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

@ -275,6 +275,7 @@ public:
// Load libraries
const CConfigFile::CVar &usedPlugins = ConfigFile.getVar("UsedPlugins");
s_LoadedLibraries.reserve(usedPlugins.size());
for (uint i = 0; i < usedPlugins.size(); ++i)
{
CLibrary *library = new CLibrary();
@ -303,6 +304,13 @@ public:
}
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;
s_DatabaseStatus = NULL;

Loading…
Cancel
Save