nl::Weave::Profiles::DataManagement_Current::TraitSchemaEngine

#include <src/lib/profiles/data-management/Current/TraitData.h>

スキーマ エンジンは特定のトレイトに関連付けられたスキーマ情報を取得し、それを解析して WDM 機械が使用可能な形式に変換する機能を提供します。

概要

これには、PathHandles から WDM パスへの変換(またはその逆)、スキーマ自体を解釈 / クエリするメソッド、ハンドルで指定された TLV との間でデータの読み書きを支援するメソッドが含まれます。

スキーマ自体は表形式で保存され、特定のトレイトについて WDM パスやデータの一般的な解析や構成を行えるように記述されています。これらのテーブルが「code-gen」の最終的な出力になります(生成されたコードが存在しないため、用語自体が若干誤解を招く可能性があります)。

公開静的属性

kHandleTableOffset = 2
const uint32_t

パブリック属性

mSchema
const Schema

パブリック関数

FindLowestCommonAncestor(PropertyPathHandle aHandle1, PropertyPathHandle aHandle2, PropertyPathHandle *aHandle1BranchChild, PropertyPathHandle *aHandle2BranchChild) const
2 つのプロパティ ハンドルから、両方のハンドルの親となる最も低いハンドルを計算します。
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::Weave::Profiles::DataManagement_Current::TraitSchemaEngine::IGetDataDelegate
nl::Weave::Profiles::DataManagement_Current::TraitSchemaEngine::ISetDataDelegate

構造体

nl::Weave::Profiles::DataManagement_Current::TraitSchemaEngine::PropertyInfo
nl::Weave::Profiles::DataManagement_Current::TraitSchemaEngine::Schema

スキーマ情報を格納するメインのスキーマ構造。

公開静的属性

kHandleTableOffset

const uint32_t kHandleTableOffset = 2

パブリック属性

mSchema

const Schema mSchema

パブリック関数

FindLowestCommonAncestor

PropertyPathHandle FindLowestCommonAncestor(
  PropertyPathHandle aHandle1,
  PropertyPathHandle aHandle2,
  PropertyPathHandle *aHandle1BranchChild,
  PropertyPathHandle *aHandle2BranchChild
) const 

2 つのプロパティ ハンドルから、両方のハンドルの親となる最も低いハンドルを計算します。

さらに、2 つのハンドルを含む 2 つの子ブランチを(同じ場合でも)返します。

詳細
戻り値
PropertyPathHandle
最下位の親へのハンドル。

GetChildHandle

PropertyPathHandle GetChildHandle(
  PropertyPathHandle aParentHandle,
  uint8_t aContextTag
) const 

GetDepth

int32_t GetDepth(
  PropertyPathHandle aHandle
) const 

指定されたハンドルのスキーマツリーの深さを計算します。

詳細
戻り値
int32_t
樹木の深さ

GetDictionaryItemHandle

PropertyPathHandle GetDictionaryItemHandle(
  PropertyPathHandle aParentHandle,
  uint16_t aDictionaryKey
) const 

GetFirstChild

PropertyPathHandle GetFirstChild(
  PropertyPathHandle aParentHandle
) const 

特定の親に関連付けられている最初の子ハンドルを返します。

詳細
戻り値
PropertyPathHandle
最初の子のハンドル。

GetHighestForwardVersion

SchemaVersion GetHighestForwardVersion(
  SchemaVersion aVersion
) const 

指定したデータスキーマのバージョンから、上位互換の最も高いスキーマ バージョンが返されます。

GetLowestCompatibleVersion

SchemaVersion GetLowestCompatibleVersion(
  SchemaVersion aVersion
) const 

指定したデータスキーマ バージョンについて、互換性のある最小スキーマ バージョンを返します。

GetMap

const PropertyInfo * GetMap(
  PropertyPathHandle aHandle
) const 

特定のパスハンドルを記述する PropertyInfo 構造体へのポインタを返します。

詳細
戻り値
PropertyInfo*

GetMaxVersion

SchemaVersion GetMaxVersion() const 

GetMinVersion

SchemaVersion GetMinVersion() const 

GetNextChild

PropertyPathHandle GetNextChild(
  PropertyPathHandle aParentId,
  PropertyPathHandle aChildHandle
) const 

既存の子にハンドルを指定すると、特定の親に関連付けられている次の子ハンドルを返します。

詳細
戻り値
PropertyPathHandle
次の子のハンドル。

GetParent

PropertyPathHandle GetParent(
  PropertyPathHandle aHandle
) const 

指定した子パスハンドルの親ハンドルを返します。

親ハンドルが辞書要素でもある場合、ハンドル内の辞書キーは保持されます。

詳細
戻り値
PropertyPathHandle
親のハンドル。

GetProfileId

uint32_t GetProfileId(
  void
) const 

関連付けられているトレイトのプロファイル ID を返します。

詳細
戻り値
Trait
プロフィール ID

GetRelativePathTags

WEAVE_ERROR GetRelativePathTags(
  const PropertyPathHandle aCandidateHandle,
  uint64_t *aTags,
  const uint32_t aTagsSize,
  uint32_t & aNumTags
) const 

PropertyPathHandle をコンテキスト タグの配列に変換します。

