From 3f8ae6cf4f03be83f16846af32d73dd89b937c40 Mon Sep 17 00:00:00 2001 From: lichao <lichao@aiotlink.com> Date: 星期二, 30 三月 2021 15:45:54 +0800 Subject: [PATCH] add dot separated topic partial match; refactor. --- src/shm_queue.h | 17 +++++++++-------- 1 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/shm_queue.h b/src/shm_queue.h index 5b30380..a536553 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,12 @@ 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); 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 Recv(BHMsg &msg, const int timeout_ms); + bool Recv(MsgI &msg, const int timeout_ms) { return Read(msg, timeout_ms); } + bool Send(const MQId &remote_id, const BHMsg &msg, const int timeout_ms); + bool Send(const MQId &remote_id, const MsgI &msg, const int timeout_ms); }; } // namespace bhome_shm -- Gitblit v1.8.0