nl:: Weave:: Profiles:: DataManagement_Current:: TraitSchemaEngine
#include <src/lib/profiles/data-management/Current/TraitData.h>
架构引擎会获取与特定特征相关的架构信息,并提供相应功能来解析该特征并将其转换为 WDM 设备可用的格式。
摘要
这包括从 PathHandle 到 WDM 路径的转换(反之亦然)、用于解释/查询架构本身的方法,以及有助于在给定句柄的 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
GetDepth
int32_t GetDepth( PropertyPathHandle aHandle ) 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(如果成功);WEAVE_ERROR_NO_MEMORY(如果 aTag 太小而无法存储完整路径)。
|
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 调用将其存储到接收器中。
详细信息 | |||||
---|---|---|---|---|---|
返回值 |
|