From f51636c193d032723c47343e39ff8296db350200 Mon Sep 17 00:00:00 2001 From: lichao <lichao@aiotlink.com> Date: 星期一, 29 三月 2021 18:04:00 +0800 Subject: [PATCH] change msg to use protobuf, add more msg type. --- src/shm_queue.h | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/shm_queue.h b/src/shm_queue.h index 5b30380..9d08016 100644 --- a/src/shm_queue.h +++ b/src/shm_queue.h @@ -102,12 +102,12 @@ using namespace bhome_msg; -class ShmMsgQueue : private ShmObject<SharedQueue<Msg> > +class ShmMsgQueue : private ShmObject<SharedQueue<MsgI> > { - typedef ShmObject<SharedQueue<Msg> > Super; + typedef ShmObject<SharedQueue<MsgI> > Super; typedef Super::Data Queue; - bool Write(const Msg &buf, const int timeout_ms) { return data()->Write(buf, timeout_ms); } - bool Read(Msg &buf, const int timeout_ms) { return data()->Read(buf, timeout_ms); } + bool Write(const MsgI &buf, const int timeout_ms) { return data()->Write(buf, timeout_ms); } + bool Read(MsgI &buf, const int timeout_ms) { return data()->Read(buf, timeout_ms); } MQId id_; protected: ShmMsgQueue(const std::string &raw_name, ShmType &segment, const int len); // internal use. @@ -115,11 +115,11 @@ ShmMsgQueue(const MQId &id, ShmType &segment, const int len); ShmMsgQueue(ShmType &segment, const int len); ~ShmMsgQueue(); - bool Send(const MQId &remote_id, const void *data, const size_t size, const int timeout_ms); - bool Recv(MQId &source_id, void *&data, size_t &size, const int timeout_ms); + // bool Send(const MQId &remote_id, const void *data, const size_t size, const int timeout_ms); // request + bool Recv(BHMsg &msg, const int timeout_ms); + bool Send(const MQId &remote_id, const BHMsg &msg, const int timeout_ms); const MQId &Id() const { return id_; } - bool Send(const MQId &remote_id, const Msg &msg, const int timeout_ms); - bool Recv(Msg &msg, const int timeout_ms) { return Read(msg, timeout_ms); } + bool Send(const MQId &remote_id, const MsgI &msg, const int timeout_ms); }; } // namespace bhome_shm -- Gitblit v1.8.0