Message parser for FIPA ACL Messages, based on boost::spirit.
More...
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <fipa_acl/fipa_acl.h>
Go to the source code of this file.
|
| std::map< std::string, std::string > | options |
| |
Message parser for FIPA ACL Messages, based on boost::spirit.
- Author
- Thomas Roehr, thoma.nosp@m.s.ro.nosp@m.ehr@d.nosp@m.fki..nosp@m.de
Definition in file main.cpp.
◆ info()
| void info |
( |
char ** |
argv | ) |
|
Definition at line 18 of file main.cpp.
20 printf(
"usage: %s -b <binary-message-file> -i \n", argv[0]);
21 printf(
"-b require a binary message file as input\n");
22 printf(
"-i interactive mode\n");
◆ main()
| int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 131 of file main.cpp.
134 if( !
usage(argc, argv) )
137 std::string filename;
138 if( ( filename =
options[
"binary-msg-file"]) !=
"")
141 }
else if (
options[
"interactive"] !=
"")
bool parseFile(const std::string &filename)
std::map< std::string, std::string > options
bool usage(int argc, char **argv)
◆ parseFile()
| bool parseFile |
( |
const std::string & |
filename | ) |
|
Definition at line 76 of file main.cpp.
78 std::ifstream in(filename.c_str(), std::ios_base::in);
82 std::cerr <<
"Error: could not open input file: " 83 << filename << std::endl;
bool parseMsg(const std::string &storage)
◆ parseInteractive()
| bool parseInteractive |
( |
| ) |
|
Definition at line 105 of file main.cpp.
110 printf(
"Performative: \n");
114 printf(
"Content: \n");
122 return parseMsg(bitefficientMessage);
bool parseMsg(const std::string &storage)
static std::string create(const ACLMessage &msg, const representation::Type &acl_representation)
void setContent(const std::string &content)
This class provides a representation of a message conforming to the FIPA specification SC00061...
void setPerformative(Performative perf)
Set performative.
◆ parseMsg()
| bool parseMsg |
( |
const std::string & |
storage | ) |
|
Definition at line 51 of file main.cpp.
57 bool success = parser.
parseData(storage, msg);
61 std::cout <<
"------------------------------------\n";
62 std::cout <<
" Parsing succeeded\n";
63 std::cout <<
"------------------------------------\n";
64 std::cout << msg.
toString() << std::endl;
70 std::cout <<
" Parsing failed\n";
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 f...
std::string toString() const
Allows to parse a bytestream that conforms to the bitefficient representation of FIPA messages to a A...
This class provides a representation of a message conforming to the FIPA specification SC00061...
Agent Communication Language.
◆ usage()
| bool usage |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 26 of file main.cpp.
30 while( (option = getopt(argc, argv,
"hb:i")) != -1 )
35 options[
"binary-msg-file"] = optarg;
std::map< std::string, std::string > options
◆ options
| std::map<std::string, std::string> options |