Class: RLTK::CG::VectorType
Overview
A type used to represent vector operations (SIMD). This is NOT an aggregate type.
Instance Attribute Summary
Attributes included from BindingClass
Instance Method Summary collapse
-
#element_type ⇒ Type
Type of object stored inside this vector.
-
#initialize(overloaded, size = 0) ⇒ VectorType
constructor
Create a new vector type from a pointer or a type.
-
#size ⇒ Integer
(also: #length)
Number of objects in this vector type.
Methods inherited from Type
#allignment, #context, from_ptr, #hash, #kind
Methods included from AbstractClass
Methods included from BindingClass
Constructor Details
#initialize(overloaded, size = 0) ⇒ VectorType
Create a new vector type from a pointer or a type.
282 283 284 285 286 287 288 289 290 291 292 293 |
# File 'lib/rltk/cg/type.rb', line 282 def initialize(overloaded, size = 0) @ptr = case overloaded when FFI::Pointer overloaded else @element_type = check_cg_type(overloaded, Type, 'overloaded') bname = Bindings.get_bname(self.class.short_name) Bindings.send(bname, @element_type, size) end end |
Instance Method Details
#element_type ⇒ Type
Returns Type of object stored inside this vector.
296 297 298 |
# File 'lib/rltk/cg/type.rb', line 296 def element_type @element_type ||= Type.from_ptr(Bindings.get_element_type(@ptr)) end |
#size ⇒ Integer Also known as: length
Returns Number of objects in this vector type.
301 302 303 |
# File 'lib/rltk/cg/type.rb', line 301 def size Bindings.get_vector_size(@ptr) end |