23 #ifndef APPLICATION20100908H 24 #define APPLICATION20100908H 26 #include "goby/common/core_helpers.h" 27 #include "goby/common/exception.h" 28 #include "goby/common/logger.h" 30 #include "goby/pb/protobuf/config.pb.h" 31 #include "goby/pb/protobuf/header.pb.h" 33 #include "goby/common/zeromq_application_base.h" 34 #include "protobuf_pubsub_node_wrapper.h" 72 template <
typename ProtoBufMessage>
73 void subscribe(boost::function<
void(
const ProtoBufMessage&)> handler =
74 boost::function<
void(
const ProtoBufMessage&)>(),
75 const std::string& group =
"")
78 pubsub_node_->subscribe<ProtoBufMessage>(handler, group);
85 template <
typename ProtoBufMessage,
class C>
86 void subscribe(
void (C::*mem_func)(
const ProtoBufMessage&), C* obj,
87 const std::string& group =
"")
90 pubsub_node_->subscribe<ProtoBufMessage>(boost::bind(mem_func, obj, _1), group);
111 boost::shared_ptr<StaticProtobufPubSubNodeWrapper> pubsub_node() {
return pubsub_node_; }
117 void __set_up_sockets();
121 boost::shared_ptr<StaticProtobufNode> protobuf_node_;
122 boost::shared_ptr<StaticProtobufPubSubNodeWrapper> pubsub_node_;
Base class provided for users to generate applications that participate in the Goby publish/subscribe...
void subscribe(void(C::*mem_func)(const ProtoBufMessage &), C *obj, const std::string &group="")
Subscribe for a type using a class member function as the handler.
void subscribe(boost::function< void(const ProtoBufMessage &)> handler=boost::function< void(const ProtoBufMessage &)>(), const std::string &group="")
Subscribe to a message (of any type derived from google::protobuf::Message)
The global namespace for the Goby project.
Represents the eight available terminal colors (and bold variants)
common::ZeroMQService & zeromq_service()
Fetchs the newest received message of this type.