Particle Identification and Tracking
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
utilities::Wrapper_o_hdf Class Reference

Wrapper class for dealing with output to matlab. More...

#include <wrapper_o_hdf.h>

+ Inheritance diagram for utilities::Wrapper_o_hdf:
+ Collaboration diagram for utilities::Wrapper_o_hdf:

Public Types

enum  FILE_T { APPEND_FILE =0, NEW_FILE, NEW_FILE_OVR, FILL_FILE }
 
typedef enum
utilities::Wrapper_o_hdf::FILE_T 
FILE_T
 

Public Member Functions

 Wrapper_o_hdf (const std::string &file_name, const std::set< D_TYPE > &d_add, int comp_number, Wrapper_o_hdf::FILE_T file_type, const std::string &group_prefix="frame")
 Constructor. More...
 
void initialize_wrapper ()
 preforms any initialization that needs to be done the logic for this is to not needlessly open and close files, or creat matlab arrays if they arn't going to be used. More...
 
void open_group (int, int, int)
 Opens a group to put particles into. More...
 
void set_all_values (const tracking::particle *)
 sets all of the values that the wrapper knows about by asking the particle More...
 
void set_all_values (const tracking::Track_box *, const utilities::Tuple< float, 3 > &)
 sets all of the values that the wrapper knows about by asking the particle. More...
 
void set_value (D_TYPE, const tracking::particle *)
 
void add_meta_store (const Md_store *md_in)
 Adds all the meta data in a Md_store object. More...
 
void close_group ()
 Closes the currently open group. More...
 
void finalize_wrapper ()
 Performs any clean up. More...
 
void print () const
 
int num_entries () const
 
const std::set< D_TYPE > & get_content_tpyes () const
 Returns a set containing the D_TYPES that the wrapper can cope with. More...
 
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, 2 > &val)
 Adds a Pair 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 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_root (const std::string &key, float val)
 Adds a float meta-data. More...
 
void add_meta_data_root (const std::string &key, const Tuple< float, 2 > &val)
 Adds a Pair meta-data. More...
 
void add_meta_data_root (const std::string &key, const Tuple< float, 3 > &val)
 Adds a Triple meta-data. More...
 
void add_meta_data_root (const std::string &key, const std::string &val)
 Adds a string meta-data. More...
 
void add_meta_data_root (const std::string &key, int val)
 Adds an integer meta-data. More...
 
void add_meta_data_comp (const std::string &key, float val)
 Adds a float meta-data. More...
 
void add_meta_data_comp (const std::string &key, const Tuple< float, 2 > &val)
 Adds a Pair meta-data. More...
 
void add_meta_data_comp (const std::string &key, const Tuple< float, 3 > &val)
 Adds a Triple meta-data. More...
 
void add_meta_data_comp (const std::string &key, const std::string &val)
 Adds a string meta-data. More...
 
void add_meta_data_comp (const std::string &key, int val)
 Adds an integer meta-data. More...
 
void add_meta_data (const std::string &key, float val, D_TYPE dset_type)
 Adds metadata for datasets. More...
 
void add_meta_data (const std::string &key, const Tuple< float, 2 > &val, D_TYPE dset_type)
 Adds a Pair meta-data for a data set. More...
 
void add_meta_data (const std::string &key, const Tuple< float, 3 > &val, D_TYPE dset_type)
 Adds a Triple meta-data for a data set. More...
 
void add_meta_data (const std::string &key, const std::string &val, D_TYPE dset_type)
 Adds a string meta-data for a data set. More...
 
void add_meta_data (const std::string &key, int val, D_TYPE dset_type)
 Adds an integer meta-data for a data set. More...
 
void add_meta_data_list (const Read_config &, const std::set< D_TYPE > &)
 Adds all parameters from the Read_config object to the data sets in the set. More...
 
 ~Wrapper_o_hdf ()
 

Private Member Functions

std::string format_name_ (int in) const
 formats group names More...
 

Private Attributes

int part_count_
 Count of the number of particles that have been added. More...
 
bool wrapper_open_
 if the wrapper is 'open' to get additional particles More...
 
bool group_open_
 if there is a 'open' group More...
 
int group_index_
 index of current group More...
 
bool new_indexing_
 Parameter to control behavior of indexing. More...
 
