Revised OpenFlow Library  v0.6.0dev
 All Classes Files Functions Variables Friends Groups Pages
cparams.h
1 /*
2  * cparams.h
3  *
4  * Created on: 01.04.2014
5  * Author: andreas
6  */
7 
8 #ifndef CPARAMS_H_
9 #define CPARAMS_H_
10 
11 #include <map>
12 #include <string>
13 #include <iostream>
14 
15 #include "rofl/common/cparam.h"
16 #include "rofl/common/logging.h"
17 
18 namespace rofl {
19 
20 class cparams {
21 
22  std::map<std::string, cparam> params;
23 
24 public:
25 
29  cparams();
30 
34  virtual
35  ~cparams();
36 
40  cparams(
41  cparams const& params);
42 
46  cparams&
47  operator= (
48  cparams const& params);
49 
50 public:
51 
55  void
56  clear() { params.clear(); };
57 
61  std::map<std::string, cparam>&
62  set_params() { return params; };
63 
67  std::map<std::string, cparam> const&
68  get_params() const { return params; };
69 
73  cparam&
74  add_param(std::string const& key);
75 
79  void
80  drop_param(std::string const& key);
81 
85  cparam&
86  set_param(std::string const& key);
87 
91  cparam const&
92  get_param(std::string const& key) const;
93 
97  bool
98  has_param(std::string const& key) const;
99 
100 public:
101 
102  friend std::ostream&
103  operator<< (std::ostream& os, cparams const& p) {
104  os << rofl::indent(0) << "<cparams #params: " << p.params.size() << " >" << std::endl;
105  rofl::indent i(2);
106  for (std::map<std::string, cparam>::const_iterator
107  it = p.params.begin(); it != p.params.end(); ++it) {
108  os << rofl::indent(0) << "<key: \"" << it->first << "\" >" << std::endl;
109  rofl::indent j(2);
110  os << it->second;
111  }
112  return os;
113  };
114 };
115 
116 }; // end of namespace rofl
117 
118 #endif /* CPARAMS_H_ */
Definition: cparams.h:20
Definition: cparam.h:25
Definition: logging.h:76