Allows printing of a newly constructed fipa::acl::Message.
More...
#include <message_printer.h>
Allows printing of a newly constructed fipa::acl::Message.
Definition at line 11 of file message_printer.h.
◆ MessagePrinter()
| fipa::acl::MessagePrinter::MessagePrinter |
( |
| ) |
|
◆ ~MessagePrinter()
| fipa::acl::MessagePrinter::~MessagePrinter |
( |
| ) |
|
◆ print()
Print the output of a fipa message to stdout
- Parameters
-
Definition at line 13 of file message_printer.cpp.
15 printf(
"FIPA Message read:\n");
18 if( (msg.
header.
id & ! 0xfa) == 0) printf(
"\tid is FA\n");
19 else if( (msg.
header.
id & ! 0xfb) == 0 ) printf(
"\tid is FB\n");
20 else if( (msg.
header.
id & ! 0xfc) == 0 ) printf(
"\tid is FC\n");
21 else printf(
"\tWARNING: id is unknown\n");
25 printf(
"performative(type): %s\n", msg.
type.c_str());
27 printf(
"msg-parameters count: %d\n",(
int) msg.
parameters.size());
28 for(uint32_t i=0; i < msg.
parameters.size(); i++)
31 printf(
"\tparameter #%d: %s\n",i, mp.name.c_str());
33 if(mp.name ==
"sender")
35 AgentIdentifierPrinter aidPrinter;
37 aidPrinter.print(aid);
38 }
else if(mp.name ==
"receiver")
40 AgentIdentifierPrinter aidPrinter;
41 std::vector<fipa::acl::AgentIdentifier> aids = boost::get<std::vector<fipa::acl::AgentIdentifier> >(mp.data);
42 int length = aids.size();
44 printf(
"Receiver: \n");
45 for(
int i = 0; i < length; i++)
47 aidPrinter.print(aids[i]);
51 }
else if(mp.name ==
"content")
54 printf(
"encoding: %s\n", bs.
encoding.c_str());
57 printf(
"content: %s\n", printBytes.c_str());
58 }
else if(mp.name ==
"reply-with")
60 std::string replyWith = boost::get<std::string>(mp.data);
61 printf(
"ReplyWith: %s\n", replyWith.c_str());
62 }
else if(mp.name ==
"reply-by")
65 std::string dtString = dt.
toString();
66 printf(
"DateTime: %s\n", dtString.c_str());
68 }
else if(mp.name ==
"in-reply-to")
70 std::string inReplyTo = boost::get<std::string>(mp.data);
71 printf(
"InReplyTo: %s\n", inReplyTo.c_str());
73 }
else if(mp.name ==
"reply-to")
75 AgentIdentifierPrinter aidPrinter;
76 std::vector<fipa::acl::AgentIdentifier> aids = boost::get<std::vector<fipa::acl::AgentIdentifier> >(mp.data);
77 int length = aids.size();
79 printf(
"ReplyTo: \n");
80 for(
int i = 0; i < length; i++)
82 aidPrinter.print(aids[i]);
86 }
else if(mp.name ==
"language")
88 std::string language = boost::get<std::string>(mp.data);
89 printf(
"Language: %s\n", language.c_str());
92 }
else if(mp.name ==
"encoding")
94 std::string encoding = boost::get<std::string>(mp.data);
95 printf(
"Encoding: %s\n", encoding.c_str());
98 }
else if(mp.name ==
"ontology")
101 std::string ontology = boost::get<std::string>(mp.data);
102 printf(
"Ontology: %s\n", ontology.c_str());
105 }
else if(mp.name ==
"protocol")
107 std::string protocol = boost::get<std::string>(mp.data);
108 printf(
"Protocol: %s\n", protocol.c_str());
111 }
else if(mp.name ==
"conversation-id")
113 std::string conversationId = boost::get<std::string>(mp.data);
114 printf(
"Conversation-id: %s\n", conversationId.c_str());
std::vector< message::Parameter > parameters
std::string toPrettyString() const
Representation of a byte sequence. We also embed information about the encoding.
std::string toString() const
Definition for AgentIdentifier.
The documentation for this class was generated from the following files:
- /build/rock-master-18.09-multiagent-fipa-acl-0.20180914/src/message_parser/message_printer.h
- /build/rock-master-18.09-multiagent-fipa-acl-0.20180914/src/message_parser/message_printer.cpp