ResponseMap.h
Go to the documentation of this file.
1 #ifndef _utl_ResponseMap_h_
2 #define _utl_ResponseMap_h_
3 
13 #include <map>
14 
15 
16 namespace utl {
17  template<typename T> class Validated;
18 
28  class ResponseMap {
29  public:
31  ResponseMap(const std::map<std::string, double>& m)
32  { fResponseMap = m; }
33 
34  typedef std::map<std::string, double>::const_iterator const_iterator;
35 
36  void Clear() { fResponseMap.clear(); }
37 
38  std::map<std::string, double>::size_type Size() const { return fResponseMap.size(); }
39 
41  void AddResponseItem(const std::string& identifier, const double weight)
42  { fResponseMap[identifier] += weight; }
43 
45  const_iterator Begin() const { return fResponseMap.begin(); }
46 
48  const_iterator End() const { return fResponseMap.end(); }
49 
51  bool operator==(const ResponseMap& m) const
52  { return fResponseMap == m.fResponseMap; }
53 
54  private:
55  friend class utl::Validated<ResponseMap>;
57  fResponseMap.clear();
58  }
59  std::map<std::string, double> fResponseMap;
60  };
61 
62 }
63 
64 
65 #endif
const_iterator End() const
Get an iterator to the end of the ResponseMap.
Definition: ResponseMap.h:48
std::map< std::string, double > fResponseMap
Definition: ResponseMap.h:59
void AddResponseItem(const std::string &identifier, const double weight)
Add the item denoted by the identifier with the specified weight to the ResponseMap.
Definition: ResponseMap.h:41
bool operator==(const ResponseMap &m) const
compares if two ResponseMaps are identical
Definition: ResponseMap.h:51
std::map< std::string, double >::size_type Size() const
Definition: ResponseMap.h:38
Wrapper class for initially unset data.
Definition: ResponseMap.h:17
std::map< std::string, double >::const_iterator const_iterator
Definition: ResponseMap.h:34
A helper class which manages a list of system response identifiers (std::strings) and their correspon...
Definition: ResponseMap.h:28
const_iterator Begin() const
Get an iterator to the first element of the ResponseMap.
Definition: ResponseMap.h:45
ResponseMap(const std::map< std::string, double > &m)
Constructor to create a ResponseMap from an stl-map.
Definition: ResponseMap.h:31
constexpr double m
Definition: AugerUnits.h:121

, generated on Tue Sep 26 2023.