libxr
Embedded C++ framework for bare-metal, RTOS and Linux
Loading...
Searching...
No Matches
KeyInfo Struct Reference

键信息结构,存储键的元数据 Structure containing key metadata. More...

#include <layout.hpp>

Collaboration diagram for KeyInfo:
[legend]

Public Member Functions

 KeyInfo ()
 构造一个默认可写的键头元数据 Construct one default writable key-header metadata object.
 
void SetNameLength (uint8_t len)
 设置键名长度 / Set the key name length.
 
uint8_t GetNameLength () const
 获取键名长度 / Get the key name length.
 
void SetDataSize (uint32_t size)
 设置数据字节数 / Set the payload size in bytes.
 
uint32_t GetDataSize () const
 获取数据字节数 / Get the payload size in bytes.
 

Public Attributes

BlockBoolData< MinWriteSize > no_next_key
 是否是最后一个键
 
BlockBoolData< MinWriteSize > available_flag
 该键是否有效
 
BlockBoolData< MinWriteSize > uninit
 该键是否未初始化
 
uint32_t raw_info
 

Detailed Description

键信息结构,存储键的元数据 Structure containing key metadata.

Definition at line 118 of file layout.hpp.

Constructor & Destructor Documentation

◆ KeyInfo()

KeyInfo::KeyInfo ( )
inline

构造一个默认可写的键头元数据 Construct one default writable key-header metadata object.

Definition at line 132 of file layout.hpp.

133 {
137 }
static void SetFlag(BlockBoolData< BlockSize > &obj, bool value)
把一个布尔值编码进位图块 / Encode one boolean value into a flag block.
Definition layout.hpp:43
BlockBoolData< MinWriteSize > uninit
该键是否未初始化
Definition layout.hpp:122
BlockBoolData< MinWriteSize > available_flag
该键是否有效
Definition layout.hpp:121
BlockBoolData< MinWriteSize > no_next_key
是否是最后一个键
Definition layout.hpp:120

Member Function Documentation

◆ GetDataSize()

uint32_t KeyInfo::GetDataSize ( ) const
inline

获取数据字节数 / Get the payload size in bytes.

Returns
数据字节数 / Payload size in bytes.

Definition at line 167 of file layout.hpp.

167{ return raw_info & 0x01FFFFFF; }
uint32_t raw_info
Definition layout.hpp:124

◆ GetNameLength()

uint8_t KeyInfo::GetNameLength ( ) const
inline

获取键名长度 / Get the key name length.

Returns
键名长度 / Key name length.

Definition at line 152 of file layout.hpp.

152{ return (raw_info >> 25) & 0x7F; }

◆ SetDataSize()

void KeyInfo::SetDataSize ( uint32_t size)
inline

设置数据字节数 / Set the payload size in bytes.

Parameters
size数据字节数 / Payload size in bytes.

Definition at line 158 of file layout.hpp.

159 {
160 raw_info = (raw_info & 0xFE000000) | (size & 0x01FFFFFF);
161 }

◆ SetNameLength()

void KeyInfo::SetNameLength ( uint8_t len)
inline

设置键名长度 / Set the key name length.

Parameters
len键名长度 / Key name length.

Definition at line 143 of file layout.hpp.

144 {
145 raw_info = (raw_info & 0x01FFFFFF) | ((len & 0x7F) << 25);
146 }

Member Data Documentation

◆ available_flag

BlockBoolData<MinWriteSize> KeyInfo::available_flag

该键是否有效

Definition at line 121 of file layout.hpp.

◆ no_next_key

BlockBoolData<MinWriteSize> KeyInfo::no_next_key

是否是最后一个键

Definition at line 120 of file layout.hpp.

◆ raw_info

uint32_t KeyInfo::raw_info
Initial value:
=
0

高 7 位保存 nameLength,低 25 位保存 dataSize。 Upper 7 bits store nameLength and lower 25 bits store dataSize.

Definition at line 124 of file layout.hpp.

◆ uninit

BlockBoolData<MinWriteSize> KeyInfo::uninit

该键是否未初始化

Definition at line 122 of file layout.hpp.


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