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

Allows to parse a bytestream that conforms to the bitefficient representation of FIPA messages to a ACLMessage. More...

#include <message_parser.h>

Static Public Member Functions

static bool parseData (const std::string &storage, ACLMessage &msg, fipa::acl::representation::Type representation=fipa::acl::representation::BITEFFICIENT)
 parses a correctly encoded message according to grammar_bitefficient.h and creates a Message object for internal use More...
 

Detailed Description

Allows to parse a bytestream that conforms to the bitefficient representation of FIPA messages to a ACLMessage.

Given a bytestream that conforms to the FIPA Standard for the bitefficient representation of messages, this class can be used to parse this stream into a ACLMessage. The parsing makes extensive use of the boost::spirit library, a library whose contribution we want to acknowledge here. The Spirit library has been used to define the grammar and the underlying parser, i.e. the core of this library.

Definition at line 28 of file message_parser.h.

Member Function Documentation

bool fipa::acl::MessageParser::parseData ( const std::string &  storage,
ACLMessage msg,
fipa::acl::representation::Type  representation = fipa::acl::representation::BITEFFICIENT 
)
static

parses a correctly encoded message according to grammar_bitefficient.h and creates a Message object for internal use

Parameters
storageArray of bytes that represent the bitefficient FIPA encoded message
msgThe message extracted from the data
representationthe representation to decode the incoming message
Returns
The decoded ACLMessage object

Definition at line 17 of file message_parser.cpp.

18 {
19  MessageParserImplementationPtr messageParser = msParsers[representation];
20  if(messageParser)
21  {
22  return messageParser->parseData(storage, msg);
23  } else {
24  std::string msg = "MessageParser: there is no parser registered for " + representation::TypeTxt[representation];
25  throw std::runtime_error(msg);
26  }
27 }
boost::shared_ptr< MessageParserImplementation > MessageParserImplementationPtr
const std::string TypeTxt[]
Definition: types.h:28

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