libxr  1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
LibXR::Topic::Domain Class Reference

主题域(Domain)管理器,用于组织多个主题。Domain manager for organizing multiple topics. More...

#include <message.hpp>

Collaboration diagram for LibXR::Topic::Domain:
[legend]

Public Member Functions

 Domain (const char *name)
 构造函数,初始化或查找指定名称的主题域。Constructor initializing or looking up a domain by name.
 

Data Fields

RBTree< uint32_t >::Node< RBTree< uint32_t > > * node_
 指向该域的根节点。Pointer to the root node of the domain.
 

Detailed Description

主题域(Domain)管理器,用于组织多个主题。Domain manager for organizing multiple topics.

Definition at line 151 of file message.hpp.

Constructor & Destructor Documentation

◆ Domain()

LibXR::Topic::Domain::Domain ( const char * name)
inline

构造函数,初始化或查找指定名称的主题域。Constructor initializing or looking up a domain by name.

Parameters
name主题域的名称。Name of the domain.

Definition at line 159 of file message.hpp.

160 {
161 if (!domain_)
162 {
163 if (!domain_)
164 {
165 domain_ =
166 new RBTree<uint32_t>([](const uint32_t &a, const uint32_t &b)
167 { return static_cast<int>(a) - static_cast<int>(b); });
168 }
169 }
170
171 auto crc32 = CRC32::Calculate(name, strlen(name));
172
173 auto domain = domain_->Search<RBTree<uint32_t>>(crc32);
174
175 if (domain != nullptr)
176 {
177 node_ = domain;
178 return;
179 }
180
182 [](const uint32_t &a, const uint32_t &b)
183 { return static_cast<int>(a) - static_cast<int>(b); });
184
185 domain_->Insert(*node_, crc32);
186 }
static uint32_t Calculate(const void *raw, size_t len)
计算数据的 CRC32 校验码 / Computes the CRC32 checksum for the given data
Definition crc.hpp:251
红黑树的泛型数据节点,继承自 BaseNode (Generic data node for Red-Black Tree, inheriting from BaseNode).
Definition rbt.hpp:64
红黑树实现,支持泛型键和值,并提供线程安全操作 (Red-Black Tree implementation supporting generic keys and values with thread...
Definition rbt.hpp:24
Node< Data > * Search(const Key &key)
搜索红黑树中的节点 (Search for a node in the Red-Black Tree).
Definition rbt.hpp:122
void Insert(BaseNode &node, KeyType &&key)
在树中插入新节点 (Insert a new node into the tree).
Definition rbt.hpp:237
RBTree< uint32_t >::Node< RBTree< uint32_t > > * node_
指向该域的根节点。Pointer to the root node of the domain.
Definition message.hpp:191
static RBTree< uint32_t > * domain_
主题域的红黑树结构,存储不同的主题 Red-Black Tree structure for storing different topics in the domain
Definition message.hpp:1078

Field Documentation

◆ node_

RBTree<uint32_t>::Node<RBTree<uint32_t> >* LibXR::Topic::Domain::node_

指向该域的根节点。Pointer to the root node of the domain.

Definition at line 191 of file message.hpp.


The documentation for this class was generated from the following file: