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

主题(Topic)管理类 / Topic management class More...

#include <message.hpp>

Collaboration diagram for LibXR::Topic:

Data Structures

struct  ASyncBlock
 异步订阅块,继承自 SuberBlock Asynchronous subscription block, inheriting from SuberBlock More...
 
class  ASyncSubscriber
 异步订阅者类,用于订阅异步数据 Asynchronous subscriber class for subscribing to asynchronous data More...
 
struct  Block
 存储主题(Topic)数据的结构体。Structure storing topic data. More...
 
struct  CallbackBlock
 回调订阅块,继承自 SuberBlock Callback subscription block, inheriting from SuberBlock More...
 
class  Domain
 主题域(Domain)管理器,用于组织多个主题。Domain manager for organizing multiple topics. More...
 
struct  QueueBlock
 队列订阅块,继承自 SuberBlock Queue subscription block, inheriting from SuberBlock More...
 
class  QueuedSubscriber
 构造函数,使用名称和无锁队列进行初始化 Constructor using a name and a lock-free queue More...
 
class  Server
 服务器类,负责解析数据并将其分发到相应的主题 Server class responsible for parsing data and distributing it to corresponding topics More...
 
struct  SuberBlock
 订阅者信息存储结构。Structure storing subscriber information. More...
 
struct  SyncBlock
 同步订阅者存储结构。Structure storing synchronous subscriber data. More...
 
class  SyncSubscriber
 同步订阅者类,允许同步方式接收数据。Synchronous subscriber class allowing data reception in a synchronous manner. More...
 

Public Types

enum class  SuberType : uint8_t { SYNC , ASYNC , QUEUE , CALLBACK }
 订阅者类型。Subscriber type. More...
 
typedef RBTree< uint32_t >::Node< Block > * TopicHandle
 主题句柄,指向存储数据的红黑树节点。Handle pointing to a red-black tree node storing data.
 
typedef LibXR::Topic::ASyncBlock ASyncBlock
 
typedef LibXR::Topic::QueueBlock QueueBlock
 
typedef LibXR::Topic::CallbackBlock CallbackBlock
 

Public Member Functions

void RegisterCallback (Callback< RawData & > &cb)
 注册回调函数 Registers a callback function
 
 Topic ()
 默认构造函数,创建一个空的 Topic 实例 Default constructor, creates an empty Topic instance
 
 Topic (const char *name, uint32_t max_length, Domain *domain=nullptr, bool cache=false, bool check_length=false)
 构造函数,使用指定名称、最大长度、域及其他选项初始化主题 Constructor to initialize a topic with the specified name, maximum length, domain, and options
 
 Topic (TopicHandle topic)
 通过句柄构造主题 Constructs a topic from a topic handle
 
void EnableCache ()
 启用主题的缓存功能 Enables caching for the topic
 
template<typename Data >
void Publish (Data &data)
 发布数据 Publishes data
 
template<typename Data >
void PublishFromCallback (Data &data, bool in_isr)
 从回调函数发布数据 Publishes data from a callback function
 
void Publish (void *addr, uint32_t size)
 以原始地址和大小发布数据 Publishes data using raw address and size
 
void PublishFromCallback (void *addr, uint32_t size, bool in_isr)
 从回调函数发布数据 Publishes data from a callback function
 
template<SizeLimitMode Mode = SizeLimitMode::MORE>
ErrorCode DumpData (RawData data, bool pack=false)
 转储数据 Dump data
 
template<typename Data >
ErrorCode DumpData (PackedData< Data > &data)
 转储数据到 PackedData Dumps data into PackedData format
 
template<typename Data >
ErrorCode DumpData (Data &data)
 转储数据到普通数据结构 Dumps data into a normal data structure
 
 operator TopicHandle ()
 Topic 转换为 TopicHandle Converts Topic to TopicHandle
 

Static Public Member Functions

template<typename Data >
static Topic CreateTopic (const char *name, Domain *domain=nullptr, bool cache=false, bool check_length=true)
 创建一个新的主题 Creates a new topic
 
static TopicHandle Find (const char *name, Domain *domain=nullptr)
 在指定域中查找主题 Finds a topic in the specified domain
 
template<typename Data >
static TopicHandle FindOrCreate (const char *name, Domain *domain=nullptr, bool cache=false, bool check_length=true)
 在指定域中查找或创建主题 Finds or creates a topic in the specified domain
 
