libxr  1.0
Want to be the best embedded framework
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).
 

Data Fields

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 105 of file layout.hpp.

Constructor & Destructor Documentation

◆ KeyInfo()

KeyInfo::KeyInfo ( )
inline

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

Definition at line 119 of file layout.hpp.

120 {
124 }
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:109
BlockBoolData< MinWriteSize > available_flag
该键是否有效
Definition layout.hpp:108
BlockBoolData< MinWriteSize > no_next_key
是否是最后一个键
Definition layout.hpp:107

Member Function Documentation

◆ GetDataSize()

uint32_t KeyInfo::GetDataSize ( ) const
inline

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

Returns
数据字节数 (Payload size in bytes).

Definition at line 154 of file layout.hpp.

154{ return raw_info & 0x01FFFFFF; }
uint32_t raw_info
Definition layout.hpp:111

◆ GetNameLength()

uint8_t KeyInfo::GetNameLength ( ) const
inline

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

Returns
键名长度 (Key name length).

Definition at line 139 of file layout.hpp.

139{ 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 145 of file layout.hpp.

146 {
147 raw_info = (raw_info & 0xFE000000) | (size & 0x01FFFFFF);
148 }

◆ SetNameLength()

void KeyInfo::SetNameLength ( uint8_t len)
inline

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

Parameters
len键名长度 (Key name length).

Definition at line 130 of file layout.hpp.

131 {
132 raw_info = (raw_info & 0x01FFFFFF) | ((len & 0x7F) << 25);
133 }

Field Documentation

◆ available_flag

BlockBoolData<MinWriteSize> KeyInfo::available_flag

该键是否有效

Definition at line 108 of file layout.hpp.

◆ no_next_key

BlockBoolData<MinWriteSize> KeyInfo::no_next_key

是否是最后一个键

Definition at line 107 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 111 of file layout.hpp.

◆ uninit

BlockBoolData<MinWriteSize> KeyInfo::uninit

该键是否未初始化

Definition at line 109 of file layout.hpp.


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