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 與儲存在結構定義中的 相符,則傳回 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:: |
Structs |
|
---|---|
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。
|
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 與儲存在結構定義中的 相符,則傳回 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 呼叫,將其儲存至接收器。
詳細資料 | |||||
---|---|---|---|---|---|
傳回值 |
|