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

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 7 of file main.cpp.

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