Commit bb2d4d94 authored by Brice Videau's avatar Brice Videau

Added type to tuners.

parent 44a874d0
......@@ -53,6 +53,7 @@ enum ccs_error_e {
CCS_INVALID_CONFIGURATION,
CCS_INVALID_NAME,
CCS_INVALID_CONDITION,
CCS_INVALID_TUNER,
CCS_INVALID_GRAPH,
CCS_TYPE_NOT_COMPARABLE,
CCS_INVALID_BOUNDS,
......
......@@ -5,6 +5,18 @@
extern "C" {
#endif
enum ccs_tuner_type_e {
CCS_RANDOM,
CCS_GENERIC,
CCS_TUNER_TYPE_MAX,
CCS_TUNER_TYPE_32BIT = INT_MAX
};
typedef enum ccs_tuner_type_e ccs_tuner_type_t;
extern ccs_result_t
ccs_tuner_get_type(ccs_tuner_t tuner,
ccs_tuner_type_t *type_ret);
extern ccs_result_t
ccs_tuner_get_name(ccs_tuner_t tuner,
const char **name_ret);
......@@ -18,8 +30,8 @@ ccs_tuner_get_configuration_space(ccs_tuner_t tuner,
ccs_configuration_space_t *configuration_space_ret);
extern ccs_result_t
ccs_tuner_get_objective_spce(ccs_tuner_t tuner,
ccs_objective_space_t *objective_space_ret);
ccs_tuner_get_objective_space(ccs_tuner_t tuner,
ccs_objective_space_t *objective_space_ret);
extern ccs_result_t
ccs_tuner_ask(ccs_tuner_t tuner,
......
......@@ -6,6 +6,17 @@ ccs_tuner_get_ops(ccs_tuner_t tuner) {
return (_ccs_tuner_ops_t *)tuner->obj.ops;
}
ccs_result_t
ccs_tuner_get_type(ccs_tuner_t tuner,
ccs_tuner_type_t *type_ret) {
if (!tuner || !tuner->data)
return -CCS_INVALID_OBJECT;
if (!type_ret)
return -CCS_INVALID_VALUE;
_ccs_tuner_common_data_t *d = (_ccs_tuner_common_data_t *)tuner->data;
*type_ret = d->type;
return CCS_SUCCESS;
}
ccs_result_t
ccs_tuner_get_name(ccs_tuner_t tuner,
......@@ -44,8 +55,8 @@ ccs_tuner_get_configuration_space(ccs_tuner_t tuner,
}
ccs_result_t
ccs_tuner_get_objective_spce(ccs_tuner_t tuner,
ccs_objective_space_t *objective_space_ret) {
ccs_tuner_get_objective_space(ccs_tuner_t tuner,
ccs_objective_space_t *objective_space_ret) {
if (!tuner || !tuner->data)
return -CCS_INVALID_OBJECT;
if (!objective_space_ret)
......
......@@ -38,6 +38,7 @@ struct _ccs_tuner_s {
};
struct _ccs_tuner_common_data_s {
ccs_tuner_type_t type;
const char *name;
void *user_data;
ccs_configuration_space_t configuration_space;
......
......@@ -200,6 +200,7 @@ ccs_create_random_tuner(const char *name,
_ccs_object_init(&(tun->obj), CCS_TUNER, (_ccs_object_ops_t *)&_ccs_tuner_random_ops);
tun->data = (struct _ccs_tuner_data_s *)(mem + sizeof(struct _ccs_tuner_s));
data = (_ccs_random_tuner_data_t *)tun->data;
data->common_data.type = CCS_RANDOM;
data->common_data.name = (const char *)(mem + sizeof(struct _ccs_tuner_s) +
sizeof(struct _ccs_random_tuner_data_s));
data->common_data.user_data = user_data;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment