This class is used for reading and writing information to a mz5 file.
More...
#include <Connection_mz5.hpp>
List of all members.
Public Member Functions |
| Connection_mz5 (const std::string filename, const OpenPolicy op=ReadOnly, const Configuration_mz5 config=Configuration_mz5()) |
| Default constructor.
|
| ~Connection_mz5 () |
| Closes all open datasets and flushes file to filesystem.
|
void | createAndWrite1DDataSet (hsize_t size, void *data, const Configuration_mz5::MZ5DataSets v) |
| Creates and write a one dimensional dataset.
|
void | extendData (const std::vector< double > &d1, const Configuration_mz5::MZ5DataSets v) |
| Extends data of to a dataset.
|
const std::map
< Configuration_mz5::MZ5DataSets,
size_t > & | getFields () |
| Returns a list of all existing datasets in this file.
|
void * | readDataSet (Configuration_mz5::MZ5DataSets v, size_t &dsend, void *ptr=0) |
| Reads a dataset.
|
void | clean (const Configuration_mz5::MZ5DataSets v, void *data, const size_t dsend) |
| Clean up of open datasets and destruction of corresponding data elements.
|
void | getData (std::vector< double > &data, const Configuration_mz5::MZ5DataSets v, const hsize_t start, const hsize_t end) |
| Gets data from a numerical dataset and writes it to the vector.
|
const Configuration_mz5 & | getConfiguration () |
| Getter.
|
Private Member Functions |
H5::DSetCreatPropList | getCParm (int rank, const Configuration_mz5::MZ5DataSets &v, const hsize_t &datadim) |
| Creates a DSetCreatPropList for a dataset.
|
H5::DataSet | getDataSet (int rank, hsize_t *dim, hsize_t *maxdim, const Configuration_mz5::MZ5DataSets v) |
| Creates a dataset.
|
void | readFile () |
| Initializes a file and read internal mz5 information.
|
void | extendAndWrite1DDataSet (const H5::DataSet &dataset, const std::vector< double > &d1) |
| Extends and appends data to an existing dataset with no buffer.
|
void | addToBuffer (std::vector< double > &b, const std::vector< double > &d1, const size_t bs, const H5::DataSet &dataset) |
| Internal method to add data to a buffer.
|
void | flush (const Configuration_mz5::MZ5DataSets v) |
| Flushes all data to the hard drive.
|
void | close () |
| Closes the file and flushes all open buffers/datasets.
|
Detailed Description
This class is used for reading and writing information to a mz5 file.
On destruction it will automatically close all existing datasets and flush the file.
Definition at line 40 of file Connection_mz5.hpp.
Member Enumeration Documentation
mz5 file open policy.
- Enumerator:
FailIfFileExists |
Fails if the file already exists.
|
RemoveAndCreate |
If file exists, it will be deleted and created empty.
|
ReadWrite |
Open file with read and write support.
|
ReadOnly |
Open file with read only support.
|
Definition at line 46 of file Connection_mz5.hpp.
Constructor & Destructor Documentation
Default constructor.
When opening a file, which is a hdf5 file but no mz5 file, a runtime_error is thrown.
- Parameters:
-
filename | file name |
op | open policy |
configuration | configuration used to determine chunk and buffer sizes |
pwiz::msdata::mz5::Connection_mz5::~Connection_mz5 |
( |
| ) |
|
Closes all open datasets and flushes file to filesystem.
Member Function Documentation
Creates and write a one dimensional dataset.
- Parameters:
-
size | size of the dataset |
data | void pointer to the dataset beginning |
v | dataset enumeration value |
Extends data of to a dataset.
This method automatically uses an internal buffer to write the data and calls extendsAndWrite1DDataSet()
- Parameters:
-
d1 | data |
v | dataset enumeration value |
Returns a list of all existing datasets in this file.
Reads a dataset.
If no pointer is set, this method will allocate the needed mememory with calloc. To regain the memory call clean().
- Parameters:
-
v | dataset enumeration value |
dsend | dataset size |
ptr | start pointer where the data should be written to. |
- Returns:
- pointer to the data
Clean up of open datasets and destruction of corresponding data elements.
This method calls vlenReclaim, free and close.
- Parameters:
-
v | dataset enumeration value |
data | pointer to the beginning of the data |
dsend | length of the data. |
void pwiz::msdata::mz5::Connection_mz5::getData |
( |
std::vector< double > & |
data, |
|
|
const Configuration_mz5::MZ5DataSets |
v, |
|
|
const hsize_t |
start, |
|
|
const hsize_t |
end |
|
) |
| |
Gets data from a numerical dataset and writes it to the vector.
This method is used to get mz,intensity and time.
- Parameters:
-
data | data vector |
v | dataset enumeration value |
start | start index |
end | end index |
Getter.
- Returns:
- current configuration
Creates a DSetCreatPropList for a dataset.
- Parameters:
-
rank | dimensionality of dataset |
dataset | dataset used to determine the name |
datadim | data dimensions |
- Returns:
- DSetCreatPropList
Creates a dataset.
- Parameters:
-
rank | dimensionality of the dataset |
dim | size of each dimension |
maxdim | maximal size of each dimension |
v | dataset enumeration value |
- Returns:
- dataset
void pwiz::msdata::mz5::Connection_mz5::readFile |
( |
| ) |
|
|
private |
Initializes a file and read internal mz5 information.
Will throw a runtime_error when the file is not a mz5 file.
void pwiz::msdata::mz5::Connection_mz5::extendAndWrite1DDataSet |
( |
const H5::DataSet & |
dataset, |
|
|
const std::vector< double > & |
d1 |
|
) |
| |
|
private |
Extends and appends data to an existing dataset with no buffer.
- Parameters:
-
void pwiz::msdata::mz5::Connection_mz5::addToBuffer |
( |
std::vector< double > & |
b, |
|
|
const std::vector< double > & |
d1, |
|
|
const size_t |
bs, |
|
|
const H5::DataSet & |
dataset |
|
) |
| |
|
private |
Internal method to add data to a buffer.
- Parameters:
-
b | buffer |
d1 | data |
bs | buffer size |
dataset | dataset |
Flushes all data to the hard drive.
- Parameters:
-
v | dataset enumeration value |
void pwiz::msdata::mz5::Connection_mz5::close |
( |
| ) |
|
|
private |
Closes the file and flushes all open buffers/datasets.
Member Data Documentation
H5::H5File* pwiz::msdata::mz5::Connection_mz5::file_ |
|
private |
Mapping from a dataset enumeration value to the dataset.
Definition at line 219 of file Connection_mz5.hpp.
bool pwiz::msdata::mz5::Connection_mz5::closed_ |
|
private |
The documentation for this class was generated from the following file: