class TraitSchemaEngine

Defined at line 169 of file x64-shared/gen/third_party/openweave-core/src/include/Weave/Profiles/data-management/Current/TraitData.h

The schema engine takes schema information associated with a particular trait and provides facilities to parse and

translate that into a form usable by the WDM machinery. This includes converting from PathHandles to WDM paths (and vice

versa), methods to interpret/query the schema itself and methods to help read/write out data to/from TLV given a handle.

The schema itself is stored in tabular form, sufficiently described to allow for generic parsing/composition of WDM

paths/data for any given trait. These tables are what will be the eventual output of 'code-gen' (The term itself being

somewhat misleading given the absence of any generated code :P)

Public Members

Schema mSchema

Public Methods

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

Given a reader positioned at the root of a WDM path element, read out the relevant tags and provide

the equivalent path handle.

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

Given the a string representation of a WDM path read out the relevant tags and provide

the equivalent path handle. The WDM path is represented as a string using the following rules:

- tags are separated with `/`

- the path MUST begin with a leading `/` and MUST NOT contain a trailing slash

- 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 leading `0`.

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

Convert the path handle to a TLV path.

WEAVE_ERROR StoreData (PropertyPathHandle aHandle, nl::Weave::TLV::TLVReader & aReader, ISetDataDelegate * aDelegate, IPathFilter * aPathFilter)

Given a path handle and a reader positioned on the corresponding data element, process the data buffer pointed to by the

reader and store it into the sink by invoking the SetLeafData call whenever a leaf data item is encountered.

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

Given a path handle and a writer position on the corresponding data element, retrieve leaf data from the source and write it

into the buffer pointed to by the writer in a schema compliant manner.

WEAVE_ERROR RetrieveUpdatableDictionaryData (PropertyPathHandle aHandle, uint64_t aTagToWrite, nl::Weave::TLV::TLVWriter & aWriter, IGetDataDelegate * aDelegate, PropertyPathHandle & aPropertyPathHandleOfDictItemToStartFrom)
PropertyPathHandle GetChildHandle (PropertyPathHandle aParentHandle, uint8_t aContextTag)

Returns the property path handle of the child of a parent given the parent handle and the child's context tag.

If the parent happens to be in a dictionary, the key is preserved in the child.

PropertyPathHandle GetDictionaryItemHandle (PropertyPathHandle aParentHandle, uint16_t aDictionaryKey)

Returns the property path handle of the dictionary item given its parent dictionary handle and an item

key.

bool IsLeaf (PropertyPathHandle aPropertyHandle)

Returns true if the handle refers to a leaf node in the schema tree.

const PropertyInfo * GetMap (PropertyPathHandle aHandle)

Returns a pointer to the PropertyInfo structure describing a particular path handle.

uint64_t GetTag (PropertyPathHandle aHandle)

Returns the tag associated with a path handle. If it's a dictionary element, this function returns the ProfileTag. Otherwise,

it returns context tags.

PropertyPathHandle GetParent (PropertyPathHandle aHandle)

Returns the parent handle of a given child path handle. Dictionary keys in the handle are preserved in the case where the

parent handle is also a dictionary element.

PropertyPathHandle GetFirstChild (PropertyPathHandle aParentHandle)

Returns the first child handle associated with a particular parent.

PropertyPathHandle GetNextChild (PropertyPathHandle aParentId, PropertyPathHandle aChildHandle)

Given a handle to an existing child, returns the next child handle associated with a particular parent.

int32_t GetDepth (PropertyPathHandle aHandle)

Calculate the depth in the schema tree for a given handle.

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

Given two property handles, calculate the lowest handle that serves as a parent to both of these handles. Additionally,

return the two child branches that contain each of the two handles (even if they are the same).

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

Converts a PropertyPathHandle to an array of context tags.

Parameters

aCandidateHandle [in] The PropertyPathHandle to be converted.
aTags [in] Pointer to the output array.
aTagsSize [in] Size of the aTags array, in number of elements.
aNumTags [out] The number of tags written to aTags

Returns

WEAVE_NO_ERROR in case of success; WEAVE_ERROR_NO_MEMORY if aTags is too small

to store the full path.

bool MatchesProfileId (uint32_t aProfileId)

Returns true if the passed in profileId matches that stored in the schema.

uint32_t GetProfileId ()

Returns the profile id of the associated trait.

bool IsDictionary (PropertyPathHandle aHandle)

Returns true if the handle is a dictionary (and not in a dictionary - see method below).

bool IsInDictionary (PropertyPathHandle aHandle, PropertyPathHandle & aDictionaryItemHandle)

Returns true if the handle is *inside* a dictionary (a dictionary element). A user passed in handle (aDictionaryItemHandle)

is updated to point to the top-most dictionary element handle within the dictionary.

bool IsNullable (PropertyPathHandle aHandle)
bool IsEphemeral (PropertyPathHandle aHandle)
bool IsOptional (PropertyPathHandle aHandle)
bool IsParent (PropertyPathHandle aChildHandle, PropertyPathHandle aParentHandle)

Checks if a given handle is a child of another handle. This can be an in-direct parent.

bool GetVersionIntersection (SchemaVersionRange & aVersion, SchemaVersionRange & aIntersection)

Given a version range, this function checks to see if there is a compatibility intersection between that

and what is supported by schema that is backing this schema engine. If there is an intersection, the function will

return true and update the aIntersection argument passed in to reflect that results of that intersection test.

SchemaVersion GetHighestForwardVersion (SchemaVersion aVersion)

Given a provided data schema version, this will return the highest forward compatible schema version.

SchemaVersion GetLowestCompatibleVersion (SchemaVersion aVersion)

Given a provided data schema version, this will return the minimum compatible schema version

SchemaVersion GetMinVersion ()
SchemaVersion GetMaxVersion ()

Records