Module: CVFFI::VectorMath::NativeVectors::ClassMethods

Defined in:
lib/opencv-ffi-ext/vector_math.rb

Instance Method Summary collapse

Instance Method Details

#define_vector(type, length, name = nil) ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'lib/opencv-ffi-ext/vector_math.rb', line 20

def define_vector( type, length, name = nil )
  name = name || "#{type}_#{length}_vector"
  class_eval <<-eos
  class #{name} < NiceFFI::Struct
      layout :d, [:#{type}, #{length}]
      def length; #{length}; end
  end
  eos
  name
end