Wrapper_o_hdf::FILE_T file_type_
 Parameter to control file creation and over writing. More...
 
H5::H5File * file_
 Pointer to hdf file. More...
 
std::string file_name_
 file name More...
 
std::string group_name_
 name of currently open group More...
 
std::set< D_TYPEd_types_add_
 A set of the data types that are to be added to the file. More...
 
std::set< D_TYPEd_types_check_
 A set of the data types to be checked to make sure there isn't a mismatch. More...
 
std::set< D_TYPEd_types_already_
 The set of data that the file already contains. More...
 
std::string group_prefix_
 prefix for use in formatting the group name More...
 
Wrapper_o_hdf_groupcurrent_group_
 object for current group More...
 
int comp_number_
 computation number More...
 
H5::Group * dset_pram_group_
 

Static Private Attributes

static const int format_padding_ = 6
 the number if digits in the formatted group name More...
 

Detailed Description

Wrapper class for dealing with output to matlab.

Member Typedef Documentation

Member Enumeration Documentation

Enumerator
APPEND_FILE 
NEW_FILE 
NEW_FILE_OVR 
FILL_FILE 

Constructor & Destructor Documentation

Wrapper_o_hdf::Wrapper_o_hdf ( const std::string &  file_name,
const std::set< D_TYPE > &  d_add,
int  comp_number,
Wrapper_o_hdf::FILE_T  file_type,
const std::string &  group_prefix = "frame" 
)

Constructor.

Parameters
file_namefull name of the file to open
d_adda set of the data types to add
group_prefixthe prefix used for building group names
file_typeEnum to control if a new file is created, indexing, etc
comp_numberthe computation number to use during name clashes

References APPEND_FILE, file_type_, and new_indexing_.

Wrapper_o_hdf::~Wrapper_o_hdf ( )

References finalize_wrapper().

Member Function Documentation

void Wrapper_o_hdf::add_meta_data ( const std::string &  key,
float  val 
)
virtual

Adds a float meta-data.

Implements utilities::Wrapper_out.

References current_group_, group_open_, and local_add_meta_data().

Referenced by add_meta_data_list(), and main().

void Wrapper_o_hdf::add_meta_data ( const std::string &  key,
const Tuple< float, 2 > &  val 
)
virtual

Adds a Pair meta-data.

Implements utilities::Wrapper_out.

References current_group_, group_open_, and local_add_meta_data().

void Wrapper_o_hdf::add_meta_data ( const std::string &  key,
const Tuple< float, 3 > &  val 
)
virtual

Adds a Triple meta-data.

Implements utilities::Wrapper_out.

References current_group_, group_open_, and local_add_meta_data().

void Wrapper_o_hdf::add_meta_data ( const std::string &  key,
const std::string &  val 
)
virtual

Adds a string meta-data.

Implements utilities::Wrapper_out.

References current_group_, group_open_, and local_add_meta_data().

void Wrapper_o_hdf::add_meta_data ( const std::string &  key,
int  val 
)
virtual

Adds an integer meta-data.

Implements utilities::Wrapper_out.

References current_group_, group_open_, and local_add_meta_data().

void Wrapper_o_hdf::add_meta_data ( const std::string &  key,
float  val,
D_TYPE  dset_type 
)
virtual

Adds metadata for datasets.

Adds a float meta-data for a data set

Implements utilities::Wrapper_out.

References comp_number_, dset_pram_group_, local_add_meta(), and wrapper_open_.

void Wrapper_o_hdf::add_meta_data ( const std::string &  key,
const Tuple< float, 2 > &  val,
D_TYPE  dset_type 
)
virtual

Adds a Pair meta-data for a data set.

Implements utilities::Wrapper_out.

References comp_number_, dset_pram_group_, local_add_meta(), and wrapper_open_.

void Wrapper_o_hdf::add_meta_data ( const std::string &  key,
const Tuple< float, 3 > &  val,
D_TYPE  dset_type 
)
virtual

Adds a Triple meta-data for a data set.

Implements utilities::Wrapper_out.

References comp_number_, dset_pram_group_, local_add_meta(), and wrapper_open_.

void Wrapper_o_hdf::add_meta_data ( const std::string &  key,
const std::string &  val,
D_TYPE  dset_type 
)
virtual

Adds a string meta-data for a data set.

Implements utilities::Wrapper_out.

References comp_number_, dset_pram_group_, local_add_meta(), and wrapper_open_.

void Wrapper_o_hdf::add_meta_data ( const std::string &  key,
int  val,
D_TYPE  dset_type 
)
virtual

Adds an integer meta-data for a data set.

Implements utilities::Wrapper_out.

References comp_number_, dset_pram_group_, local_add_meta(), and wrapper_open_.

void Wrapper_o_hdf::add_meta_data_comp ( const std::string &  key,
float  val 
)
virtual
void Wrapper_o_hdf::add_meta_data_comp ( const std::string &  key,
const Tuple< float, 2 > &  val 
)
virtual
void Wrapper_o_hdf::add_meta_data_comp ( const std::string &  key,
const Tuple< float, 3 > &  val 
)
virtual
void Wrapper_o_hdf::add_meta_data_comp ( const std::string &  key,
const std::string &  val 
)
virtual
void Wrapper_o_hdf::add_meta_data_comp ( const std::string &  key,
int  val 
)
virtual
void Wrapper_o_hdf::add_meta_data_list ( const Read_config ,
const std::set< D_TYPE > &   
)
virtual
void Wrapper_o_hdf::add_meta_data_root ( const std::string &  key,
float  val 
)
virtual

Adds a float meta-data.

Implements utilities::Wrapper_out.

References file_, local_add_meta_data_root(), and wrapper_open_.

Referenced by initialize_wrapper().

void Wrapper_o_hdf::add_meta_data_root ( const std::string &  key,
const Tuple< float, 2 > &  val 
)
virtual

Adds a Pair meta-data.

Implements utilities::Wrapper_out.

References file_, local_add_meta_data_root(), and wrapper_open_.

void Wrapper_o_hdf::add_meta_data_root ( const std::string &  key,
const Tuple< float, 3 > &  val 
)
virtual

Adds a Triple meta-data.

Implements utilities::Wrapper_out.

References file_, local_add_meta_data_root(), and wrapper_open_.

void Wrapper_o_hdf::add_meta_data_root ( const std::string &  key,
const std::string &  val 
)
virtual

Adds a string meta-data.

Implements utilities::Wrapper_out.

References file_, local_add_meta_data_root(), and wrapper_open_.

void Wrapper_o_hdf::add_meta_data_root ( const std::string &  key,
int  val 
)
virtual

Adds an integer meta-data.

Implements utilities::Wrapper_out.

References file_, local_add_meta_data_root(), and wrapper_open_.

void Wrapper_o_hdf::add_meta_store ( const Md_store md_in)
virtual

Adds all the meta data in a Md_store object.

Implements utilities::Wrapper_out.

References utilities::Wrapper_o_hdf_group::add_meta_store(), and current_group_.

void Wrapper_o_hdf::close_group ( )
virtual

Closes the currently open group.

Throws an error if there is no open group.

Implements utilities::Wrapper_out.

References current_group_, group_open_, and utilities::Wrapper_o_hdf_group::write_to_disk().

Referenced by finalize_wrapper().

void Wrapper_o_hdf::finalize_wrapper ( )
virtual

Performs any clean up.

that needs to be done such as closing a file

Implements utilities::Wrapper_out.

References close_group(), dset_pram_group_, file_, group_open_, and wrapper_open_.

Referenced by main(), and ~Wrapper_o_hdf().

string Wrapper_o_hdf::format_name_ ( int  in) const
private

formats group names

References format_padding_, and group_prefix_.

Referenced by open_group().

const set< D_TYPE > & Wrapper_o_hdf::get_content_tpyes ( ) const
virtual

Returns a set containing the D_TYPES that the wrapper can cope with.

Implements utilities::Wrapper_out.

References d_types_add_.

void Wrapper_o_hdf::initialize_wrapper ( )
virtual

preforms any initialization that needs to be done the logic for this is to not needlessly open and close files, or creat matlab arrays if they arn't going to be used.

It also allows the wrapper object to be reused (ie, do all the processing, output one subset of data to one place, and another subset to another place

Implements utilities::Wrapper_out.

References add_meta_data_root(), APPEND_FILE, comp_number_, d_types_add_, dset_pram_group_, file_, file_name_, file_type_, FILL_FILE, utilities::format_dset_name(), NEW_FILE, NEW_FILE_OVR, and wrapper_open_.

Referenced by main().

int utilities::Wrapper_o_hdf::num_entries ( ) const
inline
void Wrapper_o_hdf::open_group ( int  group,
int  p_count,
int  wrapper_size 
)
virtual

Opens a group to put particles into.

Parameters
groupthe index of the group to be opened
p_countthe number of particles to expect
wrapper_sizethe size of the group of the underlying wrapper, if <0, then set equal to p_count

Implements utilities::Wrapper_out.

References APPEND_FILE, utilities::Wrapper_o_hdf_group::APPEND_GROUP, comp_number_, current_group_, d_types_add_, utilities::Wrapper_o_hdf_group::ERROR, file_, file_type_, FILL_FILE, utilities::Wrapper_o_hdf_group::FILL_GROUP, format_name_(), group_open_, NEW_FILE, NEW_FILE_OVR, utilities::Wrapper_o_hdf_group::NEW_GROUP, and wrapper_open_.

void Wrapper_o_hdf::print ( ) const
void utilities::Wrapper_o_hdf::set_all_values ( const tracking::particle )
virtual

sets all of the values that the wrapper knows about by asking the particle

Implements utilities::Wrapper_out.

void Wrapper_o_hdf::set_all_values ( const tracking::Track_box ,
const utilities::Tuple< float, 3 > &   
)
virtual

sets all of the values that the wrapper knows about by asking the particle.

This function is for outputting the results of 3D linking

Implements utilities::Wrapper_out.

References tracking::Track_box::average_cord(), current_group_, group_open_, and utilities::Wrapper_o_hdf_group::store_particle_pos().

void utilities::Wrapper_o_hdf::set_value ( D_TYPE  ,
const tracking::particle  
)

Member Data Documentation

int utilities::Wrapper_o_hdf::comp_number_
private

computation number

Referenced by add_meta_data(), add_meta_data_comp(), initialize_wrapper(), and open_group().

Wrapper_o_hdf_group* utilities::Wrapper_o_hdf::current_group_
private
std::set<D_TYPE> utilities::Wrapper_o_hdf::d_types_add_
private

A set of the data types that are to be added to the file.

Referenced by get_content_tpyes(), initialize_wrapper(), and open_group().

std::set<D_TYPE> utilities::Wrapper_o_hdf::d_types_already_
private

The set of data that the file already contains.

std::set<D_TYPE> utilities::Wrapper_o_hdf::d_types_check_
private

A set of the data types to be checked to make sure there isn't a mismatch.

H5::Group* utilities::Wrapper_o_hdf::dset_pram_group_
private
H5::H5File* utilities::Wrapper_o_hdf::file_
private

Pointer to hdf file.

Referenced by add_meta_data_root(), finalize_wrapper(), initialize_wrapper(), and open_group().

std::string utilities::Wrapper_o_hdf::file_name_
private

file name

Referenced by initialize_wrapper().

Wrapper_o_hdf::FILE_T utilities::Wrapper_o_hdf::file_type_
private

Parameter to control file creation and over writing.

Referenced by initialize_wrapper(), open_group(), and Wrapper_o_hdf().

const int utilities::Wrapper_o_hdf::format_padding_ = 6
staticprivate

the number if digits in the formatted group name

Referenced by format_name_().

int utilities::Wrapper_o_hdf::group_index_
private

index of current group

std::string utilities::Wrapper_o_hdf::group_name_
private

name of currently open group

bool utilities::Wrapper_o_hdf::group_open_
private
std::string utilities::Wrapper_o_hdf::group_prefix_
private

prefix for use in formatting the group name

Referenced by format_name_().

bool utilities::Wrapper_o_hdf::new_indexing_
private

Parameter to control behavior of indexing.

Referenced by Wrapper_o_hdf().

int utilities::Wrapper_o_hdf::part_count_
private

Count of the number of particles that have been added.

bool utilities::Wrapper_o_hdf::wrapper_open_
private

if the wrapper is 'open' to get additional particles

Referenced by add_meta_data(), add_meta_data_root(), finalize_wrapper(), initialize_wrapper(), and open_group().


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