4 #include <boost/foreach.hpp> 13 TiXmlDeclaration * decl =
new TiXmlDeclaration(
"1.0",
"",
"" );
14 doc.LinkEndChild( decl );
16 TiXmlElement * messageElem =
new TiXmlElement(
"fipa-message" );
20 doc.LinkEndChild( messageElem );
22 BOOST_FOREACH(TiXmlElement* elem, getParameters(aclMsg))
24 messageElem->LinkEndChild(elem);
28 printer.SetIndent(
"");
29 printer.SetLineBreak(
"");
31 doc.Accept( &printer );
36 std::vector<TiXmlElement*> XMLMessageFormat::getParameters(
const ACLMessage& aclMsg)
const 38 using namespace MessageField;
39 std::vector<TiXmlElement*> vec;
42 if(!receivers.empty())
48 receiversElem->LinkEndChild(elem);
50 vec.push_back(receiversElem);
59 vec.push_back(senderElem);
65 TiXmlText* text =
new TiXmlText(aclMsg.
getContent());
67 contentElem->LinkEndChild(text);
68 vec.push_back(contentElem);
75 languageElem->LinkEndChild(
new TiXmlText(language));
76 vec.push_back(languageElem);
83 encodingElem->LinkEndChild(
new TiXmlText(encoding));
84 vec.push_back(encodingElem);
91 ontologyElem->LinkEndChild(
new TiXmlText(ontology));
92 vec.push_back(ontologyElem);
99 protocolElem->LinkEndChild(
new TiXmlText(protocol));
100 vec.push_back(protocolElem);
104 if(!replyWith.empty())
107 replyWithElem->LinkEndChild(
new TiXmlText(replyWith));
108 vec.push_back(replyWithElem);
112 if(!inReplyTo.empty())
115 inReplyToElem->LinkEndChild(
new TiXmlText(inReplyTo));
116 vec.push_back(inReplyToElem);
120 if(!replyBy.isNull())
124 vec.push_back(replyByElem);
134 replyToElem->LinkEndChild(elem);
136 vec.push_back(replyToElem);
140 if(!conversationId.empty())
143 conversationIdElem->LinkEndChild(
new TiXmlText(conversationId));
144 vec.push_back(conversationIdElem);
std::string getLanguage() const
std::string getConversationID() const
AgentID getSender() const
const std::string * getContentPtr() const
AgentIDList getAllReplyTo() const
std::string getContent() const
std::map< MessageField::Type, std::string > MessageFieldTxt
std::vector< UserdefParam > getUserdefParams() const
std::string getReplyWith() const
std::vector< AgentID > AgentIDList
AgentIDList getAllReceivers() const
std::string getEncoding() const
std::string getPerformative() const
This class provides a representation of a message conforming to the FIPA specification SC00061...
std::string getInReplyTo() const
std::string getProtocol() const
Implements the general AgentID functionality, which is present throughout the fipa specifications(FIP...
Foundation of Physical Intelligent Agents.
base::Time getReplyBy() const
std::string getOntology() const