Class: OMX::OMXTables
- Inherits:
-
Object
- Object
- OMX::OMXTables
- Extended by:
- FFI::Library
- Defined in:
- lib/OpenMatriX.rb
Overview
A class to return the tables in the OMX file
Defined Under Namespace
Classes: H5GInfoT, H5_index, InvalidFile
Instance Method Summary collapse
- #cast_to_H5_index(pointer) ⇒ Object
- #cast_to_H5GInfoT(pointer) ⇒ Object
-
#getNTables ⇒ Object
A function to return the number of matrix tables.
-
#getTableNames ⇒ Object
A function to get the table names.
-
#initialize(file) ⇒ OMXTables
constructor
A new instance of OMXTables.
Constructor Details
#initialize(file) ⇒ OMXTables
Returns a new instance of OMXTables.
253 254 255 256 |
# File 'lib/OpenMatriX.rb', line 253 def initialize(file) @id = file.id @gId = gOpen(@id, "data",0) end |
Instance Method Details
#cast_to_H5_index(pointer) ⇒ Object
240 241 242 |
# File 'lib/OpenMatriX.rb', line 240 def cast_to_H5_index pointer H5_index.new pointer end |
#cast_to_H5GInfoT(pointer) ⇒ Object
229 230 231 |
# File 'lib/OpenMatriX.rb', line 229 def cast_to_H5GInfoT pointer H5GInfoT.new pointer end |
#getNTables ⇒ Object
A function to return the number of matrix tables. Returns an integer value of the number of tables in the matrix
260 261 262 263 264 |
# File 'lib/OpenMatriX.rb', line 260 def getNTables() h5gi = cast_to_H5GInfoT(FFI::MemoryPointer.new :char, H5GInfoT.size) op = nTables(@gId,h5gi) return(h5gi[:nLinks]) end |
#getTableNames ⇒ Object
A function to get the table names. Returns a string array of table names.
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
# File 'lib/OpenMatriX.rb', line 267 def getTableNames() nT = self.getNTables()-1 gName = FFI::MemoryPointer.new(:string) pl = createpl(OMX::h5P_CLS_LINK_ACCESS_ID_g) # Note from okiAndrew: this seems seriously kludgy, but it works. tN ||= [] for t in 0..nT tn2o = tNames2(@gId, ".", 0, t, 0, gName, 20, pl) #puts "gName = #{gName.read_string()}" tN << gName.read_string() end return(tN) end |