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>
57 public:
virtual bool HandleData(
const std::string &_newdata) = 0;
62 public:
virtual bool IsLocal()
const = 0;
83 void (
const boost::shared_ptr<M const> &)> &_cb) : callback(_cb)
98 google::protobuf::Message *m;
99 if ((m = dynamic_cast<google::protobuf::Message*>(&test))
101 gzthrow(
"Message type must be a google::protobuf type\n");
102 return m->GetTypeName();
108 boost::shared_ptr<M> m(
new M);
109 m->ParseFromString(_newdata);
120 private: boost::function<void (const boost::shared_ptr<M const> &)>
131 const boost::function<
void (ConstGzStringPtr &)> &_cb)
140 return m.GetTypeName();
147 packet.ParseFromString(_newdata);
149 boost::shared_ptr<msgs::GzString> m(
new msgs::GzString);
150 m->ParseFromString(_newdata);
161 private: boost::function<void (boost::shared_ptr<msgs::GzString> &)>