static void PackData (uint32_t topic_name_crc32, RawData buffer, RawData source)
 
static TopicHandle WaitTopic (const char *name, uint32_t timeout=UINT32_MAX, Domain *domain=nullptr)
 等待主题的创建并返回其句柄 Waits for a topic to be created and returns its handle
 

Private Attributes

TopicHandle block_ = nullptr
 主题句柄,指向当前主题的内存块 Topic handle pointing to the memory block of the current topic
 

Static Private Attributes

static RBTree< uint32_t > * domain_ = nullptr
 主题域的红黑树结构,存储不同的主题 Red-Black Tree structure for storing different topics in the domain
 
static SpinLock domain_lock_
 主题域访问的自旋锁,确保多线程安全 SpinLock for domain access to ensure thread safety
 
static Domaindef_domain_ = nullptr
 默认的主题域,所有未指定域的主题都会归入此域 Default domain where all topics without a specified domain are assigned
 

Detailed Description

主题(Topic)管理类 / Topic management class

该类提供了基于发布-订阅模式的主题管理,支持同步、异步、队列和回调订阅者,以及数据的缓存和校验机制。 This class provides topic management based on the publish-subscribe model, supporting synchronous, asynchronous, queue-based, and callback subscribers, as well as data caching and validation mechanisms.

Definition at line 28 of file message.hpp.

Member Typedef Documentation

◆ TopicHandle

主题句柄,指向存储数据的红黑树节点。Handle pointing to a red-black tree node storing data.

Definition at line 125 of file message.hpp.

Member Enumeration Documentation

◆ SuberType

订阅者类型。Subscriber type.

Enumerator
SYNC 

同步订阅者。Synchronous subscriber.

ASYNC 

异步订阅者。Asynchronous subscriber.

QUEUE 

队列订阅者。Queued subscriber.

CALLBACK 

回调订阅者。Callback subscriber.

Definition at line 181 of file message.hpp.

182 {
183 SYNC,
184 ASYNC,
185 QUEUE,
186 CALLBACK,
187 };
@ SYNC
同步订阅者。Synchronous subscriber.
@ ASYNC
异步订阅者。Asynchronous subscriber.
@ QUEUE
队列订阅者。Queued subscriber.
@ CALLBACK
回调订阅者。Callback subscriber.

Constructor & Destructor Documentation

◆ Topic() [1/3]

LibXR::Topic::Topic ( )
inline

默认构造函数,创建一个空的 Topic 实例 Default constructor, creates an empty Topic instance

Definition at line 489 of file message.hpp.

489{}

◆ Topic() [2/3]

LibXR::Topic::Topic ( const char name,
uint32_t  max_length,
Domain domain = nullptr,
bool  cache = false,
bool  check_length = false 
)
inline

构造函数,使用指定名称、最大长度、域及其他选项初始化主题 Constructor to initialize a topic with the specified name, maximum length, domain, and options

Parameters
name主题名称 Topic name
max_length数据的最大长度 Maximum length of data
domain主题所属的域(默认为 nullptr)Domain to which the topic belongs (default: nullptr)
cache是否启用缓存(默认为 false)Whether to enable caching (default: false)
check_length是否检查数据长度(默认为 false)Whether to check data length (default: false)

Definition at line 503 of file message.hpp.

