libxr
Embedded C++ framework for bare-metal, RTOS and Linux
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
 

Public Attributes

RBTree< uint32_t >::Node< RBTree< uint32_t > > * node_
 

Detailed Description

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

Definition at line 206 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
96 EnsureDomainRegistry();
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) { return (a > b) - (a < b); });
110
111 domain_->Insert(*node_, crc32);
112}
static uint32_t Calculate(const void *raw, size_t len)
计算数据的 CRC32 校验码 / Computes the CRC32 checksum for the given data
Definition crc_o3.cpp:35
红黑树的泛型数据节点,继承自 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
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_
Definition topic.hpp:216

Member Data 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 216 of file topic.hpp.


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