Class: Hornetseye::Element

Inherits:
Node show all
Defined in:
docs/multiarray/lib/multiarray/element.rb

Overview

Base class for representing native elements

Direct Known Subclasses

BOOL, Composite, FLOAT_, INDEX_, INT_, OBJECT

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#<=>, ===, #[], #[]=, #allocate, #b=, #b_with_decompose, #basetype, #between?, bool, #check_shape, #clip, coercion_bool, coercion_byte, coercion_maxint, #collect, #components, cond, #conditional, #convolve, #decompose, #dilate, dimension, #dimension, #downsample, #each, #empty?, #eq_with_multiarray, #erode, #fill!, #flip, float_scalar, floating, #fmod_with_float, #g=, #g_with_decompose, #gauss_blur, #gauss_gradient, #height, #histogram, #histogram_with_rgb, #if, #if_else, #imag=, #imag_with_decompose, indgen, #inject, #inspect, #integral, #lut, #lut_with_rgb, #mask, #matched?, #max, #mean, #memorise, #memory, #min, #normalise, #orig_to_cvmat, #orig_to_type_with_frame, #prod, #r=, #r_with_decompose, #range, #real=, #real_with_decompose, #reshape, rgb?, #rgb?, #roll, #save_dfloat, #save_dfloatrgb, #save_magick, #save_openexr, #save_sfloat, #save_sfloatrgb, #save_ubyte, #save_ubytergb, #save_uint, #save_uintrgb, #save_usint, #save_usintrgb, scalar, shape, #shape, #shift, #show, #size, #sobel, #stretch, #sum, #swap_rgb_with_scalar, #to_a, #to_cvmat, #to_magick, #to_narray, to_type, #to_type, #to_type_with_frame, #to_type_with_identity, #to_type_with_rgb, #transpose, typecode, #typecode, #unmask, #unroll, #warp, #width

Constructor Details

#initialize(value = self.class.default) ⇒ Element

Constructor initialising element with a value

Parameters:

  • value (Object) (defaults to: self.class.default)

    Initial value for element.



67
68
69
70
71
72
73
# File 'docs/multiarray/lib/multiarray/element.rb', line 67

def initialize( value = self.class.default )
  if Thread.current[ :function ].nil?
    @value = value
  else
    @value = GCCValue.new Thread.current[ :function ], value.to_s
  end
end

Class Method Details

.fetch(ptr) ⇒ Object

Retrieve element from memory

Parameters:

  • ptr (Malloc, List)

    Memory to load element from.

See Also:



31
32
33
# File 'docs/multiarray/lib/multiarray/element.rb', line 31

def fetch( ptr )
  construct *ptr.load(self)
end