505 {
506 if (!def_domain_)
507 {
509 if (!domain_)
510 {
511 domain_ =
512 new RBTree<uint32_t>([](const uint32_t &a, const uint32_t &b)
513 { return static_cast<int>(a) - static_cast<int>(b); });
514 }
515 if (!def_domain_)
516 {
517 def_domain_ = new Domain("libxr_def_domain");
518 }
520 }
521
522 if (domain == nullptr)
523 {
525 }
526
527 auto crc32 = CRC32::Calculate(name, strlen(name));
528
529 auto topic = domain->node_->data_.Search<Block>(crc32);
530
531 if (topic)
532 {
533 ASSERT(topic->data_.max_length == max_length);
534 ASSERT(topic->data_.check_length == check_length);
535
536 block_ = topic;
537 }
538 else
539 {
540 block_ = new RBTree<uint32_t>::Node<Block>;
541 block_->data_.max_length = max_length;
542 block_->data_.crc32 = crc32;
543 block_->data_.data.addr_ = nullptr;
544 block_->data_.cache = false;
545 block_->data_.check_length = check_length;
546
547 domain->node_->data_.Insert(*block_, crc32);
548 }
549
550 if (cache && !block_->data_.cache)
551 {
552 EnableCache();
553 }
554 }
static uint32_t Calculate(const void *raw, size_t len)
计算数据的 CRC32 校验码 / Computes the CRC32 checksum for the given data
Definition crc.hpp:251
void Lock() noexcept
阻塞直到获取锁 / Blocks until the lock is acquired
Definition spin_lock.hpp:44
void Unlock() noexcept
释放锁 / Releases the lock
Definition spin_lock.hpp:57
static Domain * def_domain_
默认的主题域,所有未指定域的主题都会归入此域 Default domain where all topics without a specified domain are assigned
Definition message.hpp:1131
void EnableCache()
启用主题的缓存功能 Enables caching for the topic
Definition message.hpp:630
static SpinLock domain_lock_
主题域访问的自旋锁,确保多线程安全 SpinLock for domain access to ensure thread safety
Definition message.hpp:1125
TopicHandle block_
主题句柄,指向当前主题的内存块 Topic handle pointing to the memory block of the current topic
Definition message.hpp:1113
static RBTree< uint32_t > * domain_
主题域的红黑树结构,存储不同的主题 Red-Black Tree structure for storing different topics in the domain
Definition message.hpp:1119
constexpr auto min(T1 a, T2 b) -> typename std::common_type< T1, T2 >::type
计算两个数的最小值

◆ Topic() [3/3]

LibXR::Topic::Topic ( TopicHandle  topic)
inline

通过句柄构造主题 Constructs a topic from a topic handle

Parameters
topic主题句柄 Topic handle

Definition at line 580 of file message.hpp.

580: block_(topic) {}

Member Function Documentation

◆ CreateTopic()

template<typename Data >
static Topic LibXR::Topic::CreateTopic ( const char name,
Domain domain = nullptr,
bool  cache = false,
bool  check_length = true 
)
inlinestatic

创建一个新的主题 Creates a new topic

Template Parameters
Data主题数据类型 Topic data type
Parameters
name主题名称 Topic name
domain主题所属的域(默认为 nullptr)Domain to which the topic belongs (default: nullptr)
cache是否启用缓存(默认为 false)Whether to enable caching (default: false)
check_length是否检查数据长度(默认为 true)Whether to check data length (default: true)
Returns
创建的 Topic 实例 The created Topic instance

Definition at line 569 of file message.hpp.

571 {
572 return Topic(name, sizeof(Data), domain, cache, check_length);
573 }
Topic()
默认构造函数,创建一个空的 Topic 实例 Default constructor, creates an empty Topic instance
Definition message.hpp:489

◆ DumpData() [1/3]

template<typename Data >
ErrorCode LibXR::Topic::DumpData ( Data data)
inline

转储数据到普通数据结构 Dumps data into a normal data structure

Template Parameters
Data数据类型 Data type
Parameters
data存储数据的变量 Variable to store the data

Definition at line 893 of file message.hpp.

894 {
895 if (block_->data_.data.addr_ == nullptr)
896 {
897 return ErrorCode::EMPTY;
898 }
899
900 ASSERT(sizeof(Data) == block_->data_.data.size_);
901
902 return DumpData<SizeLimitMode::NONE>(data, false);
903 }

◆ DumpData() [2/3]

template<typename Data >
ErrorCode LibXR::Topic::DumpData ( PackedData< Data > &  data)
inline

转储数据到 PackedData Dumps data into PackedData format

Template Parameters
Data数据类型 Data type
Parameters
data存储数据的 PackedData 结构 PackedData structure to store data

Definition at line 874 of file message.hpp.

875 {
876 if (block_->data_.data.addr_ == nullptr)
877 {
878 return ErrorCode::EMPTY;
879 }
880
881 ASSERT(sizeof(Data) == block_->data_.data.size_);
882
883 return DumpData<SizeLimitMode::NONE>(RawData(data), true);
884 }

◆ DumpData() [3/3]

template<SizeLimitMode Mode = SizeLimitMode::MORE>
ErrorCode LibXR::Topic::DumpData ( RawData  data,
bool  pack = false 
)
inline

转储数据 Dump data

Template Parameters
Mode数据大小检查模式 Size limit check mode
Parameters
data需要转储的数据 Data to be dumped
pack是否打包数据 Pack data
Returns
ErrorCode

Definition at line 824 of file message.hpp.

