babeltrace2 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/babeltrace2.gemspec +13 -0
  4. data/lib/babeltrace2.rb +49 -0
  5. data/lib/babeltrace2/error-reporting.rb +432 -0
  6. data/lib/babeltrace2/func-status.rb +26 -0
  7. data/lib/babeltrace2/graph/component-class-dev.rb +801 -0
  8. data/lib/babeltrace2/graph/component-class.rb +134 -0
  9. data/lib/babeltrace2/graph/component-descriptor-set.rb +78 -0
  10. data/lib/babeltrace2/graph/component.rb +362 -0
  11. data/lib/babeltrace2/graph/connection.rb +35 -0
  12. data/lib/babeltrace2/graph/graph.rb +523 -0
  13. data/lib/babeltrace2/graph/interrupter.rb +57 -0
  14. data/lib/babeltrace2/graph/message-iterator-class.rb +374 -0
  15. data/lib/babeltrace2/graph/message-iterator.rb +253 -0
  16. data/lib/babeltrace2/graph/message.rb +721 -0
  17. data/lib/babeltrace2/graph/port.rb +124 -0
  18. data/lib/babeltrace2/graph/private-query-executor.rb +4 -0
  19. data/lib/babeltrace2/graph/query-executor.rb +142 -0
  20. data/lib/babeltrace2/graph/self-component-class.rb +37 -0
  21. data/lib/babeltrace2/graph/self-component-port.rb +35 -0
  22. data/lib/babeltrace2/graph/self-component.rb +264 -0
  23. data/lib/babeltrace2/graph/self-message-iterator.rb +147 -0
  24. data/lib/babeltrace2/integer-range-set.rb +275 -0
  25. data/lib/babeltrace2/logging-defs.rb +19 -0
  26. data/lib/babeltrace2/logging.rb +77 -0
  27. data/lib/babeltrace2/plugin/plugin-dev.rb +335 -0
  28. data/lib/babeltrace2/plugin/plugin-loading.rb +459 -0
  29. data/lib/babeltrace2/trace-ir/clock-class.rb +258 -0
  30. data/lib/babeltrace2/trace-ir/clock-snapshot.rb +45 -0
  31. data/lib/babeltrace2/trace-ir/event-class.rb +292 -0
  32. data/lib/babeltrace2/trace-ir/event.rb +91 -0
  33. data/lib/babeltrace2/trace-ir/field-class.rb +1416 -0
  34. data/lib/babeltrace2/trace-ir/field-path.rb +123 -0
  35. data/lib/babeltrace2/trace-ir/field.rb +871 -0
  36. data/lib/babeltrace2/trace-ir/packet.rb +57 -0
  37. data/lib/babeltrace2/trace-ir/stream-class.rb +425 -0
  38. data/lib/babeltrace2/trace-ir/stream.rb +137 -0
  39. data/lib/babeltrace2/trace-ir/trace-class.rb +343 -0
  40. data/lib/babeltrace2/trace-ir/trace.rb +321 -0
  41. data/lib/babeltrace2/types.rb +667 -0
  42. data/lib/babeltrace2/util.rb +23 -0
  43. data/lib/babeltrace2/value.rb +869 -0
  44. data/lib/babeltrace2/version.rb +126 -0
  45. metadata +105 -0
