g_free(obj);
}
-struct bt_field_class *bt_field_class_real_create(bt_trace_class *trace_class)
+static
+struct bt_field_class *create_real_field_class(bt_trace_class *trace_class,
+ enum bt_field_class_type type)
{
struct bt_field_class_real *real_fc = NULL;
BT_ASSERT_PRE_NON_NULL(trace_class, "Trace class");
- BT_LOGD_STR("Creating default real field class object.");
+ BT_LOGD("Creating default real field class object: type=%s",
+ bt_common_field_class_type_string(type));
real_fc = g_new0(struct bt_field_class_real, 1);
if (!real_fc) {
BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate one real field class.");
goto error;
}
- if (init_field_class((void *) real_fc, BT_FIELD_CLASS_TYPE_REAL,
- destroy_real_field_class)) {
+ if (init_field_class((void *) real_fc, type, destroy_real_field_class)) {
goto error;
}
return (void *) real_fc;
}
-bt_bool bt_field_class_real_is_single_precision(const struct bt_field_class *fc)
+struct bt_field_class *bt_field_class_real_single_precision_create(
+ bt_trace_class *trace_class)
{
- const struct bt_field_class_real *real_fc = (const void *) fc;
-
- BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_REAL, "Field class");
- return real_fc->is_single_precision;
+ return create_real_field_class(trace_class,
+ BT_FIELD_CLASS_TYPE_SINGLE_PRECISION_REAL);
}
-void bt_field_class_real_set_is_single_precision(struct bt_field_class *fc,
- bt_bool is_single_precision)
+struct bt_field_class *bt_field_class_real_double_precision_create(
+ bt_trace_class *trace_class)
{
- struct bt_field_class_real *real_fc = (void *) fc;
-
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_REAL, "Field class");
- BT_ASSERT_PRE_DEV_FC_HOT(fc, "Field class");
- real_fc->is_single_precision = (bool) is_single_precision;
- BT_LIB_LOGD("Set real field class's \"is single precision\" property: "
- "%!+F", fc);
+ return create_real_field_class(trace_class,
+ BT_FIELD_CLASS_TYPE_DOUBLE_PRECISION_REAL);
}
static
{
struct bt_named_field_class *named_fc = ptr;
- BT_OBJECT_PUT_REF_AND_RESET(named_fc->user_attributes);
-
if (ptr) {
+ BT_OBJECT_PUT_REF_AND_RESET(named_fc->user_attributes);
finalize_named_field_class(ptr);
g_free(ptr);
}
return named_fc->fc;
}
+struct bt_field_class *
+bt_field_class_structure_member_borrow_field_class(
+ struct bt_field_class_structure_member *member)
+{
+ struct bt_named_field_class *named_fc = (void *) member;
+
+ BT_ASSERT_PRE_DEV_NON_NULL(member, "Structure field class member");
+ return named_fc->fc;
+}
+
static
void destroy_option_field_class(struct bt_object *obj)
{
return opt_fc->content_fc;
}
+struct bt_field_class *bt_field_class_option_borrow_field_class(
+ struct bt_field_class *fc)
+{
+ struct bt_field_class_option *opt_fc = (void *) fc;
+
+ BT_ASSERT_PRE_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_OPTION,
+ "Field class");
+ return opt_fc->content_fc;
+}
+
const struct bt_field_path *
bt_field_class_option_borrow_selector_field_path_const(
const struct bt_field_class *fc)
return named_fc->fc;
}
+struct bt_field_class *
+bt_field_class_variant_option_borrow_field_class(
+ struct bt_field_class_variant_option *option)
+{
+ struct bt_named_field_class *named_fc = (void *) option;
+
+ BT_ASSERT_PRE_DEV_NON_NULL(option, "Variant field class option");
+ return named_fc->fc;
+}
+
const struct bt_integer_range_set_unsigned *
bt_field_class_variant_with_selector_unsigned_option_borrow_ranges_const(
const struct bt_field_class_variant_with_selector_unsigned_option *option)