Class: BOAST::CustomType

Inherits:
DataType show all
Defined in:
lib/BOAST/DataTypes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DataType

inherited

Methods included from PrivateStateAccessor

private_boolean_state_accessor, private_state_accessor

Constructor Details

#initialize(hash = {}) ⇒ CustomType

Returns a new instance of CustomType.



346
347
348
349
350
351
352
353
# File 'lib/BOAST/DataTypes.rb', line 346

def initialize(hash={})
  @name = hash[:type_name]
  @size = hash[:size]
  @size = 0 if @size.nil?
  @vector_length = hash[:vector_length]
  @vector_length = 1 if @vector_length.nil?
  @total_size = @vector_length*@size
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



345
346
347
# File 'lib/BOAST/DataTypes.rb', line 345

def name
  @name
end

#sizeObject (readonly)

Returns the value of attribute size.



345
346
347
# File 'lib/BOAST/DataTypes.rb', line 345

def size
  @size
end

#vector_lengthObject (readonly)

Returns the value of attribute vector_length.



345
346
347
# File 'lib/BOAST/DataTypes.rb', line 345

def vector_length
  @vector_length
end

Instance Method Details

#declObject



355
356
357
# File 'lib/BOAST/DataTypes.rb', line 355

def decl
  return "#{@name}" if [C, CL, CUDA].include?( lang )
end