10 #include <arpa/inet.h>
13 #include<boost/algorithm/string/erase.hpp>
15 #include <base-logging/Logging.hpp>
17 #include <fipa_acl/message_generator/acl_message.h>
18 #include <fipa_acl/message_generator/message_format.h>
32 if (!content->empty())
34 uint32_t digit = content->size();
39 if(strlen(content->c_str()) != digit)
41 if(digit <= std::numeric_limits<uint8_t>::max())
43 uint8_t dataSize = digit;
45 mes.append(reinterpret_cast<const char*>(&dataSize),
sizeof(uint8_t));
47 }
else if (digit <= std::numeric_limits<uint16_t>::max())
49 uint16_t dataSize = digit;
50 dataSize = htons(dataSize);
52 mes.append(reinterpret_cast<const char*>(&dataSize),
sizeof(uint16_t));
57 mes.append(reinterpret_cast<const char*>(&digit),
sizeof(uint32_t));
61 char digitString[100];
62 snprintf(digitString,100,
"%c#%d%c",0x14,digit,
'\"');
80 return retstr.append(1,
id).append(1,version);
99 return char(((
int) version[0]-48)*16 + ((
int)version[2]-48));
113 return std::string(a);
118 if(performative.empty())
128 return (
char(0x10) + sword +
char(0x00));
131 throw std::runtime_error(
"BitefficientMessageFormat does not support codetables");
148 if ( !sender.
empty())
155 if (!receivers.empty())
163 if (!replyWith.empty())
172 if (!inReplyTo.empty())
178 if (!replyTo.empty())
184 if (!language.empty())
190 if (!encoding.empty())
196 if (!ontology.empty())
200 if (!protocol.empty())
206 if (!conversationID.empty())
222 LOG_WARN(
"Userdefined parameters: %d", (
int) s.size());
224 std::vector<UserdefParam>::iterator it;
226 for (; it != s.end(); ++it)
237 std::vector<UserdefParam>::const_iterator it = params.begin();
238 for (; it != params.end(); ++it)
270 std::vector<std::string>::const_iterator it = adrr.begin();
271 for (; it != adrr.end(); ++it)
286 std::vector<AgentID>::const_iterator it = aids.begin();
287 for (; it != aids.end(); ++it)
310 throw std::runtime_error(
"BitefficientMessageFormat: getBitBinExpression called with wrong base character");
320 std::stringstream ss (std::stringstream::in | std::stringstream::out);
322 std::string test = ss.str();
326 if(base ==
'o' || base ==
'd')
329 throw std::runtime_error(
"BitefficientMessageFormat: getBitBinNumber called with wrong base character");
336 return char(0x14) + (
'\"' + sword +
'\"') +
char(0x00);
339 throw std::runtime_error(
"BitefficientMessageFormat does not support codetables");
std::string getEncoding() const
const Resolvers & getResolvers() const
Get list of resolvers.
bool empty() const
Check if AgentId is empty, i.e. does not contain a name.
std::vector< UserdefParam > getUserdefParams() const
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
base::Time getReplyBy() const
std::string getPerformative() const
std::string getReplyWith() const
std::string getOntology() const
AgentIDList getAllReplyTo() const
const std::string & getValue() const
const std::vector< std::string > & getAddresses() const
Retrieve list of addresses.
Performative
an enum of all the predefined fipa message performatives so far, presented in the order used in the m...
const std::string * getContentPtr() const
std::string getLanguage() const
std::string getInReplyTo() const
std::map< ACLMessage::Performative, std::string > PerformativeTxt
const std::string & getName() const
AgentID getSender() const
std::string getProtocol() const
This class provides a representation of a message conforming to the FIPA specification SC00061...
overloaded equality operator for UserdefParam class objects
const std::vector< UserdefParam > & getUserdefParams() const
Get the all userdefined parameter.
Implements the general AgentID functionality, which is present throughout the fipa specifications(FIP...
AgentIDList getAllReceivers() const
std::string getConversationID() const