Class: OMX::OMXAttr

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

Overview

A Class to read and return the OMX version and shape (number of zones) attribute

Defined Under Namespace

Classes: InvalidFile

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ OMXAttr



190
191
192
# File 'lib/OpenMatriX.rb', line 190

def initialize(file)
  @id = file.id
end

Instance Method Details

#getVersionObject

A function to return the OMX Version number

Raises:



195
196
197
198
199
200
201
202
# File 'lib/OpenMatriX.rb', line 195

def getVersion()
  aid = basic_openattr(@id,"OMX_VERSION")
  attrOut = FFI::MemoryPointer.new(H5Types.hsize_t)
  sv = get_type(aid)
  oo = basic_readattr(aid,sv,attrOut)
  raise InvalidFile.new("OMX_VERSION Attribute not found") if oo < 0
  return(attrOut.read_string())
end

#getZonesObject

A function to return the number of zones

Raises:



205
206
207
208
209
210
211
212
# File 'lib/OpenMatriX.rb', line 205

def getZones()
  aid = basic_openattr(@id,"SHAPE")
  attrOut = FFI::MemoryPointer.new(H5Types.hsize_t)
  sv = get_type(aid)
  oo = basic_readattr(aid,sv,attrOut)
  raise InvalidFile.new("SHAPE Attribute not found") if oo < 0
  return(attrOut.read_int())
end