Class: Sigma::DataInputs

Inherits:
Object
  • Object
show all
Extended by:
FFI::Library
Defined in:
lib/sigma/data_input.rb

Overview

An ordered collection of DataInput

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pointerObject

Returns the value of attribute pointer.



66
67
68
# File 'lib/sigma/data_input.rb', line 66

def pointer
  @pointer
end

Class Method Details

.createDataInputs

Create an empty collection

Returns:



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.

Parameters:

  • pointer (FFI::MemoryPointer)

Returns:



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

Parameters:



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

Returns:



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

#lenInteger

Get length of DataInputs

Returns:

  • (Integer)


87
88
89
# File 'lib/sigma/data_input.rb', line 87

def len
  ergo_lib_data_inputs_len(self.pointer)
end