|
libxr
Embedded C++ framework for bare-metal, RTOS and Linux
|
模板类,表示数据库中的具体键 Template class representing a specific key in the database. More...
#include <interface.hpp>
Public Member Functions | |
| Key (Database &database, const char *name, Data init_value) | |
| 构造函数,初始化键并从数据库加载数据 Constructor to initialize key and load data from the database. | |
| Key (Database &database, const char *name) | |
| 构造函数,初始化键,并在数据库不存在时赋默认值 Constructor to initialize key, assigning default value if not found in the database. | |
| Key (const Key &other)=delete | |
| 禁止拷贝数据库键对象 Copy construction is disabled for database keys. | |
| Key (Key &&other)=delete | |
| 禁止移动数据库键对象 Move construction is disabled for database keys. | |
| Key & | operator= (const Key &other)=delete |
| 禁止拷贝赋值数据库键对象 Copy assignment is disabled for database keys. | |
| Key & | operator= (Key &&other)=delete |
| 禁止移动赋值数据库键对象 Move assignment is disabled for database keys. | |
| operator Data () | |
| 类型转换运算符,返回存储的数据 Type conversion operator returning stored data. | |
| ErrorCode | Save () |
| 保存当前键值到数据库 Save the current key value to the database. | |
| ErrorCode | Set (Data data) |
| 设置键的值并更新数据库 Set the key's value and update the database. | |
| ErrorCode | Load () |
| 从数据库加载键的值 Load the key's value from the database. | |
| ErrorCode | operator= (Data data) |
| 赋值运算符,设置键的值 Assignment operator to set the key's value. | |
Public Member Functions inherited from LibXR::Database::KeyBase | |
| KeyBase (const char *name, RawData raw_data) | |
| 构造函数,初始化键名和原始数据 Constructor to initialize key name and raw data. | |
Public Attributes | |
| Data | data_ |
| 键存储的数据 / The data stored in the key. | |
| Database & | database_ |
| 关联的数据库对象 / Reference to the associated database. | |
Public Attributes inherited from LibXR::Database::KeyBase | |
| const char * | name_ |
| 键名 / Key name. | |
| RawData | raw_data_ |
| 原始数据 / Raw data associated with the key. | |
模板类,表示数据库中的具体键 Template class representing a specific key in the database.
| Data | 存储的数据类型 / The type of data stored. |
Definition at line 51 of file interface.hpp.
|
inline |
构造函数,初始化键并从数据库加载数据 Constructor to initialize key and load data from the database.
如果键在数据库中不存在,则使用提供的值进行初始化。 If the key does not exist in the database, it is initialized with the provided value.
| database | 关联的数据库对象 / Reference to the associated database. |
| name | 键名 / Key name. |
| init_value | 初始化值 / Initial value for the key. |
Definition at line 69 of file interface.hpp.
|
inline |
构造函数,初始化键,并在数据库不存在时赋默认值 Constructor to initialize key, assigning default value if not found in the database.
如果键在数据库中不存在,则初始化为零。 If the key does not exist in the database, it is initialized with zero.
| database | 关联的数据库对象 / Reference to the associated database. |
| name | 键名 / Key name. |
Definition at line 95 of file interface.hpp.
|
delete |
禁止拷贝数据库键对象 Copy construction is disabled for database keys.
| other | 被拷贝的键对象 / Database key to copy from. |
|
delete |
禁止移动数据库键对象 Move construction is disabled for database keys.
| other | 被转移的键对象 / Database key to move from. |
|
inline |
从数据库加载键的值 Load the key's value from the database.
Definition at line 171 of file interface.hpp.
|
inline |
类型转换运算符,返回存储的数据 Type conversion operator returning stored data.
Definition at line 145 of file interface.hpp.
|
delete |
禁止拷贝赋值数据库键对象 Copy assignment is disabled for database keys.
| other | 被拷贝的键对象 / Database key to copy from. |
|
inline |
赋值运算符,设置键的值 Assignment operator to set the key's value.
| data | 需要存储的新值 / New value to store. |
Definition at line 179 of file interface.hpp.
|
delete |
禁止移动赋值数据库键对象 Move assignment is disabled for database keys.
| other | 被转移的键对象 / Database key to move from. |
|
inline |
保存当前键值到数据库 Save the current key value to the database.
Definition at line 152 of file interface.hpp.
|
inline |
设置键的值并更新数据库 Set the key's value and update the database.
| data | 需要存储的新值 / New value to store. |
Definition at line 160 of file interface.hpp.
| Data LibXR::Database::Key< Data >::data_ |
键存储的数据 / The data stored in the key.
Definition at line 54 of file interface.hpp.
| Database& LibXR::Database::Key< Data >::database_ |
关联的数据库对象 / Reference to the associated database.
Definition at line 55 of file interface.hpp.