Revised OpenFlow Library  v0.6.0dev
 All Classes Files Functions Variables Friends Groups Pages
coftablestatsarray.h
1 /*
2  * coftables.h
3  *
4  * Created on: 14.03.2014
5  * Author: andreas
6  */
7 
8 #ifndef COFTABLESTATSARRAY_H_
9 #define COFTABLESTATSARRAY_H_
10 
11 #include <iostream>
12 #include <map>
13 
14 #include "rofl/common/openflow/coftablestats.h"
15 
16 namespace rofl {
17 namespace openflow {
18 
20 
21  uint8_t ofp_version;
22  std::map<uint8_t, coftable_stats_reply> array;
23 
24 public:
25 
29  coftablestatsarray(uint8_t ofp_version = OFP_VERSION_UNKNOWN);
30 
34  virtual
36 
41 
46  operator= (coftablestatsarray const& tables);
47 
51  bool
52  operator== (coftablestatsarray const& tables) const;
53 
58  operator+= (coftablestatsarray const& tables);
59 
60 public:
61 
65  virtual size_t
66  length() const;
67 
71  virtual void
72  pack(uint8_t *buf = (uint8_t*)0, size_t buflen = 0);
73 
77  virtual void
78  unpack(uint8_t *buf, size_t buflen);
79 
80 public:
81 
85  size_t
86  size() const { return array.size(); };
87 
91  void
92  clear() { array.clear(); };
93 
97  uint8_t
98  get_version() const { return ofp_version; };
99 
103  void
104  set_version(uint8_t ofp_version) { this->ofp_version = ofp_version; };
105 
109  std::map<uint8_t, coftable_stats_reply> const&
110  get_table_stats() const { return array; };
111 
115  std::map<uint8_t, coftable_stats_reply>&
116  set_table_stats() { return array; };
117 
118 public:
119 
124  add_table_stats(uint8_t table_id);
125 
129  void
130  drop_table_stats(uint8_t table_id);
131 
136  set_table_stats(uint8_t table_id);
137 
141  coftable_stats_reply const&
142  get_table_stats(uint8_t table_id) const;
143 
147  bool
148  has_table_stats(uint8_t table_id);
149 
150 public:
151 
152  friend std::ostream&
153  operator<< (std::ostream& os, coftablestatsarray const& tablestatsarray) {
154  os << rofl::indent(0) << "<coftablestatsarray #tables:" << (int)tablestatsarray.array.size() << " >" << std::endl;
155  rofl::indent i(2);
156  for (std::map<uint8_t, coftable_stats_reply>::const_iterator
157  it = tablestatsarray.array.begin(); it != tablestatsarray.array.end(); ++it) {
158  os << it->second;
159  }
160  return os;
161  }
162 };
163 
164 }; // end of openflow
165 }; // end of rofl
166 
167 
168 
169 #endif /* COFGROUPS_H_ */
Definition: coftablestatsarray.h:19
Definition: logging.h:76
virtual size_t length() const
Definition: coftablestatsarray.cc:88
Definition: coftablestats.h:22