C Configuration Space and Tuning Library (CCS)
Loading...
Searching...
No Matches
Functions
tree_configuration.h File Reference

A tree configuration is a position on the tree (see tree.h) of a tree space (see tree_space.h). More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

ccs_result_t ccs_create_tree_configuration (ccs_tree_space_t tree_space, ccs_features_t features, size_t position_size, const size_t *position, ccs_tree_configuration_t *configuration_ret)
 Create a new instance of a tree configuration on a given tree_space.
 
ccs_result_t ccs_tree_configuration_get_tree_space (ccs_tree_configuration_t configuration, ccs_tree_space_t *tree_space_ret)
 Get the tree space associated to the configuration.
 
ccs_result_t ccs_tree_configuration_get_features (ccs_tree_configuration_t configuration, ccs_features_t *features_ret)
 Get the associated features.
 
ccs_result_t ccs_tree_configuration_get_position (ccs_tree_configuration_t configuration, size_t position_size, size_t *position, size_t *position_size_ret)
 Get the position of the configuration.
 
ccs_result_t ccs_tree_configuration_get_values (ccs_tree_configuration_t configuration, size_t num_values, ccs_datum_t *values, size_t *num_values_ret)
 Get the values along the path of the configuration.
 
ccs_result_t ccs_tree_configuration_get_node (ccs_tree_configuration_t configuration, ccs_tree_t *node_ret)
 Get the node pointed to by the configuration.
 
ccs_result_t ccs_tree_configuration_hash (ccs_tree_configuration_t configuration, ccs_hash_t *hash_ret)
 Compute a hash value for the configuration by hashing together the tree space reference, the position size and the position values.
 
ccs_result_t ccs_tree_configuration_cmp (ccs_tree_configuration_t configuration, ccs_tree_configuration_t other_configuration, int *cmp_ret)
 Define a strict ordering of tree configuration instances.
 

Detailed Description

A tree configuration is a position on the tree (see tree.h) of a tree space (see tree_space.h).

Function Documentation

◆ ccs_create_tree_configuration()

ccs_result_t ccs_create_tree_configuration ( ccs_tree_space_t  tree_space,
ccs_features_t  features,
size_t  position_size,
const size_t *  position,
ccs_tree_configuration_t configuration_ret 
)
extern

Create a new instance of a tree configuration on a given tree_space.

An empty position targets the root of the tree.

Parameters
[in]tree_space
[in]featuresan optional features to use. If NULL and a feature space was provided at configuration_space creation, the default features of the feature space will be used.
[in]position_sizethe number of entries in the position array
[in]positionan array of indexes defining a location in the tree. can be NULL if position_size is 0
[out]configuration_reta pointer to the variable that will hold the newly created tree configuration
Returns
CCS_RESULT_SUCCESS on success
CCS_RESULT_ERROR_INVALID_OBJECT if tree space is not a valid CCS tree space; or if features is not NULL and is not a valid CCS features
CCS_RESULT_ERROR_INVALID_FEATURES if features feature space is not the same as the feature space provided at tree_space creation.
CCS_RESULT_ERROR_INVALID_VALUE if configuration_ret is NULL; or if position is NULL and position_size is greater than 0; or if position does not describe a valid position in the tree space
CCS_RESULT_ERROR_OUT_OF_MEMORY if there was a lack of memory to allocate the new tree configuration
Remarks
This function is thread-safe

◆ ccs_tree_configuration_cmp()

ccs_result_t ccs_tree_configuration_cmp ( ccs_tree_configuration_t  configuration,
ccs_tree_configuration_t  other_configuration,
int *  cmp_ret 
)
extern

Define a strict ordering of tree configuration instances.

Tree space, size of position and position values are compared.

Parameters
[in]configurationthe first configuration
[in]other_configurationthe second configuration
[out]cmp_retthe pointer to the variable that will contain the result of the comparison. Will contain -1, 0, or 1 depending on if the first configuration is found to be respectively lesser than, equal, or greater then the second configuration
Returns
CCS_RESULT_SUCCESS on success
CCS_RESULT_ERROR_INVALID_OBJECT if configuration or other_configuration are not a valid CCS tree configurations
Remarks
This function is thread-safe

◆ ccs_tree_configuration_get_features()

