Particle Identification and Tracking
attr_list_hdf.h
Go to the documentation of this file.
1 //Copyright 2010 Thomas A Caswell
2 //tcaswell@uchicago.edu
3 //http://jfi.uchicago.edu/~tcaswell
4 //
5 //This program is free software; you can redistribute it and/or modify
6 //it under the terms of the GNU General Public License as published by
7 //the Free Software Foundation; either version 3 of the License, or (at
8 //your option) any later version.
9 //
10 //This program is distributed in the hope that it will be useful, but
11 //WITHOUT ANY WARRANTY; without even the implied warranty of
12 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 //General Public License for more details.
14 //
15 //You should have received a copy of the GNU General Public License
16 //along with this program; if not, see <http://www.gnu.org/licenses>.
17 //
18 
19 #ifndef HDF_ATTTR_LIST
20 #define HDF_ATTTR_LIST
21 
22 #include <list>
23 #include <string>
24 #include "tuple.h"
25 #include "enum_utils.h"
26 // forward declare classes
27 namespace H5
28 {
29 class H5Object;
30 }
31 
32 namespace utilities
33 {
34 
35 
46 {
47 public:
51  Attr_list_hdf(H5::H5Object * obj);
56 
60  bool contains_attr(const std::string & key) const;
61 
68  int get_value(const std::string & key, int & value_out) const ;
73  void set_value(const std::string & key, const int & value_in,bool over_write = false) ;
77  float get_value(const std::string & key, float & value_out) const ;
81  void set_value(const std::string & key, const float & value_in,bool over_write = false) ;
82 
86  template<int N>
87  utilities::Tuple<float,N> get_value(const std::string & key, utilities::Tuple<float,N> & value_out) const ;
91  template<int N>
92  void set_value(const std::string & key, const utilities::Tuple<float,N> & value_in,bool over_write = false) ;
96  std::string get_value(const std::string & key,std::string & value_out)const;
100  void set_value(const std::string & key,const std::string & value_out,bool over_write = false);
101 
105  bool get_value(const std::string & key,bool & value_out)const;
109  void set_value(const std::string & key,const bool & value_out,bool over_write = false);
110 
111 
115  unsigned int get_value(const std::string & key,unsigned int& value_out)const;
119  void set_value(const std::string & key,const unsigned int & value_out,bool over_write = false);
120 
121 
122 
123 
124 
128  void remove_attr(const std::string & key);
129 
130 
134  void print()const;
135 
139  std::list<std::string> contents()const;
146  utilities::V_TYPE get_type(const std::string& key)const;
147 
148 
149 private:
153  std::list<std::string> keys_;
157  H5::H5Object * obj_;
158 
159 
160 
161 };
162 }
163 
164 
165 
166 #endif