Grid3
MetaDataContainer.h
Go to the documentation of this file.
1 #ifndef METADATA_CONTAINER
2 #define METADATA_CONTAINER
3 
4 #include <map>
5 using namespace std;
6 
9 private:
10  map<string, double> double_data;
11  map<string, long> long_data;
12  map<string, bool> bool_data;
13  map<string, string> string_data;
14 
15 public:
16  void SetDouble(string key, double value){
17  double_data[key]=value;
18  }
19 
20  double GetDouble(string key, double default_value=0){
21  auto it=double_data.find(key);
22  if(it!=double_data.end()){
23  return it->second;
24  }
25  return default_value;
26  }
27 
28  void SetLong(string key, long value){
29  long_data[key]=value;
30  }
31 
32  long GetLong(string key, long default_value=0){
33  auto it=long_data.find(key);
34  if(it!=long_data.end()){
35  return it->second;
36  }
37  return default_value;
38  }
39 
40  void SetBool(string key, bool value){
41  bool_data[key]=value;
42  }
43 
44  bool GetBool(string key, bool default_value=false){
45  auto it=bool_data.find(key);
46  if(it!=bool_data.end()){
47  return it->second;
48  }
49  return default_value;
50  }
51 
52  void SetString(string key, string value){
53  string_data[key]=value;
54  }
55 
56  string GetString(string key, string default_value=""){
57  auto it=string_data.find(key);
58  if(it!=string_data.end()){
59  return it->second;
60  }
61  return default_value;
62  }
63 
64 };
65 
66 
67 #endif
void SetBool(string key, bool value)
Definition: MetaDataContainer.h:40
bool GetBool(string key, bool default_value=false)
Definition: MetaDataContainer.h:44
double GetDouble(string key, double default_value=0)
Definition: MetaDataContainer.h:20
void SetDouble(string key, double value)
Definition: MetaDataContainer.h:16
void SetString(string key, string value)
Definition: MetaDataContainer.h:52
Class for storing meta data related to a volume image.
Definition: MetaDataContainer.h:8
long GetLong(string key, long default_value=0)
Definition: MetaDataContainer.h:32
void SetLong(string key, long value)
Definition: MetaDataContainer.h:28
string GetString(string key, string default_value="")
Definition: MetaDataContainer.h:56