/*
|
* =====================================================================================
|
*
|
* Filename: center_topic_node.h
|
*
|
* Description:
|
*
|
* Version: 1.0
|
* Created: 2021年05月20日 12时44分42秒
|
* Revision: none
|
* Compiler: gcc
|
*
|
* Author: Li Chao (), lichao@aiotlink.com
|
* Organization:
|
*
|
* =====================================================================================
|
*/
|
#ifndef CENTER_TOPIC_NODE_YCI0P9KC
|
#define CENTER_TOPIC_NODE_YCI0P9KC
|
|
#include "bh_util.h"
|
#include "shm.h"
|
#include <atomic>
|
#include <memory>
|
#include <thread>
|
|
class TopicNode;
|
class NodeCenter;
|
// center as a topic node.
|
class CenterTopicNode
|
{
|
public:
|
typedef std::shared_ptr<Synced<NodeCenter>> CenterPtr;
|
CenterTopicNode(CenterPtr center, bhome_shm::SharedMemory &shm);
|
~CenterTopicNode();
|
bool Start();
|
void Stop();
|
|
private:
|
CenterPtr pscenter_;
|
std::unique_ptr<TopicNode> pnode_;
|
std::thread worker_;
|
std::atomic<bool> run_;
|
};
|
|
#endif // end of include guard: CENTER_TOPIC_NODE_YCI0P9KC
|