Added: #1440 Initial process data dependency listing

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 13 years ago
parent c6a2534c98
commit 809cbe6c5a

@ -53,11 +53,16 @@ public:
// ***************** PROCESS FUNCTIONS (EASILY EXPOSABLE TO SCRIPTS ETCETERA) *****************
/// Get a parsed georges sheets value from the current project. (example: Interface.DstDirectory)
virtual std::string getProjectValue(const std::string &name) = 0;
/// Gets the output directory for the project.
virtual std::string getOutputDirectory() = 0;
/// Get the temporary directory for the current process. The directory must be deleted when the process ends. May return random temporary directories if no process is running.
virtual std::string getTempDir() = 0;
virtual std::string getTempDirectory() = 0;
/// Get a value from the currently active project configuration
virtual bool getValue(std::string &result, const std::string &name) = 0;
virtual bool getValues(std::vector<std::string> &resultAppend, const std::string &name) = 0;
virtual bool getValueNb(uint &result, const std::string &name) = 0;
}; /* class IPipelineProcess */
} /* namespace PIPELINE */

@ -38,6 +38,7 @@
#include <nel/misc/class_registry.h>
// Project includes
#include "pipeline_process.h"
namespace PIPELINE {
@ -49,16 +50,19 @@ namespace PIPELINE {
*/
class IProcessInfo : public NLMISC::IClassable
{
protected:
IPipelineProcess *m_PipelineProcess;
public:
IProcessInfo() { }
IProcessInfo() : m_PipelineProcess(IPipelineProcess::getInstance()) { }
virtual ~IProcessInfo() { }
void setPipelineProcess(IPipelineProcess *pipelineProcess) { m_PipelineProcess = pipelineProcess; }
/// Dependency information used to store the initial state of files on which the process depends.
/// A process handler is not allowed to depend on any files it does not list here.
/// Must return all directories on which the process handler recursively depends.
virtual void getDependentDirectoriesRecursive(std::vector<std::string> &result) = 0;
/// Must return all directories on which the process handler depends.
/// Must return all directories on which the process handler depends, these are NOT RECURSIVE.
virtual void getDependentDirectories(std::vector<std::string> &result) = 0;
/// Must return all files on which the process handler depends, ONLY if these are not in dependent directories.
virtual void getDependentFiles(std::vector<std::string> &result) = 0;

@ -66,7 +66,7 @@ public:
virtual void run()
{
std::string tempDirectory = PIPELINE::IPipelineProcess::getInstance()->getTempDir();
std::string tempDirectory = PIPELINE::IPipelineProcess::getInstance()->getTempDirectory();
PIPELINE::IPipelineInterface::getInstance()->endedRunnableTask();
}

@ -29,6 +29,7 @@
#include "process_interface_info.h"
// STL includes
#include <sstream>
// NeL includes
// #include <nel/misc/debug.h>
@ -50,14 +51,42 @@ CProcessInterfaceInfo::~CProcessInterfaceInfo()
}
void CProcessInterfaceInfo::getDependentDirectoriesRecursive(std::vector<std::string> &result)
{
}
void CProcessInterfaceInfo::getDependentDirectories(std::vector<std::string> &result)
{
{
uint nb;
if (m_PipelineProcess->getValueNb(nb, "Interface.Atlas"))
{
for (uint i = 0; i < nb; ++i)
{
std::stringstream ss;
ss << "Interface.Atlas[" << i << "].SrcDirectories";
m_PipelineProcess->getValues(result, ss.str());
}
}
}
{
uint nb;
if (m_PipelineProcess->getValueNb(nb, "Interface.AtlasDxtc"))
{
for (uint i = 0; i < nb; ++i)
{
std::stringstream ss;
ss << "Interface.AtlasDxtc[" << i << "].SrcDirectories";
m_PipelineProcess->getValues(result, ss.str());
}
}
}
{
std::stringstream ss;
ss << "Interface.Fullscreen.SrcDirectories";
m_PipelineProcess->getValues(result, ss.str());
}
{
std::stringstream ss;
ss << "Interface.3D.SrcDirectories";
m_PipelineProcess->getValues(result, ss.str());
}
}
void CProcessInterfaceInfo::getDependentFiles(std::vector<std::string> &result)

@ -56,7 +56,6 @@ public:
CProcessInterfaceInfo();
virtual ~CProcessInterfaceInfo();
virtual void getDependentDirectoriesRecursive(std::vector<std::string> &result);
virtual void getDependentDirectories(std::vector<std::string> &result);
virtual void getDependentFiles(std::vector<std::string> &result);

@ -38,34 +38,48 @@
// Project includes
#include "pipeline_service.h"
#include "pipeline_project.h"
using namespace std;
// using namespace NLMISC;
namespace PIPELINE {
CPipelineProcessImpl::CPipelineProcessImpl()
CPipelineProcessImpl::CPipelineProcessImpl(CPipelineProject *activeProject) : m_ActiveProject(activeProject)
{
if (activeProject == NULL)
{
nlassert(getInstance() == NULL);
NLMISC::INelContext::getInstance().setSingletonPointer("IPipelineProcess", this);
}
}
CPipelineProcessImpl::~CPipelineProcessImpl()
{
if (m_ActiveProject == NULL)
{
NLMISC::INelContext::getInstance().releaseSingletonPointer("IPipelineProcess", this);
}
}
std::string CPipelineProcessImpl::getProjectValue(const std::string &name)
std::string CPipelineProcessImpl::getOutputDirectory()
{
return ""; // TODO
if (m_ActiveProject == NULL)
{
nlwarning("(m_ActiveProject == NULL)");
return getTempDirectory();
}
else
{
return m_ActiveProject->getOutputDirectory();
}
}
std::string CPipelineProcessImpl::getTempDir()
std::string CPipelineProcessImpl::getTempDirectory()
{
// IF PROJECT blahblah TODO
// ELSE
if (m_ActiveProject == NULL)
{
nlwarning("(m_ActiveProject == NULL)");
std::stringstream ss;
ss << g_PipelineDirectory;
ss << NLMISC::CTime::getSecondsSince1970();
@ -74,6 +88,49 @@ std::string CPipelineProcessImpl::getTempDir()
ss << PIPELINE_DIRECTORY_TEMP_SUFFIX;
return ss.str();
}
else
{
return m_ActiveProject->getTempDirectory();
}
}
bool CPipelineProcessImpl::getValue(std::string &result, const std::string &name)
{
if (m_ActiveProject == NULL)
{
nlwarning("(m_ActiveProject == NULL)");
return false;
}
else
{
return m_ActiveProject->getValue(result, name);
}
}
bool CPipelineProcessImpl::getValues(std::vector<std::string> &resultAppend, const std::string &name)
{
if (m_ActiveProject == NULL)
{
nlwarning("(m_ActiveProject == NULL)");
return false;
}
else
{
return m_ActiveProject->getValues(resultAppend, name);
}
}
bool CPipelineProcessImpl::getValueNb(uint &result, const std::string &name)
{
if (m_ActiveProject == NULL)
{
nlwarning("(m_ActiveProject == NULL)");
return false;
}
else
{
return m_ActiveProject->getValueNb(result, name);
}
}
} /* namespace PIPELINE */

@ -37,6 +37,7 @@
#include "../plugin_library/pipeline_process.h"
namespace PIPELINE {
class CPipelineProject;
/**
* \brief CPipelineProcessImpl
@ -46,12 +47,19 @@ namespace PIPELINE {
*/
class CPipelineProcessImpl : public IPipelineProcess
{
private:
CPipelineProject *m_ActiveProject;
public:
CPipelineProcessImpl();
CPipelineProcessImpl(CPipelineProject *activeProject);
virtual ~CPipelineProcessImpl();
virtual std::string getProjectValue(const std::string &name);
virtual std::string getTempDir();
virtual std::string getOutputDirectory();
virtual std::string getTempDirectory();
virtual bool getValue(std::string &result, const std::string &name);
virtual bool getValues(std::vector<std::string> &resultAppend, const std::string &name);
virtual bool getValueNb(uint &result, const std::string &name);
}; /* class CPipelineProcessImpl */
} /* namespace PIPELINE */

@ -53,7 +53,7 @@
#include "database_status.h"
#include "pipeline_interface_impl.h"
#include "pipeline_process_impl.h"
#include "../plugin_library/process_info.h"
// using namespace std;
using namespace NLMISC;
@ -318,7 +318,7 @@ public:
s_DatabaseStatus = new CDatabaseStatus();
s_PipelineInterfaceImpl = new CPipelineInterfaceImpl();
s_PipelineProcessImpl = new CPipelineProcessImpl();
s_PipelineProcessImpl = new CPipelineProcessImpl(NULL); // Create a singleton impl for global usage without running project for test purposes.
// Load libraries
const CConfigFile::CVar &usedPlugins = ConfigFile.getVar("UsedPlugins");
@ -526,6 +526,48 @@ NLMISC_COMMAND(showProjectValue, "Show project value.", "<projectName> <valueNam
}
}
NLMISC_COMMAND(showDependencies, "Show dependencies.", "<projectName> <processName>")
{
if(args.size() != 2) return false;
std::vector<PIPELINE::CProcessPluginInfo> plugins;
PIPELINE::g_PipelineWorkspace->getProcessPlugins(plugins, args[1]);
PIPELINE::CPipelineProject *project = PIPELINE::g_PipelineWorkspace->getProject(args[0]);
if (project)
{
PIPELINE::IPipelineProcess *pipelineProcess = new PIPELINE::CPipelineProcessImpl(project);
for (std::vector<PIPELINE::CProcessPluginInfo>::iterator plugin_it = plugins.begin(), plugin_end = plugins.end(); plugin_it != plugin_end; ++plugin_it)
{
switch (plugin_it->InfoType)
{
case PIPELINE::PLUGIN_REGISTERED_CLASS:
{
PIPELINE::IProcessInfo *processInfo = static_cast<PIPELINE::IProcessInfo *>(NLMISC::CClassRegistry::create(plugin_it->Info));
log.displayNL("PROCESS_INFO: %s", plugin_it->Info.c_str());
processInfo->setPipelineProcess(pipelineProcess);
std::vector<std::string> result;
processInfo->getDependentDirectories(result);
for (std::vector<std::string>::iterator it = result.begin(), end = result.end(); it != end; ++it)
log.displayNL("DIRECTORY: %s", it->c_str());
result.clear();
processInfo->getDependentFiles(result);
for (std::vector<std::string>::iterator it = result.begin(), end = result.end(); it != end; ++it)
log.displayNL("FILE: %s", it->c_str());
}
break;
default:
nlwarning("Not implemented.");
break;
}
}
}
else
{
log.displayNL("Project '%s' does not exist", args[0].c_str());
return false;
}
return true;
}
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 */

Loading…
Cancel
Save