Class: Babeltrace2::BTFieldClass
Defined Under Namespace
Modules: Enumeration
Classes: Array, BitArray, Bool, Integer, Option, Real, String, Structure, Variant
Constant Summary
collapse
- TYPE_MAP =
{}
- IntegerUnsigned =
BTFieldClass::Integer::Unsigned
- IntegerSigned =
BTFieldClass::Integer::Signed
- RealSinglePrecision =
BTFieldClass::Real::SinglePrecision
- RealDoublePrecision =
BTFieldClass::Real::DoublePrecision
Instance Attribute Summary
Attributes inherited from BTObject
#handle
Class Method Summary
collapse
Instance Method Summary
collapse
inherited, #initialize
Methods inherited from BTObject
#==, #initialize, #to_ptr
Class Method Details
.from_h(trace_class, h, stream_class_h = nil) ⇒ Object
184
185
186
187
|
# File 'lib/babeltrace2/trace-ir/field-class.rb', line 184
def self.from_h(trace_class, h, stream_class_h = nil)
Babeltrace2.const_get(snake_case_to_class(h[:type])).from_h(
trace_class, h, stream_class_h)
end
|
.from_handle(handle, retain: true, auto_release: true) ⇒ Object
143
144
145
146
147
148
|
# File 'lib/babeltrace2/trace-ir/field-class.rb', line 143
def self.from_handle(handle, retain: true, auto_release: true)
clss = TYPE_MAP[Babeltrace2.bt_field_class_get_type(handle)]
raise "unsupported field class type" unless clss
handle = clss[0].new(handle)
clss[1].new(handle, retain: retain, auto_release: auto_release)
end
|
Instance Method Details
#from_h(h) ⇒ Object
189
190
191
192
|
# File 'lib/babeltrace2/trace-ir/field-class.rb', line 189
def from_h(h)
self.user_attributes = h[:user_attributes] if h[:user_attributes]
self
end
|
#get_type ⇒ Object
Also known as:
type
150
151
152
|
# File 'lib/babeltrace2/trace-ir/field-class.rb', line 150
def get_type
Babeltrace2.bt_field_class_get_type(@handle)
end
|
#get_user_attributes ⇒ Object
Also known as:
user_attributes
172
173
174
|
# File 'lib/babeltrace2/trace-ir/field-class.rb', line 172
def get_user_attributes
BTValueMap.new(Babeltrace2.bt_field_class_borrow_user_attributes(@handle), retain: true)
end
|
#set_user_attributes(user_attributes) ⇒ Object
161
162
163
164
165
|
# File 'lib/babeltrace2/trace-ir/field-class.rb', line 161
def set_user_attributes(user_attributes)
bt_user_attributes = BTValue.from_value(user_attributes)
Babeltrace2.bt_field_class_set_user_attributes(@handle, bt_user_attributes)
self
end
|
#to_h ⇒ Object
177
178
179
180
181
182
|
# File 'lib/babeltrace2/trace-ir/field-class.rb', line 177
def to_h
res = { type: class_snake_case_name }
user_attributes_value = user_attributes.value
res[:user_attributes] = user_attributes_value if !user_attributes_value.empty?
res
end
|
#type_is(other_type) ⇒ Object
Also known as:
type_is?, type?
155
156
157
|
# File 'lib/babeltrace2/trace-ir/field-class.rb', line 155
def type_is(other_type)
(type & other_type) == other_type
end
|
#user_attributes=(user_attributes) ⇒ Object
167
168
169
170
|
# File 'lib/babeltrace2/trace-ir/field-class.rb', line 167
def user_attributes=(user_attributes)
set_user_attributes(user_attributes)
user_attributes
end
|