Class: Hdf5::H5Datatype

Inherits:
Object
  • Object
show all
Extended by:
FFI::Library
Defined in:
lib/hdf5.rb

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

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ H5Datatype

Returns a new instance of H5Datatype.



305
306
307
# File 'lib/hdf5.rb', line 305

def initialize(id)
  @id = id
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



304
305
306
# File 'lib/hdf5.rb', line 304

def id
  @id
end

Instance Method Details

#h5_classObject



308
309
310
# File 'lib/hdf5.rb', line 308

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…

Returns:

  • (Boolean)


317
318
319
# File 'lib/hdf5.rb', line 317

def is_complex?
  nmembers == 2 and member_types.map{|t| t.h5_class} == [:h5t_float, :h5t_float]
end

#member_typesObject

An array of datatypes of the members of a compound datatype



321
322
323
# File 'lib/hdf5.rb', line 321

def member_types
  nmembers.times.map{|i| self.class.new(basic_get_member_type(@id, i))}
end

#nmembersObject

The number of members in a compound datatype



312
313
314
# File 'lib/hdf5.rb', line 312

def nmembers
  basic_get_nmembers(@id)
end