Added: Get temp directory of current project.

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 13 years ago
parent 90cc3bda2c
commit 8bdfa294eb

@ -58,6 +58,8 @@ public:
static IPipelineInterface *getInstance(); static IPipelineInterface *getInstance();
// ***************** PLUGIN UTILITY FUNCTIONS *****************
/// Get the configuration file of the pipeline service. Must only be used for configuration values that may be different on different services, such as tool paths. /// Get the configuration file of the pipeline service. Must only be used for configuration values that may be different on different services, such as tool paths.
virtual NLMISC::CConfigFile &getConfigFile() = 0; virtual NLMISC::CConfigFile &getConfigFile() = 0;
@ -70,6 +72,14 @@ public:
/// Call when a runnable task has ended to reset to STATE_IDLE. /// Call when a runnable task has ended to reset to STATE_IDLE.
virtual void endedRunnableTask() = 0; virtual void endedRunnableTask() = 0;
// ***************** PROCESS FUNCTIONS *****************
/// Get a parsed georges sheets value from the current project. (example: OutputDirectory)
virtual std::string getProjectValue(const std::string &name) = 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;
}; /* class IPipelineInterface */ }; /* class IPipelineInterface */
#define PIPELINE_REGISTER_CLASS(_class_) PIPELINE::IPipelineInterface::getInstance()->registerClass(#_class_, _class_::creator, typeid(_class_).name()); #define PIPELINE_REGISTER_CLASS(_class_) PIPELINE::IPipelineInterface::getInstance()->registerClass(#_class_, _class_::creator, typeid(_class_).name());

@ -1,55 +0,0 @@
/**
* \file pipeline_plugin.cpp
* \brief IPipelinePlugin
* \date 2012-02-25 10:27GMT
* \author Jan Boon (Kaetemi)
* IPipelinePlugin
*/
/*
* 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_plugin.h"
// STL includes
// NeL includes
// #include <nel/misc/debug.h>
// Project includes
using namespace std;
// using namespace NLMISC;
namespace PIPELINE {
IPipelinePlugin::IPipelinePlugin()
{
}
IPipelinePlugin::~IPipelinePlugin()
{
}
} /* namespace PIPELINE */
/* end of file */

@ -1,63 +0,0 @@
/**
* \file pipeline_plugin.h
* \brief IPipelinePlugin
* \date 2012-02-25 10:27GMT
* \author Jan Boon (Kaetemi)
* IPipelinePlugin
*/
/*
* 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_PLUGIN_H
#define PIPELINE_PIPELINE_PLUGIN_H
#include <nel/misc/types_nl.h>
// STL includes
// NeL includes
// Project includes
namespace PIPELINE {
/**
* \brief IPipelinePlugin
* \date 2012-02-25 10:27GMT
* \author Jan Boon (Kaetemi)
* A pipeline plugin (dll) exposes multiple process plugins.
*/
class IPipelinePlugin
{
protected:
// pointers
// ...
// instances
// ...
public:
IPipelinePlugin();
virtual ~IPipelinePlugin();
}; /* class IPipelinePlugin */
} /* namespace PIPELINE */
#endif /* #ifndef PIPELINE_PIPELINE_PLUGIN_H */
/* end of file */

@ -67,7 +67,7 @@ BOOL WINAPI DllMain(HANDLE hModule, DWORD /* ul_reason_for_call */, LPVOID /* lp
} }
// ****************************************************************** // ******************************************************************
/*
CPipelinePluginMax::CPipelinePluginMax() CPipelinePluginMax::CPipelinePluginMax()
{ {
@ -76,7 +76,7 @@ CPipelinePluginMax::CPipelinePluginMax()
CPipelinePluginMax::~CPipelinePluginMax() CPipelinePluginMax::~CPipelinePluginMax()
{ {
} }*/
} /* namespace PIPELINE */ } /* namespace PIPELINE */

@ -42,7 +42,7 @@ namespace PIPELINE {
* \date 2012-02-25 10:39GMT * \date 2012-02-25 10:39GMT
* \author Jan Boon (Kaetemi) * \author Jan Boon (Kaetemi)
* CPipelinePluginMax * CPipelinePluginMax
*/ *//*
class CPipelinePluginMax class CPipelinePluginMax
{ {
protected: protected:
@ -54,7 +54,7 @@ protected:
public: public:
CPipelinePluginMax(); CPipelinePluginMax();
virtual ~CPipelinePluginMax(); virtual ~CPipelinePluginMax();
}; /* class CPipelinePluginMax */ };*/ /* class CPipelinePluginMax */
} /* namespace PIPELINE */ } /* namespace PIPELINE */

