fipa_acl  1.4
Functions
main.cpp File Reference
#include <iostream>
#include <fipa_acl/conversation_monitor.h>
#include <getopt.h>
#include <cstdlib>

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 8 of file main.cpp.

9 {
10  std::string protocolfile;
11  bool useXML = false;
12 
13  int opt;
14  if(argc == 1)
15  {
16  printf("usage: %s -f <protocolfile>\n", argv[0]);
17  return 0;
18  }
19 
20  while( (opt = getopt(argc, argv, "f:hx")) != -1)
21  {
22  switch(opt)
23  {
24  case 'f':
25  protocolfile = std::string(optarg);
26  break;
27  case 'x':
28  useXML = true;
29  break;
30  case 'h':
31  default:
32  printf("usage: %s -f <protocolfile>\n", argv[0]);
33  return 0;
34 
35  }
36  }
37 
38  printf("Load specification of: %s\n", protocolfile.c_str());
39  try {
40  StateMachineReader reader;
41  StateMachine statemachine = reader.loadSpecification(protocolfile);
42  if(useXML)
43  {
44  printf("%s", statemachine.toXML().c_str());
45  } else{
46  printf("%s", statemachine.toString().c_str());
47  }
48  } catch(std::runtime_error& e)
49  {
50  printf("Runtime error: %s\n", e.what());
51  }
52 
53  return 0;
54 }
std::string toXML() const
implements a XML parser that generates a state machine from a given spec. file; uses the tinyXML libr...
std::string toString() const
StateMachine loadSpecification(const std::string &file)