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

topic 所属的命名域 / Naming domain that groups topics More...

#include <topic.hpp>

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

Public Member Functions

 Domain (const char *name)
 构造一个 topic 域 / Construct one topic domain
 

Data Fields

RBTree< uint32_t >::Node< RBTree< uint32_t > > * node_
 该域在全局域表里的节点。This domain's node inside the global domain tree.
 

Detailed Description

topic 所属的命名域 / Naming domain that groups topics

Definition at line 178 of file topic.hpp.

Constructor & Destructor Documentation

◆ Domain()

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

构造一个 topic 域 / Construct one topic domain

Parameters
name域名称 / Domain name

Definition at line 92 of file topic.cpp.

93{
94 ASSERT(name != nullptr);
95
97
98 auto crc32 = CRC32::Calculate(name, strlen(name));
99
100 auto domain = domain_->Search<RBTree<uint32_t>>(crc32);
101
102 if (domain != nullptr)
103 {
104 node_ = domain;
105 return;
106 }
107
109 [](const uint32_t& a, const uint32_t& b)
110 { return static_cast<int>(a) - static_cast<int>(b); });
111
112 domain_->Insert(*node_, crc32);
113}
static LIBXR_FORCE_OPTIMIZE_O3 uint32_t Calculate(const void *raw, size_t len)
计算数据的 CRC32 校验码 / Computes the CRC32 checksum for the given data
Definition crc.hpp:256
红黑树的泛型数据节点,继承自 BaseNode (Generic data node for Red-Black Tree, inheriting from BaseNode).
Definition rbt.hpp:63
红黑树实现,支持泛型键和值,并提供线程安全操作 (Red-Black Tree implementation supporting generic keys and values with thread...
Definition rbt.hpp:23
Node< Data > * Search(const Key &key)
搜索红黑树中的节点 (Search for a node in the Red-Black Tree).
Definition rbt.hpp:120
void Insert(BaseNode &node, KeyType &&key)
在树中插入新节点 (Insert a new node into the tree).
Definition rbt.hpp:235
RBTree< uint32_t >::Node< RBTree< uint32_t > > * node_
该域在全局域表里的节点。This domain's node inside the global domain tree.
Definition topic.hpp:187
static RBTree< uint32_t > * domain_
全局 topic 域注册表。Global registry of topic domains.
Definition topic.hpp:535
static void EnsureDomainRegistry()
确保全局域注册表已创建 / Ensure the global domain registry exists
Definition topic.cpp:13

Field Documentation

◆ node_

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

该域在全局域表里的节点。This domain's node inside the global domain tree.

Definition at line 187 of file topic.hpp.


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