@ -57,12 +57,15 @@ namespace {
class CMaxExportShapeCommand : public NLMISC::IRunnable class CMaxExportShapeCommand : public NLMISC::IRunnable
{ {
public:
NLMISC::CLog *Log;
virtual void getName(std::string &result) const virtual void getName(std::string &result) const
{ result = "CMaxExportShapeCommand"; } { result = "CMaxExportShapeCommand"; }
virtual void run() virtual void run()
{ {
// ... std::string tempDirectory = PIPELINE::IPipelineInterface::getInstance()->getTempDir();
PIPELINE::IPipelineInterface::getInstance()->endedRunnableTask(); PIPELINE::IPipelineInterface::getInstance()->endedRunnableTask();
} }
@ -76,6 +79,7 @@ CMaxExportShapeCommand s_MaxExportShapeCommand;
NLMISC_CATEGORISED_COMMAND(max, maxExportShape, "Export shapes from a .max file manually.", "<filePath> <outDirectory>") NLMISC_CATEGORISED_COMMAND(max, maxExportShape, "Export shapes from a .max file manually.", "<filePath> <outDirectory>")
{ {
if(args.size() != 2) return false; if(args.size() != 2) return false;
PIPELINE::s_MaxExportShapeCommand.Log = &log;
if (!PIPELINE::IPipelineInterface::getInstance()->tryRunnableTask("COMMAND_MAX_EXPORT_SHAPE", &PIPELINE::s_MaxExportShapeCommand)) if (!PIPELINE::IPipelineInterface::getInstance()->tryRunnableTask("COMMAND_MAX_EXPORT_SHAPE", &PIPELINE::s_MaxExportShapeCommand))
{ {
log.displayNL("Busy."); log.displayNL("Busy.");

@ -49,7 +49,7 @@ namespace PIPELINE {
#define PIPELINE_DATABASE_STATUS_SUBDIR "database.status/" #define PIPELINE_DATABASE_STATUS_SUBDIR "database.status/"
#define PIPELINE_DATABASE_ERRORS_SUBDIR "database.errors/" #define PIPELINE_DATABASE_ERRORS_SUBDIR "database.errors/"
#define PIPELINE_DATABASE_DEPEND_SUFFIX "database.depend/" #define PIPELINE_DATABASE_DEPEND_SUBDIR "database.depend/"
#define PIPELINE_DATABASE_STATUS_SUFFIX ".status" #define PIPELINE_DATABASE_STATUS_SUFFIX ".status"
#define PIPELINE_DATABASE_ERRORS_SUFFIX ".errors" #define PIPELINE_DATABASE_ERRORS_SUFFIX ".errors"
#define PIPELINE_DATABASE_DEPEND_SUFFIX ".depend" #define PIPELINE_DATABASE_DEPEND_SUFFIX ".depend"

@ -29,6 +29,7 @@
#include "pipeline_interface_impl.h" #include "pipeline_interface_impl.h"
// STL includes // STL includes
#include <sstream>
// NeL includes // NeL includes
#include <nel/misc/app_context.h> #include <nel/misc/app_context.h>
@ -77,6 +78,27 @@ void CPipelineInterfaceImpl::endedRunnableTask()
PIPELINE::endedRunnableTask(); PIPELINE::endedRunnableTask();
} }
std::string CPipelineInterfaceImpl::getProjectValue(const std::string &name)
{
return ""; // TODO
}
std::string CPipelineInterfaceImpl::getTempDir()
{
// IF PROJECT blahblah TODO
// ELSE
{
std::stringstream ss;
ss << g_PipelineDirectory;
ss << NLMISC::CTime::getSecondsSince1970();
ss << ".";
ss << rand();
ss << PIPELINE_DIRECTORY_TEMP_SUFFIX;
return ss.str();
}
}
} /* namespace PIPELINE */ } /* namespace PIPELINE */
/* end of file */ /* end of file */

@ -40,6 +40,8 @@
namespace PIPELINE { namespace PIPELINE {
#define PIPELINE_DIRECTORY_TEMP_SUFFIX ".temp"
/** /**
* \brief CPipelineInterfaceImpl * \brief CPipelineInterfaceImpl
* \date 2012-02-25 12:21GMT * \date 2012-02-25 12:21GMT
@ -64,6 +66,8 @@ public:
virtual void registerClass(const std::string &className, NLMISC::IClassable* (*creator)(), const std::string &typeidCheck) throw(NLMISC::ERegistry); virtual void registerClass(const std::string &className, NLMISC::IClassable* (*creator)(), const std::string &typeidCheck) throw(NLMISC::ERegistry);
virtual bool tryRunnableTask(std::string stateName, NLMISC::IRunnable *task); virtual bool tryRunnableTask(std::string stateName, NLMISC::IRunnable *task);
virtual void endedRunnableTask(); virtual void endedRunnableTask();
virtual std::string getProjectValue(const std::string &name);
virtual std::string getTempDir();
}; /* class CPipelineInterfaceImpl */ }; /* class CPipelineInterfaceImpl */
} /* namespace PIPELINE */ } /* namespace PIPELINE */

Loading…
Cancel
Save