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.
Class Method Summary collapse
Instance Method Summary collapse
- #copy(options = {}) ⇒ Object
- #decl ⇒ Object
-
#initialize(hash = {}) ⇒ Sizet
constructor
A new instance of Sizet.
- #to_hash ⇒ Object
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
#signed ⇒ Object (readonly)
Returns the value of attribute signed.
8 9 10 |
# File 'lib/BOAST/DataTypes.rb', line 8 def signed @signed end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
9 10 11 |
# File 'lib/BOAST/DataTypes.rb', line 9 def size @size end |
#vector_length ⇒ Object (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
Instance Method Details
#copy(options = {}) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/BOAST/DataTypes.rb', line 23 def copy(={}) hash = self.to_hash .each { |k,v| hash[k] = v } return Sizet::new(hash) end |
#decl ⇒ Object
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_hash ⇒ Object
19 20 21 |
# File 'lib/BOAST/DataTypes.rb', line 19 def to_hash return { :signed => @signed } end |