nl:: Weave:: Profiles:: DataManagement_Current:: TraitSchemaEngine
#include <src/lib/profiles/data-management/Current/TraitData.h>
結構定義引擎會擷取與特定特性相關的結構定義資訊,並提供可剖析及轉譯為 WDM 機械適用表單的設備。
總結
這包括從 PathHandling 轉換為 WDM 路徑 (反之亦然)、解讀/查詢結構定義本身的方法,以及協助處理/匯出指定控點向 TLV 讀取資料的方法。
結構定義本身會以表格形式儲存,充分描述允許任何指定特徵的通用 WDM 路徑/資料剖析。下表是 'code-gen'
公開的靜態屬性 |
|
---|---|
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
|
將 PropertyPathHandling 轉換為內容標記的陣列。
|
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 傳送的相符項目與結構定義中儲存的項目相符,則傳回 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:: |
存放結構定義資訊的主要結構定義結構。 |
公開的靜態屬性
kProcessTableOffset
const uint32_t kHandleTableOffset = 2
公開屬性
mSchema (結構定義)
const Schema mSchema
公開函式
查找最低公主
PropertyPathHandle FindLowestCommonAncestor( PropertyPathHandle aHandle1, PropertyPathHandle aHandle2, PropertyPathHandle *aHandle1BranchChild, PropertyPathHandle *aHandle2BranchChild ) const
假設有兩個屬性控點,請計算這兩個控點做為父項的最小控點。
此外,傳回含有兩個控點的兩個子分支 (即使兩者都相同)。
詳細資料 | |||
---|---|---|---|
傳回值 |
|
取得子項處理常式
PropertyPathHandle GetChildHandle( PropertyPathHandle aParentHandle, uint8_t aContextTag ) const
GetDepth
int32_t GetDepth( PropertyPathHandle aHandle ) const
計算指定樹狀結構的結構定義樹狀結構深度。
詳細資料 | |||
---|---|---|---|
傳回值 |
|
擷取字典項目
PropertyPathHandle GetDictionaryItemHandle( PropertyPathHandle aParentHandle, uint16_t aDictionaryKey ) const
取得 ChildChild
PropertyPathHandle GetFirstChild( PropertyPathHandle aParentHandle ) const
傳回與特定父項相關聯的第一個子項控點。
詳細資料 | |||
---|---|---|---|
傳回值 |
|
取得最高轉送版本
SchemaVersion GetHighestForwardVersion( SchemaVersion aVersion ) const
有提供的資料架構版本時,系統將傳回與第一個版本相容的最高結構定義版本。
取得最低支援版本
SchemaVersion GetLowestCompatibleVersion( SchemaVersion aVersion ) const
有提供的資料架構版本時,系統將傳回最低相容的結構定義版本。
取得地圖
const PropertyInfo * GetMap( PropertyPathHandle aHandle ) const
取得最高版本
SchemaVersion GetMaxVersion() const
GetMinVersion
SchemaVersion GetMinVersion() const
GetNextChild
PropertyPathHandle GetNextChild( PropertyPathHandle aParentId, PropertyPathHandle aChildHandle ) const
在取得現有子項的處理常式之後,傳回與特定子發布商相關聯的下一個子處理常式。
詳細資料 | |||
---|---|---|---|
傳回值 |
|
取得家長
PropertyPathHandle GetParent( PropertyPathHandle aHandle ) const
傳回指定子路徑控點的父項控點。
當父項控點也是字典元素時,系統會保留控點的字典鍵。
詳細資料 | |||
---|---|---|---|
傳回值 |
|
取得設定檔 ID
uint32_t GetProfileId( void ) const
傳回相關特性的設定檔 ID。
詳細資料 | |||
---|---|---|---|
傳回值 |
|
GetRelativePathTag
WEAVE_ERROR GetRelativePathTags( const PropertyPathHandle aCandidateHandle, uint64_t *aTags, const uint32_t aTagsSize, uint32_t & aNumTags ) const
將 PropertyPathHandling 轉換為內容標記的陣列。
詳細資料 | |||||||||
---|---|---|---|---|---|---|---|---|---|
參數 |
|
||||||||
傳回 |
WEAVE_NO_ERROR 表示成功;如果 ATag 太小,無法儲存完整路徑,則為 WEAVE_ERROR_NO_MEMORY。
|
GetTag
uint64_t GetTag( PropertyPathHandle aHandle ) const
傳回與路徑控點相關的標記。
如果為字典元素,此函式會傳回 ProfileTag。否則,會傳回內容標記。
詳細資料 | |||
---|---|---|---|
傳回值 |
|
GetVersion 交集
bool GetVersionIntersection( SchemaVersionRange & aVersion, SchemaVersionRange & aIntersection ) const
有鑑於此版本範圍,此函式會檢查其是否與支援此架構引擎的結構定義支援相容性交集。
如果有交集,函式會傳回 true 並更新 傳入的 aIntersection 引數,以反映該十字路口測試的結果。
字典
bool IsDictionary( PropertyPathHandle aHandle ) const
如果處理常式是字典 (而非字典中),則傳回 true;詳情請參閱下面的方法。
詳細資料 | |||
---|---|---|---|
傳回值 |
|
暫時
bool IsEphemeral( PropertyPathHandle aHandle ) const
字典
bool IsInDictionary( PropertyPathHandle aHandle, PropertyPathHandle & aDictionaryItemHandle ) const
如果處理常式是字典 (字典元素) 內,則傳回 true。
使用者將在控點中傳遞 (aDictionaryItemHandling) 使用者更新為指向字典中最上方的字典元素控點。
詳細資料 | |||
---|---|---|---|
傳回值 |
|
伊斯蘭
bool IsLeaf( PropertyPathHandle aPropertyHandle ) const
如果處理常式參照結構定義樹狀結構中的分葉節點,則傳回 true。
詳細資料 | |||
---|---|---|---|
傳回值 |
|
可選
bool IsNullable( PropertyPathHandle aHandle ) const
是否為選用
bool IsOptional( PropertyPathHandle aHandle ) const
母親
bool IsParent( PropertyPathHandle aChildHandle, PropertyPathHandle aParentHandle ) const
檢查指定的帳號是否為其他帳號的子項。
這可以是間接父項。
詳細資料 | |||
---|---|---|---|
傳回值 |
|
地圖控點路徑
WEAVE_ERROR MapHandleToPath( PropertyPathHandle aHandle, nl::Weave::TLV::TLVWriter & aPathWriter ) const
地圖路徑
WEAVE_ERROR MapPathToHandle( nl::Weave::TLV::TLVReader & aPathReader, PropertyPathHandle & aHandle ) const
由於讀取者位於 WDM 路徑元素的根目錄,請讀取相關的標記並提供相同的路徑控點。
詳細資料 | |||||
---|---|---|---|---|---|
傳回值 |
|
地圖路徑
WEAVE_ERROR MapPathToHandle( const char *aPathString, PropertyPathHandle & aHandle ) const
以 WDM 路徑的字串表示時,請閱讀相關標記,並提供同等的路徑控點。
以下的 WDM 路徑會以字串表示:
- 標記以
/
分隔 - 路徑「必須」開頭是
/
,且「不得」包含結尾的斜線 - numerical tags in the WDM path MUST be encoded using the standard C library for integer to string encoding, i.e. decimal encoding (default) MUST NOT contain a leading 0, a hexadecimal encoding MUST begin with
0x
, and octal encoding MUST contain a leading0
.
詳細資料 | |||||||
---|---|---|---|---|---|---|---|
傳回值 |
|
相符的設定檔 ID
bool MatchesProfileId( uint32_t aProfileId ) const
如果 profileId 傳送的相符項目與結構定義中儲存的項目相符,則傳回 true。
詳細資料 | |||
---|---|---|---|
傳回值 |
|
擷取資料
WEAVE_ERROR RetrieveData( PropertyPathHandle aHandle, uint64_t aTagToWrite, nl::Weave::TLV::TLVWriter & aWriter, IGetDataDelegate *aDelegate, IDirtyPathCut *apDirtyPathCut ) const
在對應資料元素的路徑路徑和寫入者位置上,從來源擷取分葉資料,並將資料寫入寫入工具指出的緩衝區指向的緩衝區中。
詳細資料 | |||||
---|---|---|---|---|---|
傳回值 |
|
擷取上的資料字典資料
WEAVE_ERROR RetrieveUpdatableDictionaryData( PropertyPathHandle aHandle, uint64_t aTagToWrite, nl::Weave::TLV::TLVWriter & aWriter, IGetDataDelegate *aDelegate, PropertyPathHandle & aPropertyPathHandleOfDictItemToStartFrom ) const
儲存資料
WEAVE_ERROR StoreData( PropertyPathHandle aHandle, nl::Weave::TLV::TLVReader & aReader, ISetDataDelegate *aDelegate, IPathFilter *aPathFilter ) const
指定路徑控點和位於對應資料元素中的讀取者之後,請處理讀取者指向的資料緩衝區,並且在每次遇到分葉資料項目時叫用 SetLeafData 呼叫,將資料儲存至接收器。
詳細資料 | |||||
---|---|---|---|---|---|
傳回值 |
|