FileWriter.cc
1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/**
* FileWriter.cc
*
* Created on: 02 oct. 2014
* Author: AKKA
*/
#include "FileWriter.hh"
namespace AMDA {
namespace ParamOutputImpl {
namespace Download {
namespace FileWriter {
FileWriter::FileWriter(AMDA::Parameters::ParameterManager& pParameterManager) :
_parameterManager(pParameterManager)
{
}
FileWriter::~FileWriter(void)
{
}
void FileWriter::sortParametersInfoByType(std::string crtParamId,
std::set<std::pair<std::string,AMDA::Info::ParamInfoSPtr>,cmpParamInfoStruct>& baseParamsInfoList,
std::set<std::pair<std::string,AMDA::Info::ParamInfoSPtr>,cmpParamInfoStruct>& derivedParamsInfoList)
{
//get current parameter
AMDA::Parameters::ParameterSPtr crtParam = _parameterManager.getParameter(crtParamId);
if (crtParam == nullptr)
return;
//get current param info
AMDA::Info::ParamInfoSPtr paramInfo = AMDA::Info::ParamMgr::getInstance()->getParamInfoFromId(crtParam->getInfoId());
if (paramInfo == nullptr)
return;
if (paramInfo->getProcessInfo().empty())
{
//it's a base parameter
baseParamsInfoList.insert(std::pair<std::string,AMDA::Info::ParamInfoSPtr>(crtParamId,paramInfo));
if(!paramInfo->getLinkedParamList().empty())
{
for (auto linkedParamId : paramInfo->getLinkedParamList())
sortParametersInfoByType(linkedParamId, baseParamsInfoList, derivedParamsInfoList);
}
}
else
{
//it's a derived parameter
derivedParamsInfoList.insert(std::pair<std::string,AMDA::Info::ParamInfoSPtr>(crtParamId,paramInfo));
for (auto linkedParamId : paramInfo->getLinkedParamList())
sortParametersInfoByType(linkedParamId, baseParamsInfoList, derivedParamsInfoList);
}
}
} /* namespace FileWriter */
} /* namespace Download */
} /* namespace ParamOutputImpl */
} /* namespace AMDA */