|
AudioScience HPI
Version_4.33.01
|
Functions | |
| enum e_entity_role | HPI_Entity_GetRole (struct hpi_entity *entity) |
| Return the role of the entity. More... | |
| const char * | HPI_Entity_GetTypeName (struct hpi_entity *entity) |
| Return the typename of the entity. More... | |
| const char * | HPI_Entity_GetRoleName (struct hpi_entity *entity) |
| hpi_err_t | HPI_Entity_FindNext (struct hpi_entity *container_entity, enum e_entity_type type, enum e_entity_role role, int recursive_flag, struct hpi_entity **current_match) |
| Search for an entity with the given type and role in a container entity. More... | |
| void | HPI_Entity_Free (struct hpi_entity *entity) |
| Free an hpi_entity allocated by HPI_Universal_* and HPI_Entity_* functions. More... | |
| hpi_err_t | HPI_Entity_AllocAndPack (const enum e_entity_type type, const size_t item_count, const enum e_entity_role role, const void *value, const size_t value_size, struct hpi_entity **pentity) |
| Allocate and initialize an entity with the provided parameters. More... | |
| hpi_err_t | HPI_Entity_CopyValueFrom (struct hpi_entity *entity, enum e_entity_type type, size_t item_count, void *value_dst_p, size_t value_size) |
| Copies item_count items from the Entity's value array into *value_dst_p. More... | |
| hpi_err_t | HPI_Entity_Unpack (struct hpi_entity *entity, enum e_entity_type *type, size_t *item_count, enum e_entity_role *role, void **value) |
| Extracts information from an entity into the specified locations. More... | |
| enum e_entity_type |
Type tags used in hpi_entity structures.
The value of an entity is an array of a single type.
| enum e_entity_role |
Role tags used in hpi_entity structures.
Conceptually similar to C struct member names.
| Enumerator | |
|---|---|
| entity_role_null | no specific role |
| entity_role_value | value of addressed object |
| entity_role_classname | the name of addressed object |
| entity_role_units | A string representing the value units E.g. "dB", "Hz" |
| entity_role_flags | Entity flags A bitfield composed from values from e_entity_flag_values. |
| entity_role_range | The range of a value For numeric values, the range is [minimum, maximum, step]. |
| entity_role_mapping | A mapping between sets of values of different types For instance mapping integers to strings. Encoded as two items, first with entity_role_key, second with entity_role_value |
| entity_role_enum | A sequence of allowed values for the item with entity_role_value. |
| entity_role_value_constraint | Sequence of entities describing constraints on the value Typically entity_role_range, entity_role_enum. |
| entity_role_parameter_port | Identifies a sequence representing a parameter port. |
| entity_role_block | Identifies a sequence representing a block. |
| entity_role_label | A label. |
| entity_role_key | Identifies the key part in entity_role_mapping. |
| entity_role_value_label | Identifies a mapping between values and labels. |
| enum e_entity_flag_values |
Flag values used with entity_role_flags.
| enum e_entity_role HPI_Entity_GetRole | ( | struct hpi_entity * | entity | ) |
| const char* HPI_Entity_GetTypeName | ( | struct hpi_entity * | entity | ) |
Return the typename of the entity.
| entity | Pointer to the entity |
| const char* HPI_Entity_GetRoleName | ( | struct hpi_entity * | entity | ) |
| entity | Pointer to the entity |
| hpi_err_t HPI_Entity_FindNext | ( | struct hpi_entity * | container_entity, |
| enum e_entity_type | type, | ||
| enum e_entity_role | role, | ||
| int | recursive_flag, | ||
| struct hpi_entity ** | current_match | ||
| ) |
Search for an entity with the given type and role in a container entity.
Search for an entity with the given type and role in container_entity. The search starts with the first entity inside the container_entity. If container_entity is not a sequence then the function will return immediately. The variable pointed by current_match will be updated with the address of the next Entity or set to NULL if no more entities are found. If current_match is not NULL upon call then the search resumes from the entity following current_match. The recursive_flag is honored so if current match is a sequence and recursive_flag is non-zero then searching will start with the first item in the sequence.
| container_entity | Pointer to the container entity to be searched. |
| type | Entity type selector value or entity_type_null. If a non-null type is specified then the returned match will have this type. If a null type is specified then the type of the entity is ignored when searching. |
| role | Entity role selector value or entity_role_null. If a non-null role is specified then the returned match will have this type. If a null role is specified then the role of the entity is ignored when searching. |
| current_match | Pointer to the variable where the pointer to the next matching entity will be copied. If no matching entity is found *current_match is set to NULL. |
| recursive_flag | Indicates the next entity should be obtained using a depth-first search. When the recursive_flag is set, the search starts at the current position in the entity tree and proceeds through the list of entity objects. Every time a sequence is encountered the new sequence is searched until the bottom of the tree is reached at which point the search backtracks. |
For example, the tree below would be searched in order A,B,C,D,E,F,G,H if the recursive_flag is set. If the recursive_flag is not set the search order becomes A,B,C,H.
References HPI_ERROR_MEMORY_ALLOC.
| void HPI_Entity_Free | ( | struct hpi_entity * | entity | ) |
Free an hpi_entity allocated by HPI_Universal_* and HPI_Entity_* functions.
| entity | Pointer to the entity to be freed |
Referenced by HPI_Object_GetValue(), and HPI_Object_SetValue().
| hpi_err_t HPI_Entity_AllocAndPack | ( | const enum e_entity_type | type, |
| const size_t | item_count, | ||
| const enum e_entity_role | role, | ||
| const void * | value, | ||
| const size_t | value_size, | ||
| struct hpi_entity ** | pentity | ||
| ) |
Allocate and initialize an entity with the provided parameters.
| type | Entity type. |
| item_count | Number of instances of type contained in the value array. |
| role | Entity role. |
| value_size | Size in bytes of variable pointed to by value. |
| value | Pointer to an array of type with at least item_count elements. |
| pentity | Location where a pointer to the newly allocated buffer containing the entity is saved. The buffer must be freed by the caller using HPI_Entity_Free() even when the call returns an error. |
Referenced by HPI_Object_SetValue().
| hpi_err_t HPI_Entity_CopyValueFrom | ( | struct hpi_entity * | entity, |
| enum e_entity_type | type, | ||
| size_t | item_count, | ||
| void * | value_dst_p, | ||
| size_t | value_size | ||
| ) |
Copies item_count items from the Entity's value array into *value_dst_p.
If type is different from the type of the entity no value is copied and HPI_ERROR_ENTITY_TYPE_MISMATCH is returned.
If the item_count is larger than the size of the Entity's value array then no value is copied and HPI_ERROR_ENTITY_ITEM_COUNT is returned.
When type is entity_type_cstring, a zero terminator is appended to the copied bytes.
| entity | Pointer to the entity to copy values from. |
| type | Type of the variable pointed by value_dst_p. |
| item_count | Number of items to copy. This should match the storage associated with value_dst_p. |
| value_dst_p | Pointer to output buffer |
| value_size | Size in bytes of variable pointed to by value. |
References HPI_ERROR_ENTITY_TYPE_MISMATCH.
Referenced by HPI_Object_GetValue().
| hpi_err_t HPI_Entity_Unpack | ( | struct hpi_entity * | entity, |
| enum e_entity_type * | type, | ||
| size_t * | item_count, | ||
| enum e_entity_role * | role, | ||
| void ** | value | ||
| ) |
Extracts information from an entity into the specified locations.
| entity | The entity being unpacked. |
| type | Pointer to the variable where the type of the entity is copied to. |
| item_count | Pointer to the variable where the number of instances of type contained in the entity is copied to. |
| role | Pointer to the variable where the role of the entity is copied to. |
| value | Pointer to the location where a pointer to the value array of the entity is updated. Note: the value array of the entity is not copied, a pointer to its location is copied into the variable pointed by value. |
References HPI_ERROR_MEMORY_ALLOC.
1.8.13