Class: RLTK::CG::SimpleAggregateType Abstract

Inherits:
AggregateType show all
Includes:
AbstractClass
Defined in:
lib/rltk/cg/type.rb

Overview

This class is abstract.

ArrayType and PointerType inherit from this class so they can share a constructor.

Direct Known Subclasses

ArrayType, PointerType

Instance Attribute Summary

Attributes included from BindingClass

#ptr

Instance Method Summary collapse

Methods included from AbstractClass

included

Methods inherited from Type

#allignment, #context, from_ptr, #hash, #kind, #size

Methods included from BindingClass

#==

Constructor Details

#initialize(overloaded, size_or_address_space = 0) ⇒ SimpleAggregateType

Used to initialize ArrayTypes and PointerTypes.

Parameters:

  • overloaded (FFI::Pointer, Type)

    Pointer to an existing aggregate type or a Type object that describes the objects that will be stored in an aggregate type.



239
240
241
242
243
244
245
246
247
248
249
250
# File 'lib/rltk/cg/type.rb', line 239

def initialize(overloaded, size_or_address_space = 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_or_address_space)
	end
end

Instance Method Details

#element_typeType

Returns Type of objects stored inside this aggregate.

Returns:

  • (Type)

    Type of objects stored inside this aggregate.



253
254
255
# File 'lib/rltk/cg/type.rb', line 253

def element_type
	@element_type ||= Type.from_ptr(Bindings.get_element_type(@ptr))
end