Added: Pipeline interface class for plugins to request information from the pipeline service.

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

@ -0,0 +1,47 @@
/**
* \file pipeline_interface.cpp
* \brief IPipelineInterface
* \date 2012-02-25 12:10GMT
* \author Jan Boon (Kaetemi)
* IPipelineInterface
*/
/*
* Copyright (C) 2012 by authors
*
* This file is part of RYZOM CORE PIPELINE.
* RYZOM CORE PIPELINE is free software: you can redistribute it
* and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* RYZOM CORE PIPELINE is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RYZOM CORE PIPELINE; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include <nel/misc/types_nl.h>
#include "pipeline_interface.h"
// STL includes
// NeL includes
// #include <nel/misc/debug.h>
// Project includes
using namespace std;
// using namespace NLMISC;
namespace PIPELINE {
void fksjdlfkjdskfljdsklfjdslkfjdsf() { }
} /* namespace PIPELINE */
/* end of file */

@ -0,0 +1,57 @@
/**
* \file pipeline_interface.h
* \brief IPipelineInterface
* \date 2012-02-25 12:10GMT
* \author Jan Boon (Kaetemi)
* IPipelineInterface
*/
/*
* Copyright (C) 2012 by authors
*
* This file is part of RYZOM CORE PIPELINE.
* RYZOM CORE PIPELINE is free software: you can redistribute it
* and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* RYZOM CORE PIPELINE is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RYZOM CORE PIPELINE; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef PIPELINE_PIPELINE_INTERFACE_H
#define PIPELINE_PIPELINE_INTERFACE_H
#include <nel/misc/types_nl.h>
// STL includes
// NeL includes
// Project includes
namespace PIPELINE {
/**
* \brief IPipelineInterface
* \date 2012-02-25 12:10GMT
* \author Jan Boon (Kaetemi)
* IPipelineInterface
*/
class IPipelineInterface
{
public:
IPipelineInterface() { }
virtual ~IPipelineInterface() { }
}; /* class IPipelineInterface */
} /* namespace PIPELINE */
#endif /* #ifndef PIPELINE_PIPELINE_INTERFACE_H */
/* end of file */

