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

A Binding is set of value in a Context see context.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_binding_get_context (ccs_binding_t binding, ccs_context_t *context_ret)
 Get the context of a binding.
 
ccs_result_t ccs_binding_get_value (ccs_binding_t binding, size_t index, ccs_datum_t *value_ret)
 Get the value of the parameter at the given index.
 
ccs_result_t ccs_binding_get_values (ccs_binding_t binding, size_t num_values, ccs_datum_t *values, size_t *num_values_ret)
 Get all the values in the binding.
 
ccs_result_t ccs_binding_get_value_by_name (ccs_binding_t binding, const char *name, ccs_bool_t *found_ret, ccs_datum_t *value_ret)
 Get the value of the parameter with the given name.
 
ccs_result_t ccs_binding_get_value_by_parameter (ccs_binding_t binding, ccs_parameter_t parameter, ccs_bool_t *found_ret, ccs_datum_t *value_ret)
 Get the value of the parameter with the given handle.
 
ccs_result_t ccs_binding_hash (ccs_binding_t binding, ccs_hash_t *hash_ret)
 Compute a hash value for the binding by hashing together the context reference, the number of values, and the values themselves.
 
ccs_result_t ccs_binding_cmp (ccs_binding_t binding, ccs_binding_t other_binding, int *cmp_ret)
 Define a strict ordering of binding instances.
 

Detailed Description

A Binding is set of value in a Context see context.h.

Those values can be accessed by using the parameter index in the context. Bindings are immutable except from a reference counting and callback management point of view.

Function Documentation

◆ ccs_binding_cmp()

ccs_result_t ccs_binding_cmp ( ccs_binding_t  binding,
ccs_binding_t  other_binding,
int *  cmp_ret 
)
extern

Define a strict ordering of binding instances.

Context, number of values and values are compared.

Parameters
[in]bindingthe first binding
[in]other_bindingthe second binding
[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 binding is found to be respectively lesser than, equal, or greater then the second binding
Returns
CCS_RESULT_SUCCESS on success
CCS_RESULT_ERROR_INVALID_OBJECT if binding or other_binding are not valid CCS bindings; or if binding and other_binding are bindings of different types
CCS_RESULT_ERROR_INVALID_VALUE if cmp_ret is NULL
Remarks
This function is thread-safe

◆ ccs_binding_get_context()

ccs_result_t ccs_binding_get_context ( ccs_binding_t  binding,
ccs_context_t context_ret 
)
extern

Get the context of a binding.

Parameters
[in]binding
[out]context_reta pointer to the variable which will contain the context
Returns
CCS_RESULT_SUCCESS on success
CCS_RESULT_ERROR_INVALID_OBJECT if binding is not a valid CCS object
CCS_RESULT_ERROR_INVALID_VALUE if context_ret is NULL
Remarks
This function is thread-safe

◆ ccs_binding_get_value()

ccs_result_t ccs_binding_get_value ( ccs_binding_t  binding,
size_t  index,
ccs_datum_t value_ret 
)
extern

Get the value of the parameter at the given index.

Parameters
[in]binding
[in]indexindex of the parameter in the associated context
[out]value_reta pointer to the variable that will hold the value
Returns
CCS_RESULT_SUCCESS on success
CCS_RESULT_ERROR_INVALID_OBJECT if binding is not a valid CCS object
CCS_RESULT_ERROR_INVALID_VALUE if value_ret is NULL
CCS_RESULT_ERROR_OUT_OF_BOUNDS if index is greater than the count of parameters in the context
Remarks
This function is thread-safe

◆ ccs_binding_get_value_by_name()

ccs_result_t ccs_binding_get_value_by_name ( ccs_binding_t  binding,
const char *  name,
ccs_bool_t found_ret,
ccs_datum_t value_ret 
)
extern

Get the value of the parameter with the given name.

Parameters
[in]binding
[in]namethe name of the parameter whose value to retrieve
[out]found_reta pointer to the an optional variable that will hold whether a parameter named name was found in binding
[out]value_reta pointer to the variable that will hold the value
Returns
CCS_RESULT_SUCCESS on success
CCS_RESULT_ERROR_INVALID_OBJECT if binding is not a valid CCS object
CCS_RESULT_ERROR_INVALID_VALUE if value_ret is NULL
CCS_RESULT_ERROR_INVALID_NAME if found_ret is NULL no parameter with such name exist in the binding context
Remarks
This function is thread-safe

◆ ccs_binding_get_value_by_parameter()

ccs_result_t ccs_binding_get_value_by_parameter ( ccs_binding_t  binding,
ccs_parameter_t  parameter,
ccs_bool_t found_ret,
ccs_datum_t value_ret 
)
extern

Get the value of the parameter with the given handle.

Parameters
[in]binding
[in]parameterparameter whose value to retrieve
[out]found_reta pointer to the an optional variable that will hold whether the parameter was found in the binding context
[out]value_reta pointer to the variable that will hold the value
Returns
CCS_RESULT_SUCCESS on success
CCS_RESULT_ERROR_INVALID_OBJECT if binding is not a valid CCS object
CCS_RESULT_ERROR_INVALID_PARAMETER if found_ret is NULL and parameter does not exist in binding context
Remarks
This function is thread-safe

◆ ccs_binding_get_values()

ccs_result_t ccs_binding_get_values ( ccs_binding_t  binding,
size_t  num_values,
ccs_datum_t values,
size_t *  num_values_ret 
)
extern

Get all the values in the binding.

Parameters
[in]binding
[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 binding is not a valid CCS object
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_binding_hash()

ccs_result_t ccs_binding_hash ( ccs_binding_t  binding,
ccs_hash_t hash_ret 
)
extern

Compute a hash value for the binding by hashing together the context reference, the number of values, and the values themselves.

Parameters
[in]binding
[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 binding is not a valid CCS binding
CCS_RESULT_ERROR_INVALID_VALUE if hash_ret is NULL
Remarks
This function is thread-safe