lichao
2021-04-09 2197cf91e7a3bd5941327ba630a42946b88f069e
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