@@ -0,0 +1,258 @@
1
+ module Babeltrace2
2
+ attach_function :bt_clock_class_create,
3
+ [ :bt_self_component_handle ],
4
+ :bt_clock_class_handle
5
+
6
+ attach_function :bt_clock_class_set_frequency,
7
+ [ :bt_clock_class_handle, :uint64 ],
8
+ :void
9
+
10
+ attach_function :bt_clock_class_get_frequency,
11
+ [ :bt_clock_class_handle ],
12
+ :uint64
13
+
14
+ attach_function :bt_clock_class_set_offset,
15
+ [ :bt_clock_class_handle, :int64, :uint64 ],
16
+ :void
17
+
18
+ attach_function :bt_clock_class_get_offset,
19
+ [ :bt_clock_class_handle, :pointer, :pointer],
20
+ :void
21
+
22
+ attach_function :bt_clock_class_set_precision,
23
+ [ :bt_clock_class_handle, :uint64 ],
24
+ :void
25
+
26
+ attach_function :bt_clock_class_get_precision,
27
+ [ :bt_clock_class_handle ],
28
+ :uint64
29
+
30
+ attach_function :bt_clock_class_set_origin_is_unix_epoch,
31
+ [ :bt_clock_class_handle, :bt_bool ],
32
+ :void
33
+
34
+ attach_function :bt_clock_class_origin_is_unix_epoch,
35
+ [ :bt_clock_class_handle ],
36
+ :bt_bool
37
+
38
+ BT_CLOCK_CLASS_SET_NAME_STATUS_OK = BT_FUNC_STATUS_OK
39
+ BT_CLOCK_CLASS_SET_NAME_STATUS_MEMORY_ERROR = BT_FUNC_STATUS_MEMORY_ERROR
40
+ BTClockClassSetNameStatus = enum :bt_clock_class_set_name_status,
41
+ [ :BT_CLOCK_CLASS_SET_NAME_STATUS_OK,
42
+ BT_CLOCK_CLASS_SET_NAME_STATUS_OK,
43
+ :BT_CLOCK_CLASS_SET_NAME_STATUS_MEMORY_ERROR,
44
+ BT_CLOCK_CLASS_SET_NAME_STATUS_MEMORY_ERROR ]
45
+
46
+ attach_function :bt_clock_class_set_name,
47
+ [ :bt_clock_class_handle, :string ],
48
+ :bt_clock_class_set_name_status
49
+
50
+ attach_function :bt_clock_class_get_name,
51
+ [ :bt_clock_class_handle ],
52
+ :string
53
+
54
+ BT_CLOCK_CLASS_SET_DESCRIPTION_STATUS_OK = BT_FUNC_STATUS_OK
55
+ BT_CLOCK_CLASS_SET_DESCRIPTION_STATUS_MEMORY_ERROR = BT_FUNC_STATUS_MEMORY_ERROR
56
+ BTClockClassSetDescriptionStatus = enum :bt_clock_class_set_description_status,
57
+ [ :BT_CLOCK_CLASS_SET_DESCRIPTION_STATUS_OK,
58
+ BT_CLOCK_CLASS_SET_DESCRIPTION_STATUS_OK,
59
+ :BT_CLOCK_CLASS_SET_DESCRIPTION_STATUS_MEMORY_ERROR,
60
+ BT_CLOCK_CLASS_SET_DESCRIPTION_STATUS_MEMORY_ERROR ]
61
+
62
+ attach_function :bt_clock_class_set_description,
63
+ [ :bt_clock_class_handle, :string ],
64
+ :bt_clock_class_set_description_status
65
+
66
+ attach_function :bt_clock_class_get_description,
67
+ [ :bt_clock_class_handle ],
68
+ :string
69
+
70
+ attach_function :bt_clock_class_set_uuid,
71
+ [ :bt_clock_class_handle, :bt_uuid ],
72
+ :void
73
+
74
+ attach_function :bt_clock_class_get_uuid,
75
+ [ :bt_clock_class_handle ],
76
+ :bt_uuid
77
+
78
+ attach_function :bt_clock_class_set_user_attributes,
79
+ [ :bt_clock_class_handle, :bt_value_map_handle ],
80
+ :void
81
+
82
+ attach_function :bt_clock_class_borrow_user_attributes,
83
+ [ :bt_clock_class_handle ],
84
+ :bt_value_map_handle
85
+
86
+ attach_function :bt_clock_class_borrow_user_attributes_const,
87
+ [ :bt_clock_class_handle ],
88
+ :bt_value_map_handle
89
+
90
+ BT_CLOCK_CLASS_CYCLES_TO_NS_FROM_ORIGIN_STATUS_OK = BT_FUNC_STATUS_OK
91
+ BT_CLOCK_CLASS_CYCLES_TO_NS_FROM_ORIGIN_STATUS_OVERFLOW_ERROR = BT_FUNC_STATUS_OVERFLOW_ERROR
92
+ BTClockClassCyclesToNSFromOriginStatus =
93
+ enum :bt_clock_class_cycles_to_ns_from_origin_status,
94
+ [ :BT_CLOCK_CLASS_CYCLES_TO_NS_FROM_ORIGIN_STATUS_OK,
95
+ BT_CLOCK_CLASS_CYCLES_TO_NS_FROM_ORIGIN_STATUS_OK,
96
+ :BT_CLOCK_CLASS_CYCLES_TO_NS_FROM_ORIGIN_STATUS_OVERFLOW_ERROR,
97
+ BT_CLOCK_CLASS_CYCLES_TO_NS_FROM_ORIGIN_STATUS_OVERFLOW_ERROR ]
98
+
99
+ attach_function :bt_clock_class_cycles_to_ns_from_origin,
100
+ [ :bt_clock_class_handle, :uint64, :pointer ],
101
+ :bt_clock_class_cycles_to_ns_from_origin_status
102
+
103
+ attach_function :bt_clock_class_get_ref,
104
+ [ :bt_clock_class_handle ],
105
+ :void
106
+
107
+ attach_function :bt_clock_class_put_ref,
108
+ [ :bt_clock_class_handle ],
109
+ :void
110
+
111
+ class BTClockClass < BTSharedObject
112
+ CyclesToNSFromOriginStatus = BTClockClassCyclesToNSFromOriginStatus
113
+ @get_ref = :bt_clock_class_get_ref
114
+ @put_ref = :bt_clock_class_put_ref
115
+
116
+ def initialize(handle = nil, retain: true, auto_release: true,
117
+ self_component: nil)
118
+ if handle
119
+ super(handle, retain: retain, auto_release: auto_release)
120
+ else
121
+ handle = Babeltrace2.bt_clock_class_create(self_component)
122
+ raise Babeltrace2.process_error if handle.null?
123
+ super(handle)
124
+ end
125
+ end
126
+
127
+ def set_frequency(frequency)
128
+ Babeltrace2.bt_clock_class_set_frequency(@handle, frequency)
129
+ self
130
+ end
131
+
132
+ def frequency=(frequency)
133
+ set_frequency(frequency)
134
+ frequency
135
+ end
136
+
137
+ def get_frequency
138
+ Babeltrace2.bt_clock_class_get_frequency(@handle)
139
+ end
140
+ alias frequency get_frequency
141
+
142
+ def set_offset(offset_seconds, offset_cycles)
143
+ Babeltrace2.bt_clock_class_set_offset(@handle, offset_seconds, offset_cycles)
144
+ self
145
+ end
146
+
147
+ def get_offset
148
+ ptr1 = FFI::MemoryPointer.new(:int64)
149
+ ptr2 = FFI::MemoryPointer.new(:uint64)
150
+ Babeltrace2.bt_clock_class_get_offset(@handle, ptr1, ptr2)
151
+ [ptr1.read_int64, ptr2.read_uint64]
152
+ end
153
+ alias offset get_offset
154
+
155
+ def set_precision(precision)
156
+ Babeltrace2.bt_clock_class_set_precision(@handle, precision)
157
+ self
158
+ end
159
+
160
+ def precision=(precision)
161
+ set_precision(precision)
162
+ precision
163
+ end
164
+
165
+ def get_precision
166
+ Babeltrace2.bt_clock_class_get_precision(@handle)
167
+ end
168
+ alias precision get_precision
169
+
170
+ def set_origin_is_unix_epoch(origin_is_unix_epoch)
171
+ Babeltrace2.bt_clock_class_set_origin_is_unix_epoch(
172
+ @handle, origin_is_unix_epoch ? BT_TRUE : BT_FALSE)
173
+ self
174
+ end
175
+
176
+ def origin_is_unix_epoch=(origin_is_unix_epoch)
177
+ set_origin_is_unix_epoch(origin_is_unix_epoch)
178
+ origin_is_unix_epoch
179
+ end
180
+
181
+ def origin_is_unix_epoch
182
+ Babeltrace2.bt_clock_class_origin_is_unix_epoch(@handle) != BT_FALSE
183
+ end
184
+ alias origin_is_unix_epoch? origin_is_unix_epoch
185
+
186
+ def set_name(name)
187
+ res = Babeltrace2.bt_clock_class_set_name(@handle, name)
188
+ raise Babeltrace2.process_error(res) if res != :BT_CLOCK_CLASS_SET_NAME_STATUS_OK
189
+ self
190
+ end
191
+
192
+ def name=(name)
193
+ set_name(name)
194
+ name
195
+ end
196
+
197
+ def get_name
198
+ Babeltrace2.bt_clock_class_get_name(@handle)
199
+ end
200
+ alias name get_name
201
+
202
+ def set_description(description)
203
+ res = Babeltrace2.bt_clock_class_set_description(@handle, description)
204
+ raise Babeltrace2.process_error(res) if res != :BT_CLOCK_CLASS_SET_DESCRIPTION_STATUS_OK
205
+ self
206
+ end
207
+
208
+ def description=(description)
209
+ set_description(description)
210
+ description
211
+ end
212
+
213
+ def get_description
214
+ Babeltrace2.bt_clock_class_get_description(@handle)
215
+ end
216
+ alias description get_description
217
+
218
+ def set_uuid(uuid)
219
+ Babeltrace2.bt_clock_class_set_uuid(@handle, uuid)
220
+ self
221
+ end
222
+
223
+ def uuid=(uuid)
224
+ set_uuid(uuid)
225
+ uuid
226
+ end
227
+
228
+ def get_uuid
229
+ uuid = Babeltrace2.bt_clock_class_get_uuid(@handle)
230
+ return nil if uuid.null?
231
+ uuid
232
+ end
233
+ alias uuid get_uuid
234
+
235
+ def set_user_attributes(user_attributes)
236
+ Babeltrace2.bt_clock_class_set_user_attributes(@handle, BTValue.from_value(user_attributes))
237
+ self
238
+ end
239
+
240
+ def user_attributes=(user_attributes)
241
+ set_user_attributes(user_attributes)
242
+ user_attributes
243
+ end
244
+
245
+ def get_user_attributes
246
+ handle = Babeltrace2.bt_clock_class_borrow_user_attributes(@handle)
247
+ BTValueMap.new(handle, retain: true)
248
+ end
249
+ alias user_attributes get_user_attributes
250
+
251
+ def cycles_to_ns_from_origin(value)
252
+ ptr = FFI::MemoryPointer.new(:int64)
253
+ res = Babeltrace2.bt_clock_class_cycles_to_ns_from_origin(@handle, value, ptr)
254
+ raise Babeltrace2.process_error(res) if res != :BT_CLOCK_CLASS_CYCLES_TO_NS_FROM_ORIGIN_STATUS_OK
255
+ ptr.read_int64
256
+ end
257
+ end
258
+ end
@@ -0,0 +1,45 @@
1
+ module Babeltrace2
2
+
3
+ attach_function :bt_clock_snapshot_borrow_clock_class_const,
4
+ [ :bt_clock_snapshot_handle ],
5
+ :bt_clock_class_handle
6
+
7
+ attach_function :bt_clock_snapshot_get_value,
8
+ [ :bt_clock_snapshot_handle ],
9
+ :uint64
10
+
11
+ BT_CLOCK_SNAPSHOT_GET_NS_FROM_ORIGIN_STATUS_OK = BT_FUNC_STATUS_OK
12
+ BT_CLOCK_SNAPSHOT_GET_NS_FROM_ORIGIN_STATUS_OVERFLOW_ERROR = BT_FUNC_STATUS_OVERFLOW_ERROR
13
+ BTClockSnapshotGetNSFromOriginStatus =
14
+ enum :bt_clock_snapshot_get_ns_from_origin_status,
15
+ [ :BT_CLOCK_SNAPSHOT_GET_NS_FROM_ORIGIN_STATUS_OK,
16
+ BT_CLOCK_SNAPSHOT_GET_NS_FROM_ORIGIN_STATUS_OK,
17
+ :BT_CLOCK_SNAPSHOT_GET_NS_FROM_ORIGIN_STATUS_OVERFLOW_ERROR,
18
+ BT_CLOCK_SNAPSHOT_GET_NS_FROM_ORIGIN_STATUS_OVERFLOW_ERROR ]
19
+
20
+ attach_function :bt_clock_snapshot_get_ns_from_origin,
21
+ [ :bt_clock_snapshot_handle, :pointer ],
22
+ :bt_clock_snapshot_get_ns_from_origin_status
23
+
24
+ class BTClockSnapshot < BTObject
25
+ GetNSFromOriginStatus = BTClockSnapshotGetNSFromOriginStatus
26
+ def get_clock_class
27
+ handle = Babeltrace2.bt_clock_snapshot_borrow_clock_class_const(@handle)
28
+ BTClockClass.new(handle, retain: true)
29
+ end
30
+ alias clock_class get_clock_class
31
+
32
+ def get_value
33
+ Babeltrace2.bt_clock_snapshot_get_value(@handle)
34
+ end
35
+ alias value get_value
36
+
37
+ def get_ns_from_origin
38
+ ptr = FFI::MemoryPointer.new(:int64)
39
+ res = Babeltrace2.bt_clock_snapshot_get_ns_from_origin(@handle, ptr)
40
+ raise Babeltrace2.process_error(res) if res != :BT_CLOCK_SNAPSHOT_GET_NS_FROM_ORIGIN_STATUS_OK
41
+ ptr.read_int64
42
+ end
43
+ alias ns_from_origin get_ns_from_origin
44
+ end
45
+ end
@@ -0,0 +1,292 @@
1
+ module Babeltrace2
2
+ attach_function :bt_event_class_create,
3
+ [ :bt_stream_class_handle ],
4
+ :bt_event_class_handle
5
+
6
+ attach_function :bt_event_class_create_with_id,
7
+ [ :bt_stream_class_handle, :uint64 ],
8
+ :bt_event_class_handle
9
+
10
+ attach_function :bt_event_class_borrow_stream_class,
11
+ [ :bt_event_class_handle ],
12
+ :bt_stream_class_handle
13
+
14
+ attach_function :bt_event_class_get_id,
15
+ [ :bt_event_class_handle ],
16
+ :uint64
17
+
18
+ BT_EVENT_CLASS_SET_NAME_STATUS_OK = BT_FUNC_STATUS_OK
19
+ BT_EVENT_CLASS_SET_NAME_STATUS_MEMORY_ERROR = BT_FUNC_STATUS_MEMORY_ERROR
20
+ BTEventClassSetNameStatus = enum :bt_event_class_set_name_status,
21
+ [ :BT_EVENT_CLASS_SET_NAME_STATUS_OK,
22
+ BT_EVENT_CLASS_SET_NAME_STATUS_OK,
23
+ :BT_EVENT_CLASS_SET_NAME_STATUS_MEMORY_ERROR,
24
+ BT_EVENT_CLASS_SET_NAME_STATUS_MEMORY_ERROR ]
25
+
26
+ attach_function :bt_event_class_set_name,
27
+ [ :bt_event_class_handle, :string ],
28
+ :bt_event_class_set_name_status
29
+
30
+ attach_function :bt_event_class_get_name,
31
+ [ :bt_event_class_handle ],
32
+ :string
33
+
34
+ BT_EVENT_CLASS_LOG_LEVEL_EMERGENCY = 0
35
+ BT_EVENT_CLASS_LOG_LEVEL_ALERT = 1
36
+ BT_EVENT_CLASS_LOG_LEVEL_CRITICAL = 2
37
+ BT_EVENT_CLASS_LOG_LEVEL_ERROR = 3
38
+ BT_EVENT_CLASS_LOG_LEVEL_WARNING = 4
39
+ BT_EVENT_CLASS_LOG_LEVEL_NOTICE = 5
40
+ BT_EVENT_CLASS_LOG_LEVEL_INFO = 6
41
+ BT_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM = 7
42
+ BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM = 8
43
+ BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS = 9
44
+ BT_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE = 10
45
+ BT_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT = 11
46
+ BT_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION = 12
47
+ BT_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE = 13
48
+ BT_EVENT_CLASS_LOG_LEVEL_DEBUG = 14
49
+ BTEventClassLogLevel = enum :bt_event_class_log_level,
50
+ [ :BT_EVENT_CLASS_LOG_LEVEL_EMERGENCY,
51
+ BT_EVENT_CLASS_LOG_LEVEL_EMERGENCY,
52
+ :BT_EVENT_CLASS_LOG_LEVEL_ALERT,
53
+ BT_EVENT_CLASS_LOG_LEVEL_ALERT,
54
+ :BT_EVENT_CLASS_LOG_LEVEL_CRITICAL,
55
+ BT_EVENT_CLASS_LOG_LEVEL_CRITICAL,
56
+ :BT_EVENT_CLASS_LOG_LEVEL_ERROR,
57
+ BT_EVENT_CLASS_LOG_LEVEL_ERROR,
58
+ :BT_EVENT_CLASS_LOG_LEVEL_WARNING,
59
+ BT_EVENT_CLASS_LOG_LEVEL_WARNING,
60
+ :BT_EVENT_CLASS_LOG_LEVEL_NOTICE,
61
+ BT_EVENT_CLASS_LOG_LEVEL_NOTICE,
62
+ :BT_EVENT_CLASS_LOG_LEVEL_INFO,
63
+ BT_EVENT_CLASS_LOG_LEVEL_INFO,
64
+ :BT_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM,
65
+ BT_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM,
66
+ :BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM,
67
+ BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM,
68
+ :BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS,
69
+ BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS,
70
+ :BT_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE,
71
+ BT_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE,
72
+ :BT_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT,
73
+ BT_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT,
74
+ :BT_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION,
75
+ BT_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION,
76
+ :BT_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE,
77
+ BT_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE,
78
+ :BT_EVENT_CLASS_LOG_LEVEL_DEBUG,
79
+ BT_EVENT_CLASS_LOG_LEVEL_DEBUG ]
80
+
81
+ attach_function :bt_event_class_set_log_level,
82
+ [ :bt_event_class_handle, :bt_event_class_log_level ],
83
+ :void
84
+
85
+ attach_function :bt_event_class_get_log_level,
86
+ [ :bt_event_class_handle, :pointer ],
87
+ :bt_property_availability
88
+
89
+ BT_EVENT_CLASS_SET_EMF_URI_STATUS_OK = BT_FUNC_STATUS_OK
90
+ BT_EVENT_CLASS_SET_EMF_URI_STATUS_MEMORY_ERROR = BT_FUNC_STATUS_MEMORY_ERROR
91
+ BTEventClassSetEmfUriStatus = enum :bt_event_class_set_emf_uri_status,
92
+ [ :BT_EVENT_CLASS_SET_EMF_URI_STATUS_OK,
93
+ BT_EVENT_CLASS_SET_EMF_URI_STATUS_OK,
94
+ :BT_EVENT_CLASS_SET_EMF_URI_STATUS_MEMORY_ERROR,
95
+ BT_EVENT_CLASS_SET_EMF_URI_STATUS_MEMORY_ERROR ]
96
+
97
+ attach_function :bt_event_class_set_emf_uri,
98
+ [ :bt_event_class_handle, :string ],
99
+ :bt_event_class_set_emf_uri_status
100
+
101
+ attach_function :bt_event_class_get_emf_uri,
102
+ [ :bt_event_class_handle ],
103
+ :string
104
+
105
+ BT_EVENT_CLASS_SET_FIELD_CLASS_STATUS_OK = BT_FUNC_STATUS_OK
106
+ BT_EVENT_CLASS_SET_FIELD_CLASS_STATUS_MEMORY_ERROR = BT_FUNC_STATUS_MEMORY_ERROR
107
+ BTEventClassSetFieldClassStatus = enum :bt_event_class_set_field_class_status,
108
+ [ :BT_EVENT_CLASS_SET_FIELD_CLASS_STATUS_OK,
109
+ BT_EVENT_CLASS_SET_FIELD_CLASS_STATUS_OK,
110
+ :BT_EVENT_CLASS_SET_FIELD_CLASS_STATUS_MEMORY_ERROR,
111
+ BT_EVENT_CLASS_SET_FIELD_CLASS_STATUS_MEMORY_ERROR ]
112
+
113
+ attach_function :bt_event_class_set_payload_field_class,
114
+ [ :bt_event_class_handle, :bt_field_class_handle ],
115
+ :bt_event_class_set_field_class_status
116
+
117
+ attach_function :bt_event_class_borrow_payload_field_class,
118
+ [ :bt_event_class_handle ],
119
+ :bt_field_class_handle
120
+
121
+ attach_function :bt_event_class_borrow_payload_field_class_const,
122
+ [ :bt_event_class_handle ],
123
+ :bt_field_class_handle
124
+
125
+ attach_function :bt_event_class_set_specific_context_field_class,
126
+ [ :bt_event_class_handle, :bt_field_class_handle ],
127
+ :bt_event_class_set_field_class_status
128
+
129
+ attach_function :bt_event_class_borrow_specific_context_field_class,
130
+ [ :bt_event_class_handle ],
131
+ :bt_field_class_handle
132
+
133
+ attach_function :bt_event_class_borrow_specific_context_field_class_const,
134
+ [ :bt_event_class_handle ],
135
+ :bt_field_class_handle
136
+
137
+ attach_function :bt_event_class_set_user_attributes,
138
+ [ :bt_event_class_handle, :bt_value_map_handle ],
139
+ :void
140
+
141
+ attach_function :bt_event_class_borrow_user_attributes,
142
+ [ :bt_event_class_handle ],
143
+ :bt_value_map_handle
144
+
145
+ attach_function :bt_event_class_borrow_user_attributes_const,
146
+ [ :bt_event_class_handle ],
147
+ :bt_value_map_handle
148
+
149
+ attach_function :bt_event_class_get_ref,
150
+ [ :bt_event_class_handle ],
151
+ :void
152
+
153
+ attach_function :bt_event_class_put_ref,
154
+ [ :bt_event_class_handle ],
155
+ :void
156
+
157
+ class BTEventClass < BTSharedObject
158
+ SetNameStatus = BTEventClassSetNameStatus
159
+ LogLevel = BTEventClassLogLevel
160
+ SetEmfUriStatus = BTEventClassSetEmfUriStatus
161
+ SetFieldClassStatus = BTEventClassSetFieldClassStatus
162
+ @get_ref = :bt_event_class_get_ref
163
+ @put_ref = :bt_event_class_put_ref
164
+
165
+ def initialize(handle = nil, retain: true, auto_release: true,
166
+ stream_class: nil, id: nil)
167
+ if handle
168
+ super(handle, retain: retain, auto_release: auto_release)
169
+ else
170
+ handle = if id
171
+ Babeltrace2.bt_event_class_create_with_id(stream_class, id)
172
+ else
173
+ Babeltrace2.bt_event_class_create(stream_class)
174
+ end
175
+ raise Babeltrace2.process_error if handle.null?
176
+ super(handle)
177
+ end
178
+ end
179
+
180
+ def get_stream_class
181
+ handle = Babeltrace2.bt_event_class_borrow_stream_class(@handle)
182
+ BTStreamClass.new(handle, retain: true)
183
+ end
184
+ alias stream_class get_stream_class
185
+
186
+ def get_id
187
+ Babeltrace2.bt_event_class_get_id(@handle)
188
+ end
189
+ alias id get_id
190
+
191
+ def set_name(name)
192
+ res = Babeltrace2.bt_event_class_set_name(@handle, name)
193
+ raise Babeltrace2.process_error(res) if res != :BT_EVENT_CLASS_SET_NAME_STATUS_OK
194
+ self
195
+ end
196
+
197
+ def name=(name)
198
+ set_name(name)
199
+ name
200
+ end
201
+
202
+ def get_name
203
+ Babeltrace2.bt_event_class_get_name(@handle)
204
+ end
205
+ alias name get_name
206
+
207
+ def set_log_level(log_level)
208
+ Babeltrace2.bt_event_class_set_log_level(@handle, log_level)
209
+ self
210
+ end
211
+
212
+ def log_level=(log_level)
213
+ set_log_level(log_level)
214
+ log_level
215
+ end
216
+
217
+ def get_log_level
218
+ ptr = FFI::MemoryPointer.new(:int)
219
+ res = Babeltrace2.bt_event_class_get_log_level(@handle, ptr)
220
+ return nil if res == :BT_PROPERTY_AVAILABILITY_NOT_AVAILABLE
221
+ BTEventClassLogLevel.from_native(ptr.read_int, nil)
222
+ end
223
+ alias log_level get_log_level
224
+
225
+ def set_emf_uri(emf_uri)
226
+ res = Babeltrace2.bt_event_class_set_emf_uri(@handle, emf_uri)
227
+ raise Babeltrace2.process_error(res) if res != :BT_EVENT_CLASS_SET_EMF_URI_STATUS_OK
228
+ self
229
+ end
230
+
231
+ def emf_uri=(emf_uri)
232
+ set_emf_uri(emf_uri)
233
+ emf_uri
234
+ end
235
+
236
+ def get_emf_uri
237
+ Babeltrace2.bt_event_class_get_emf_uri(@handle)
238
+ end
239
+ alias emf_uri get_emf_uri
240
+
241
+ def set_payload_field_class(field_class)
242
+ res = Babeltrace2.bt_event_class_set_payload_field_class(@handle, field_class)
243
+ raise Babeltrace2.process_error(res) if res != :BT_EVENT_CLASS_SET_FIELD_CLASS_STATUS_OK
244
+ self
245
+ end
246
+
247
+ def payload_field_class=(field_class)
248
+ set_payload_field_class(field_class)
249
+ field_class
250
+ end
251
+
252
+ def get_payload_field_class
253
+ handle = Babeltrace2.bt_event_class_borrow_payload_field_class(@handle)
254
+ return nil if handle.null?
255
+ BTFieldClass.from_handle(handle)
256
+ end
257
+ alias payload_field_class get_payload_field_class
258
+
259
+ def set_specific_context_field_class(field_class)
260
+ res = Babeltrace2.bt_event_class_set_specific_context_field_class(@handle, field_class)
261
+ raise Babeltrace2.process_error(res) if res != :BT_EVENT_CLASS_SET_FIELD_CLASS_STATUS_OK
262
+ self
263
+ end
264
+
265
+ def specific_context_field_class=(field_class)
266
+ set_specific_context_field_class(field_class)
267
+ field_class
268
+ end
269
+
270
+ def get_specific_context_field_class
271
+ handle = Babeltrace2.bt_event_class_borrow_specific_context_field_class(@handle)
272
+ return nil if handle.null?
273
+ BTFieldClass.from_handle(handle)
274
+ end
275
+ alias specific_context_field_class get_specific_context_field_class
276
+
277
+ def set_user_attributes(user_attributes)
278
+ Babeltrace2.bt_event_class_set_user_attributes(@handle, BTValue.from_value(user_attributes))
279
+ self
280
+ end
281
+
282
+ def user_attributes=(user_attributes)
283
+ set_user_attributes(user_attributes)
284
+ user_attributes
285
+ end
286
+
287
+ def get_user_attributes
288
+ BTValueMap.new(Babeltrace2.bt_event_class_borrow_user_attributes(@handle), retain: true)
289
+ end
290
+ alias user_attributes get_user_attributes
291
+ end
292
+ end