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

Wraps the attribute functionality of hdf objects. More...

#include <attr_list_hdf.h>

+ Collaboration diagram for utilities::Attr_list_hdf:

Public Member Functions

 Attr_list_hdf (H5::H5Object *obj)
 Constructor. More...
 
 ~Attr_list_hdf ()
 Destructor. More...
 
bool contains_attr (const std::string &key) const
 Returns true If the attribute list contains the key. More...
 
int get_value (const std::string &key, int &value_out) const
 Returns the value associated with the key cast as an integer. More...
 
void set_value (const std::string &key, const int &value_in, bool over_write=false)
 Sets the value associated with the key cast as an integer. More...
 
float get_value (const std::string &key, float &value_out) const
 Gets float type values. More...
 
void set_value (const std::string &key, const float &value_in, bool over_write=false)
 Sets float type values. More...
 
template<int N>
utilities::Tuple< float, N > get_value (const std::string &key, utilities::Tuple< float, N > &value_out) const
 Gets tuple values, templated on tuple length. More...
 
template<int N>
void set_value (const std::string &key, const utilities::Tuple< float, N > &value_in, bool over_write=false)
 Sets tuple values, templated on tuple length. More...
 
std::string get_value (const std::string &key, std::string &value_out) const
 Gets string values. More...
 
void set_value (const std::string &key, const std::string &value_out, bool over_write=false)
 Sets string values. More...
 
bool get_value (const std::string &key, bool &value_out) const
 Gets bool value. More...
 
void set_value (const std::string &key, const bool &value_out, bool over_write=false)
 Sets bool value. More...
 
unsigned int get_value (const std::string &key, unsigned int &value_out) const
 Gets an unsigned int value. More...
 
void set_value (const std::string &key, const unsigned int &value_out, bool over_write=false)
 Sets an unsigned int value. More...
 
void remove_attr (const std::string &key)
 Removes the key from the H5Object. More...
 
void print () const
 Prints the contents to stdout. More...
 
std::list< std::string > contents () const
 Returns a list of the keys contained in this wrapper. More...
 
utilities::V_TYPE get_type (const std::string &key) const
 Returns the type of scalar attributes. More...
 

Private Attributes

std::list< std::string > keys_
 List of the keys of the attributes in the object. More...
 
H5::H5Object * obj_
 Pointer to the hdf object. More...
 

Detailed Description

Wraps the attribute functionality of hdf objects.

Eventually this should be split into a base class and the hdf class so that other input/output formats can be handled under the same interface. It possibly should be merged with md_store objects as well.

If the underlying object is changed else where, the list of keys will not be updated.

Constructor & Destructor Documentation

Attr_list_hdf::Attr_list_hdf ( H5::H5Object *  obj)

Constructor.

References add_key(), keys_, and obj_.

Attr_list_hdf::~Attr_list_hdf ( )

Destructor.

Member Function Documentation

bool Attr_list_hdf::contains_attr ( const std::string &  key) const

Returns true If the attribute list contains the key.

References keys_.

Referenced by utilities::extract_prams(), main(), utilities::Wrapper_i_hdf::priv_init(), and set_value().

list< string > Attr_list_hdf::contents ( ) const

Returns a list of the keys contained in this wrapper.

References keys_.

Referenced by utilities::Generic_wrapper_hdf::get_meta_data(), and utilities::Md_store::Md_store().

utilities::V_TYPE Attr_list_hdf::get_type ( const std::string &  key) const

Returns the type of scalar attributes.

Only works for int,float, and string. All others return V_ERROR.

Todo:
make to work for all (or most) types

References obj_, utilities::V_ERROR, utilities::V_FLOAT, utilities::V_INT, utilities::V_STRING, and utilities::V_UINT.

Referenced by utilities::extract_prams(), utilities::Generic_wrapper_hdf::get_meta_data(), and utilities::Md_store::Md_store().

int Attr_list_hdf::get_value ( const std::string &  key,
int &  value_out 
) const

Returns the value associated with the key cast as an integer.

Still need to sort out what to do if this is an inappropriate cast. This assumes that you have checked to make sure that the attribute exists, or it will throw the hdf errors out

References obj_.

Referenced by utilities::extract_prams(), utilities::Generic_wrapper_hdf::get_meta_data(), utilities::Wrapper_o_hdf_group::get_meta_data(), utilities::Generic_wrapper_hdf::get_meta_data_priv(), main(), utilities::Md_store::Md_store(), utilities::Wrapper_i_hdf::priv_init(), and set_value().

float Attr_list_hdf::get_value ( const std::string &  key,
float &  value_out 
) const

Gets float type values.

References obj_.

template<int N>
utilities::Tuple< float, N > Attr_list_hdf::get_value ( const std::string &  key,
utilities::Tuple< float, N > &  value_out 
) const

Gets tuple values, templated on tuple length.

References utilities::Tuple< T, length >::get_ptr(), and obj_.

std::string Attr_list_hdf::get_value ( const std::string &  key,
std::string &  value_out 
) const

Gets string values.

References obj_.

bool Attr_list_hdf::get_value ( const std::string &  key,
bool &  value_out 
) const

Gets bool value.

References obj_.

unsigned int Attr_list_hdf::get_value ( const std::string &  key,
unsigned int &  value_out 
) const

Gets an unsigned int value.

References obj_.

void Attr_list_hdf::print ( ) const

Prints the contents to stdout.

References keys_.

Referenced by main().

void Attr_list_hdf::remove_attr ( const std::string &  key)

Removes the key from the H5Object.

References keys_, and obj_.

void Attr_list_hdf::set_value ( const std::string &  key,
const int &  value_in,
bool  over_write = false 
)

Sets the value associated with the key cast as an integer.

Still need to sort out what to do if this is an inappropriate cast.

References contains_attr(), get_value(), keys_, and obj_.

Referenced by utilities::Generic_wrapper_hdf::add_meta_data_priv(), utilities::Wrapper_o_hdf_group::add_meta_store(), local_add_meta(), main(), and utilities::Wrapper_o_hdf_group::set_meta_data().

void Attr_list_hdf::set_value ( const std::string &  key,
const float &  value_in,
bool  over_write = false 
)

Sets float type values.

References contains_attr(), get_value(), keys_, and obj_.

template<int N>
void Attr_list_hdf::set_value ( const std::string &  key,
const utilities::Tuple< float, N > &  value_in,
bool  over_write = false 
)

Sets tuple values, templated on tuple length.

References contains_attr(), utilities::Tuple< T, length >::get_ptr(), get_value(), and obj_.

void Attr_list_hdf::set_value ( const std::string &  key,
const std::string &  value_out,
bool  over_write = false 
)

Sets string values.

References contains_attr(), get_value(), keys_, and obj_.

void Attr_list_hdf::set_value ( const std::string &  key,
const bool &  value_out,
bool  over_write = false 
)

Sets bool value.

References contains_attr(), get_value(), keys_, and obj_.

void Attr_list_hdf::set_value ( const std::string &  key,
const unsigned int &  value_out,
bool  over_write = false 
)

Sets an unsigned int value.

References contains_attr(), get_value(), keys_, and obj_.

Member Data Documentation

std::list<std::string> utilities::Attr_list_hdf::keys_
private

List of the keys of the attributes in the object.

Referenced by Attr_list_hdf(), contains_attr(), contents(), print(), remove_attr(), and set_value().

H5::H5Object* utilities::Attr_list_hdf::obj_
private

Pointer to the hdf object.

Referenced by Attr_list_hdf(), get_type(), get_value(), remove_attr(), and set_value().


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