|
fipa_acl
1.4
|
This class provides a representation of a message conforming to the FIPA specification SC00061. More...
#include <acl_message.h>
Public Types | |
| enum | Performative { ACCEPT_PROPOSAL = 0, AGREE, CANCEL, CALL_FOR_PROPOSAL, CONFIRM, DISCONFIRM, FAILURE, INFORM, INFORM_IF, INFORM_REF, NOT_UNDERSTOOD, PROPAGATE, PROPOSE, PROXY, QUERY_IF, QUERY_REF, REFUSE, REJECT_PROPOSAL, REQUEST, REQUEST_WHEN, REQUEST_WHENEVER, SUBSCRIBE, END_PERFORMATIVE } |
| an enum of all the predefined fipa message performatives so far, presented in the order used in the message and encoding specifications More... | |
Public Member Functions | |
| ACLMessage () | |
| Default constructor. More... | |
| ACLMessage (Performative performative) | |
| constructor of an ACLMessage with a predefined performative More... | |
| ACLMessage (const std::string &perf) | |
| constructor of an ACLMessage with a custom performative More... | |
| bool | operator== (const ACLMessage &other) const |
| void | setPerformative (Performative perf) |
| Set performative. More... | |
| void | setPerformative (const std::string &str) |
| the method checks whether the passed performative string is a word or not(according to the fipa spec) More... | |
| std::string | getPerformative () const |
| Performative | getPerformativeAsEnum () const |
| void | addReceiver (const AgentID &aid) |
| void | deleteReceiver (const AgentID &aid) |
| void | clearReceivers () |
| AgentIDList | getAllReceivers () const |
| void | setAllReceivers (const AgentIDList &receivers) |
| void | addReplyTo (const AgentID &aid) |
| void | deleteReplyTo (const AgentID &aid) |
| void | clearReplyTo () |
| AgentIDList | getAllReplyTo () const |
| void | setAllReplyTo (const AgentIDList &replyTo) |
| void | setInReplyTo (const std::string &str) |
| std::string | getInReplyTo () const |
| void | setReplyWith (const std::string &str) |
| std::string | getReplyWith () const |
| void | setConversationID (const std::string &str) |
| std::string | getConversationID () const |
| void | setProtocol (const std::string &str) |
| the method checks whether the passed protocol string is a word or not(according to the fipa spec) More... | |
| std::string | getProtocol () const |
| void | setOntology (const std::string &str) |
| std::string | getOntology () const |
| void | setEncoding (const std::string &str) |
| std::string | getEncoding () const |
| void | setLanguage (const std::string &str) |
| std::string | getLanguage () const |
| void | setContent (const std::string &content) |
| void | setBinaryContent (const std::vector< uint8_t > &content) |
| bool | hasBinaryContent () const |
| std::string | getContent () const |
| const std::string * | getContentPtr () const |
| void | setSender (const AgentID &sender) |
| AgentID | getSender () const |
| void | addUserdefParam (const UserdefParam &p) |
| std::vector< UserdefParam > | getUserdefParams () const |
| void | setUserdefParams (const std::vector< UserdefParam > &p) |
| base::Time | getReplyBy () const |
| void | setReplyBy (const base::Time &time) |
| std::string | toString () const |
Static Public Member Functions | |
| static Performative | performativeFromString (const std::string &performative) |
Friends | |
| class | MessageFormat |
This class provides a representation of a message conforming to the FIPA specification SC00061.
The class implements the general structure of an ACLMessage. It follows the FIPA specification SC00061(http://www.fipa.org/specs/fipa00061/index.html) with emphasis of what is needed in order to encode it (so far according to the bit efficient specification SC00069 - http://www.fipa.org/specs/fipa00069/index.html) Important notice regarding using the class: The copy constructor provided and the overloaded assignment operator provide deep-copy methods for the class objects, HOWEVER the setter and getter methods(for the pointer fields i.e. sender) do not. Some fields were made pointers for reasons of using as little memory as possible at runtime; if the conclusion is reached that this is not needed, it should be a fairly simple task to make the class own all of its fields(even by leaving the fields as pointers)with the provided deep-copy methods(just allocate memory for the owned field and use the asignment operator to assign the value of the passed parameter)
Definition at line 55 of file acl_message.h.
an enum of all the predefined fipa message performatives so far, presented in the order used in the message and encoding specifications
Definition at line 64 of file acl_message.h.
| fipa::acl::ACLMessage::ACLMessage | ( | ) |
Default constructor.
Definition at line 56 of file acl_message.cpp.
| fipa::acl::ACLMessage::ACLMessage | ( | Performative | performative | ) |
constructor of an ACLMessage with a predefined performative
| performative | a predefined fipa performative(represented by its index in the perfs vector) |
Definition at line 61 of file acl_message.cpp.
| fipa::acl::ACLMessage::ACLMessage | ( | const std::string & | perf | ) |
constructor of an ACLMessage with a custom performative
| perf | string representing the custom performative(but it can just as well be one of the pre-defined ones) |
Definition at line 66 of file acl_message.cpp.
| void fipa::acl::ACLMessage::addReceiver | ( | const AgentID & | aid | ) |
Add an agent id to the list of receivers
Definition at line 146 of file acl_message.cpp.
| void fipa::acl::ACLMessage::addReplyTo | ( | const AgentID & | aid | ) |
Add agent id to reply to list
Definition at line 172 of file acl_message.cpp.
| void fipa::acl::ACLMessage::addUserdefParam | ( | const UserdefParam & | p | ) |
Add a userdefined parameter
| p | userdefined parameter |
Definition at line 216 of file acl_message.cpp.
| void fipa::acl::ACLMessage::clearReceivers | ( | ) |
Clear list of receivers
Definition at line 167 of file acl_message.cpp.
| void fipa::acl::ACLMessage::clearReplyTo | ( | ) |
Clear reply to list
Definition at line 193 of file acl_message.cpp.
| void fipa::acl::ACLMessage::deleteReceiver | ( | const AgentID & | aid | ) |
Delete an agent id from the list of receivers
Definition at line 156 of file acl_message.cpp.
| void fipa::acl::ACLMessage::deleteReplyTo | ( | const AgentID & | aid | ) |
Delete an agent id from the reply to list
Definition at line 182 of file acl_message.cpp.
|
inline |
Retrieve list of all receivers
Definition at line 166 of file acl_message.h.
|
inline |
|
inline |
Get content as string If the content is binary use string's data() function to access the underlying array
Definition at line 294 of file acl_message.h.
|
inline |
Get reference to content object in order to avoid unnecessary content copies
Definition at line 299 of file acl_message.h.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Get Performative
Definition at line 145 of file acl_message.h.
|
inline |
|
inline |
Return reply by as time object
Definition at line 334 of file acl_message.h.
|
inline |
|
inline |
|
inline |
Retrieve any userdefined parameters this message contains
Definition at line 323 of file acl_message.h.
| bool fipa::acl::ACLMessage::hasBinaryContent | ( | ) | const |
Check whether the content has to be treated as binary or not. This is done by simply checking on the existance of a \0 (0x00) in the data.
Definition at line 210 of file acl_message.cpp.
| bool fipa::acl::ACLMessage::operator== | ( | const ACLMessage & | other | ) | const |
The parameters are not passed by reference on purpose so that the copy constructor of the class is called. This is necessary because in the comparison, pointer fields are modified(removed) and we don't want this to affect the original object
Definition at line 230 of file acl_message.cpp.
|
static |
Get Performative from string
| std::runtime_error | when string is not a known representation of a performative |
Definition at line 42 of file acl_message.cpp.
|
inline |
Set list of all receivers
Definition at line 171 of file acl_message.h.
|
inline |
|
inline |
Set content using a byte vector
| content | binary content |
Definition at line 280 of file acl_message.h.
|
inline |
Set content
| content | Content as string (can be binary content as well) |
Definition at line 274 of file acl_message.h.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| void fipa::acl::ACLMessage::setPerformative | ( | Performative | perf | ) |
Set performative.
| runtime_error | if performative does not exist |
Definition at line 121 of file acl_message.cpp.
| void fipa::acl::ACLMessage::setPerformative | ( | const std::string & | str | ) |
the method checks whether the passed performative string is a word or not(according to the fipa spec)
| runtime_error | if performative does not exist or is illegal |
Definition at line 133 of file acl_message.cpp.
| void fipa::acl::ACLMessage::setProtocol | ( | const std::string & | str | ) |
the method checks whether the passed protocol string is a word or not(according to the fipa spec)
| runtime_error | when protocol name contains illegal characters |
Definition at line 198 of file acl_message.cpp.
|
inline |
|
inline |
|
inline |
Set the sender of this message
| sender | Sender's AgentID |
Definition at line 305 of file acl_message.h.
| void fipa::acl::ACLMessage::setUserdefParams | ( | const std::vector< UserdefParam > & | p | ) |
Set the list of userdefined parameter of this message Overwrites an already existing parameter list
Definition at line 224 of file acl_message.cpp.
| std::string fipa::acl::ACLMessage::toString | ( | ) | const |
Convert message to string
Definition at line 363 of file acl_message.cpp.
|
friend |
Definition at line 57 of file acl_message.h.
1.8.13