Class: Sigma::DataInputs
- Inherits:
-
Object
- Object
- Sigma::DataInputs
- Extended by:
- FFI::Library
- Defined in:
- lib/sigma/data_input.rb
Overview
An ordered collection of DataInput
Instance Attribute Summary collapse
-
#pointer ⇒ Object
Returns the value of attribute pointer.
Class Method Summary collapse
-
.create ⇒ DataInputs
Create an empty collection.
-
.with_raw_pointer(unread_pointer) ⇒ DataInputs
Takes ownership of an existing DataInputs Pointer.
Instance Method Summary collapse
-
#add(data_input) ⇒ Object
Add a DataInput.
-
#get(index) ⇒ DataInput?
Get item at specified index or return nil if no item exists.
-
#len ⇒ Integer
Get length of DataInputs.
Instance Attribute Details
#pointer ⇒ Object
Returns the value of attribute pointer.
66 67 68 |
# File 'lib/sigma/data_input.rb', line 66 def pointer @pointer end |
Class Method Details
.create ⇒ DataInputs
Create an empty collection
78 79 80 81 82 83 |
# File 'lib/sigma/data_input.rb', line 78 def self.create pointer = FFI::MemoryPointer.new(:pointer) ergo_lib_data_inputs_new(pointer) init(pointer) end |
.with_raw_pointer(unread_pointer) ⇒ DataInputs
Note:
A user of sigma_rb generally does not need to call this function
Takes ownership of an existing DataInputs Pointer.
72 73 74 |
# File 'lib/sigma/data_input.rb', line 72 def self.with_raw_pointer(unread_pointer) init(unread_pointer) end |
Instance Method Details
#add(data_input) ⇒ Object
Add a DataInput
93 94 95 |
# File 'lib/sigma/data_input.rb', line 93 def add(data_input) ergo_lib_data_inputs_add(data_input.pointer, self.pointer) end |
#get(index) ⇒ DataInput?
Get item at specified index or return nil if no item exists
100 101 102 103 104 105 106 107 108 109 |
# File 'lib/sigma/data_input.rb', line 100 def get(index) pointer = FFI::MemoryPointer.new(:pointer) res = ergo_lib_data_inputs_get(self.pointer, index, pointer) Util.check_error!(res[:error]) if res[:is_some] Sigma::DataInput.with_raw_pointer(pointer) else nil end end |
#len ⇒ Integer
Get length of DataInputs
87 88 89 |
# File 'lib/sigma/data_input.rb', line 87 def len ergo_lib_data_inputs_len(self.pointer) end |