@ -31,7 +31,8 @@
// STL includes // STL includes
// NeL includes // NeL includes
// #include <nel/misc/debug.h> #include "nel/misc/dynloadlib.h"
#include "nel/misc/debug.h"
// Project includes // Project includes
@ -40,6 +41,23 @@ using namespace std;
namespace PIPELINE { namespace PIPELINE {
// ******************************************************************
class CPipelinePluginMaxNelLibrary : public NLMISC::INelLibrary {
void onLibraryLoaded(bool /* firstTime */) { nldebug("Library loaded: CPipelinePluginMax"); }
void onLibraryUnloaded(bool /* lastTime */) { nldebug("Library unloaded: CPipelinePluginMax"); }
};
NLMISC_DECL_PURE_LIB(CPipelinePluginMaxNelLibrary)
HINSTANCE CPipelinePluginMaxDllHandle = NULL;
BOOL WINAPI DllMain(HANDLE hModule, DWORD /* ul_reason_for_call */, LPVOID /* lpReserved */)
{
CPipelinePluginMaxDllHandle = (HINSTANCE)hModule;
return TRUE;
}
// ******************************************************************
CPipelinePluginMax::CPipelinePluginMax() CPipelinePluginMax::CPipelinePluginMax()
{ {

@ -0,0 +1,59 @@
/**
* \file pipeline_interface_impl.cpp
* \brief CPipelineInterfaceImpl
* \date 2012-02-25 12:21GMT
* \author Jan Boon (Kaetemi)
* CPipelineInterfaceImpl
*/
/*
* Copyright (C) 2012 by authors
*
* This file is part of RYZOM CORE PIPELINE.
* RYZOM CORE PIPELINE is free software: you can redistribute it
* and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* RYZOM CORE PIPELINE is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RYZOM CORE PIPELINE; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include <nel/misc/types_nl.h>
#include "pipeline_interface_impl.h"
// STL includes
// NeL includes
// #include <nel/misc/debug.h>
#include <nel/misc/app_context.h>
#include <nel/misc/debug.h>
// Project includes
using namespace std;
// using namespace NLMISC;
namespace PIPELINE {
CPipelineInterfaceImpl::CPipelineInterfaceImpl()
{
nlassert(NLMISC::INelContext::isContextInitialised());
nlassert(NLMISC::INelContext::getInstance().getSingletonPointer("IPipelineInterface") == NULL);
NLMISC::INelContext::getInstance().setSingletonPointer("IPipelineInterface", this);
}
CPipelineInterfaceImpl::~CPipelineInterfaceImpl()
{
}
} /* namespace PIPELINE */
/* end of file */

@ -0,0 +1,64 @@
/**
* \file pipeline_interface_impl.h
* \brief CPipelineInterfaceImpl
* \date 2012-02-25 12:21GMT
* \author Jan Boon (Kaetemi)
* CPipelineInterfaceImpl
*/
/*
* Copyright (C) 2012 by authors
*
* This file is part of RYZOM CORE PIPELINE.
* RYZOM CORE PIPELINE is free software: you can redistribute it
* and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* RYZOM CORE PIPELINE is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RYZOM CORE PIPELINE; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef PIPELINE_PIPELINE_INTERFACE_IMPL_H
#define PIPELINE_PIPELINE_INTERFACE_IMPL_H
#include <nel/misc/types_nl.h>
// STL includes
// NeL includes
// Project includes
#include "../pipeline_library/pipeline_interface.h"
namespace PIPELINE {
/**
* \brief CPipelineInterfaceImpl
* \date 2012-02-25 12:21GMT
* \author Jan Boon (Kaetemi)
* CPipelineInterfaceImpl
*/
class CPipelineInterfaceImpl : public IPipelineInterface
{
protected:
// pointers
// ...
// instances
// ...
public:
CPipelineInterfaceImpl();
virtual ~CPipelineInterfaceImpl();
}; /* class CPipelineInterfaceImpl */
} /* namespace PIPELINE */
#endif /* #ifndef PIPELINE_PIPELINE_INTERFACE_IMPL_H */
/* end of file */

@ -45,6 +45,7 @@
#include <nel/misc/task_manager.h> #include <nel/misc/task_manager.h>
#include <nel/misc/async_file_manager.h> #include <nel/misc/async_file_manager.h>
#include <nel/misc/algo.h> #include <nel/misc/algo.h>
#include <nel/misc/dynloadlib.h>
// Project includes // Project includes
#include "pipeline_workspace.h" #include "pipeline_workspace.h"
@ -57,7 +58,6 @@ using namespace NLGEORGES;
namespace PIPELINE { namespace PIPELINE {
bool g_IsMaster = false;
std::string g_DatabaseDirectory; std::string g_DatabaseDirectory;
std::string g_PipelineDirectory; std::string g_PipelineDirectory;
bool g_IsExiting = false; bool g_IsExiting = false;
@ -89,6 +89,12 @@ namespace {
#define PIPELINE_SHORT_SERVICE_NAME "PLSS" #define PIPELINE_SHORT_SERVICE_NAME "PLSS"
#endif #endif
#ifdef NL_DEBUG
#define PIPELINE_SERVICE_DIRECTORY "R:\\build\\dev\\bin\\Release"
#else
#define PIPELINE_SERVICE_DIRECTORY ""
#endif
/// Enum /// Enum
enum EState enum EState
{ {
@ -106,6 +112,8 @@ CDatabaseStatus *s_DatabaseStatus = NULL;
EState s_State = STATE_IDLE; EState s_State = STATE_IDLE;
CMutex s_StateMutex; CMutex s_StateMutex;
std::vector<NLMISC::CLibrary *> s_LoadedLibraries;
// ****************************************************************** // ******************************************************************
/// Service wants to broadcast all users trough pipeline /// Service wants to broadcast all users trough pipeline
@ -254,7 +262,6 @@ public:
/// Initializes the service (must be called before the first call to update()) /// Initializes the service (must be called before the first call to update())
virtual void init() virtual void init()
{ {
g_IsMaster = ConfigFile.getVar("IsMaster").asBool();
g_DatabaseDirectory = CPath::standardizePath(ConfigFile.getVar("DatabaseDirectory").asString(), true); g_DatabaseDirectory = CPath::standardizePath(ConfigFile.getVar("DatabaseDirectory").asString(), true);
if (!CFile::isDirectory(g_DatabaseDirectory)) nlwarning("'DatabaseDirectory' does not exist! (%s)", g_DatabaseDirectory.c_str()); if (!CFile::isDirectory(g_DatabaseDirectory)) nlwarning("'DatabaseDirectory' does not exist! (%s)", g_DatabaseDirectory.c_str());
g_PipelineDirectory = CPath::standardizePath(ConfigFile.getVar("PipelineDirectory").asString(), true); g_PipelineDirectory = CPath::standardizePath(ConfigFile.getVar("PipelineDirectory").asString(), true);
@ -265,6 +272,18 @@ public:
initSheets(); initSheets();
s_DatabaseStatus = new CDatabaseStatus(); s_DatabaseStatus = new CDatabaseStatus();
// Load libraries
const CConfigFile::CVar &usedPlugins = ConfigFile.getVar("UsedPlugins");
for (uint i = 0; i < usedPlugins.size(); ++i)
{
CLibrary *library = new CLibrary();
if (library->loadLibrary(usedPlugins.asString(i), true, true, true))
{
s_LoadedLibraries.push_back(library);
}
else delete library;
}
} }
/// This function is called every "frame" (you must call init() before). It returns false if the service is stopped. /// This function is called every "frame" (you must call init() before). It returns false if the service is stopped.
@ -350,6 +369,6 @@ NLMISC_COMMAND(updateDatabaseStatus, "Updates the entire database status. This a
return true; return true;
} }
NLNET_SERVICE_MAIN(PIPELINE::CPipelineService, PIPELINE_SHORT_SERVICE_NAME, PIPELINE_LONG_SERVICE_NAME, 0, PIPELINE::s_ShardCallbacks, "", "") NLNET_SERVICE_MAIN(PIPELINE::CPipelineService, PIPELINE_SHORT_SERVICE_NAME, PIPELINE_LONG_SERVICE_NAME, 0, PIPELINE::s_ShardCallbacks, PIPELINE_SERVICE_DIRECTORY, PIPELINE_SERVICE_DIRECTORY)
/* end of file */ /* end of file */

Loading…
Cancel
Save