17 #ifndef CALLBACKHELPER_HH
18 #define CALLBACKHELPER_HH
20 #include <google/protobuf/message.h>
21 #include <boost/function.hpp>
22 #include <boost/shared_ptr.hpp>
53 public:
virtual bool HandleData(
const std::string &newdata) = 0;
57 public:
virtual bool IsLocal()
const = 0;
73 void (
const boost::shared_ptr<M const> &)> &cb) : callback(cb)
88 google::protobuf::Message *m;
89 if ((m = dynamic_cast<google::protobuf::Message*>(&test))
91 gzthrow(
"Message type must be a google::protobuf type\n");
92 return m->GetTypeName();
95 public:
virtual bool HandleData(
const std::string &newdata)
97 boost::shared_ptr<M> m(
new M);
98 m->ParseFromString(newdata);
108 private: boost::function<void (const boost::shared_ptr<M const> &)>
115 const boost::function<
void (ConstGzStringPtr &)> &cb)
124 return m.GetTypeName();
130 packet.ParseFromString(newdata);
132 boost::shared_ptr<msgs::GzString> m(
new msgs::GzString);
133 m->ParseFromString(newdata);
143 private: boost::function<void (boost::shared_ptr<msgs::GzString> &)>