lichao
2021-04-01 d26327b3cde043a9470dcd7fea8e704ea517fdae
src/pubsub_center.h
@@ -23,7 +23,6 @@
#include <mutex>
#include <set>
#include <unordered_map>
using namespace bhome_shm;
// publish/subcribe manager.
class PubSubCenter
@@ -31,18 +30,19 @@
   class SocketBus : public ShmSocket
   {
   public:
      SocketBus(SharedMemory &shm) :
          ShmSocket(shm, &kBHBusQueueId, 1000) {}
      SocketBus(ShmSocket::Shm &shm) :
          ShmSocket(shm, &kBHTopicBus, 1000) {}
      using ShmSocket::shm;
   };
   SocketBus socket_;
   ShmSocket::Shm &shm() { return socket_.shm(); }
   std::mutex mutex_;
   typedef std::set<MQId> Clients;
   std::unordered_map<std::string, Clients> records_;
   ShmSocket::Shm &shm() { return socket_.shm(); }
public:
   PubSubCenter(SharedMemory &shm);
   PubSubCenter(ShmSocket::Shm &shm) :
       socket_(shm) {}
   PubSubCenter() :
       PubSubCenter(BHomeShm()) {}
   ~PubSubCenter() { Stop(); }