lib: split trace API into trace class and trace APIs
[babeltrace.git] / include / babeltrace / trace-ir / field-classes-internal.h
index 7103a86c0313ded4d9551cecc1ecd1aa83f7704d..94056c3eb75dee54ed6c6f6a92e61cc75bb1f1bb 100644 (file)
 
 #define BT_ASSERT_PRE_FC_IS_INT(_fc, _name)                            \
        BT_ASSERT_PRE(                                                  \
-               ((struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER || \
-               ((struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_SIGNED_INTEGER || \
-               ((struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION || \
-               ((struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION, \
+               ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER || \
+               ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_SIGNED_INTEGER || \
+               ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION || \
+               ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION, \
                _name " is not an integer field class: %![fc-]+F", (_fc))
 
 #define BT_ASSERT_PRE_FC_IS_UNSIGNED_INT(_fc, _name)                   \
        BT_ASSERT_PRE(                                                  \
-               ((struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER || \
-               ((struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION, \
+               ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER || \
+               ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION, \
                _name " is not an unsigned integer field class: %![fc-]+F", (_fc))
 
 #define BT_ASSERT_PRE_FC_IS_ENUM(_fc, _name)                           \
        BT_ASSERT_PRE(                                                  \
-               ((struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION || \
-               ((struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION, \
+               ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION || \
+               ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION, \
                _name " is not an enumeration field class: %![fc-]+F", (_fc))
 
 #define BT_ASSERT_PRE_FC_IS_ARRAY(_fc, _name)                          \
        BT_ASSERT_PRE(                                                  \
-               ((struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_STATIC_ARRAY || \
-               ((struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY, \
+               ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_STATIC_ARRAY || \
+               ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY, \
                _name " is not an array field class: %![fc-]+F", (_fc))
 
 #define BT_ASSERT_PRE_FC_HAS_ID(_fc, _type, _name)                     \
-       BT_ASSERT_PRE(((struct bt_field_class *) (_fc))->type == (_type),       \
+       BT_ASSERT_PRE(((const struct bt_field_class *) (_fc))->type == (_type),         \
                _name " has the wrong type: expected-type=%s, "         \
                "%![fc-]+F", bt_common_field_class_type_string(_type), (_fc))
 
 #define BT_ASSERT_PRE_FC_HOT(_fc, _name)                               \
-       BT_ASSERT_PRE_HOT((struct bt_field_class *) (_fc),              \
+       BT_ASSERT_PRE_HOT((const struct bt_field_class *) (_fc),                \
                (_name), ": %!+F", (_fc))
 
 #define BT_FIELD_CLASS_NAMED_FC_AT_INDEX(_fc, _index)          \
@@ -91,9 +91,9 @@ struct bt_field_class {
 
        /*
         * Only used in developer mode, this flag indicates whether or
-        * not this field class is part of a trace.
+        * not this field class is part of a trace class.
         */
-       bool part_of_trace;
+       bool part_of_trace_class;
 };
 
 struct bt_field_class_integer {
@@ -220,14 +220,14 @@ struct bt_field_class_variant {
 };
 
 static inline
-bool bt_field_class_has_known_type(struct bt_field_class *fc)
+bool bt_field_class_has_known_type(const struct bt_field_class *fc)
 {
        return fc->type >= BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER &&
                fc->type <= BT_FIELD_CLASS_TYPE_VARIANT;
 }
 
 BT_HIDDEN
-void _bt_field_class_freeze(struct bt_field_class *field_class);
+void _bt_field_class_freeze(const struct bt_field_class *field_class);
 
 #ifdef BT_DEV_MODE
 # define bt_field_class_freeze         _bt_field_class_freeze
@@ -242,12 +242,13 @@ void _bt_field_class_freeze(struct bt_field_class *field_class);
  * shared objects for other purposes.
  */
 BT_HIDDEN
-void _bt_field_class_make_part_of_trace(struct bt_field_class *field_class);
+void _bt_field_class_make_part_of_trace_class(
+               const struct bt_field_class *field_class);
 
 #ifdef BT_DEV_MODE
-# define bt_field_class_make_part_of_trace     _bt_field_class_make_part_of_trace
+# define bt_field_class_make_part_of_trace_class       _bt_field_class_make_part_of_trace_class
 #else
-# define bt_field_class_make_part_of_trace(_fc)        ((void) _fc)
+# define bt_field_class_make_part_of_trace_class(_fc)  ((void) _fc)
 #endif
 
 #endif /* BABELTRACE_TRACE_IR_FIELD_CLASSES_INTERNAL_H */
This page took 0.0249 seconds and 4 git commands to generate.