lichao
2021-05-18 e54b8e58780c7d9f37b06cc4e1dc88badb2129c9
src/topic_node.h
@@ -163,6 +163,32 @@
   int proc_index_ = -1;
   TopicQueryCache topic_query_cache_;
   class RecvQ
   {
   public:
      void Write(BHMsgHead &&head, std::string &&body) { q_.push_back({std::move(head), std::move(body)}); }
      bool Read(BHMsgHead &head, std::string &body)
      {
         if (q_.empty()) {
            return false;
         } else {
            head = std::move(q_.front().head);
            body = std::move(q_.front().body);
            q_.pop_front();
            return true;
         }
      }
   private:
      struct MsgData {
         BHMsgHead head;
         std::string body;
      };
      std::deque<MsgData> q_;
   };
   Synced<RecvQ> server_buffer_;
   Synced<RecvQ> sub_buffer_;
};
#endif // end of include guard: TOPIC_NODE_YVKWA6TF