fipa_acl  1.4
Public Member Functions | List of all members
fipa::acl::XMLMessageFormat Class Reference

#include <xml_message_format.h>

Inherits fipa::acl::MessageFormat.

Public Member Functions

std::string apply (const ACLMessage &aclMsg) const
 
- Public Member Functions inherited from fipa::acl::MessageFormat
 MessageFormat ()
 
virtual ~MessageFormat ()
 
void setUseCodeTables (bool x)
 
bool getUseCodeTables () const
 
void setUpdateCodeTables (bool x)
 
bool getUpdateCodeTables () const
 
void setResolverDepth (int depth)
 
int getResolverDepth () const
 
void setVersion (const std::string &version)
 
std::string getVersion () const
 

Detailed Description

Definition at line 11 of file xml_message_format.h.

Member Function Documentation

std::string fipa::acl::XMLMessageFormat::apply ( const ACLMessage aclMsg) const
virtual

Applies the XML format to the message

Returns
the formatted message

Implements fipa::acl::MessageFormat.

Definition at line 10 of file xml_message_format.cpp.

11 {
12  TiXmlDocument doc;
13  TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "", "" );
14  doc.LinkEndChild( decl );
15 
16  TiXmlElement * messageElem = new TiXmlElement( "fipa-message" );
17  // Apply communictaive act and conversation id
18  messageElem->SetAttribute("act", aclMsg.getPerformative());
19  messageElem->SetAttribute("conversation-id", aclMsg.getConversationID());
20  doc.LinkEndChild( messageElem );
21 
22  BOOST_FOREACH(TiXmlElement* elem, getParameters(aclMsg))
23  {
24  messageElem->LinkEndChild(elem);
25  }
26 
27  TiXmlPrinter printer;
28  printer.SetIndent("");
29  printer.SetLineBreak("");
30 
31  doc.Accept( &printer );
32 
33  return printer.Str();
34 }

The documentation for this class was generated from the following files: