X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=formats%2Fctf%2Fevents.c;h=eea58cfd796ffeec39d13c381d4216dcb4128c14;hp=39620383879b3aae0076bb9aedf710e2d9c88d22;hb=8673030f3cb8d157a30e79af524fd5cca253025e;hpb=305c65e5d7156ae7936f07ad93dd45ac318b4ce2 diff --git a/formats/ctf/events.c b/formats/ctf/events.c index 39620383..eea58cfd 100644 --- a/formats/ctf/events.c +++ b/formats/ctf/events.c @@ -351,6 +351,84 @@ int bt_ctf_field_get_error(void) return ret; } +int bt_ctf_get_int_signedness(const struct definition *field) +{ + int ret; + + if (field && bt_ctf_field_type(field) == CTF_TYPE_INTEGER) { + ret = get_int_signedness(field); + } else { + ret = -1; + bt_ctf_field_set_error(-EINVAL); + } + + return ret; +} + +int bt_ctf_get_int_base(const struct definition *field) +{ + int ret; + + if (field && bt_ctf_field_type(field) == CTF_TYPE_INTEGER) { + ret = get_int_base(field); + } else { + ret = -1; + bt_ctf_field_set_error(-EINVAL); + } + + return ret; +} + +int bt_ctf_get_int_byte_order(const struct definition *field) +{ + int ret; + + if (field && bt_ctf_field_type(field) == CTF_TYPE_INTEGER) { + ret = get_int_byte_order(field); + } else { + ret = -1; + bt_ctf_field_set_error(-EINVAL); + } + + return ret; +} + +enum ctf_string_encoding bt_ctf_get_encoding(const struct definition *field) +{ + enum ctf_string_encoding ret = 0; + + if (!field) + goto end; + + if (bt_ctf_field_type(field) == CTF_TYPE_INTEGER) + ret = get_int_encoding(field); + else if (bt_ctf_field_type(field) == CTF_TYPE_STRING) + ret = get_string_encoding(field); + else + goto error; + +end: + return ret; + +error: + bt_ctf_field_set_error(-EINVAL); + return -1; +} + +int bt_ctf_get_array_len(const struct definition *field) +{ + int ret; + + if (field && bt_ctf_field_type(field) == CTF_TYPE_ARRAY) { + ret = get_array_len(field); + } else { + ret = -1; + bt_ctf_field_set_error(-EINVAL); + } + + return ret; +} + uint64_t bt_ctf_get_uint64(const struct definition *field) { unsigned int ret = 0;