Class: RLTK::CG::SimpleAggregateType Abstract

Inherits:
AggregateType show all
Includes:
Filigree::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 inherited from Type

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

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.



283
284
285
286
287
288
289
290
291
292
293
294
# File 'lib/rltk/cg/type.rb', line 283

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.



297
298
299
# File 'lib/rltk/cg/type.rb', line 297

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