825 {
826 if (block_->data_.data.addr_ == nullptr)
827 {
828 return ErrorCode::EMPTY;
829 }
830
831 if (!pack)
832 {
833 Assert::SizeLimitCheck<Mode>(block_->data_.data.size_, data.size_);
834 block_->data_.mutex.Lock();
835 memcpy(data.addr_, block_->data_.data.addr_, block_->data_.data.size_);
836 block_->data_.mutex.Unlock();
837 }
838 else
839 {
840 Assert::SizeLimitCheck<Mode>(PACK_BASE_SIZE + block_->data_.data.size_, data.size_);
841
842 block_->data_.mutex.Lock();
843 PackData(block_->data_.crc32, data, block_->data_.data);
844 block_->data_.mutex.Unlock();
845 }
846
847 return ErrorCode::OK;
848 }

◆ EnableCache()

void LibXR::Topic::EnableCache ( )
inline

启用主题的缓存功能 Enables caching for the topic

Definition at line 630 of file message.hpp.

631 {
632 block_->data_.mutex.Lock();
633 if (!block_->data_.cache)
634 {
635 block_->data_.cache = true;
636 block_->data_.data.addr_ = new uint8_t[block_->data_.max_length];
637 }
638 block_->data_.mutex.Unlock();
639 }

◆ Find()

static TopicHandle LibXR::Topic::Find ( const char name,
Domain domain = nullptr 
)
inlinestatic

在指定域中查找主题 Finds a topic in the specified domain

Parameters
name主题名称 Topic name
domain主题所属的域(默认为 nullptr)Domain to search in (default: nullptr)
Returns
主题句柄,如果找到则返回对应的句柄,否则返回 nullptr Topic handle if found, otherwise returns nullptr

Definition at line 590 of file message.hpp.

591 {
592 if (domain == nullptr)
593 {
595 }
596
597 auto crc32 = CRC32::Calculate(name, strlen(name));
598
599 return domain->node_->data_.Search<Block>(crc32);
600 }

◆ FindOrCreate()

template<typename Data >
static TopicHandle LibXR::Topic::FindOrCreate ( const char name,
Domain domain = nullptr,
bool  cache = false,
bool  check_length = true 
)
inlinestatic

在指定域中查找或创建主题 Finds or creates a topic in the specified domain

Template Parameters
Data数据类型 Data type
Parameters
name话题名称 Topic name
domain可选的域指针 Optional domain pointer (default: nullptr)
cache可选的缓存标志位 Optional cache flag (default: false)
check_length可选的数据长度检查标志位 Optional data length check flag (default: true)
Returns
TopicHandle 主题句柄 Topic handle

Definition at line 615 of file message.hpp.

617 {
618 auto topic = Find(name, domain);
619 if (topic == nullptr)
620 {
621 topic = CreateTopic<Data>(name, domain, cache, check_length).block_;
622 }
623 return topic;
624 }
static TopicHandle Find(const char *name, Domain *domain=nullptr)
在指定域中查找主题 Finds a topic in the specified domain
Definition message.hpp:590

◆ operator TopicHandle()

LibXR::Topic::operator TopicHandle ( )
inline

Topic 转换为 TopicHandle Converts Topic to TopicHandle

Returns
TopicHandle

Definition at line 941 of file message.hpp.

941{ return block_; }

◆ PackData()

static void LibXR::Topic::PackData ( uint32_t  topic_name_crc32,
RawData  buffer,
RawData  source 
)
inlinestatic

Definition at line 850 of file message.hpp.

851 {
852 PackedData<uint8_t> *pack = reinterpret_cast<PackedData<uint8_t> *>(buffer.addr_);
853
854 memcpy(&pack->raw.data_, source.addr_, source.size_);
855
856 pack->raw.header.prefix = 0xa5;
857 pack->raw.header.topic_name_crc32 = topic_name_crc32;
858 pack->raw.header.data_len = source.size_;
859 pack->raw.header.pack_header_crc8 =
860 CRC8::Calculate(&pack->raw, sizeof(PackedDataHeader) - sizeof(uint8_t));
862 reinterpret_cast<uint8_t *>(reinterpret_cast<uint8_t *>(pack) + PACK_BASE_SIZE +
863 source.size_ - sizeof(uint8_t));
864 *crc8_pack = CRC8::Calculate(pack, PACK_BASE_SIZE - sizeof(uint8_t) + source.size_);
865 }
static uint8_t Calculate(const void *raw, size_t len)
计算数据的 CRC8 校验码 / Computes the CRC8 checksum for the given data
Definition crc.hpp:66

