Class: BOAST::Sizet
Instance Attribute Summary collapse
-
#signed ⇒ Object
readonly
Returns the value of attribute signed.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#vector_length ⇒ Object
readonly
Returns the value of attribute vector_length.
Instance Method Summary collapse
- #copy(options = {}) ⇒ Object
- #decl ⇒ Object
-
#initialize(hash = {}) ⇒ Sizet
constructor
A new instance of Sizet.
- #signed? ⇒ Boolean
- #suffix ⇒ Object
- #to_hash ⇒ Object
Methods inherited from DataType
Methods included from PrivateStateAccessor
private_boolean_state_accessor, private_state_accessor
Constructor Details
#initialize(hash = {}) ⇒ Sizet
Returns a new instance of Sizet.
19 20 21 22 23 24 25 |
# File 'lib/BOAST/DataTypes.rb', line 19 def initialize(hash={}) if hash[:signed] != nil then @signed = hash[:signed] end @size = nil @vector_length = 1 end |
Instance Attribute Details
#signed ⇒ Object (readonly)
Returns the value of attribute signed.
15 16 17 |
# File 'lib/BOAST/DataTypes.rb', line 15 def signed @signed end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
16 17 18 |
# File 'lib/BOAST/DataTypes.rb', line 16 def size @size end |
#vector_length ⇒ Object (readonly)
Returns the value of attribute vector_length.
17 18 19 |
# File 'lib/BOAST/DataTypes.rb', line 17 def vector_length @vector_length end |
Instance Method Details
#copy(options = {}) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/BOAST/DataTypes.rb', line 31 def copy(={}) hash = to_hash .each { |k,v| hash[k] = v } return Sizet::new(hash) end |
#decl ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/BOAST/DataTypes.rb', line 39 def decl return "integer(kind=#{get_default_int_size})" if lang == FORTRAN if not @signed then return "size_t" if [C, CL, CUDA].include?( lang ) else return "ptrdiff_t" if [C, CL, CUDA].include?( lang ) end end |
#signed? ⇒ Boolean
48 49 50 |
# File 'lib/BOAST/DataTypes.rb', line 48 def signed? return !!signed end |
#suffix ⇒ Object
52 53 54 55 56 57 58 59 |
# File 'lib/BOAST/DataTypes.rb', line 52 def suffix s = "" # if [C, CL, CUDA].include?( lang ) then # s += "U" if not @signed # s += "LL" if @size == 8 # end return s end |
#to_hash ⇒ Object
27 28 29 |
# File 'lib/BOAST/DataTypes.rb', line 27 def to_hash return { :signed => @signed } end |