Result Metadata
Overview
The ResultMetadata class manages metadata associated with result datasets or states. This class stores descriptive information about results such as size parameters, data types, entity types, names, and attributes that provide context for the result data.
The methods associated with a ResultMetadata object are the following.
- Definition and options
inquire()- Inquire basic information
- Metadata definition functions
setSize()- Set the size parameters of a resultsetType()- Set parent and child entities and data typesetName()- Set the name of a resultsetResultType()- Set result type
- Metadata query functions
getDimensions()- Get dimensionsgetEntityType()- Get entity type and sub-entity typegetAttributesNames()- Retrieve the names of all attributes
- Attribute management functions
addAttributeInteger()- Add integer attribute to a resultaddAttributeFloat()- Add float attribute to a resultaddAttributeDouble()- Add double attribute to a resultaddAttributeString()- Add string attribute to a resultgetAttributeValueInteger()- Get the value of an integer attributegetAttributeValueFloat()- Get the value of a float attributegetAttributeValueDouble()- Get the value of a double attributegetAttributeValueString()- Get the value of a string attribute
- General functions
getErrorCode()- Return the current error codeprintAttributes()- Print all attributes
Once instanced, define the basic metadata using setSize(),
setType(), and setName().
Additional attributes can be added using the various AddAttribute functions and retrieved
using the corresponding GetAttributeValue functions.
The size parameters include the length of the result, number of rows, and number of columns. The type parameters specify the data type (scalar, vector, tensor, etc.), parent entity type, and child entity type.
Attributes store additional metadata as key-value pairs where keys are strings and values can be integers, floats, doubles, or strings.
Class Members Descriptions
The currently available ResultMetadata enumerations and functions are described in detail in this section.
-
class
ResultMetadata Result Metadata management.
Public Functions
-
ErrorCode
getErrorCode() Return the current
ErrorCodeof the ResultMetadata object.Returns: ErrorCode- The current error code, orNONEif no error.
-
Status
setSize(long long length, int rowsCount, int columnsCount) Set the size of a result.
Parameters: - length – Length of the result
- rowsCount – Number of rows in the result
- columnsCount – Number of columns in the result
Returns:
-
Status
setType(DataLayout type, EntityType entityType, EntityType subEntityType) Specify type of parent and child entities and data type.
- Errors
-
ENUMis generated if an improper entityType, subEntityType combination.
-
Parameters: - dataType –
DataLayouttype - entityType –
EntityTypeof parent entity - subEntityType –
EntityTypeof child entity
Returns:
-
Status
setName(const char *name) Set the name of a result.
Parameters: name – Name of the result Returns: Status
-
Status
inquire(char name[], long long *lrec, int *nrow, int *ncol, DataLayout *type) Inquire of defined name, lrec, nrow, ncol and type as output arguments.
- Errors
-
NULLOBJECTis generated if any output argument is NULL.
Parameters: - name – [out] Name of the result
- lrec – [out] Length of the result
- nrow – [out] Number of rows in the result
- ncol – [out] Number of columns in the result
- type – [out]
DataLayouttype
Returns:
-
Status
addAttributeInteger(const char *name, int value) Add an integer attribute to a result.
- Errors
-
OPERATIONis generated if the attribute could not be added.
-
Parameters: - name – Name of the attribute
- value – Value of the attribute
Returns:
-
Status
addAttributeFloat(const char *name, float value) Add a float attribute to a result.
- Errors
-
OPERATIONis generated if the attribute could not be added.
-
Parameters: - name – Name of the attribute
- value – Value of the attribute
Returns:
-
Status
addAttributeDouble(const char *name, double value) Add a double attribute to a result.
- Errors
-
OPERATIONis generated if the attribute could not be added.
-
Parameters: - name – Name of the attribute
- value – Value of the attribute
Returns:
-
Status
addAttributeString(const char *name, const char *value) Add a string attribute to a result.
- Errors
-
OPERATIONis generated if the attribute could not be added.
-
Parameters: - name – Name of the attribute
- value – Value of the attribute
Returns:
-
Status
getAttributeValueInteger(const char *name, int *value) Get the value of an integer attribute. If the attribute does not exist, the value is set to
INT_MAX.Parameters: - name – Name of the attribute
- value – [out] Pointer to store the value of the attribute
Returns:
-
Status
getAttributeValueFloat(const char *name, float *value) Get the value of a float attribute. If the attribute does not exist, the value is set to
FLT_MAX.Parameters: - name – Name of the attribute
- value – [out] Pointer to store the value of the attribute
Returns:
-
Status
getAttributeValueDouble(const char *name, double *value) Get the value of a double attribute. If the attribute does not exist, the value is set to
DBL_MAX.Parameters: - name – Name of the attribute
- value – [out] Pointer to store the value of the attribute
Returns:
-
Status
getAttributeValueString(const char *name, char *value) Get the value of a string attribute. If the attribute does not exist, the value is set to an empty string.
Parameters: - name – Name of the attribute
- value – [out] Pointer to store the value of the attribute
Returns:
-
Status
setResultType(ResultType resultType) Set the result type of the metadata.
Parameters: resultType – ResultTypeReturns: Status
-
Status
getDimensions(char dimensions[]) Get the physical dimensions string of the metadata based on the result type.
- Errors
-
NULLOBJECTis generated if dimensions is NULL.
Parameters: dimensions – [out] Array to store the dimensions string Returns: Status
-
Status
getEntityType(EntityType *entityType, EntityType *subEntityType) Get the entity type and sub-entity type of a result metadata object.
Parameters: - entityType – [out]
EntityTypeEntity type of the result metadata - subEntityType – [out]
EntityTypeSub-entity type of the result metadata
Returns: - entityType – [out]
-
Status
printAttributes() Print names and values of attributes of a result metadata object.
Returns: Status
-
Status
getAttributesNames(ListPtr<char> &attributesNames) Retrieve the names of the attributes from a ResultMetadata object.
Parameters: attributesNames – [out] Pointer to Listof attributes namesReturns: Status
-
ErrorCode