ccs_result_t ccs_tree_configuration_get_features ( ccs_tree_configuration_t  configuration,
ccs_features_t features_ret 
)
extern

Get the associated features.

Parameters
[in]configuration
[out]features_reta pointer to the variable that will contain the returned features or NULL if none is associated to the configuration.
Returns
CCS_RESULT_SUCCESS on success
CCS_RESULT_ERROR_INVALID_OBJECT if configuration is not a valid CCS tree configuration
CCS_RESULT_ERROR_INVALID_VALUE if features_ret is NULL
Remarks
This function is thread-safe

◆ ccs_tree_configuration_get_node()

ccs_result_t ccs_tree_configuration_get_node ( ccs_tree_configuration_t  configuration,
ccs_tree_t node_ret 
)
extern

Get the node pointed to by the configuration.

Parameters
[in]configuration
[out]node_reta pointer to a variable that will contain the node to be returned
Returns
CCS_RESULT_SUCCESS on success
CCS_RESULT_ERROR_INVALID_OBJECT if configuration is not a valid CCS tree configuration
CCS_RESULT_ERROR_INVALID_VALUE if node_ret is NULL
Remarks
This function is thread-safe

◆ ccs_tree_configuration_get_position()

ccs_result_t ccs_tree_configuration_get_position ( ccs_tree_configuration_t  configuration,
size_t  position_size,
size_t *  position,
size_t *  position_size_ret 
)
extern

Get the position of the configuration.

Parameters
[in]configuration
[in]position_sizethe size of the position array
[out]positionan array of size position_size to hold the returned values, or NULL. If the array is too big, extra values are set to 0
[out]position_size_reta pointer to a variable that will contain the number of values that are or would be returned. Can be NULL
Returns
CCS_RESULT_SUCCESS on success
CCS_RESULT_ERROR_INVALID_OBJECT if configuration is not a valid CCS tree configuration
CCS_RESULT_ERROR_INVALID_VALUE if position is NULL and position_size is greater than 0; or if position is NULL and position_size_ret is NULL; or if position_size is less than the number of values that would be returned
Remarks
This function is thread-safe

◆ ccs_tree_configuration_get_tree_space()

ccs_result_t ccs_tree_configuration_get_tree_space ( ccs_tree_configuration_t  configuration,
ccs_tree_space_t tree_space_ret 
)
extern

Get the tree space associated to the configuration.

Parameters
[in]configuration
[out]tree_space_reta pointer to the variable that will contain the tree space
Returns
CCS_RESULT_SUCCESS on success
CCS_RESULT_ERROR_INVALID_OBJECT if configuration is not a valid CCS configuration
CCS_RESULT_ERROR_INVALID_VALUE if tree_space_ret is NULL
Remarks
This function is thread-safe

◆ ccs_tree_configuration_get_values()

ccs_result_t ccs_tree_configuration_get_values ( ccs_tree_configuration_t  configuration,
size_t  num_values,
ccs_datum_t values,
size_t *  num_values_ret 
)
extern

Get the values along the path of the configuration.

Parameters
[in]configuration
[in]num_valuesthe size of the values array
[out]valuesan array of size num_values to hold the returned values, or NULL. If the array is too big, extra values are set to CCS_DATA_TYPE_NONE
[out]num_values_reta pointer to a variable that will contain the number of values that are or would be returned. Can be NULL
Returns
CCS_RESULT_SUCCESS on success
CCS_RESULT_ERROR_INVALID_OBJECT if configuration is not a valid CCS tree configuration
CCS_RESULT_ERROR_INVALID_VALUE if values is NULL and num_values is greater than 0; or if values is NULL and num_values_ret is NULL; or if num_values is less than the number of values that would be returned
Remarks
This function is thread-safe

◆ ccs_tree_configuration_hash()

ccs_result_t ccs_tree_configuration_hash ( ccs_tree_configuration_t  configuration,
ccs_hash_t hash_ret 
)
extern

Compute a hash value for the configuration by hashing together the tree space reference, the position size and the position values.

Parameters
[in]configuration
[out]hash_retthe address of the variable that will contain the hash value
Returns
CCS_RESULT_SUCCESS on success
CCS_RESULT_ERROR_INVALID_OBJECT if configuration is not a valid CCS tree configuration
CCS_RESULT_ERROR_INVALID_VALUE if hash_ret is NULL
Remarks
This function is thread-safe