From 8bdfa294ebd2ea700ea41622b21ba5d1dbe0fc76 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 25 Feb 2012 17:48:30 +0100 Subject: [PATCH] Added: Get temp directory of current project. --HG-- branch : build_pipeline_v3 --- .../pipeline_library/pipeline_interface.h | 10 +++ .../pipeline_library/pipeline_plugin.cpp | 55 ---------------- .../pipeline_library/pipeline_plugin.h | 63 ------------------- .../pipeline_plugin_max.cpp | 4 +- .../pipeline_plugin_max/pipeline_plugin_max.h | 4 +- .../pipeline_plugin_max/process_max_shape.cpp | 6 +- .../pipeline_service/database_status.h | 2 +- .../pipeline_interface_impl.cpp | 22 +++++++ .../pipeline_interface_impl.h | 4 ++ 9 files changed, 46 insertions(+), 124 deletions(-) delete mode 100644 code/nel/tools/pipeline/pipeline_library/pipeline_plugin.cpp delete mode 100644 code/nel/tools/pipeline/pipeline_library/pipeline_plugin.h diff --git a/code/nel/tools/pipeline/pipeline_library/pipeline_interface.h b/code/nel/tools/pipeline/pipeline_library/pipeline_interface.h index f5b93dcc4..377e58f0e 100644 --- a/code/nel/tools/pipeline/pipeline_library/pipeline_interface.h +++ b/code/nel/tools/pipeline/pipeline_library/pipeline_interface.h @@ -58,6 +58,8 @@ public: 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. virtual NLMISC::CConfigFile &getConfigFile() = 0; @@ -70,6 +72,14 @@ public: /// Call when a runnable task has ended to reset to STATE_IDLE. 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 */ #define PIPELINE_REGISTER_CLASS(_class_) PIPELINE::IPipelineInterface::getInstance()->registerClass(#_class_, _class_::creator, typeid(_class_).name()); diff --git a/code/nel/tools/pipeline/pipeline_library/pipeline_plugin.cpp b/code/nel/tools/pipeline/pipeline_library/pipeline_plugin.cpp deleted file mode 100644 index 40c49a32e..000000000 --- a/code/nel/tools/pipeline/pipeline_library/pipeline_plugin.cpp +++ /dev/null @@ -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 - * . - */ - -#include -#include "pipeline_plugin.h" - -// STL includes - -// NeL includes -// #include - -// Project includes - -using namespace std; -// using namespace NLMISC; - -namespace PIPELINE { - -IPipelinePlugin::IPipelinePlugin() -{ - -} - -IPipelinePlugin::~IPipelinePlugin() -{ - -} - -} /* namespace PIPELINE */ - -/* end of file */ diff --git a/code/nel/tools/pipeline/pipeline_library/pipeline_plugin.h b/code/nel/tools/pipeline/pipeline_library/pipeline_plugin.h deleted file mode 100644 index 0cdd4660e..000000000 --- a/code/nel/tools/pipeline/pipeline_library/pipeline_plugin.h +++ /dev/null @@ -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 - * . - */ - -#ifndef PIPELINE_PIPELINE_PLUGIN_H -#define PIPELINE_PIPELINE_PLUGIN_H -#include - -// 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 */ diff --git a/code/nel/tools/pipeline/pipeline_plugin_max/pipeline_plugin_max.cpp b/code/nel/tools/pipeline/pipeline_plugin_max/pipeline_plugin_max.cpp index 5ca71cc17..0e1922c87 100644 --- a/code/nel/tools/pipeline/pipeline_plugin_max/pipeline_plugin_max.cpp +++ b/code/nel/tools/pipeline/pipeline_plugin_max/pipeline_plugin_max.cpp @@ -67,7 +67,7 @@ BOOL WINAPI DllMain(HANDLE hModule, DWORD /* ul_reason_for_call */, LPVOID /* lp } // ****************************************************************** - +/* CPipelinePluginMax::CPipelinePluginMax() { @@ -76,7 +76,7 @@ CPipelinePluginMax::CPipelinePluginMax() CPipelinePluginMax::~CPipelinePluginMax() { -} +}*/ } /* namespace PIPELINE */ diff --git a/code/nel/tools/pipeline/pipeline_plugin_max/pipeline_plugin_max.h b/code/nel/tools/pipeline/pipeline_plugin_max/pipeline_plugin_max.h index e0da1ad5e..6ba29fb03 100644 --- a/code/nel/tools/pipeline/pipeline_plugin_max/pipeline_plugin_max.h +++ b/code/nel/tools/pipeline/pipeline_plugin_max/pipeline_plugin_max.h @@ -42,7 +42,7 @@ namespace PIPELINE { * \date 2012-02-25 10:39GMT * \author Jan Boon (Kaetemi) * CPipelinePluginMax - */ + *//* class CPipelinePluginMax { protected: @@ -54,7 +54,7 @@ protected: public: CPipelinePluginMax(); virtual ~CPipelinePluginMax(); -}; /* class CPipelinePluginMax */ +};*/ /* class CPipelinePluginMax */ } /* namespace PIPELINE */ diff --git a/code/nel/tools/pipeline/pipeline_plugin_max/process_max_shape.cpp b/code/nel/tools/pipeline/pipeline_plugin_max/process_max_shape.cpp index 3f80111e3..6e5ab3ef8 100644 --- a/code/nel/tools/pipeline/pipeline_plugin_max/process_max_shape.cpp +++ b/code/nel/tools/pipeline/pipeline_plugin_max/process_max_shape.cpp @@ -57,12 +57,15 @@ namespace { class CMaxExportShapeCommand : public NLMISC::IRunnable { +public: + NLMISC::CLog *Log; + virtual void getName(std::string &result) const { result = "CMaxExportShapeCommand"; } virtual void run() { - // ... + std::string tempDirectory = PIPELINE::IPipelineInterface::getInstance()->getTempDir(); PIPELINE::IPipelineInterface::getInstance()->endedRunnableTask(); } @@ -76,6 +79,7 @@ CMaxExportShapeCommand s_MaxExportShapeCommand; NLMISC_CATEGORISED_COMMAND(max, maxExportShape, "Export shapes from a .max file manually.", " ") { if(args.size() != 2) return false; + PIPELINE::s_MaxExportShapeCommand.Log = &log; if (!PIPELINE::IPipelineInterface::getInstance()->tryRunnableTask("COMMAND_MAX_EXPORT_SHAPE", &PIPELINE::s_MaxExportShapeCommand)) { log.displayNL("Busy."); diff --git a/code/nel/tools/pipeline/pipeline_service/database_status.h b/code/nel/tools/pipeline/pipeline_service/database_status.h index 0bbb99f6f..1a8eee623 100644 --- a/code/nel/tools/pipeline/pipeline_service/database_status.h +++ b/code/nel/tools/pipeline/pipeline_service/database_status.h @@ -49,7 +49,7 @@ namespace PIPELINE { #define PIPELINE_DATABASE_STATUS_SUBDIR "database.status/" #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_ERRORS_SUFFIX ".errors" #define PIPELINE_DATABASE_DEPEND_SUFFIX ".depend" diff --git a/code/nel/tools/pipeline/pipeline_service/pipeline_interface_impl.cpp b/code/nel/tools/pipeline/pipeline_service/pipeline_interface_impl.cpp index 03f168ec6..e364f2988 100644 --- a/code/nel/tools/pipeline/pipeline_service/pipeline_interface_impl.cpp +++ b/code/nel/tools/pipeline/pipeline_service/pipeline_interface_impl.cpp @@ -29,6 +29,7 @@ #include "pipeline_interface_impl.h" // STL includes +#include // NeL includes #include @@ -77,6 +78,27 @@ void CPipelineInterfaceImpl::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 */ /* end of file */ diff --git a/code/nel/tools/pipeline/pipeline_service/pipeline_interface_impl.h b/code/nel/tools/pipeline/pipeline_service/pipeline_interface_impl.h index 994f2a866..080c5c31b 100644 --- a/code/nel/tools/pipeline/pipeline_service/pipeline_interface_impl.h +++ b/code/nel/tools/pipeline/pipeline_service/pipeline_interface_impl.h @@ -40,6 +40,8 @@ namespace PIPELINE { +#define PIPELINE_DIRECTORY_TEMP_SUFFIX ".temp" + /** * \brief CPipelineInterfaceImpl * \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 bool tryRunnableTask(std::string stateName, NLMISC::IRunnable *task); virtual void endedRunnableTask(); + virtual std::string getProjectValue(const std::string &name); + virtual std::string getTempDir(); }; /* class CPipelineInterfaceImpl */ } /* namespace PIPELINE */