◆ Publish() [1/2]

template<typename Data >
void LibXR::Topic::Publish ( Data data)
inline

发布数据 Publishes data

Template Parameters
Data数据类型 Data type
Parameters
data需要发布的数据 Data to be published

Definition at line 648 of file message.hpp.

649 {
650 Publish(&data, sizeof(Data));
651 }
void Publish(Data &data)
发布数据 Publishes data
Definition message.hpp:648

◆ Publish() [2/2]

void LibXR::Topic::Publish ( void addr,
uint32_t  size 
)
inline

以原始地址和大小发布数据 Publishes data using raw address and size

Parameters
addr数据的地址 Address of the data
size数据大小 Size of the data

Definition at line 672 of file message.hpp.

673 {
674 block_->data_.mutex.Lock();
675 if (block_->data_.check_length)
676 {
677 ASSERT(size == block_->data_.max_length);
678 }
679 else
680 {
681 ASSERT(size <= block_->data_.max_length);
682 }
683
684 if (block_->data_.cache)
685 {
686 memcpy(block_->data_.data.addr_, addr, size);
687 block_->data_.data.size_ = size;
688 }
689 else
690 {
691 block_->data_.data.addr_ = addr;
692 block_->data_.data.size_ = size;
693 }
694
695 RawData data = block_->data_.data;
696
697 auto foreach_fun = [&](SuberBlock &block)
698 {
699 switch (block.type)
700 {
701 case SuberType::SYNC:
702 {
703 auto sync = reinterpret_cast<SyncBlock *>(&block);
704 memcpy(sync->buff.addr_, data.addr_, data.size_);
705 sync->sem.Post();
706 break;
707 }
708 case SuberType::ASYNC:
709 {
710 auto async = reinterpret_cast<ASyncBlock *>(&block);
711 if (async->waiting)
712 {
713 memcpy(async->buff.addr_, data.addr_, data.size_);
714 async->data_ready = true;
715 }
716 break;
717 }
718 case SuberType::QUEUE:
719 {
720 auto queue_block = reinterpret_cast<QueueBlock *>(&block);
721 queue_block->fun(data, queue_block->queue, false);
722 break;
723 }
725 {
726 auto cb_block = reinterpret_cast<CallbackBlock *>(&block);
727 cb_block->cb.Run(false, data);
728 break;
729 }
730 }
731 return ErrorCode::OK;
732 };
733
734 block_->data_.subers.Foreach<SuberBlock>(foreach_fun);
735
736 block_->data_.mutex.Unlock();
737 }
Callback< RawData & > cb
订阅的回调函数 Subscribed callback function
Definition message.hpp:468
void(* fun)(RawData &, void *, bool)
处理数据的回调函数 Callback function to handle data
Definition message.hpp:360

◆ PublishFromCallback() [1/2]

template<typename Data >
void LibXR::Topic::PublishFromCallback ( Data data,
bool  in_isr 
)
inline

从回调函数发布数据 Publishes data from a callback function

Template Parameters
Data数据类型 Data type
Parameters
data需要发布的数据 Data to be published
in_isr是否在中断服务程序(ISR)中发布 Whether publishing inside an ISR

Definition at line 661 of file message.hpp.

662 {
663 PublishFromCallback(&data, sizeof(Data), in_isr);
664 }
void PublishFromCallback(Data &data, bool in_isr)
从回调函数发布数据 Publishes data from a callback function
Definition message.hpp:661

◆ PublishFromCallback() [2/2]

void LibXR::Topic::PublishFromCallback ( void addr,
uint32_t  size,
bool  in_isr 
)
inline

从回调函数发布数据 Publishes data from a callback function

Parameters
addr数据的地址 Address of the data
size数据大小 Size of the data
in_isr是否在中断服务程序(ISR)中发布 Whether publishing inside an ISR

Definition at line 746 of file message.hpp.

