PhoenixClockMock  1.0.0
Tool to manipulate mock of clock
Loading...
Searching...
No Matches
main_merge.cpp File Reference
#include "OptionParser.h"
#include "phoenix_clock_mock.h"
+ Include dependency graph for main_merge.cpp:

Go to the source code of this file.

Functions

OptionParser createOptionParser ()
 Create the OptionParser of this program.
 
int main (int argc, char **argv)
 
bool mergeMock (const std::vector< PString > &vecInputFile, const PString &outputFile)
 Merge mock files.
 

Function Documentation

◆ createOptionParser()

OptionParser createOptionParser ( )

Create the OptionParser of this program.

Returns
OptionParser of this program

Definition at line 14 of file main_merge.cpp.

14 {
15 OptionParser parser(true, __PROGRAM_VERSION__);
16 parser.setExampleLongOption("phoenix_clock_mock_merge --input=file.clockmock --output=merged.clockmock");
17 parser.setExampleShortOption("phoenix_clock_mock_merge -i file2.clockmock file2.clockmock -o merged.clockmock");
18
19 parser.addOption("input", "i", OptionType::FILENAME, true, "List of input mock to be merged");
20
21 PString defaultOutputFile("./merged.clockmock");
22 parser.addOption("output", "o", defaultOutputFile, "Name of the output merged mock file");
23 return parser;
24}

Referenced by main().

+ Here is the caller graph for this function:

◆ main()

int main ( int argc,
char ** argv )

Definition at line 48 of file main_merge.cpp.

48 {
49 OptionParser parser = createOptionParser();
50 parser.parseArgument(argc, argv);
51
52 const OptionMode & defaultMode = parser.getDefaultMode();
53 std::vector<PString> vecInputFile;
54 PString outputFile("");
55 defaultMode.getValue(vecInputFile, "input");
56 defaultMode.getValue(outputFile, "output");
57 return mergeMock(vecInputFile, outputFile) - 1;
58}
bool mergeMock(const std::vector< PString > &vecInputFile, const PString &outputFile)
Merge mock files.
OptionParser createOptionParser()
Create the OptionParser of this program.

References createOptionParser(), and mergeMock().

+ Here is the call graph for this function:

◆ mergeMock()

bool mergeMock ( const std::vector< PString > & vecInputFile,
const PString & outputFile )

Merge mock files.

Parameters
vecInputFile: vector of input files to be merged
outputFile: output file name to be saved
Returns
true on success, false otherwise

Definition at line 31 of file main_merge.cpp.

31 {
32 VecTime vecMessage;
33 bool b(true);
34 for(std::vector<PString>::const_iterator itFile(vecInputFile.begin()); itFile != vecInputFile.end() && b; ++itFile){
35 VecTime vecTmpFile;
36 if(data_load(*itFile, vecTmpFile)){
37 concatenateVecTime(vecMessage, vecTmpFile);
38 }else{
39 b = false;
40 }
41 }
42 if(b){
43 b &= data_save(outputFile, vecMessage);
44 }
45 return b;
46}
void concatenateVecTime(VecTime &vecOutput, const VecTime vecInput)
Concatenate vector of message into an other one.

References concatenateVecTime().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: