Particle Identification and Tracking
|
generic_wrapper for writing to hdf files More...
#include <generic_wrapper_hdf.h>
Public Types | |
enum | F_TYPE { F_DISK_RDWR = 0, F_DISK_EXCL, F_DISK_TRUNC, F_MEM } |
Enum for determining hdf file creation behavior. More... | |
typedef enum utilities::Generic_wrapper_hdf::F_TYPE | F_TYPE |
Enum for determining hdf file creation behavior. More... | |
Public Member Functions | |
~Generic_wrapper_hdf () | |
Generic_wrapper_hdf (std::string fname, F_TYPE f_type=F_DISK_RDWR) | |
Constructor. More... | |
template<class T > | |
void | get_dset_priv (vector< T > &data, std::vector< unsigned int > &dims, const std::string &dset_name, const DataType &mtype) const |
Wrapper state | |
Change and query the top level wrapper state | |
void | open_wrapper () |
Initializes the wrapper. More... | |
void | close_wrapper () |
closes and cleans up the wrapper More... | |
bool | is_open () const |
Returns if the wrapper is open or not. More... | |
Group state | |
Change and query the wrapper current group state | |
void | open_group (const std::string &name="none") |
Opens a group in the wrapper, ie a group in hdf or a cell in matlab. More... | |
void | close_group () |
closes the current group More... | |
Data | |
get and set data | |
void | add_dset (int rank, const unsigned int *dims, V_TYPE, const void *, const std::string &name) |
Adds data to the wrapper, must be the right size and type specified. More... | |
void | get_dset (std::vector< int > &data, std::vector< unsigned int > &dims, const std::string &dset_name) const |
Gets data from the wrapper. More... | |
void | get_dset (std::vector< unsigned int > &data, std::vector< unsigned int > &dims, const std::string &dset_name) const |
Gets data from the wrapper. More... | |
void | get_dset (std::vector< float > &data, std::vector< unsigned int > &dims, const std::string &dset_name) const |
Gets data from the wrapper. More... | |
void | get_dset_info (std::vector< int > &dims, V_TYPE &vt, const std::string &dset_name) const |
Get dset size. More... | |
Group Level Metadata | |
getter and setter functions for metadata for the currently open group. | |
void | add_meta_data (const std::string &key, float val) |
Adds a float meta-data. More... | |
void | add_meta_data (const std::string &key, const Tuple< float, 3 > &val) |
Adds a Triple meta-data. More... | |
void | add_meta_data (const std::string &key, const Tuple< float, 2 > &val) |
Adds a Pair meta-data. More... | |
void | add_meta_data (const std::string &key, const std::string &val) |
Adds a string meta-data. More... | |
void | add_meta_data (const std::string &key, int val) |
Adds an integer meta-data. More... | |
void | add_meta_data (const std::string &key, unsigned int val) |
Adds an unsigned integer meta-data. More... | |
void | add_meta_data (const Md_store *md_store) |
Adds all the meta data in a Md_store at the group level. More... | |
float | get_meta_data (const std::string &key, float &val) |
Gets a float meta-data. More... | |
Tuple< float, 3 > | get_meta_data (const std::string &key, Tuple< float, 3 > &val) |
Gets a Triple meta-data. More... | |
Tuple< float, 2 > | get_meta_data (const std::string &key, Tuple< float, 2 > &val) |
Gets a Pair meta-data. More... | |
std::string | get_meta_data (const std::string &key, std::string &val) |
Gets a string meta-data. More... | |
int | get_meta_data (const std::string &key, int &val) |
Gets an integer meta-data. More... | |
unsigned int | get_meta_data (const std::string &key, unsigned int &val) |
Gets an unsigned integer meta-data. More... | |
Md_store & | get_meta_data (Md_store &md_store) |
Gets all the meta data in a Md_store at the group level. More... | |
Dataset Level Metadata | |
getter and setter functions for metadata for the named dataset. | |
void | add_meta_data (const std::string &key, float val, const std::string &dset_name) |
Adds a float meta-data for a data set. More... | |
void | add_meta_data (const std::string &key, const Tuple< float, 3 > &val, const std::string &dset_name) |
Adds a Triple meta-data for a data set. More... | |
void | add_meta_data (const std::string &key, const Tuple< float, 2 > &val, const std::string &dset_name) |
Adds a Pair meta-data for a data set. More... | |
void | add_meta_data (const std::string &key, const std::string &val, const std::string &dset_name) |
Adds a string meta-data for a data set. More... | |
void | add_meta_data (const std::string &key, int val, const std::string &dset_name) |
Adds an integer meta-data for a data set. More... | |
void | add_meta_data (const std::string &key, unsigned int val, const std::string &dset_name) |
Adds an unsigned integer meta-data for a data set. More... | |
void | add_meta_data (const Md_store *md_store, const std::string &dset_name) |
Adds all the meta data in a Md_store at the dset level. More... | |
float | get_meta_data (const std::string &key, float &val, const std::string &dset_name) |
Gets a float meta-data for a data set. More... | |
Tuple< float, 3 > | get_meta_data (const std::string &key, Tuple< float, 3 > &val, const std::string &dset_name) |
Gets a Triple meta-data for a data set. More... | |
Tuple< float, 2 > | get_meta_data (const std::string &key, Tuple< float, 2 > &val, const std::string &dset_name) |
Gets a Pair meta-data for a data set. More... | |
std::string | get_meta_data (const std::string &key, std::string &val, const std::string &dset_name) |
Gets a string meta-data for a data set. More... | |
int | get_meta_data (const std::string &key, int &val, const std::string &dset_name) |
Gets an integer meta-data for a data set. More... | |
Md_store & | get_meta_data (Md_store &md_store, const std::string &dset_name) |
Gets all the meta data in a Md_store at the dset level. More... | |
Private Member Functions | |
template<class T > | |
void | add_meta_data_priv (const std::string &key, const T &val, const std::string &dset_name) |
Private function to add meta-data to datasets. More... | |
template<class T > | |
void | add_meta_data_priv (const std::string &key, const T &val) |
Private function to add meta-data to the current group. More... | |
template<class T > | |
T | get_meta_data_priv (const std::string &key, T &val, const std::string &dset_name) |
Private function to get meta data from datasets. More... | |
template<class T > | |
T | get_meta_data_priv (const std::string &key, T &val) |
Private function to get meta data from the current group. More... | |
template<class T > | |
void | get_dset_priv (std::vector< T > &data, std::vector< unsigned int > &dims, const std::string &dset_name, const H5::DataType &mtype) const |
Private function to get dset data out. More... | |
Private Attributes | |
std::string | file_name_ |
bool | wrapper_open_ |
bool | group_open_ |
bool | dset_open_ |
F_TYPE | f_type_ |
H5::H5File * | file_ |
H5::Group * | group_ |
Attr_list_hdf * | group_attrs_ |
generic_wrapper for writing to hdf files
Enum for determining hdf file creation behavior.
Generic_wrapper_hdf::~Generic_wrapper_hdf | ( | ) |
References close_wrapper(), and wrapper_open_.
Generic_wrapper_hdf::Generic_wrapper_hdf | ( | std::string | fname, |
F_TYPE | f_type = F_DISK_RDWR |
||
) |
Constructor.
fname | the name of the file to write to |
add_to_file | if the file already exists |
|
virtual |
Adds data to the wrapper, must be the right size and type specified.
data will be written safely with in the wrapper during this call so it can be safely freed outside if needed
[in] | rank | rank of data set |
[in] | dimensions | of data set |
[in] | vt | data type |
[in] | data | pointer to data to be set |
[in] | dset_name | name of data set |
Implements utilities::Generic_wrapper.
References CSIZE, file_, group_, group_open_, utilities::V_BOOL, utilities::V_COMPLEX, utilities::V_ERROR, utilities::V_FLOAT, utilities::V_GUID, utilities::V_INT, utilities::V_STRING, utilities::V_TIME, utilities::V_UINT, and wrapper_open_.
Referenced by main().
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Adds an unsigned integer meta-data.
Implements utilities::Generic_wrapper.
References add_meta_data_priv().
|
virtual |
Adds all the meta data in a Md_store at the group level.
Implements utilities::Generic_wrapper.
References add_meta_data_priv(), utilities::Md_store::get_key(), utilities::Md_store::get_type(), utilities::Md_store::get_value(), utilities::Md_store::size(), utilities::V_BOOL, utilities::V_COMPLEX, utilities::V_ERROR, utilities::V_FLOAT, utilities::V_GUID, utilities::V_INT, utilities::V_STRING, utilities::V_TIME, and utilities::V_UINT.
|
virtual |
Adds a float meta-data for a data set.
Implements utilities::Generic_wrapper.
References add_meta_data_priv().
|
virtual |
Adds a Triple meta-data for a data set.
Implements utilities::Generic_wrapper.
References add_meta_data_priv().
|
virtual |
Adds a Pair meta-data for a data set.
Implements utilities::Generic_wrapper.
References add_meta_data_priv().
|
virtual |
Adds a string meta-data for a data set.
Implements utilities::Generic_wrapper.
References add_meta_data_priv().
|
virtual |
Adds an integer meta-data for a data set.
Implements utilities::Generic_wrapper.
References add_meta_data_priv().
|
virtual |
Adds an unsigned integer meta-data for a data set.
Implements utilities::Generic_wrapper.
References add_meta_data_priv().
|
virtual |
Adds all the meta data in a Md_store at the dset level.
Implements utilities::Generic_wrapper.
References add_meta_data_priv(), utilities::Md_store::get_key(), utilities::Md_store::get_type(), utilities::Md_store::get_value(), utilities::Md_store::size(), utilities::V_FLOAT, utilities::V_INT, and utilities::V_STRING.
|
private |
Private function to add meta-data to datasets.
References file_, group_, group_open_, and utilities::Attr_list_hdf::set_value().
Referenced by add_meta_data().
|
private |
Private function to add meta-data to the current group.
References group_attrs_, group_open_, and utilities::Attr_list_hdf::set_value().
|
virtual |
closes the current group
Implements utilities::Generic_wrapper.
References group_, group_attrs_, and group_open_.
Referenced by close_wrapper(), and main().
|
virtual |
closes and cleans up the wrapper
Implements utilities::Generic_wrapper.
References close_group(), file_, group_open_, and wrapper_open_.
Referenced by main(), and ~Generic_wrapper_hdf().
|
virtual |
Gets data from the wrapper.
Implements utilities::Generic_wrapper_read.
References get_dset_priv().
Referenced by main().
|
virtual |
Gets data from the wrapper.
Implements utilities::Generic_wrapper_read.
References get_dset_priv().
|
virtual |
Gets data from the wrapper.
Implements utilities::Generic_wrapper_read.
References get_dset_priv().
|
virtual |
Get dset size.
[out] | dims | a vector that gets filled with the dimensions |
[out] | dims | the type of the data set |
[in] | dset_name | the name of the data set |
Implements utilities::Generic_wrapper_read.
References file_, group_, group_open_, utilities::V_ERROR, utilities::V_FLOAT, utilities::V_INT, utilities::V_UINT, and wrapper_open_.
|
private |
Private function to get dset data out.
Referenced by get_dset().
void utilities::Generic_wrapper_hdf::get_dset_priv | ( | vector< T > & | data, |
std::vector< unsigned int > & | dims, | ||
const std::string & | dset_name, | ||
const DataType & | mtype | ||
) | const |
References file_, group_, group_open_, and wrapper_open_.
|
virtual |
Gets a float meta-data.
Implements utilities::Generic_wrapper_read.
References get_meta_data_priv().
|
virtual |
Gets a Triple meta-data.
Implements utilities::Generic_wrapper_read.
References get_meta_data_priv().
|
virtual |
Gets a string meta-data.
Implements utilities::Generic_wrapper_read.
References get_meta_data_priv().
|
virtual |
Gets an integer meta-data.
Implements utilities::Generic_wrapper_read.
References get_meta_data_priv().
|
virtual |
Gets an unsigned integer meta-data.
Implements utilities::Generic_wrapper_read.
References get_meta_data_priv().
Gets all the meta data in a Md_store at the group level.
Implements utilities::Generic_wrapper_read.
References utilities::Attr_list_hdf::contents(), utilities::Attr_list_hdf::get_type(), utilities::Attr_list_hdf::get_value(), group_attrs_, utilities::Md_store::set_value(), utilities::V_BOOL, utilities::V_COMPLEX, utilities::V_ERROR, utilities::V_FLOAT, utilities::V_GUID, utilities::V_INT, utilities::V_STRING, utilities::V_TIME, and utilities::V_UINT.
|
virtual |
Gets a float meta-data for a data set.
Implements utilities::Generic_wrapper_read.
References get_meta_data_priv().
|
virtual |
Gets a Triple meta-data for a data set.
Implements utilities::Generic_wrapper_read.
References get_meta_data_priv().
|
virtual |
Gets a Pair meta-data for a data set.
Implements utilities::Generic_wrapper_read.
References get_meta_data_priv().
|
virtual |
Gets a string meta-data for a data set.
Implements utilities::Generic_wrapper_read.
References get_meta_data_priv().
|
virtual |
Gets an integer meta-data for a data set.
Implements utilities::Generic_wrapper_read.
References get_meta_data_priv().
|
virtual |
Gets all the meta data in a Md_store at the dset level.
Implements utilities::Generic_wrapper_read.
References utilities::Attr_list_hdf::contents(), file_, utilities::Attr_list_hdf::get_type(), utilities::Attr_list_hdf::get_value(), group_, group_open_, utilities::Md_store::set_value(), utilities::V_BOOL, utilities::V_COMPLEX, utilities::V_ERROR, utilities::V_FLOAT, utilities::V_GUID, utilities::V_INT, utilities::V_STRING, utilities::V_TIME, and utilities::V_UINT.
|
private |
Private function to get meta data from datasets.
References file_, utilities::Attr_list_hdf::get_value(), group_, and group_open_.
Referenced by get_meta_data().
|
private |
Private function to get meta data from the current group.
References utilities::Attr_list_hdf::get_value(), group_attrs_, and group_open_.
|
inlinevirtual |
Returns if the wrapper is open or not.
Implements utilities::Generic_wrapper.
References wrapper_open_.
|
virtual |
Opens a group in the wrapper, ie a group in hdf or a cell in matlab.
Implements utilities::Generic_wrapper.
References file_, group_, group_attrs_, group_open_, and wrapper_open_.
Referenced by main().
|
virtual |
Initializes the wrapper.
Implements utilities::Generic_wrapper.
References F_DISK_EXCL, F_DISK_RDWR, F_DISK_TRUNC, F_MEM, f_type_, file_, file_name_, and wrapper_open_.
Referenced by main().
|
private |
|
private |
Referenced by open_wrapper().
|
private |
Referenced by add_dset(), add_meta_data_priv(), close_wrapper(), get_dset_info(), get_dset_priv(), get_meta_data(), get_meta_data_priv(), open_group(), and open_wrapper().
|
private |
Referenced by open_wrapper().
|
private |
Referenced by add_dset(), add_meta_data_priv(), close_group(), get_dset_info(), get_dset_priv(), get_meta_data(), get_meta_data_priv(), and open_group().
|
private |
Referenced by add_meta_data_priv(), close_group(), get_meta_data(), get_meta_data_priv(), and open_group().
|
private |
Referenced by add_dset(), add_meta_data_priv(), close_group(), close_wrapper(), get_dset_info(), get_dset_priv(), get_meta_data(), get_meta_data_priv(), and open_group().
|
private |
Referenced by add_dset(), close_wrapper(), get_dset_info(), get_dset_priv(), is_open(), open_group(), open_wrapper(), and ~Generic_wrapper_hdf().