X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fctf-writer%2Ffields.c;h=5334dddd54b5e9847092877a9497337991ac4f11;hb=1353b066072e6c389ff35853bac83f65597e7a6a;hp=5d76c1cd47027e0e02942f624df668e571d0c058;hpb=498e7994d60bd0e9f63c3d5c0fd00eec77ba7c34;p=babeltrace.git diff --git a/src/ctf-writer/fields.c b/src/ctf-writer/fields.c index 5d76c1cd..5334dddd 100644 --- a/src/ctf-writer/fields.c +++ b/src/ctf-writer/fields.c @@ -1,25 +1,7 @@ /* - * Copyright 2013, 2014 Jérémie Galarneau - * - * Author: Jérémie Galarneau - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * SPDX-License-Identifier: MIT * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. + * Copyright 2013, 2014 Jérémie Galarneau */ #define BT_LOG_TAG "CTF-WRITER/FIELDS" @@ -50,7 +32,6 @@ _name " is not an integer or an enumeration field: " \ "field-addr=%p", (_field)) -BT_HIDDEN struct bt_ctf_field_common *bt_ctf_field_common_copy(struct bt_ctf_field_common *field) { struct bt_ctf_field_common *copy = NULL; @@ -70,7 +51,6 @@ end: return copy; } -BT_HIDDEN int bt_ctf_field_common_structure_initialize(struct bt_ctf_field_common *field, struct bt_ctf_field_type_common *type, bool is_shared, bt_ctf_object_release_func release_func, @@ -114,7 +94,6 @@ end: return ret; } -BT_HIDDEN int bt_ctf_field_common_variant_initialize(struct bt_ctf_field_common *field, struct bt_ctf_field_type_common *type, bool is_shared, bt_ctf_object_release_func release_func, @@ -166,7 +145,6 @@ end: return ret; } -BT_HIDDEN int bt_ctf_field_common_string_initialize(struct bt_ctf_field_common *field, struct bt_ctf_field_type_common *type, bool is_shared, bt_ctf_object_release_func release_func, @@ -192,7 +170,6 @@ end: return ret; } -BT_HIDDEN int bt_ctf_field_common_array_initialize(struct bt_ctf_field_common *field, struct bt_ctf_field_type_common *type, bool is_shared, bt_ctf_object_release_func release_func, @@ -236,7 +213,6 @@ end: return ret; } -BT_HIDDEN int bt_ctf_field_common_sequence_initialize(struct bt_ctf_field_common *field, struct bt_ctf_field_type_common *type, bool is_shared, bt_ctf_object_release_func release_func, @@ -264,13 +240,11 @@ end: return ret; } -BT_HIDDEN int bt_ctf_field_common_generic_validate(struct bt_ctf_field_common *field) { return (field && field->payload_set) ? 0 : -1; } -BT_HIDDEN int bt_ctf_field_common_structure_validate_recursive(struct bt_ctf_field_common *field) { int64_t i; @@ -302,7 +276,6 @@ end: return ret; } -BT_HIDDEN int bt_ctf_field_common_variant_validate_recursive(struct bt_ctf_field_common *field) { int ret = 0; @@ -321,7 +294,6 @@ end: return ret; } -BT_HIDDEN int bt_ctf_field_common_array_validate_recursive(struct bt_ctf_field_common *field) { int64_t i; @@ -345,7 +317,6 @@ end: return ret; } -BT_HIDDEN int bt_ctf_field_common_sequence_validate_recursive(struct bt_ctf_field_common *field) { int64_t i; @@ -369,14 +340,12 @@ end: return ret; } -BT_HIDDEN void bt_ctf_field_common_generic_reset(struct bt_ctf_field_common *field) { BT_ASSERT_DBG(field); field->payload_set = false; } -BT_HIDDEN void bt_ctf_field_common_structure_reset_recursive(struct bt_ctf_field_common *field) { int64_t i; @@ -400,7 +369,6 @@ void bt_ctf_field_common_structure_reset_recursive(struct bt_ctf_field_common *f } } -BT_HIDDEN void bt_ctf_field_common_variant_reset_recursive(struct bt_ctf_field_common *field) { struct bt_ctf_field_common_variant *variant = BT_CTF_FROM_COMMON(field); @@ -409,7 +377,6 @@ void bt_ctf_field_common_variant_reset_recursive(struct bt_ctf_field_common *fie variant->current_field = NULL; } -BT_HIDDEN void bt_ctf_field_common_array_reset_recursive(struct bt_ctf_field_common *field) { size_t i; @@ -432,7 +399,6 @@ void bt_ctf_field_common_array_reset_recursive(struct bt_ctf_field_common *field } } -BT_HIDDEN void bt_ctf_field_common_sequence_reset_recursive(struct bt_ctf_field_common *field) { struct bt_ctf_field_common_sequence *sequence = BT_CTF_FROM_COMMON(field); @@ -450,14 +416,12 @@ void bt_ctf_field_common_sequence_reset_recursive(struct bt_ctf_field_common *fi sequence->length = 0; } -BT_HIDDEN void bt_ctf_field_common_generic_set_is_frozen(struct bt_ctf_field_common *field, bool is_frozen) { field->frozen = is_frozen; } -BT_HIDDEN void bt_ctf_field_common_structure_set_is_frozen_recursive( struct bt_ctf_field_common *field, bool is_frozen) { @@ -480,7 +444,6 @@ void bt_ctf_field_common_structure_set_is_frozen_recursive( bt_ctf_field_common_generic_set_is_frozen(field, is_frozen); } -BT_HIDDEN void bt_ctf_field_common_variant_set_is_frozen_recursive( struct bt_ctf_field_common *field, bool is_frozen) { @@ -501,7 +464,6 @@ void bt_ctf_field_common_variant_set_is_frozen_recursive( bt_ctf_field_common_generic_set_is_frozen(field, is_frozen); } -BT_HIDDEN void bt_ctf_field_common_array_set_is_frozen_recursive( struct bt_ctf_field_common *field, bool is_frozen) { @@ -523,7 +485,6 @@ void bt_ctf_field_common_array_set_is_frozen_recursive( bt_ctf_field_common_generic_set_is_frozen(field, is_frozen); } -BT_HIDDEN void bt_ctf_field_common_sequence_set_is_frozen_recursive( struct bt_ctf_field_common *field, bool is_frozen) { @@ -546,7 +507,6 @@ void bt_ctf_field_common_sequence_set_is_frozen_recursive( bt_ctf_field_common_generic_set_is_frozen(field, is_frozen); } -BT_HIDDEN void _bt_ctf_field_common_set_is_frozen_recursive(struct bt_ctf_field_common *field, bool is_frozen) { @@ -564,13 +524,11 @@ end: return; } -BT_HIDDEN bt_ctf_bool bt_ctf_field_common_generic_is_set(struct bt_ctf_field_common *field) { return field && field->payload_set; } -BT_HIDDEN bt_ctf_bool bt_ctf_field_common_structure_is_set_recursive( struct bt_ctf_field_common *field) { @@ -592,7 +550,6 @@ end: return is_set; } -BT_HIDDEN bt_ctf_bool bt_ctf_field_common_variant_is_set_recursive(struct bt_ctf_field_common *field) { struct bt_ctf_field_common_variant *variant = BT_CTF_FROM_COMMON(field); @@ -608,7 +565,6 @@ bt_ctf_bool bt_ctf_field_common_variant_is_set_recursive(struct bt_ctf_field_com return is_set; } -BT_HIDDEN bt_ctf_bool bt_ctf_field_common_array_is_set_recursive(struct bt_ctf_field_common *field) { size_t i; @@ -628,7 +584,6 @@ end: return is_set; } -BT_HIDDEN bt_ctf_bool bt_ctf_field_common_sequence_is_set_recursive(struct bt_ctf_field_common *field) { size_t i; @@ -858,7 +813,6 @@ void bt_ctf_field_string_destroy(struct bt_ctf_field *field) g_free(field); } -BT_HIDDEN int bt_ctf_field_serialize_recursive(struct bt_ctf_field *field, struct bt_ctfser *ctfser, enum bt_ctf_byte_order native_byte_order) @@ -1139,6 +1093,7 @@ end: return ret; } +BT_EXPORT struct bt_ctf_field *bt_ctf_field_create(struct bt_ctf_field_type *type) { struct bt_ctf_field *field = NULL; @@ -1160,11 +1115,13 @@ end: return field; } +BT_EXPORT struct bt_ctf_field_type *bt_ctf_field_get_type(struct bt_ctf_field *field) { return bt_ctf_object_get_ref(bt_ctf_field_common_borrow_type((void *) field)); } +BT_EXPORT enum bt_ctf_field_type_id bt_ctf_field_get_type_id(struct bt_ctf_field *field) { struct bt_ctf_field_common *field_common = (void *) field; @@ -1173,6 +1130,7 @@ enum bt_ctf_field_type_id bt_ctf_field_get_type_id(struct bt_ctf_field *field) return (int) field_common->type->id; } +BT_EXPORT int bt_ctf_field_sequence_set_length(struct bt_ctf_field *field, struct bt_ctf_field *length_field) { @@ -1200,6 +1158,7 @@ int bt_ctf_field_sequence_set_length(struct bt_ctf_field *field, length, (bt_ctf_field_common_create_func) bt_ctf_field_create); } +BT_EXPORT struct bt_ctf_field *bt_ctf_field_structure_get_field_by_index( struct bt_ctf_field *field, uint64_t index) { @@ -1207,6 +1166,7 @@ struct bt_ctf_field *bt_ctf_field_structure_get_field_by_index( (void *) field, index)); } +BT_EXPORT struct bt_ctf_field *bt_ctf_field_structure_get_field_by_name( struct bt_ctf_field *field, const char *name) { @@ -1214,6 +1174,7 @@ struct bt_ctf_field *bt_ctf_field_structure_get_field_by_name( (void *) field, name)); } +BT_EXPORT struct bt_ctf_field *bt_ctf_field_array_get_field( struct bt_ctf_field *field, uint64_t index) { @@ -1221,6 +1182,7 @@ struct bt_ctf_field *bt_ctf_field_array_get_field( bt_ctf_field_common_array_borrow_field((void *) field, index)); } +BT_EXPORT struct bt_ctf_field *bt_ctf_field_sequence_get_field( struct bt_ctf_field *field, uint64_t index) { @@ -1228,6 +1190,7 @@ struct bt_ctf_field *bt_ctf_field_sequence_get_field( bt_ctf_field_common_sequence_borrow_field((void *) field, index)); } +BT_EXPORT struct bt_ctf_field *bt_ctf_field_variant_get_field(struct bt_ctf_field *field, struct bt_ctf_field *tag_field) { @@ -1288,6 +1251,7 @@ end: return current_field; } +BT_EXPORT struct bt_ctf_field *bt_ctf_field_variant_get_current_field( struct bt_ctf_field *variant_field) { @@ -1295,7 +1259,6 @@ struct bt_ctf_field *bt_ctf_field_variant_get_current_field( (void *) variant_field)); } -BT_HIDDEN struct bt_ctf_field *bt_ctf_field_enumeration_borrow_container( struct bt_ctf_field *field) { @@ -1308,12 +1271,14 @@ struct bt_ctf_field *bt_ctf_field_enumeration_borrow_container( return (void *) enumeration->container; } +BT_EXPORT struct bt_ctf_field *bt_ctf_field_enumeration_get_container( struct bt_ctf_field *field) { return bt_ctf_object_get_ref(bt_ctf_field_enumeration_borrow_container(field)); } +BT_EXPORT int bt_ctf_field_integer_signed_get_value(struct bt_ctf_field *field, int64_t *value) { @@ -1331,6 +1296,7 @@ int bt_ctf_field_integer_signed_get_value(struct bt_ctf_field *field, return 0; } +BT_EXPORT int bt_ctf_field_integer_signed_set_value(struct bt_ctf_field *field, int64_t value) { @@ -1354,6 +1320,7 @@ int bt_ctf_field_integer_signed_set_value(struct bt_ctf_field *field, return ret; } +BT_EXPORT int bt_ctf_field_integer_unsigned_get_value(struct bt_ctf_field *field, uint64_t *value) { @@ -1371,6 +1338,7 @@ int bt_ctf_field_integer_unsigned_get_value(struct bt_ctf_field *field, return 0; } +BT_EXPORT int bt_ctf_field_integer_unsigned_set_value(struct bt_ctf_field *field, uint64_t value) { @@ -1393,39 +1361,46 @@ int bt_ctf_field_integer_unsigned_set_value(struct bt_ctf_field *field, return 0; } +BT_EXPORT int bt_ctf_field_floating_point_get_value(struct bt_ctf_field *field, double *value) { return bt_ctf_field_common_floating_point_get_value((void *) field, value); } +BT_EXPORT int bt_ctf_field_floating_point_set_value(struct bt_ctf_field *field, double value) { return bt_ctf_field_common_floating_point_set_value((void *) field, value); } +BT_EXPORT const char *bt_ctf_field_string_get_value(struct bt_ctf_field *field) { return bt_ctf_field_common_string_get_value((void *) field); } +BT_EXPORT int bt_ctf_field_string_set_value(struct bt_ctf_field *field, const char *value) { return bt_ctf_field_common_string_set_value((void *) field, value); } +BT_EXPORT int bt_ctf_field_string_append(struct bt_ctf_field *field, const char *value) { return bt_ctf_field_common_string_append((void *) field, value); } +BT_EXPORT int bt_ctf_field_string_append_len(struct bt_ctf_field *field, const char *value, unsigned int length) { return bt_ctf_field_common_string_append_len((void *) field, value, length); } +BT_EXPORT struct bt_ctf_field *bt_ctf_field_copy(struct bt_ctf_field *field) { return (void *) bt_ctf_field_common_copy((void *) field); @@ -1820,7 +1795,6 @@ end: return ret; } -BT_HIDDEN int bt_ctf_field_structure_set_field_by_name(struct bt_ctf_field *field, const char *name, struct bt_ctf_field *value) {