| 1 | #ifndef BABELTRACE2_GRAPH_MESSAGE_ITERATOR_CLASS_H |
| 2 | #define BABELTRACE2_GRAPH_MESSAGE_ITERATOR_CLASS_H |
| 3 | |
| 4 | /* |
| 5 | * Copyright (c) 2019 EfficiOS Inc. |
| 6 | * |
| 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 8 | * of this software and associated documentation files (the "Software"), to deal |
| 9 | * in the Software without restriction, including without limitation the rights |
| 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 11 | * copies of the Software, and to permit persons to whom the Software is |
| 12 | * furnished to do so, subject to the following conditions: |
| 13 | * |
| 14 | * The above copyright notice and this permission notice shall be included in |
| 15 | * all copies or substantial portions of the Software. |
| 16 | * |
| 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 23 | * SOFTWARE. |
| 24 | */ |
| 25 | |
| 26 | #ifndef __BT_IN_BABELTRACE_H |
| 27 | # error "Please include <babeltrace2/babeltrace.h> instead." |
| 28 | #endif |
| 29 | |
| 30 | #ifdef __cplusplus |
| 31 | extern "C" { |
| 32 | #endif |
| 33 | |
| 34 | typedef enum bt_message_iterator_class_set_method_status { |
| 35 | BT_MESSAGE_ITERATOR_CLASS_SET_METHOD_STATUS_OK = __BT_FUNC_STATUS_OK, |
| 36 | } bt_message_iterator_class_set_method_status; |
| 37 | |
| 38 | typedef enum bt_message_iterator_class_initialize_method_status { |
| 39 | BT_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_STATUS_OK = __BT_FUNC_STATUS_OK, |
| 40 | BT_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_STATUS_ERROR = __BT_FUNC_STATUS_ERROR, |
| 41 | BT_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, |
| 42 | } bt_message_iterator_class_initialize_method_status; |
| 43 | |
| 44 | typedef enum bt_message_iterator_class_next_method_status { |
| 45 | BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_OK = __BT_FUNC_STATUS_OK, |
| 46 | BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN, |
| 47 | BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_ERROR = __BT_FUNC_STATUS_ERROR, |
| 48 | BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, |
| 49 | BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_END = __BT_FUNC_STATUS_END, |
| 50 | } bt_message_iterator_class_next_method_status; |
| 51 | |
| 52 | typedef enum bt_message_iterator_class_seek_ns_from_origin_method_status { |
| 53 | BT_MESSAGE_ITERATOR_CLASS_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_OK = __BT_FUNC_STATUS_OK, |
| 54 | BT_MESSAGE_ITERATOR_CLASS_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN, |
| 55 | BT_MESSAGE_ITERATOR_CLASS_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_ERROR = __BT_FUNC_STATUS_ERROR, |
| 56 | BT_MESSAGE_ITERATOR_CLASS_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, |
| 57 | } bt_message_iterator_class_seek_ns_from_origin_method_status; |
| 58 | |
| 59 | typedef enum bt_message_iterator_class_can_seek_ns_from_origin_method_status { |
| 60 | BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_OK = __BT_FUNC_STATUS_OK, |
| 61 | BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN, |
| 62 | BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_ERROR = __BT_FUNC_STATUS_ERROR, |
| 63 | BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, |
| 64 | } bt_message_iterator_class_can_seek_ns_from_origin_method_status; |
| 65 | |
| 66 | typedef enum bt_message_iterator_class_seek_beginning_method_status { |
| 67 | BT_MESSAGE_ITERATOR_CLASS_SEEK_BEGINNING_METHOD_STATUS_OK = __BT_FUNC_STATUS_OK, |
| 68 | BT_MESSAGE_ITERATOR_CLASS_SEEK_BEGINNING_METHOD_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN, |
| 69 | BT_MESSAGE_ITERATOR_CLASS_SEEK_BEGINNING_METHOD_STATUS_ERROR = __BT_FUNC_STATUS_ERROR, |
| 70 | BT_MESSAGE_ITERATOR_CLASS_SEEK_BEGINNING_METHOD_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, |
| 71 | } bt_message_iterator_class_seek_beginning_method_status; |
| 72 | |
| 73 | typedef enum bt_message_iterator_class_can_seek_beginning_method_status { |
| 74 | BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_BEGINNING_METHOD_STATUS_OK = __BT_FUNC_STATUS_OK, |
| 75 | BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_BEGINNING_METHOD_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN, |
| 76 | BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_BEGINNING_METHOD_STATUS_ERROR = __BT_FUNC_STATUS_ERROR, |
| 77 | BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_BEGINNING_METHOD_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, |
| 78 | } bt_message_iterator_class_can_seek_beginning_method_status; |
| 79 | |
| 80 | typedef bt_message_iterator_class_initialize_method_status |
| 81 | (*bt_message_iterator_class_initialize_method)( |
| 82 | bt_self_message_iterator *message_iterator, |
| 83 | bt_self_message_iterator_configuration *config, |
| 84 | bt_self_component *self_component, |
| 85 | bt_self_component_port_output *port); |
| 86 | |
| 87 | typedef void |
| 88 | (*bt_message_iterator_class_finalize_method)( |
| 89 | bt_self_message_iterator *message_iterator); |
| 90 | |
| 91 | typedef bt_message_iterator_class_next_method_status |
| 92 | (*bt_message_iterator_class_next_method)( |
| 93 | bt_self_message_iterator *message_iterator, |
| 94 | bt_message_array_const msgs, uint64_t capacity, |
| 95 | uint64_t *count); |
| 96 | |
| 97 | typedef bt_message_iterator_class_seek_ns_from_origin_method_status |
| 98 | (*bt_message_iterator_class_seek_ns_from_origin_method)( |
| 99 | bt_self_message_iterator *message_iterator, |
| 100 | int64_t ns_from_origin); |
| 101 | |
| 102 | typedef bt_message_iterator_class_can_seek_ns_from_origin_method_status |
| 103 | (*bt_message_iterator_class_can_seek_ns_from_origin_method)( |
| 104 | bt_self_message_iterator *message_iterator, |
| 105 | int64_t ns_from_origin, bt_bool *can_seek); |
| 106 | |
| 107 | typedef bt_message_iterator_class_seek_beginning_method_status |
| 108 | (*bt_message_iterator_class_seek_beginning_method)( |
| 109 | bt_self_message_iterator *message_iterator); |
| 110 | |
| 111 | typedef bt_message_iterator_class_can_seek_beginning_method_status |
| 112 | (*bt_message_iterator_class_can_seek_beginning_method)( |
| 113 | bt_self_message_iterator *message_iterator, bt_bool *can_seek); |
| 114 | |
| 115 | extern void bt_message_iterator_class_get_ref( |
| 116 | const bt_message_iterator_class *message_iterator_class); |
| 117 | |
| 118 | extern void bt_message_iterator_class_put_ref( |
| 119 | const bt_message_iterator_class *message_iterator_class); |
| 120 | |
| 121 | #define BT_MESSAGE_ITERATOR_CLASS_PUT_REF_AND_RESET(_var) \ |
| 122 | do { \ |
| 123 | bt_message_iterator_class_put_ref(_var); \ |
| 124 | (_var) = NULL; \ |
| 125 | } while (0) |
| 126 | |
| 127 | #define BT_MESSAGE_ITERATOR_CLASS_MOVE_MOVE_REF(_var_dst, _var_src) \ |
| 128 | do { \ |
| 129 | bt_message_iterator_class_put_ref(_var_dst); \ |
| 130 | (_var_dst) = (_var_src); \ |
| 131 | (_var_src) = NULL; \ |
| 132 | } while (0) |
| 133 | |
| 134 | extern bt_message_iterator_class * |
| 135 | bt_message_iterator_class_create( |
| 136 | bt_message_iterator_class_next_method next_method); |
| 137 | |
| 138 | extern bt_message_iterator_class_set_method_status |
| 139 | bt_message_iterator_class_set_initialize_method( |
| 140 | bt_message_iterator_class *message_iterator_class, |
| 141 | bt_message_iterator_class_initialize_method method); |
| 142 | |
| 143 | extern bt_message_iterator_class_set_method_status |
| 144 | bt_message_iterator_class_set_finalize_method( |
| 145 | bt_message_iterator_class *message_iterator_class, |
| 146 | bt_message_iterator_class_finalize_method method); |
| 147 | |
| 148 | extern bt_message_iterator_class_set_method_status |
| 149 | bt_message_iterator_class_set_seek_ns_from_origin_methods( |
| 150 | bt_message_iterator_class *message_iterator_class, |
| 151 | bt_message_iterator_class_seek_ns_from_origin_method seek_method, |
| 152 | bt_message_iterator_class_can_seek_ns_from_origin_method can_seek_method); |
| 153 | |
| 154 | extern bt_message_iterator_class_set_method_status |
| 155 | bt_message_iterator_class_set_seek_beginning_methods( |
| 156 | bt_message_iterator_class *message_iterator_class, |
| 157 | bt_message_iterator_class_seek_beginning_method seek_method, |
| 158 | bt_message_iterator_class_can_seek_beginning_method can_seek_method); |
| 159 | |
| 160 | #ifdef __cplusplus |
| 161 | } |
| 162 | #endif |
| 163 | |
| 164 | #endif /* BABELTRACE2_GRAPH_MESSAGE_ITERATOR_CLASS_H */ |