libxr 1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
LibXR::List::Node< Data > Class Template Reference

数据节点模板,继承自 BaseNode,用于存储具体数据类型。 Template data node that inherits from BaseNode to store specific data types. More...

#include <list.hpp>

Inheritance diagram for LibXR::List::Node< Data >:
Collaboration diagram for LibXR::List::Node< Data >:

Public Member Functions

 Node ()
 默认构造函数,初始化节点大小。 Default constructor initializing the node size.
 
 Node (const Data &data)
 使用数据值构造 Node 节点。 Constructs a Node with the given data value.
 
template<typename... Args>
 Node (Args... args)
 通过参数列表构造节点 (Constructor initializing a node using arguments list).
 
Nodeoperator= (const Data &data)
 赋值运算符重载,允许直接对节点赋值。 Overloaded assignment operator for assigning values to the node.
 
Dataoperator-> () noexcept
 操作符重载,提供数据访问接口。 Operator overloads providing access to the data.
 
const Dataoperator-> () const noexcept
 
Dataoperator* () noexcept
 
 operator Data & () noexcept
 
- Public Member Functions inherited from LibXR::List::BaseNode
 BaseNode (size_t size)
 构造 BaseNode 并设置节点大小。 Constructs a BaseNode and sets its size.
 
 ~BaseNode ()
 析构函数,确保节点不会在列表中残留。 Destructor ensuring the node does not remain in the list.
 

Data Fields

Data data_
 存储的数据。 The stored data.
 
- Data Fields inherited from LibXR::List::BaseNode
BaseNodenext_ = nullptr
 指向下一个节点的指针。 Pointer to the next node.
 
size_t size_
 当前节点的数据大小(字节)。 Size of the current node (in bytes).
 

Detailed Description

template<typename Data>
class LibXR::List::Node< Data >

数据节点模板,继承自 BaseNode,用于存储具体数据类型。 Template data node that inherits from BaseNode to store specific data types.

Template Parameters
Data存储的数据类型。 The type of data stored.

Definition at line 59 of file list.hpp.

Constructor & Destructor Documentation

◆ Node() [1/3]

template<typename Data >
LibXR::List::Node< Data >::Node ( )
inline

默认构造函数,初始化节点大小。 Default constructor initializing the node size.

Definition at line 66 of file list.hpp.

66: BaseNode(sizeof(Data)) {}
BaseNode(size_t size)
构造 BaseNode 并设置节点大小。 Constructs a BaseNode and sets its size.
Definition list.hpp:39
constexpr auto min(T1 a, T2 b) -> typename std::common_type< T1, T2 >::type
计算两个数的最小值

◆ Node() [2/3]

template<typename Data >
LibXR::List::Node< Data >::Node ( const Data data)
inlineexplicit

使用数据值构造 Node 节点。 Constructs a Node with the given data value.

Parameters
data要存储的数据。 The data to be stored.

Definition at line 75 of file list.hpp.

75: BaseNode(sizeof(Data)), data_(data) {}
Data data_
存储的数据。 The stored data.
Definition list.hpp:111

◆ Node() [3/3]

template<typename Data >
template<typename... Args>
LibXR::List::Node< Data >::Node ( Args...  args)
inlineexplicit

通过参数列表构造节点 (Constructor initializing a node using arguments list).

Template Parameters
Args参数类型 (Types of arguments for data initialization).
Parameters
args数据构造参数 (Arguments used for constructing the data).

Definition at line 83 of file list.hpp.

83 : BaseNode(sizeof(Data)), data_{args...}
84 {
85 }

Member Function Documentation

◆ operator Data &()

template<typename Data >
LibXR::List::Node< Data >::operator Data & ( )
inlinenoexcept

Definition at line 109 of file list.hpp.

109{ return data_; }

◆ operator*()

template<typename Data >
Data & LibXR::List::Node< Data >::operator* ( )
inlinenoexcept

Definition at line 108 of file list.hpp.

108{ return data_; }

◆ operator->() [1/2]

template<typename Data >
const Data * LibXR::List::Node< Data >::operator-> ( ) const
inlinenoexcept

Definition at line 107 of file list.hpp.

107{ return &data_; }

◆ operator->() [2/2]

template<typename Data >
Data * LibXR::List::Node< Data >::operator-> ( )
inlinenoexcept

操作符重载,提供数据访问接口。 Operator overloads providing access to the data.

Definition at line 106 of file list.hpp.

106{ return &data_; }

◆ operator=()

template<typename Data >
Node & LibXR::List::Node< Data >::operator= ( const Data data)
inline

赋值运算符重载,允许直接对节点赋值。 Overloaded assignment operator for assigning values to the node.

Parameters
data赋值的数据。 The data to be assigned.
Returns
返回修改后的 Node 对象引用。 Returns a reference to the modified Node object.

Definition at line 96 of file list.hpp.

97 {
98 data_ = data;
99 return *this;
100 }

Field Documentation

◆ data_

template<typename Data >
Data LibXR::List::Node< Data >::data_

存储的数据。 The stored data.

Definition at line 111 of file list.hpp.


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