/*
|
* =====================================================================================
|
*
|
* Filename: pubsub_center.h
|
*
|
* Description:
|
*
|
* Version: 1.0
|
* Created: 2021年04月01日 09时29分39秒
|
* Revision: none
|
* Compiler: gcc
|
*
|
* Author: Li Chao (),
|
* Organization:
|
*
|
* =====================================================================================
|
*/
|
#ifndef PUBSUB_CENTER_MFSUZJU7
|
#define PUBSUB_CENTER_MFSUZJU7
|
|
#include "center.h"
|
#include "defs.h"
|
#include "socket.h"
|
#include <mutex>
|
#include <set>
|
#include <unordered_map>
|
|
BHCenter::MsgHandler MakeBusCenter();
|
|
// publish/subcribe manager.
|
class PubSubCenter
|
{
|
ShmSocket socket_;
|
|
public:
|
PubSubCenter(ShmSocket::Shm &shm) :
|
socket_(shm, &BHTopicBus(), 1000) {}
|
PubSubCenter() :
|
PubSubCenter(BHomeShm()) {}
|
~PubSubCenter() { Stop(); }
|
bool Start(const int nworker = 2);
|
bool Stop() { return socket_.Stop(); }
|
};
|
|
#endif // end of include guard: PUBSUB_CENTER_MFSUZJU7
|