Main.cc
2.74 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/**
* Main.cc
* Created on: 15 oct. 2012
* Author: AKKA IS
*/
//includes boost
#include <boost/shared_ptr.hpp>
#include "Application.hh"
#include "ParseMainArguments.hh"
// DD_Client_r_lib module includes
#include "TimeUtil.hh"
// Plugin module include
#include "PluginManager.hh"
// Parameters module include
#include "ParameterManager.hh"
#include "Parameter.hh"
#include "Process.hh"
#include "DownloadOutput.hh"
#include "ServicesServer.hh"
// XMLParameterConfigurator module include
#include "XMLParameterConfigurator.hh"
using namespace std;
using namespace AMDA::Main;
using namespace AMDA::Parameters;
using namespace AMDA::ParamOutputImpl::Download;
int amdaOutputASCIIFile(int argc, char *argv[], AMDA::helpers::Properties& /*lProperties*/) {
int result = AMDA_EXIT_OK;
boost::shared_ptr<ParseMainArguments> parseArg;
/// Parse command line parameters
parseArg = boost::shared_ptr<ParseMainArguments>( new ParseMainArguments(argc, argv));
if (!parseArg->isStopProcess()) {
///Create ParameterManager and configuration
ParameterManager parameterManager;
double lStartTime = DD_Time2Double(parseArg->getStartTime().c_str());
double lTimeInt = DD_Time2Double(parseArg->getIntervalTime().c_str());
std::string emptyStr;
parameterManager.addInputInterval(lStartTime, lStartTime + lTimeInt, 0, emptyStr, emptyStr, 0);
///Create Parameter
parameterManager.createParameter(parseArg->getParamName());
///Create DownloadOutput
DownloadOutput* lDownloadOutput = new DownloadOutput(parameterManager);
ParamOutputSPtr lParamOutput(lDownloadOutput);
///Configure previous DownloadOutput created
lDownloadOutput->getDownloadProperties().setFileFormat(OutputFileFormat::ASCII_FILE_FORMAT);
lDownloadOutput->getDownloadProperties().setTimeFormat( parseArg->getFormatOutputTime());
lDownloadOutput->setSampling(parseArg->getSamplingMode(), parseArg->getSampling(), parseArg->getGapThreshold());
lDownloadOutput->getDownloadProperties().setTimeResolution(parseArg->getSampling());
//Configure parameter
ParamProperties *paramProperties = new ParamProperties();
paramProperties->setOriginalId(parseArg->getParamName());
for (auto clbInfo : parseArg->getCalibrationInfoNameList())
paramProperties->addCalibrationInfo(clbInfo);
//Add param properties to download output
lDownloadOutput->getDownloadProperties().addParamProperties(paramProperties);
//Add output to the parameter manager
parameterManager.getParamOutputList().push_back(lParamOutput);
/// launch request
parameterManager.execute(parseArg->getWorkPath());
}
return result;
}
/**
* Main function
*/
int main(int argc, char *argv[]) {
AMDA::Common::Application lMain;
return lMain.main(argc,argv,amdaOutputASCIIFile);
}