fipa_acl  1.4
debug.h
Go to the documentation of this file.
1 #ifndef __FIPA_ACL_MESSAGEPARSER_DEBUG_H_
2 #define __FIPA_ACL_MESSAGEPARSER_DEBUG_H_
3 
4 #include <iosfwd>
5 #include <utility>
6 
7 #include <fipa_acl/message_parser/types.h>
8 #warning "debug.h ENABLED"
9 
28 namespace std
29 {
30 
31 template< typename C, typename E>
32 std::basic_ostream<C, E>& operator<<(std::basic_ostream<C,E>& out, fipa::acl::Header h)
33 {
34  return out << "Header<" << h.toString() << ">";
35 }
36 
37 template<typename C, typename E>
38 std::basic_ostream<C, E>& operator<<(std::basic_ostream<C,E>& out, fipa::acl::DateTime dt)
39 {
40  std::string dtString = dt.toString();
41  return out << "DateTime<" << dtString << ">";
42 }
43 
44 template<typename C, typename E>
45 std::basic_ostream<C, E>& operator<<(std::basic_ostream<C,E>& out, fipa::acl::Time t)
46 {
47  return out << "Time<" << ">";
48 }
49 
50 template< typename C, typename E>
51 std::basic_ostream<C, E>& operator<<(std::basic_ostream<C,E>& out, const fipa::acl::message::ParameterValue& p)
52 {
53  std::string tmp = boost::apply_visitor(fipa::acl::message::ParameterPrinter(), p);
54  return out << "message::ParameterValue<" << tmp << ">";
55 }
56 
57 /* Already covered by previous definition for fipa::acl::message::ParameterValue -- adding this definition creates duplication error
58 template< typename C, typename E>
59 std::basic_ostream<C, E>& operator<<(std::basic_ostream<C,E>& out, const fipa::acl::envelope::ParameterValue& p)
60 {
61  return out << "envelope::ParameterValue<" << p << ">";
62 }*/
63 
64 template< typename C, typename E>
65 std::basic_ostream<C, E>& operator<<(std::basic_ostream<C,E>& out, fipa::acl::message::Parameter p)
66 {
67  return out << "message::Parameter<" << p.toString() << ">";
68 }
69 
70 template< typename C, typename E>
71 std::basic_ostream<C, E>& operator<<(std::basic_ostream<C,E>& out, fipa::acl::AgentIdentifier p)
72 {
73  return out << "AgentId<" << p.name << ">";
74 }
75 
76 template< typename C, typename E>
77 std::basic_ostream<C, E>& operator<<(std::basic_ostream<C,E>& out, const fipa::acl::UserDefinedParameter& p)
78 {
79  return out << "UserDefinedParameter<" << p;
80 }
81 
82 template< typename C, typename E>
83 std::basic_ostream<C, E>& operator<<(std::basic_ostream<C,E>& out, const fipa::acl::ByteSequence& b)
84 {
85  return out << "Bytesequence<" << b.toPrettyString() << ">";
86 }
87 
88 template< typename C, typename E>
89 std::basic_ostream<C, E>& operator<<(std::basic_ostream<C,E>& out, const fipa::acl::DateTime& d)
90 {
91  return out << "DateTime<" << d.toString() << ">";
92 }
93 
94 template< typename C, typename E>
95 std::basic_ostream<C, E>& operator<<(std::basic_ostream<C,E>& out, const fipa::acl::Resolver& r)
96 {
97  fipa::acl::AgentIdentifier agentId = r.get();
98  return out << "Resolver<" << agentId.name << ">";
99 }
100 
101 template< typename C, typename E>
102 std::basic_ostream<C, E>& operator<<(std::basic_ostream<C,E>& out, const fipa::acl::AgentID& agentId)
103 {
104  return out << "AgentID<" << agentId.getName() << ">";
105 }
106 
107 template< typename C, typename E>
108 std::basic_ostream<C, E>& operator<<(std::basic_ostream<C,E>& out, const fipa::acl::AgentIDList& agentIdList)
109 {
110  fipa::acl::AgentIDList::const_iterator cit = agentIdList.begin();
111  out << "AgentIDList<";
112  for(; cit != agentIdList.end(); ++cit)
113  {
114  out << cit->getName() << ",";
115  }
116  out << ">";
117  return out;
118 }
119 
120 template< typename C, typename E>
121 std::basic_ostream<C, E>& operator<<(std::basic_ostream<C,E>& out, const fipa::acl::ACLMessage& msg)
122 {
123  return out << "ACLMessage<" << msg.toString() << ">";
124 }
125 
126 }
127 
128 #endif
boost::recursive_wrapper< AgentIdentifier > Resolver
Definition: agent_id.h:15
std::string toString() const
Definition: types.h:36
std::string toString() const
Definition: debug.h:28
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::string toPrettyString() const
Representation of a byte sequence. We also embed information about the encoding.
std::vector< AgentID > AgentIDList
Definition: agent_id.h:20
const std::string & getName() const
setter and getter methods for all fields; they do not result in deep-copies assignments/retreivals, but this can be easily changed if needed through the overloaded operator which do
Definition: agent_id.h:90
std::string toString() const
Definition: date_time.cpp:9
Definition for AgentIdentifier.
Definition: agent_id.h:30
std::string toString() const
Definition: types.h:52
This class provides a representation of a message conforming to the FIPA specification SC00061...
Definition: acl_message.h:55
Implements the general AgentID functionality, which is present throughout the fipa specifications(FIP...
Definition: agent_id.h:37