Class: BOAST::Sizet

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}) ⇒ Sizet

Returns a new instance of Sizet.



11
12
13
14
15
16
17
# File 'lib/BOAST/DataTypes.rb', line 11

def initialize(hash={})
  if hash[:signed] != nil then
    @signed = hash[:signed]
  end
  @size = nil
  @vector_length = 1
end

Instance Attribute Details

#signedObject (readonly)

Returns the value of attribute signed.



8
9
10
# File 'lib/BOAST/DataTypes.rb', line 8

def signed
  @signed
end

#sizeObject (readonly)

Returns the value of attribute size.



9
10
11
# File 'lib/BOAST/DataTypes.rb', line 9

def size
  @size
end

#vector_lengthObject (readonly)

Returns the value of attribute vector_length.



10
11
12
# File 'lib/BOAST/DataTypes.rb', line 10

def vector_length
  @vector_length
end

Class Method Details

.parens(*args, &block) ⇒ Object



4
5
6
# File 'lib/BOAST/DataTypes.rb', line 4

def self.parens(*args,&block)
  return Variable::new(args[0], self, *args[1..-1], &block)
end

Instance Method Details

#copy(options = {}) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/BOAST/DataTypes.rb', line 23

def copy(options={})
  hash = self.to_hash
  options.each { |k,v|
    hash[k] = v
  }
  return Sizet::new(hash)
end

#declObject



31
32
33
34
35
36
37
38
# File 'lib/BOAST/DataTypes.rb', line 31

def decl
  return "integer(kind=#{BOAST::get_default_int_size})" if BOAST::get_lang == FORTRAN
  if not @signed then
    return "size_t" if [C, CL, CUDA].include?( BOAST::get_lang )
  else
    return "ptrdiff_t" if [C, CL, CUDA].include?( BOAST::get_lang )
  end
end

#to_hashObject



19
20
21
# File 'lib/BOAST/DataTypes.rb', line 19

def to_hash
  return { :signed => @signed }
end