Class: Hdf5::H5Datatype
Overview
Object for wrapping an HD5 datatype, which contains information about the type and makeup of an individual element of the dataset, which may be a float or integer, or may be a vast compound type
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #h5_class ⇒ Object
-
#initialize(id) ⇒ H5Datatype
constructor
A new instance of H5Datatype.
-
#is_complex? ⇒ Boolean
We assume that a compound datatype with two floating point members is a complex number.
-
#member_types ⇒ Object
An array of datatypes of the members of a compound datatype.
-
#nmembers ⇒ Object
The number of members in a compound datatype.
Constructor Details
#initialize(id) ⇒ H5Datatype
Returns a new instance of H5Datatype.
311 312 313 314 |
# File 'lib/hdf5.rb', line 311 def initialize(id) ObjectSpace.define_finalizer(self){H5Datatype.basic_close(id)} @id = id end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
310 311 312 |
# File 'lib/hdf5.rb', line 310 def id @id end |
Instance Method Details
#h5_class ⇒ Object
315 316 317 |
# File 'lib/hdf5.rb', line 315 def h5_class basic_get_class(@id) end |
#is_complex? ⇒ Boolean
We assume that a compound datatype with two floating point members is a complex number. This may want to be revisisted…
324 325 326 |
# File 'lib/hdf5.rb', line 324 def is_complex? nmembers == 2 and member_types.map{|t| t.h5_class} == [:h5t_float, :h5t_float] end |
#member_types ⇒ Object
An array of datatypes of the members of a compound datatype
328 329 330 |
# File 'lib/hdf5.rb', line 328 def member_types nmembers.times.map{|i| self.class.new(basic_get_member_type(@id, i))} end |
#nmembers ⇒ Object
The number of members in a compound datatype
319 320 321 |
# File 'lib/hdf5.rb', line 319 def nmembers basic_get_nmembers(@id) end |