Tomographer  v5.2
Tomographer C++ Framework Documentation
Tomographer::MAT::File Class Reference

A MATLAB file open for reading data. More...

#include <tomographer/tools/ezmatio.h>

Public Member Functions

 File (const std::string fname)
 Open a data file for reading. More...
 
 File (const File &other)=delete
 
 File (File &&other)
 Move constructor. More...
 
Var var (const std::string varname, bool load_data=true)
 Find a variable by name. More...
 
std::vector< VargetVarInfoList ()
 Get a list of all variables in this data file. More...
 
mat_t * getMatPtr ()
 Direct access to the underlying C pointer used for the MatIO library. More...
 
Fileoperator= (File &&other)
 Move assignment operator. More...
 
Fileoperator= (const File &other)=delete
 

Detailed Description

A MATLAB file open for reading data.

Access variables with var(), and get a list of variables with getVarInfoList().

This class is in fact a wrapper for MatIO C function calls. This class owns a mat_t pointer to an open file, which is open in the constructor and closed in the destructor.

Note
This C++ class is not copyable. You may pass it by value everywhere though as if it were copyable, because of C++11 move semantics.

Definition at line 192 of file ezmatio.h.

Constructor & Destructor Documentation

§ File() [1/2]

Tomographer::MAT::File::File ( const std::string  fname)
inline

Open a data file for reading.

The file will be immediately open for reading. You may directly call the var(), getVarInfoList() etc. methods after constructing a File object.

Definition at line 200 of file ezmatio.h.

§ File() [2/2]

Tomographer::MAT::File::File ( File &&  other)
inline

Move constructor.

This object has C++11 move semantics, meaning that you can pass it around by value. Read more on C++11 move semantics for more information.

Definition at line 215 of file ezmatio.h.

Member Function Documentation

§ getMatPtr()

mat_t* Tomographer::MAT::File::getMatPtr ( )
inline

Direct access to the underlying C pointer used for the MatIO library.

Please be careful with this. The pointer is owned by this object, and will be free'd at the end of this object's lifetime.

Definition at line 253 of file ezmatio.h.

§ getVarInfoList()

std::vector< Var > Tomographer::MAT::File::getVarInfoList ( )
inline

Get a list of all variables in this data file.

The returned Var objects don't have data loaded. You must re-open them with var() to get the data.

Definition at line 1175 of file ezmatio.h.

§ operator=()

File& Tomographer::MAT::File::operator= ( File &&  other)
inline

Move assignment operator.

This object has C++11 move semantics, meaning that you can pass it around by value. Read more on C++11 move semantics for more information.

Definition at line 263 of file ezmatio.h.

§ var()

Var Tomographer::MAT::File::var ( const std::string  varname,
bool  load_data = true 
)
inline

Find a variable by name.

This returns a Var object with the information corresponding to the given variable.

If load_data is true (the default), then the returned Var object also contains the variable data. Otherwise, it just contains the information about the type, dimensions, etc.

Definition at line 1170 of file ezmatio.h.


The documentation for this class was generated from the following file: