nl:: Weave:: Profiles:: DataManagement_Current:: TraitSchemaEngine
#include <src/lib/profiles/data-management/Current/TraitData.h>
架构引擎获取与特定特征相关联的架构信息,并提供解析并将其转换为可供 WDM 机器使用的形式的功能。
摘要
这包括从 PathHandle 转换为 WDM 路径(反之亦然)、用于解译/查询架构本身的方法,以及用于将数据发送到指定句柄的 TLV 以及从 TLV 中读取数据的方法。
架构本身以表格形式存储,包含充分说明的信息,可用于对任何给定特征的 WDM 路径/数据进行一般解析/组合。这些表格将是“code-gen”的最终输出(在没有任何生成的代码的情况下,此术语本身有点误导性 :P)
公共静态属性 |
|
---|---|
kHandleTableOffset = 2
|
const uint32_t
|
公共属性 |
|
---|---|
mSchema
|
const Schema
|
公共函数 |
|
---|---|
FindLowestCommonAncestor(PropertyPathHandle aHandle1, PropertyPathHandle aHandle2, PropertyPathHandle *aHandle1BranchChild, PropertyPathHandle *aHandle2BranchChild) const
|
假设有两个属性句柄,请计算同时作为这两个句柄的父级的最低句柄。
|
GetChildHandle(PropertyPathHandle aParentHandle, uint8_t aContextTag) const
|
|
GetDepth(PropertyPathHandle aHandle) const
|
int32_t
计算给定句柄在架构树中的深度。
|
GetDictionaryItemHandle(PropertyPathHandle aParentHandle, uint16_t aDictionaryKey) const
|
|
GetFirstChild(PropertyPathHandle aParentHandle) const
|
返回与特定父项相关联的第一个子句柄。
|
GetHighestForwardVersion(SchemaVersion aVersion) const
|
SchemaVersion
根据提供的数据架构版本,将返回最高向前兼容的架构版本。
|
GetLowestCompatibleVersion(SchemaVersion aVersion) const
|
SchemaVersion
根据提供的数据架构版本,将返回最低的兼容架构版本。
|
GetMap(PropertyPathHandle aHandle) const
|
const PropertyInfo *
返回一个指针,该指针指向描述特定路径句柄的 PropertyInfo 结构。
|
GetMaxVersion() const
|
SchemaVersion
|
GetMinVersion() const
|
SchemaVersion
|
GetNextChild(PropertyPathHandle aParentId, PropertyPathHandle aChildHandle) const
|
给定现有子级的句柄,并返回与特定父级关联的下一个子级句柄。
|
GetParent(PropertyPathHandle aHandle) const
|
返回指定子路径句柄的父句柄。
|
GetProfileId(void) const
|
uint32_t
返回关联特征的个人资料 ID。
|
GetRelativePathTags(const PropertyPathHandle aCandidateHandle, uint64_t *aTags, const uint32_t aTagsSize, uint32_t & aNumTags) const
|
将 PropertyPathHandle 转换为上下文标记数组。
|
GetTag(PropertyPathHandle aHandle) const
|
uint64_t
返回与路径句柄关联的标记。
|
GetVersionIntersection(SchemaVersionRange & aVersion, SchemaVersionRange & aIntersection) const
|
bool
在给定版本范围的情况下,此函数会检查版本范围之间是否存在兼容性交集,以及支持此架构引擎的架构支持的功能交集。
|
IsDictionary(PropertyPathHandle aHandle) const
|
bool
如果句柄是字典(而不是在字典中 - 请参阅下面的方法),则返回 true。
|
IsEphemeral(PropertyPathHandle aHandle) const
|
bool
|
IsInDictionary(PropertyPathHandle aHandle, PropertyPathHandle & aDictionaryItemHandle) const
|
bool
如果该句柄在字典(字典元素)内,则返回 true。
|
IsLeaf(PropertyPathHandle aPropertyHandle) const
|
bool
如果该句柄引用架构树中的叶节点,则返回 true。
|
IsNullable(PropertyPathHandle aHandle) const
|
bool
|
IsOptional(PropertyPathHandle aHandle) const
|
bool
|
IsParent(PropertyPathHandle aChildHandle, PropertyPathHandle aParentHandle) const
|
bool
检查给定句柄是否为另一个句柄的子级。
|
MapHandleToPath(PropertyPathHandle aHandle, nl::Weave::TLV::TLVWriter & aPathWriter) const
|
将路径句柄转换为 TLV 路径。
|
MapPathToHandle(nl::Weave::TLV::TLVReader & aPathReader, PropertyPathHandle & aHandle) const
|
假定读者位于 WDM 路径元素的根目录下,读出相关标记并提供等效的路径句柄。
|
MapPathToHandle(const char *aPathString, PropertyPathHandle & aHandle) const
|
在给定 WDM 路径的字符串表示形式的情况下,可以读出相关标记并提供等效的路径句柄。
|
MatchesProfileId(uint32_t aProfileId) const
|
bool
如果传入的 profileId 与架构中存储的 ID 匹配,则返回 true。
|
RetrieveData(PropertyPathHandle aHandle, uint64_t aTagToWrite, nl::Weave::TLV::TLVWriter & aWriter, IGetDataDelegate *aDelegate, IDirtyPathCut *apDirtyPathCut) const
|
给定路径句柄和相应数据元素上的写入器位置,以符合架构的方式从源检索叶数据,并将其写入写入器所指向的缓冲区。
|
RetrieveUpdatableDictionaryData(PropertyPathHandle aHandle, uint64_t aTagToWrite, nl::Weave::TLV::TLVWriter & aWriter, IGetDataDelegate *aDelegate, PropertyPathHandle & aPropertyPathHandleOfDictItemToStartFrom) const
|
|
StoreData(PropertyPathHandle aHandle, nl::Weave::TLV::TLVReader & aReader, ISetDataDelegate *aDelegate, IPathFilter *aPathFilter) const
|
给定路径句柄和位于相应数据元素上的读取器,处理读取器指向的数据缓冲区,并在遇到叶数据项时通过调用 SetLeafData 调用将其存储到接收器中。
|
类 |
|
---|---|
nl:: |
|
nl:: |
结构体 |
|
---|---|
nl:: |
|
nl:: |
存放架构信息的主架构结构。 |
公共静态属性
kHandleTableOffset
const uint32_t kHandleTableOffset = 2
公共属性
mSchema
const Schema mSchema
公共函数
FindLowestCommonAncestor
PropertyPathHandle FindLowestCommonAncestor( PropertyPathHandle aHandle1, PropertyPathHandle aHandle2, PropertyPathHandle *aHandle1BranchChild, PropertyPathHandle *aHandle2BranchChild ) const
假设有两个属性句柄,请计算同时作为这两个句柄的父级的最低句柄。
此外,返回包含这两个句柄各自(即使它们相同)的两个子分支。
具体说明 | |||
---|---|---|---|
返回值 |
|
GetChildHandle
PropertyPathHandle GetChildHandle( PropertyPathHandle aParentHandle, uint8_t aContextTag ) const
GetDictionaryItemHandle
PropertyPathHandle GetDictionaryItemHandle( PropertyPathHandle aParentHandle, uint16_t aDictionaryKey ) const
GetFirstChild
PropertyPathHandle GetFirstChild( PropertyPathHandle aParentHandle ) const
返回与特定父项相关联的第一个子句柄。
具体说明 | |||
---|---|---|---|
返回值 |
|
GetHighestForwardVersion
SchemaVersion GetHighestForwardVersion( SchemaVersion aVersion ) const
根据提供的数据架构版本,将返回最高向前兼容的架构版本。
GetLowestCompatibleVersion
SchemaVersion GetLowestCompatibleVersion( SchemaVersion aVersion ) const
根据提供的数据架构版本,将返回最低的兼容架构版本。
GetMap
const PropertyInfo * GetMap( PropertyPathHandle aHandle ) const
GetMaxVersion
SchemaVersion GetMaxVersion() const
GetMinVersion
SchemaVersion GetMinVersion() const
GetNextChild
PropertyPathHandle GetNextChild( PropertyPathHandle aParentId, PropertyPathHandle aChildHandle ) const
给定现有子级的句柄,并返回与特定父级关联的下一个子级句柄。
具体说明 | |||
---|---|---|---|
返回值 |
|
GetParent
PropertyPathHandle GetParent( PropertyPathHandle aHandle ) const
返回指定子路径句柄的父句柄。
在父句柄也是字典元素的情况下,系统会保留句柄中的字典键。
具体说明 | |||
---|---|---|---|
返回值 |
|
GetProfileId
uint32_t GetProfileId( void ) const
返回关联特征的个人资料 ID。
具体说明 | |||
---|---|---|---|
返回值 |
|
GetRelativePathTags
WEAVE_ERROR GetRelativePathTags( const PropertyPathHandle aCandidateHandle, uint64_t *aTags, const uint32_t aTagsSize, uint32_t & aNumTags ) const
将 PropertyPathHandle 转换为上下文标记数组。
具体说明 | |||||||||
---|---|---|---|---|---|---|---|---|---|
参数 |
|
||||||||
返回值 |
如果成功,则为 WEAVE_NO_ERROR;如果 aTag 过小而无法存储完整路径,则为 WEAVE_ERROR_NO_MEMORY。
|
GetTag
uint64_t GetTag( PropertyPathHandle aHandle ) const
返回与路径句柄关联的标记。
如果是字典元素,则此函数返回 ProfileTag。否则,它会返回上下文标记。
具体说明 | |||
---|---|---|---|
返回值 |
|
GetVersionIntersection
bool GetVersionIntersection( SchemaVersionRange & aVersion, SchemaVersionRange & aIntersection ) const
在给定版本范围的情况下,此函数会检查版本范围之间是否存在兼容性交集,以及支持此架构引擎的架构支持的功能交集。
如果存在交叉情况,该函数将返回 true 并更新传入的 aIntersection 参数,以反映该交叉测试的结果。
IsDictionary
bool IsDictionary( PropertyPathHandle aHandle ) const
如果句柄是字典(而不是在字典中 - 请参阅下面的方法),则返回 true。
具体说明 | |||
---|---|---|---|
返回值 |
|
IsEphemeral
bool IsEphemeral( PropertyPathHandle aHandle ) const
IsInDictionary
bool IsInDictionary( PropertyPathHandle aHandle, PropertyPathHandle & aDictionaryItemHandle ) const
如果该句柄在字典(字典元素)内,则返回 true。
传入的句柄 (aDictionaryItemHandle) 会更新为指向字典中最顶层的字典元素句柄。
具体说明 | |||
---|---|---|---|
返回值 |
|
IsLeaf
bool IsLeaf( PropertyPathHandle aPropertyHandle ) const
如果该句柄引用架构树中的叶节点,则返回 true。
具体说明 | |||
---|---|---|---|
返回值 |
|
IsNullable
bool IsNullable( PropertyPathHandle aHandle ) const
IsOptional
bool IsOptional( PropertyPathHandle aHandle ) const
IsParent
bool IsParent( PropertyPathHandle aChildHandle, PropertyPathHandle aParentHandle ) const
检查给定句柄是否为另一个句柄的子级。
它可以是间接父级。
具体说明 | |||
---|---|---|---|
返回值 |
|
MapHandleToPath
WEAVE_ERROR MapHandleToPath( PropertyPathHandle aHandle, nl::Weave::TLV::TLVWriter & aPathWriter ) const
MapPathToHandle
WEAVE_ERROR MapPathToHandle( nl::Weave::TLV::TLVReader & aPathReader, PropertyPathHandle & aHandle ) const
假定读者位于 WDM 路径元素的根目录下,读出相关标记并提供等效的路径句柄。
具体说明 | |||||
---|---|---|---|---|---|
返回值 |
|
MapPathToHandle
WEAVE_ERROR MapPathToHandle( const char *aPathString, PropertyPathHandle & aHandle ) const
在给定 WDM 路径的字符串表示形式的情况下,可以读出相关标记并提供等效的路径句柄。
WDM 路径表示为使用以下规则的字符串:
- 用
/
分隔 - 路径必须以前导
/
开头,且不得包含尾随斜杠 - WDM 路径中的数字标记必须使用标准 C 库对整数编码到字符串进行编码,即十进制编码(默认)不得包含前导 0,十六进制编码必须以
0x
开头,八进制编码必须包含前导0
。
具体说明 | |||||||
---|---|---|---|---|---|---|---|
返回值 |
|
MatchesProfileId
bool MatchesProfileId( uint32_t aProfileId ) const
如果传入的 profileId 与架构中存储的 ID 匹配,则返回 true。
具体说明 | |||
---|---|---|---|
返回值 |
|
RetrieveData
WEAVE_ERROR RetrieveData( PropertyPathHandle aHandle, uint64_t aTagToWrite, nl::Weave::TLV::TLVWriter & aWriter, IGetDataDelegate *aDelegate, IDirtyPathCut *apDirtyPathCut ) const
给定路径句柄和相应数据元素上的写入器位置,以符合架构的方式从源检索叶数据,并将其写入写入器所指向的缓冲区。
具体说明 | |||||
---|---|---|---|---|---|
返回值 |
|
RetrieveUpdatableDictionaryData
WEAVE_ERROR RetrieveUpdatableDictionaryData( PropertyPathHandle aHandle, uint64_t aTagToWrite, nl::Weave::TLV::TLVWriter & aWriter, IGetDataDelegate *aDelegate, PropertyPathHandle & aPropertyPathHandleOfDictItemToStartFrom ) const
StoreData
WEAVE_ERROR StoreData( PropertyPathHandle aHandle, nl::Weave::TLV::TLVReader & aReader, ISetDataDelegate *aDelegate, IPathFilter *aPathFilter ) const
给定路径句柄和位于相应数据元素上的读取器,处理读取器指向的数据缓冲区,并在遇到叶数据项时通过调用 SetLeafData 调用将其存储到接收器中。
具体说明 | |||||
---|---|---|---|---|---|
返回值 |
|