Class: RedShift::Library::BufferAttribute

Inherits:
CShadow::CNativeAttribute
  • Object
show all
Defined in:
lib/redshift/target/c/flow/buffer.rb

Overview

An embedded struct that holds a pointer ptr to an externally stored array of doubles of length len.

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ BufferAttribute

Returns a new instance of BufferAttribute.



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/redshift/target/c/flow/buffer.rb', line 20

def initialize(*args)
  super
  owner_class.shadow_library_include_file.include "buffer.h"
  
  @reader = "result = rs_buffer_exhale_array(&shadow->#{@cvar})"
  @writer = "rs_buffer_inhale_array(&shadow->#{@cvar}, arg)"
  @dump = "rb_ary_push(result, rs_buffer_exhale_array(&shadow->#{@cvar}))"
  @load =
    "rs_buffer_inhale_array(&shadow->#{@cvar}, rb_ary_shift(from_array))"
  @free = "free(shadow->#{@cvar}.ptr)"
end