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, #dump, from_ptr, #hash, #kind, #to_s
Methods included from BindingClass
Constructor Details
#initialize(overloaded, size = 0) ⇒ VectorType
Create a new vector type from a pointer or a type.
326 327 328 329 330 331 332 333 334 335 336 337 |
# File 'lib/rltk/cg/type.rb', line 326 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.
340 341 342 |
# File 'lib/rltk/cg/type.rb', line 340 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.
345 346 347 |
# File 'lib/rltk/cg/type.rb', line 345 def size Bindings.get_vector_size(@ptr) end |