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
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
aTag に書き込まれたタグの数
戻り値
成功した場合は WEAVE_NO_ERROR。aTag が小さすぎてフルパスを保存できない場合、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
データの解析/処理中にエラーが発生しました。