PhoenixClockMock  2.0.0
Tool to manipulate mock of clock (split, merge and get info)
main_info.cpp File Reference
#include "OptionParser.h"
#include "phoenix_clock_mock.h"
+ Include dependency graph for main_info.cpp:

Go to the source code of this file.

Functions

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

Function Documentation

◆ createOptionParser()

OptionParser createOptionParser ( )

Create the OptionParser of this program.

Returns
OptionParser of this program

Definition at line 14 of file main_info.cpp.

14  {
15  OptionParser parser(true, __PROGRAM_VERSION__);
16  parser.setExampleLongOption("phoenix_clock_mock_info --input=file.clockmock");
17  parser.setExampleShortOption("phoenix_clock_mock_info -i file2.mock file2.clockmock");
18 
19  parser.addOption("input", "i", OptionType::FILENAME, true, "List of input clock mock to get the info");
20  return parser;
21 }
Parse the options passed to a program.
Definition: OptionParser.h:15

References OptionParser::addOption(), OptionType::FILENAME, OptionParser::setExampleLongOption(), and OptionParser::setExampleShortOption().

Referenced by main().

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

◆ infoMock()

bool infoMock ( const std::vector< PString > &  vecInputFile)

Merge mock files.

Parameters
vecInputFile: vector of input files to print the info
Returns
true on success, false otherwise

Definition at line 27 of file main_info.cpp.

27  {
28  bool b(true);
29  for(std::vector<PString>::const_iterator itFile(vecInputFile.begin()); itFile != vecInputFile.end() && b; ++itFile){
30  VecTime vecTmpFile;
31  if(data_load(*itFile, vecTmpFile)){
32  size_t nbMessageIn(vecTmpFile.size());
33  std::cout << "Mock '"<<(*itFile)<<"' : nbClockTime = " << nbMessageIn << std::endl;
34  }else{
35  b = false;
36  }
37  }
38  return b;
39 }
std::vector< time_t > VecTime
Definition: PClockMock.h:12
bool data_load(FILE *iter, T &data)
Load data from a message.
Definition: data_file.h:39

References data_load().

Referenced by main().

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

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 41 of file main_info.cpp.

41  {
43  parser.parseArgument(argc, argv);
44  const OptionMode & defaultMode = parser.getDefaultMode();
45  std::vector<PString> vecInputFile;
46  defaultMode.getValue(vecInputFile, "input");
47  return infoMock(vecInputFile) - 1;
48 }
Describe a mode in the program arguments.
Definition: OptionMode.h:13
bool getValue(T &value, const PString &optionName) const
Get the value of the option.
void parseArgument(int argc, char **argv)
Parse the arguments passed to the program.
const OptionMode & getDefaultMode() const
Get default mode.
bool infoMock(const std::vector< PString > &vecInputFile)
Merge mock files.
Definition: main_info.cpp:27
OptionParser createOptionParser()
Create the OptionParser of this program.
Definition: main_info.cpp:14

References createOptionParser(), OptionParser::getDefaultMode(), OptionMode::getValue(), infoMock(), and OptionParser::parseArgument().

+ Here is the call graph for this function: