18 #include "../../include/mm_mux_demux/publisher.hpp" 19 #include "../../include/mm_mux_demux/demux.hpp" 20 #include "../../include/mm_mux_demux/subscriber.hpp" 26 void foo(std::string data) {
27 std::cout <<
"foo is processing data: " << data << std::endl;
33 int main(
int argc,
char **argv)
41 ecl::SwitchArg both(
"b",
"both",
"Run both the publisher and the subscriber",
false);
42 std::vector<ecl::Arg*> xorlist;
43 xorlist.push_back(&pub);
44 xorlist.push_back(&sub);
45 xorlist.push_back(&both);
48 cmd.
parse(argc, argv);
53 std::cout <<
"Creating publisher" << std::endl;
55 ecl::MilliSleep()(200);
57 std::cout <<
"Publishing 'dude'" << std::endl;
59 ecl::MilliSleep()(500);
61 }
else if ( sub.
isSet() ) {
63 std::cout <<
"Creating demux"<< std::endl;
66 ecl::MilliSleep()(200);
69 }
else if ( both.
isSet() ) {
74 ecl::MilliSleep()(200);
76 ecl::MilliSleep()(500);
void publish(const unsigned int &id, const T &msg)
static void start(const std::string &name, const std::string &url, const mm_messages::Verbosity::Level &verbosity=mm_messages::Verbosity::QUIET, const bool bind=false)
int main(int argc, char **argv)
static void start(const std::string &name, const std::string &url, const mm_messages::Verbosity::Level &verbosity=mm_messages::Verbosity::QUIET, const bool bind=true)
Pre-establish named connections.
void parse(int argc, char **argv)
void xorAdd(Arg &a, Arg &b)
void foo(std::string data)