From 87088471478f0b79ee8a3e3e8adffd084f4084c7 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Wed, 16 Sep 2015 10:42:24 +0200 Subject: [PATCH] Use file prefix for compressed archive + Add TTName in output files names --- src/ParamOutputImpl/Plot/PlotNode.cc | 1 + src/ParamOutputImpl/Plot/PlotOutput.cc | 14 +++++++++----- src/ParamOutputImpl/Plot/PlotOutput.hh | 9 ++++++++- src/ParamOutputImpl/Plot/TickPlot/TickMarkDecorator.cc | 1 + src/PostProcessing/PostProcessingNode.hh | 3 +++ src/PostProcessing/TarNode.cc | 8 +++++++- src/PostProcessing/ZipNode.cc | 9 ++++++++- 7 files changed, 37 insertions(+), 8 deletions(-) diff --git a/src/ParamOutputImpl/Plot/PlotNode.cc b/src/ParamOutputImpl/Plot/PlotNode.cc index ffd117f..9d79fb0 100644 --- a/src/ParamOutputImpl/Plot/PlotNode.cc +++ b/src/ParamOutputImpl/Plot/PlotNode.cc @@ -51,6 +51,7 @@ void PlotNode::proceed(xmlNodePtr pNode, lContext.push(plotOutput); lContext.push(lParameterManager); + lContext.push(&plotOutput->getFilePrefix()); AMDA::Parameters::ParamOutputSPtr lParamOutput(plotOutput); AMDA::XMLConfigurator::NodeGrpCfg::proceed(pNode, lContext); lParameterManager->getParamOutputList().push_back(lParamOutput); diff --git a/src/ParamOutputImpl/Plot/PlotOutput.cc b/src/ParamOutputImpl/Plot/PlotOutput.cc index 50a3f1d..1fabbbe 100644 --- a/src/ParamOutputImpl/Plot/PlotOutput.cc +++ b/src/ParamOutputImpl/Plot/PlotOutput.cc @@ -145,8 +145,9 @@ void PlotOutput::apply() { /** * @brief Init new page - Create also the new file if necessary + * */ -void PlotOutput::initNewPage(int intervalIndex) +bool PlotOutput::initNewPage(int intervalIndex, std::string& ttName) { LOG4CXX_DEBUG(gLogger,"PlotOutput::initNewPage"); std::stringstream plotFilePrefix; @@ -163,12 +164,14 @@ void PlotOutput::initNewPage(int intervalIndex) if ((_timeIntervalList->size() > 1) && (_outputStructure == OutputStructure::ONE_FILE_PER_INTERVAL) && !_page->_superposeMode) - plotFilePrefix << _filePrefix << "_" << intervalIndex << "_"; + plotFilePrefix << _filePrefix << "_" << ttName << "_" << intervalIndex << "_"; else plotFilePrefix << _filePrefix << "_"; //draw page _page->draw(_pls, newFile, plotFilePrefix.str().c_str()); + + return newFile; } /* @@ -183,7 +186,7 @@ void PlotOutput::drawOneIntervalByPage() getDataFromServer(); //init the page - initNewPage(_currentTimeInterval->_index); + bool newFile = initNewPage(_currentTimeInterval->_index, _currentTimeInterval->_ttName); // Compute panel position depending on the page layout computePanelBounds(); @@ -246,7 +249,8 @@ void PlotOutput::drawOneIntervalByPage() _parameterValues[paramId].reset(); //add file to file list for post processing - _files.push_back(_page->_fileName); + if (newFile) + _files.push_back(_page->_fileName); //go to next interval ++_currentTimeInterval; @@ -274,7 +278,7 @@ void PlotOutput::drawAllIntervalsInOnePage() } //init the page - initNewPage(0); + initNewPage(0,_timeIntervalList->begin()->_ttName); //Compute panel position depending on the page layout computePanelBounds(); diff --git a/src/ParamOutputImpl/Plot/PlotOutput.hh b/src/ParamOutputImpl/Plot/PlotOutput.hh index 3ea8461..1dffe11 100644 --- a/src/ParamOutputImpl/Plot/PlotOutput.hh +++ b/src/ParamOutputImpl/Plot/PlotOutput.hh @@ -87,6 +87,13 @@ public: _filePrefix = filePrefix; } + /** + * @brief sets the file prefix to use. + */ + std::string& getFilePrefix() + { + return _filePrefix; + } AMDA::Parameters::ParameterManager& getParameterManager(){ return _parameterManager; } @@ -218,7 +225,7 @@ private: /** * @brief Init new page - Create also the new file if necessary */ - void initNewPage(int intervalIndex); + bool initNewPage(int intervalIndex, std::string& ttName); /* * @brief Sequence to draw one interval by page diff --git a/src/ParamOutputImpl/Plot/TickPlot/TickMarkDecorator.cc b/src/ParamOutputImpl/Plot/TickPlot/TickMarkDecorator.cc index 709cca8..2410874 100644 --- a/src/ParamOutputImpl/Plot/TickPlot/TickMarkDecorator.cc +++ b/src/ParamOutputImpl/Plot/TickPlot/TickMarkDecorator.cc @@ -445,6 +445,7 @@ void TickMarkDecorator::installLabelGenerator(PanelPlotOutput* /*pplot_*/, TimeA //_decoratorPlot->getDataFromServer(); // build all series names : + _seriesInfoList.clear(); for (auto p : _decoratorPlot->_parameterAxesList) { const std::string name = p._originalParamId; LOG4CXX_DEBUG(_logger, " inspecting parameter : " << name); diff --git a/src/PostProcessing/PostProcessingNode.hh b/src/PostProcessing/PostProcessingNode.hh index 63b7672..393022e 100644 --- a/src/PostProcessing/PostProcessingNode.hh +++ b/src/PostProcessing/PostProcessingNode.hh @@ -51,6 +51,9 @@ public: // Push post processing able in the context lContext.push(lOutput); + std::string* filePrefix = pContext.get(); + lContext.push(filePrefix); + // proceed child nodes NodeGrpCfg::proceed(pNode, lContext); } diff --git a/src/PostProcessing/TarNode.cc b/src/PostProcessing/TarNode.cc index 789407f..fe7f94f 100644 --- a/src/PostProcessing/TarNode.cc +++ b/src/PostProcessing/TarNode.cc @@ -20,7 +20,13 @@ void TarNode::proceed(xmlNodePtr pNode, // Set value in output param std::stringstream outputNodeName; - outputNodeName << pNode->parent->parent->name; + + std::string* filePrefix = pContext.get(); + + if (filePrefix == NULL) + outputNodeName << pNode->parent->parent->name; + else + outputNodeName << (*filePrefix); output->addPostProcessing(new TarPostProcessing(outputNodeName.str())); } diff --git a/src/PostProcessing/ZipNode.cc b/src/PostProcessing/ZipNode.cc index 3bcf3f9..8a751cc 100644 --- a/src/PostProcessing/ZipNode.cc +++ b/src/PostProcessing/ZipNode.cc @@ -20,7 +20,14 @@ void ZipNode::proceed(xmlNodePtr pNode, // Set value in output param std::stringstream outputNodeName; - outputNodeName << pNode->parent->parent->name; + + std::string* filePrefix = pContext.get(); + + if (filePrefix == NULL) + outputNodeName << pNode->parent->parent->name; + else + outputNodeName << (*filePrefix); + output->addPostProcessing(new ZipPostProcessing(outputNodeName.str())); } } -- libgit2 0.21.2