fipa_acl  1.4
types.h
Go to the documentation of this file.
1 #ifndef _FIPAACL_TYPES_H_
2 #define _FIPAACL_TYPES_H_
3 
4 #include <stdio.h>
5 #include <vector>
6 #include <string>
7 
8 #include <boost/variant/recursive_variant.hpp>
9 #include <boost/variant/apply_visitor.hpp>
10 #include <boost/variant/get.hpp>
11 #include <boost/bind.hpp>
12 
13 #include <fipa_acl/message_parser/date_time.h>
14 #include <fipa_acl/message_parser/byte_sequence.h>
15 #include <fipa_acl/message_parser/agent_id.h>
16 #include <fipa_acl/message_parser/parameter.h>
17 
18 namespace fipa
19 {
20 
21 //#############################################################
22 // The FIPA Bit Message Representation in Bit-Efficient Encoding
23 //#############################################################
24 
25 namespace acl
26 {
27 
28 // Embedd only types into the BOOST_FUSION_ADAPT_STRUCT
29 // So perform all definitions here
30 //
31 struct Header
32 {
33  char id;
34  char version;
35 
36  std::string toString() const
37  {
38  char tmp[100];
39  snprintf(tmp,100, "Header<id=%x, version=%x>", id, version);
40  return std::string(tmp);
41  }
42 
43 };
44 
45 namespace message {
46 
47 struct Parameter
48 {
49  std::string name;
51 
52  std::string toString() const
53  {
54  std::string tmp = name;
55  tmp += "<" + boost::apply_visitor(ParameterPrinter(), data) + ">";
56  return tmp;
57  }
58 
59 };
60 
61 }
62 
63 namespace envelope
64 {
65  struct Parameter
66  {
67  std::string name;
69 
70  std::string toString() const
71  {
72  return name + "<" + data + ">";
73  }
74  };
75 
76 }
77 
78 // Define the final message structure here
79 struct Message
80 {
81  Message() : type(""), parameters() {}
82 
84  std::string type;
85  std::vector<message::Parameter> parameters;
86 };
87 
88 
89 
90 } // end namespace acl
91 } // end namespace fipa
92 
93 #endif // _FIPAACL_TYPES_H_
std::string toString() const
Definition: types.h:36
boost::variant< std::string, fipa::acl::AgentIdentifier, std::vector< fipa::acl::AgentIdentifier >, fipa::acl::ByteSequence, fipa::acl::DateTime, fipa::acl::ByteString > ParameterValue
Definition: parameter.h:12
std::vector< message::Parameter > parameters
Definition: types.h:85
ParameterValue data
Definition: types.h:50
std::string toString() const
Definition: types.h:70
std::string toString() const
Definition: types.h:52
std::string ParameterValue
Definition: parameter.h:54
ParameterValue data
Definition: types.h:68
char version
Definition: types.h:34
std::string type
Definition: types.h:84
Foundation of Physical Intelligent Agents.
Definition: conversation.cpp:6
Header header
Definition: types.h:83