Class: Sigma::ContextExtension

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

Overview

User-defined variables to be put into context

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pointerObject

Returns the value of attribute pointer.



15
16
17
# File 'lib/sigma/context_extension.rb', line 15

def pointer
  @pointer
end

Class Method Details

.createContextExtension

Creates an empty ContextExtension

Returns:



19
20
21
22
23
# File 'lib/sigma/context_extension.rb', line 19

def self.create
  pointer = FFI::MemoryPointer.new(:pointer)
  ergo_lib_context_extension_empty(pointer)
  init(pointer) 
end

.with_raw_pointer(pointer) ⇒ ContextExtension

Note:

A user of sigma_rb generally does not need to call this function

Takes ownership of an existing ContextExtension Pointer.

Parameters:

  • pointer (FFI::MemoryPointer)

Returns:



30
31
32
# File 'lib/sigma/context_extension.rb', line 30

def self.with_raw_pointer(pointer)
  init(pointer)
end

Instance Method Details

#get_keysArray<uint8>

Get all keys in the map

Returns:

  • (Array<uint8>)


36
37
38
39
40
41
# File 'lib/sigma/context_extension.rb', line 36

def get_keys
  ce_len = ergo_lib_context_extension_len(self.pointer)
  b_ptr = FFI::MemoryPointer.new(:uint8, ce_len)
  ergo_lib_context_extension_keys(self.pointer, b_ptr)
  b_ptr.get_array_of_uint8(0, ce_len) 
end