From 80b37c691864f821cee6b945ec72eca6fd216c8e Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 3 Mar 2012 12:43:40 +0100 Subject: [PATCH] Added: #1440 Class for pipeline project sheet --HG-- branch : build_pipeline_v3 --- .../pipeline/service/pipeline_project.cpp | 55 ++++++++++++++++ .../tools/pipeline/service/pipeline_project.h | 64 +++++++++++++++++++ .../pipeline/service/pipeline_workspace.cpp | 14 +++- .../pipeline/service/pipeline_workspace.h | 4 +- 4 files changed, 133 insertions(+), 4 deletions(-) create mode 100644 code/nel/tools/pipeline/service/pipeline_project.cpp create mode 100644 code/nel/tools/pipeline/service/pipeline_project.h diff --git a/code/nel/tools/pipeline/service/pipeline_project.cpp b/code/nel/tools/pipeline/service/pipeline_project.cpp new file mode 100644 index 000000000..df00cca9a --- /dev/null +++ b/code/nel/tools/pipeline/service/pipeline_project.cpp @@ -0,0 +1,55 @@ +/** + * \file pipeline_project.cpp + * \brief CPipelineProject + * \date 2012-03-03 11:31GMT + * \author Jan Boon (Kaetemi) + * CPipelineProject + */ + +/* + * 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_project.h" + +// STL includes + +// NeL includes +// #include + +// Project includes + +using namespace std; +// using namespace NLMISC; + +namespace PIPELINE { + +CPipelineProject::CPipelineProject(CPipelineWorkspace *workspace, NLGEORGES::UForm *form) : m_Workspace(workspace), m_Form(form) +{ + +} + +CPipelineProject::~CPipelineProject() +{ + +} + +} /* namespace PIPELINE */ + +/* end of file */ diff --git a/code/nel/tools/pipeline/service/pipeline_project.h b/code/nel/tools/pipeline/service/pipeline_project.h new file mode 100644 index 000000000..1d0f939cc --- /dev/null +++ b/code/nel/tools/pipeline/service/pipeline_project.h @@ -0,0 +1,64 @@ +/** + * \file pipeline_project.h + * \brief CPipelineProject + * \date 2012-03-03 11:31GMT + * \author Jan Boon (Kaetemi) + * CPipelineProject + */ + +/* + * 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_PROJECT_H +#define PIPELINE_PIPELINE_PROJECT_H +#include + +// STL includes + +// NeL includes +#include +#include + +// Project includes + +namespace PIPELINE { + class CPipelineWorkspace; + +/** + * \brief CPipelineProject + * \date 2012-03-03 11:31GMT + * \author Jan Boon (Kaetemi) + * CPipelineProject + */ +class CPipelineProject +{ +protected: + CPipelineWorkspace *m_Workspace; + NLMISC::CRefPtr m_Form; +public: + CPipelineProject(CPipelineWorkspace *workspace, NLGEORGES::UForm *form); + virtual ~CPipelineProject(); + +}; /* class CPipelineProject */ + +} /* namespace PIPELINE */ + +#endif /* #ifndef PIPELINE_PIPELINE_PROJECT_H */ + +/* end of file */ diff --git a/code/nel/tools/pipeline/service/pipeline_workspace.cpp b/code/nel/tools/pipeline/service/pipeline_workspace.cpp index 46e441908..dd07f3c6a 100644 --- a/code/nel/tools/pipeline/service/pipeline_workspace.cpp +++ b/code/nel/tools/pipeline/service/pipeline_workspace.cpp @@ -33,8 +33,10 @@ // NeL includes // #include #include +#include // Project includes +#include "pipeline_project.h" using namespace std; // using namespace NLMISC; @@ -73,7 +75,7 @@ CPipelineWorkspace::CPipelineWorkspace(NLGEORGES::UFormLoader *formLoader, const nlwarning("Missing 'Plugins' in '%s'", m_Form->getFilename().c_str()); } } - + { UFormElm *projects; if (m_Form->getRootNode().getNodeByName(&projects, "Projects")) @@ -85,7 +87,11 @@ CPipelineWorkspace::CPipelineWorkspace(NLGEORGES::UFormLoader *formLoader, const std::string projectSheet; if (projects->getArrayValue(projectSheet, i)) { - m_Projects.push_back(formLoader->loadForm(projectSheet.c_str())); + std::string projectName = NLMISC::CFile::getFilenameWithoutExtension(projectSheet); + if (m_Projects.find(projectName) == m_Projects.end()) + m_Projects[projectName] = new CPipelineProject(this, formLoader->loadForm(projectSheet.c_str())); + else + nlwarning("Project '%s' in '%s' already", projectSheet.c_str(), m_Form->getFilename().c_str()); } else { @@ -102,7 +108,9 @@ CPipelineWorkspace::CPipelineWorkspace(NLGEORGES::UFormLoader *formLoader, const CPipelineWorkspace::~CPipelineWorkspace() { - + for (std::map::iterator it = m_Projects.begin(), end = m_Projects.end(); it != end; ++it) + delete (*it).second; + m_Projects.clear(); } void CPipelineWorkspace::getProcessPlugins(std::vector &result, const std::string &process) diff --git a/code/nel/tools/pipeline/service/pipeline_workspace.h b/code/nel/tools/pipeline/service/pipeline_workspace.h index 97e1010c6..7360bab90 100644 --- a/code/nel/tools/pipeline/service/pipeline_workspace.h +++ b/code/nel/tools/pipeline/service/pipeline_workspace.h @@ -40,6 +40,7 @@ // Project includes namespace PIPELINE { + class CPipelineProject; enum TPluginType { @@ -66,14 +67,15 @@ class CPipelineWorkspace protected: NLGEORGES::UFormLoader *m_FormLoader; NLMISC::CRefPtr m_Form; - std::vector > m_Projects; std::vector > m_Plugins; + std::map m_Projects; public: CPipelineWorkspace(NLGEORGES::UFormLoader *formLoader, const std::string &sheetName); virtual ~CPipelineWorkspace(); void getProcessPlugins(std::vector &result, const std::string &process); + CPipelineProject *getProject(const std::string &project) { return m_Projects[project]; } }; /* class CPipelineWorkspace */