From 2197cf91e7a3bd5941327ba630a42946b88f069e Mon Sep 17 00:00:00 2001
From: lichao <lichao@aiotlink.com>
Date: 星期五, 09 四月 2021 14:15:41 +0800
Subject: [PATCH] join pub/sub to node; refactor.

---
 utest/util.h |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/utest/util.h b/utest/util.h
index ca58cd7..28b636e 100644
--- a/utest/util.h
+++ b/utest/util.h
@@ -20,9 +20,7 @@
 #define UTIL_W8A0OA5U
 
 #include "bh_util.h"
-#include "msg.h"
-#include "shm.h"
-#include "shm_queue.h"
+#include "topic_node.h"
 #include <boost/date_time/posix_time/posix_time.hpp>
 #include <boost/noncopyable.hpp>
 #include <boost/test/unit_test.hpp>
@@ -107,4 +105,23 @@
 	~ShmRemover() { SharedMemory::Remove(name_); }
 };
 
+class DemoNode : public TopicNode
+{
+	std::string id_;
+
+public:
+	DemoNode(const std::string &id, SharedMemory &shm) :
+	    TopicNode(shm), id_(id) { Init(); }
+	void Init()
+	{
+		MsgRegister reg;
+		reg.mutable_proc()->set_proc_id(id_);
+		MsgCommonReply reply_body;
+
+		if (!Register(reg, reply_body, 1000)) {
+			printf("node %s register failed\n", id_.c_str());
+		}
+	}
+};
+
 #endif // end of include guard: UTIL_W8A0OA5U

--
Gitblit v1.8.0