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 result
    • setType() - Set parent and child entities and data type
    • setName() - Set the name of a result
    • setResultType() - Set result type
  • Metadata query functions
    • getDimensions() - Get dimensions
    • getEntityType() - Get entity type and sub-entity type
    • getAttributesNames() - Retrieve the names of all attributes
  • Attribute management functions
    • addAttributeInteger() - Add integer attribute to a result
    • addAttributeFloat() - Add float attribute to a result
    • addAttributeDouble() - Add double attribute to a result
    • addAttributeString() - Add string attribute to a result
    • getAttributeValueInteger() - Get the value of an integer attribute
    • getAttributeValueFloat() - Get the value of a float attribute
    • getAttributeValueDouble() - Get the value of a double attribute
    • getAttributeValueString() - Get the value of a string attribute
  • General functions
    • getErrorCode() - Return the current error code
    • printAttributes() - 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

HOOPS_CAE_EXTERN ErrorCode getErrorCode ()

Return the current ErrorCode of the ResultMetadata object.

Returns: ErrorCode - The current error code, or NONE if no error.
HOOPS_CAE_EXTERN 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

HOOPS_CAE_EXTERN Status setType (DataLayout type, EntityType entityType, EntityType subEntityType)

Specify type of parent and child entities and data type.

Errors
  • ENUM is generated if an improper entityType, subEntityType combination.

Parameters:
Returns:

Status

HOOPS_CAE_EXTERN Status setName (const char *name)

Set the name of a result.

Parameters:name – Name of the result
Returns:Status
HOOPS_CAE_EXTERN 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
NULLOBJECT is 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] DataLayout type
Returns:

Status

HOOPS_CAE_EXTERN Status addAttributeInteger (const char *name, int value)

Add an integer attribute to a result.

Errors
  • OPERATION is generated if the attribute could not be added.

Parameters:
  • name – Name of the attribute
  • value – Value of the attribute
Returns:

Status

HOOPS_CAE_EXTERN Status addAttributeFloat (const char *name, float value)

Add a float attribute to a result.

Errors
  • OPERATION is generated if the attribute could not be added.

Parameters:
  • name – Name of the attribute
  • value – Value of the attribute
Returns:

Status

HOOPS_CAE_EXTERN Status addAttributeDouble (const char *name, double value)

Add a double attribute to a result.

Errors
  • OPERATION is generated if the attribute could not be added.

Parameters:
  • name – Name of the attribute
  • value – Value of the attribute
Returns:

Status

HOOPS_CAE_EXTERN Status addAttributeString (const char *name, const char *value)

Add a string attribute to a result.

Errors
  • OPERATION is generated if the attribute could not be added.

Parameters:
  • name – Name of the attribute
  • value – Value of the attribute
Returns:

Status

HOOPS_CAE_EXTERN 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

HOOPS_CAE_EXTERN 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

HOOPS_CAE_EXTERN 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

HOOPS_CAE_EXTERN 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

HOOPS_CAE_EXTERN Status setResultType (ResultType resultType)

Set the result type of the metadata.

Parameters:resultType ResultType
Returns:Status
HOOPS_CAE_EXTERN Status getDimensions (char dimensions[])

Get the physical dimensions string of the metadata based on the result type.

Errors
NULLOBJECT is generated if dimensions is NULL.

Parameters:dimensions[out] Array to store the dimensions string
Returns:Status
HOOPS_CAE_EXTERN Status getEntityType (EntityType *entityType, EntityType *subEntityType)

Get the entity type and sub-entity type of a result metadata object.

Parameters:
  • entityType[out] EntityType Entity type of the result metadata
  • subEntityType[out] EntityType Sub-entity type of the result metadata
Returns:

Status

HOOPS_CAE_EXTERN Status printAttributes ()

Print names and values of attributes of a result metadata object.

Returns:Status
HOOPS_CAE_EXTERN Status getAttributesNames (ListPtr< char > &attributesNames)

Retrieve the names of the attributes from a ResultMetadata object.

Parameters:attributesNames[out] Pointer to List of attributes names
Returns:Status