Class: Sigma::UnsignedInputs
- Inherits:
-
Object
- Object
- Sigma::UnsignedInputs
- Extended by:
- FFI::Library
- Defined in:
- lib/sigma/input.rb
Overview
An ordered collection of UnsignedInput
Instance Attribute Summary collapse
-
#pointer ⇒ Object
Returns the value of attribute pointer.
Class Method Summary collapse
-
.create ⇒ UnsignedInputs
Create an empty collection.
-
.with_raw_pointer(unread_pointer) ⇒ UnsignedInputs
Takes ownership of an existing UnsignedInputs Pointer.
Instance Method Summary collapse
-
#add(unsigned_input) ⇒ Object
Add to collection.
-
#get(index) ⇒ UnsignedInput?
Get item at specified index or return nil if no item exists.
-
#len ⇒ Integer
Get length of collection.
Instance Attribute Details
#pointer ⇒ Object
Returns the value of attribute pointer.
247 248 249 |
# File 'lib/sigma/input.rb', line 247 def pointer @pointer end |
Class Method Details
.create ⇒ UnsignedInputs
Create an empty collection
259 260 261 262 263 264 |
# File 'lib/sigma/input.rb', line 259 def self.create pointer = FFI::MemoryPointer.new(:pointer) ergo_lib_unsigned_inputs_new(pointer) init(pointer) end |
.with_raw_pointer(unread_pointer) ⇒ UnsignedInputs
Note:
A user of sigma_rb generally does not need to call this function
Takes ownership of an existing UnsignedInputs Pointer.
253 254 255 |
# File 'lib/sigma/input.rb', line 253 def self.with_raw_pointer(unread_pointer) init(unread_pointer) end |
Instance Method Details
#add(unsigned_input) ⇒ Object
Add to collection
274 275 276 |
# File 'lib/sigma/input.rb', line 274 def add(unsigned_input) ergo_lib_unsigned_inputs_add(unsigned_input.pointer, self.pointer) end |
#get(index) ⇒ UnsignedInput?
Get item at specified index or return nil if no item exists
281 282 283 284 285 286 287 288 289 290 |
# File 'lib/sigma/input.rb', line 281 def get(index) pointer = FFI::MemoryPointer.new(:pointer) res = ergo_lib_unsigned_inputs_get(self.pointer, index, pointer) Util.check_error!(res[:error]) if res[:is_some] Sigma::UnsignedInput.with_raw_pointer(pointer) else nil end end |
#len ⇒ Integer
Get length of collection
268 269 270 |
# File 'lib/sigma/input.rb', line 268 def len ergo_lib_unsigned_inputs_len(self.pointer) end |