projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lib: use powers of two for object type enumerators
[babeltrace.git]
/
include
/
babeltrace2
/
value-const.h
diff --git
a/include/babeltrace2/value-const.h
b/include/babeltrace2/value-const.h
index 2f1ffe779b653bfdfc241f545b1de325fd15d366..0001ddd8d1e33e0a39e2621fb51f19aae489df58 100644
(file)
--- a/
include/babeltrace2/value-const.h
+++ b/
include/babeltrace2/value-const.h
@@
-38,32
+38,41
@@
extern "C" {
typedef enum bt_value_type {
/// Null value object.
typedef enum bt_value_type {
/// Null value object.
- BT_VALUE_TYPE_NULL = 0,
+ BT_VALUE_TYPE_NULL =
1 <<
0,
/// Boolean value object (holds #BT_TRUE or #BT_FALSE).
/// Boolean value object (holds #BT_TRUE or #BT_FALSE).
- BT_VALUE_TYPE_BOOL = 1,
+ BT_VALUE_TYPE_BOOL = 1 << 1,
+
+ BT_VALUE_TYPE_INTEGER = 1 << 2,
/// Unsigned integer value object (holds an unsigned 64-bit integer raw value).
/// Unsigned integer value object (holds an unsigned 64-bit integer raw value).
- BT_VALUE_TYPE_UNSIGNED_INTEGER =
2
,
+ BT_VALUE_TYPE_UNSIGNED_INTEGER =
(1 << 3) | BT_VALUE_TYPE_INTEGER
,
/// Signed integer value object (holds a signed 64-bit integer raw value).
/// Signed integer value object (holds a signed 64-bit integer raw value).
- BT_VALUE_TYPE_SIGNED_INTEGER =
3
,
+ BT_VALUE_TYPE_SIGNED_INTEGER =
(1 << 4) | BT_VALUE_TYPE_INTEGER
,
/// Floating point number value object (holds a \c double raw value).
/// Floating point number value object (holds a \c double raw value).
- BT_VALUE_TYPE_REAL =
4
,
+ BT_VALUE_TYPE_REAL =
1 << 5
,
/// String value object.
/// String value object.
- BT_VALUE_TYPE_STRING =
5
,
+ BT_VALUE_TYPE_STRING =
1 << 6
,
/// Array value object.
/// Array value object.
- BT_VALUE_TYPE_ARRAY =
6
,
+ BT_VALUE_TYPE_ARRAY =
1 << 7
,
/// Map value object.
/// Map value object.
- BT_VALUE_TYPE_MAP =
7
,
+ BT_VALUE_TYPE_MAP =
1 << 8
,
} bt_value_type;
extern bt_value_type bt_value_get_type(const bt_value *object);
} bt_value_type;
extern bt_value_type bt_value_get_type(const bt_value *object);
+static inline
+bt_bool bt_value_type_is(const bt_value_type type,
+ const bt_value_type type_to_check)
+{
+ return (type & type_to_check) == type_to_check;
+}
+
static inline
bt_bool bt_value_is_null(const bt_value *object)
{
static inline
bt_bool bt_value_is_null(const bt_value *object)
{
This page took
0.025692 seconds
and
4
git commands to generate.