747 {
748 if (block_->data_.mutex.TryLockInCallback(in_isr) != ErrorCode::OK)
749 {
750 return;
751 }
752
753 if (block_->data_.check_length)
754 {
755 ASSERT(size == block_->data_.max_length);
756 }
757 else
758 {
759 ASSERT(size <= block_->data_.max_length);
760 }
761
762 if (block_->data_.cache)
763 {
764 memcpy(block_->data_.data.addr_, addr, size);
765 block_->data_.data.size_ = size;
766 }
767 else
768 {
769 block_->data_.data.addr_ = addr;
770 block_->data_.data.size_ = size;
771 }
772
773 RawData data = block_->data_.data;
774
775 auto foreach_fun = [&](SuberBlock &block)
776 {
777 switch (block.type)
778 {
779 case SuberType::SYNC:
780 {
781 auto sync = reinterpret_cast<SyncBlock *>(&block);
782 memcpy(sync->buff.addr_, data.addr_, data.size_);
783 sync->sem.PostFromCallback(in_isr);
784 break;
785 }
786 case SuberType::ASYNC:
787 {
788 auto async = reinterpret_cast<ASyncBlock *>(&block);
789 memcpy(async->buff.addr_, data.addr_, data.size_);
790 async->data_ready = true;
791 break;
792 }
793 case SuberType::QUEUE:
794 {
795 auto queue_block = reinterpret_cast<QueueBlock *>(&block);
796 queue_block->fun(data, queue_block->queue, in_isr);
797 break;
798 }
800 {
801 auto cb_block = reinterpret_cast<CallbackBlock *>(&block);
802 cb_block->cb.Run(in_isr, data);
803 break;
804 }
805 }
806 return ErrorCode::OK;
807 };
808
809 block_->data_.subers.ForeachFromCallback<SuberBlock>(foreach_fun, in_isr);
810
811 block_->data_.mutex.UnlockFromCallback(in_isr);
812 }

◆ RegisterCallback()

void LibXR::Topic::RegisterCallback ( Callback< RawData & > &  cb)
inline

注册回调函数 Registers a callback function

Parameters
cb需要注册的回调函数 The callback function to register

Definition at line 476 of file message.hpp.

477 {
478 CallbackBlock block;
479 block.cb = cb;
481 auto node = new List::Node<CallbackBlock>(block);
482 block_->data_.subers.Add(*node);
483 }

◆ WaitTopic()

static TopicHandle LibXR::Topic::WaitTopic ( const char name,
uint32_t  timeout = UINT32_MAX,
Domain domain = nullptr 
)
inlinestatic

等待主题的创建并返回其句柄 Waits for a topic to be created and returns its handle

Parameters
name主题名称 The name of the topic
timeout等待的超时时间(默认 UINT32_MAX)Timeout duration to wait (default: UINT32_MAX)
domain主题所属的域(默认为 nullptr)The domain in which to search for the topic (default: nullptr)
Returns
TopicHandle 如果找到主题,则返回其句柄,否则返回 nullptr TopicHandle if the topic is found, otherwise returns nullptr

Definition at line 916 of file message.hpp.

918 {
919 TopicHandle topic = nullptr;
920 do
921 {
922 topic = Find(name, domain);
923 if (topic == nullptr)
924 {
925 if (timeout <= Thread::GetTime())
926 {
927 return nullptr;
928 }
929 Thread::Sleep(1);
930 }
931 } while (topic == nullptr);
932
933 return topic;
934 }
static uint32_t GetTime()
获取当前系统时间(毫秒) Gets the current system time in milliseconds
Definition thread.cpp:16
static void Sleep(uint32_t milliseconds)
让线程进入休眠状态 Puts the thread to sleep
Definition thread.cpp:9
RBTree< uint32_t >::Node< Block > * TopicHandle
主题句柄,指向存储数据的红黑树节点。Handle pointing to a red-black tree node storing data.
Definition message.hpp:125

Field Documentation

◆ block_

TopicHandle LibXR::Topic::block_ = nullptr
private

主题句柄,指向当前主题的内存块 Topic handle pointing to the memory block of the current topic

Definition at line 1113 of file message.hpp.

◆ def_domain_

Domain* LibXR::Topic::def_domain_ = nullptr
inlinestaticprivate

默认的主题域,所有未指定域的主题都会归入此域 Default domain where all topics without a specified domain are assigned

Definition at line 1131 of file message.hpp.

◆ domain_

RBTree<uint32_t>* LibXR::Topic::domain_ = nullptr
inlinestaticprivate

主题域的红黑树结构,存储不同的主题 Red-Black Tree structure for storing different topics in the domain

Definition at line 1119 of file message.hpp.

◆ domain_lock_

SpinLock LibXR::Topic::domain_lock_
inlinestaticprivate

主题域访问的自旋锁,确保多线程安全 SpinLock for domain access to ensure thread safety

Definition at line 1125 of file message.hpp.


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