fipa_acl
1.4
build
rock-master-20.06-multiagent-fipa-acl-0.20200506
src
conversation_monitor
main.cpp
Go to the documentation of this file.
1
#include <iostream>
2
#include <fipa_acl/conversation_monitor.h>
3
#include <getopt.h>
4
#include <cstdlib>
5
6
using namespace
fipa::acl
;
7
8
int
main
(
int
argc,
char
** argv)
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
}
55
56
57
58
fipa::acl::StateMachine::toXML
std::string toXML() const
Definition:
statemachine.cpp:255
fipa::acl::StateMachineReader
implements a XML parser that generates a state machine from a given spec. file; uses the tinyXML libr...
Definition:
statemachine_reader.h:24
fipa::acl::StateMachine::toString
std::string toString() const
Definition:
statemachine.cpp:232
fipa::acl::StateMachineReader::loadSpecification
StateMachine loadSpecification(const std::string &file)
Definition:
statemachine_reader.cpp:30
main
int main(int argc, char **argv)
Definition:
main.cpp:8
fipa::acl
Agent Communication Language.
Definition:
conversation.cpp:6
fipa::acl::StateMachine
Definition:
statemachine.h:22
Generated by
1.8.13