詳細
パラメータ
[in] aCandidateHandle
変換される PropertyPathHandle。
[in] aTags
出力配列へのポインタ。
[in] aTagsSize
aTags 配列のサイズ(要素数)。
[out] aNumTags
aTags に書き込まれたタグの数
戻り値
成功した場合は WEAVE_NO_ERROR、aTags が小さすぎてフルパスを保存できない場合は WEAVE_ERROR_NO_MEMORY になります。

GetTag

uint64_t GetTag(
  PropertyPathHandle aHandle
) const 

パスハンドルに関連付けられたタグを返します。

辞書要素の場合、ProfileTag を返します。それ以外の場合は、コンテキスト タグを返します。

詳細
戻り値
uint64_t

GetVersionIntersection

bool GetVersionIntersection(
  SchemaVersionRange & aVersion,
  SchemaVersionRange & aIntersection
) const 

バージョン範囲を指定すると、この関数は、そのバージョン範囲と、このスキーマ エンジンを支えるスキーマでサポートされているバージョンとの間に互換性の交差があるかどうかをチェックします。

交差がある場合、この関数は true を返し、渡された aIntersection 引数を更新して、その交差テストの結果を反映します。

IsDictionary

bool IsDictionary(
  PropertyPathHandle aHandle
) const 

ハンドルが辞書の場合、true を返します(辞書にはありません。以下のメソッドを参照してください)。

詳細
戻り値
bool

IsEphemeral

bool IsEphemeral(
  PropertyPathHandle aHandle
) const 

IsInDictionary

bool IsInDictionary(
  PropertyPathHandle aHandle,
  PropertyPathHandle & aDictionaryItemHandle
) const 

ハンドルが辞書(辞書要素)内にある場合、true を返します。

ハンドル(aDictionaryItemHandle)で渡されたユーザーが、辞書内で最上位の辞書要素のハンドルを指すように更新されます。

詳細
戻り値
bool

IsLeaf

bool IsLeaf(
  PropertyPathHandle aPropertyHandle
) const 

ハンドルがスキーマツリーのリーフノードを参照している場合、true を返します。

詳細
戻り値
bool

IsNullable

bool IsNullable(
  PropertyPathHandle aHandle
) const 

IsOptional

bool IsOptional(
  PropertyPathHandle aHandle
) const 

IsParent

bool IsParent(
  PropertyPathHandle aChildHandle,
  PropertyPathHandle aParentHandle
) const 

指定されたハンドルが別のハンドルの子かどうかを確認します。

直接の親を指定できます。

詳細
戻り値
bool

MapHandleToPath

WEAVE_ERROR MapHandleToPath(
  PropertyPathHandle aHandle,
  nl::Weave::TLV::TLVWriter & aPathWriter
) const 

パスハンドルを TLV パスに変換します。

詳細
戻り値
WEAVE_NO_ERROR
成功時。
other
ハンドルを TLV パスに変換できませんでした

MapPathToHandle

WEAVE_ERROR MapPathToHandle(
  nl::Weave::TLV::TLVReader & aPathReader,
  PropertyPathHandle & aHandle
) const 

WDM パス要素のルートに配置されたリーダーに対して、関連するタグを読み上げて、それと同等のパスハンドルを提供します。

詳細
戻り値
WEAVE_NO_ERROR
成功時。
WEAVE_ERROR_TLV_TAG_NOT_FOUND
パスの形式が正しくないため、または指定されたパスが誤っているため、一致するハンドルが見つからなかった場合。

MapPathToHandle

WEAVE_ERROR MapPathToHandle(
  const char *aPathString,
  PropertyPathHandle & aHandle
) const 

WDM パスの文字列表現を基に、関連するタグを読み上げて、それと同等のパスハンドルを指定します。

WDM パスは、次のルールに従って文字列として表されます。

  • タグは / で区切ります
  • パスは先頭が / でなければならず、末尾にスラッシュを含めてはなりません。
  • WDM パスの数値タグは、整数から文字列へのエンコード用に標準の C ライブラリを使用してエンコードされなければなりません。つまり、10 進数エンコード(デフォルト)は先頭に 0 を含んではなりません。16 進数エンコードは 0x で始まり、8 進数エンコードは先頭に 0 を含まなければなりません。

詳細
戻り値
WEAVE_NO_ERROR
成功時。
WEAVE_ERROR_TLV_TAG_NOT_FOUND
一致するハンドルが見つからなかった場合。
WEAVE_ERROR_INVALID_ARGUMENT
パス文字列の形式が正しくない場合

MatchesProfileId

bool MatchesProfileId(
  uint32_t aProfileId
) const 

渡された profileId がスキーマに保存されているものと一致する場合に true を返します。

詳細
戻り値
bool

RetrieveData

WEAVE_ERROR RetrieveData(
  PropertyPathHandle aHandle,
  uint64_t aTagToWrite,
  nl::Weave::TLV::TLVWriter & aWriter,
  IGetDataDelegate *aDelegate,
  IDirtyPathCut *apDirtyPathCut
) const 

対応するデータ要素のパスハンドルとライターの位置が与えられると、ソースからリーフデータを取得し、ライターが指すバッファにスキーマ準拠の方法で書き込みます。

詳細
戻り値
WEAVE_NO_ERROR
成功時。
other
データの書き出し中にエラーが発生しました。

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 呼び出しを呼び出してシンクに保存します。

詳細
戻り値
WEAVE_NO_ERROR
成功時。
other
データの解析/処理中にエラーが発生しました。