From db322f33ba13592f2492317e3f1a070454c97059 Mon Sep 17 00:00:00 2001 From: lichao <lichao@aiotlink.com> Date: 星期四, 13 五月 2021 19:34:46 +0800 Subject: [PATCH] center alloc all msgs. --- src/defs.h | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/defs.h b/src/defs.h index 8d5f468..f0a0d49 100644 --- a/src/defs.h +++ b/src/defs.h @@ -19,15 +19,19 @@ #ifndef DEFS_KP8LKGD0 #define DEFS_KP8LKGD0 -#include <boost/uuid/uuid.hpp> -#include <boost/uuid/uuid_generators.hpp> #include <string> -typedef boost::uuids::uuid MQId; +typedef uint64_t MQId; -const MQId kBHTopicBus = boost::uuids::string_generator()("01234567-89ab-cdef-8349-1234567890ff"); -const MQId kBHTopicReqRepCenter = boost::uuids::string_generator()("12345670-89ab-cdef-8349-1234567890ff"); -const MQId kBHUniCenter = boost::uuids::string_generator()("87654321-89ab-cdef-8349-1234567890ff"); +const MQId kBHDefaultSender = 99; +const MQId kBHTopicCenter = 100; +const MQId kBHTopicBus = 101; +inline const MQId BHGlobalSenderAddress() { return kBHDefaultSender; } +inline const MQId BHTopicCenterAddress() { return kBHTopicCenter; } +inline const MQId BHTopicBusAddress() { return kBHTopicBus; } + +int64_t CalcAllocIndex(int64_t size); +int64_t GetAllocSize(int index); const int kBHCenterPort = 24287; const char kTopicSep = '.'; @@ -36,9 +40,12 @@ class SharedMemory; } // namespace bhome_shm +std::string BHomeShmName(); bhome_shm::SharedMemory &BHomeShm(); +bool GlobalInit(bhome_shm::SharedMemory &shm); typedef std::string Topic; - +void SetLastError(const int ec, const std::string &msg); +void GetLastError(int &ec, std::string &msg); //TODO center can check shm for previous crash. #endif // end of include guard: DEFS_KP8LKGD0 -- Gitblit v1.8.0