13 #include <fipa_acl/fipa_acl.h> 15 std::map<std::string, std::string>
options;
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");
26 bool usage(
int argc,
char** argv)
30 while( (option = getopt(argc, argv,
"hb:i")) != -1 )
35 options[
"binary-msg-file"] = optarg;
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";
78 std::ifstream in(filename.c_str(), std::ios_base::in);
82 std::cerr <<
"Error: could not open input file: " 83 << filename << std::endl;
110 printf(
"Performative: \n");
114 printf(
"Content: \n");
122 return parseMsg(bitefficientMessage);
131 int main(
int argc,
char** argv)
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)
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::map< std::string, std::string > options
bool usage(int argc, char **argv)
bool parseMsg(const std::string &storage)
static std::string create(const ACLMessage &msg, const representation::Type &acl_representation)
Allows to parse a bytestream that conforms to the bitefficient representation of FIPA messages to a A...
void setContent(const std::string &content)
This class provides a representation of a message conforming to the FIPA specification SC00061...
std::string toString() const
void setPerformative(Performative perf)
Set performative.
int main(int argc, char **argv)
Agent Communication Language.