fipa_acl
1.4
build
rock-master-18.09-multiagent-fipa-acl-0.20180914
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
5
using namespace
fipa::acl
;
6
7
int
main
(
int
argc,
char
** argv)
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
}
54
55
56
57
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:7
fipa::acl
Agent Communication Language.
Definition:
conversation.cpp:7
fipa::acl::StateMachine
Definition:
statemachine.h:22
Generated by
1.8.13