Revised OpenFlow Library  v0.6.0dev
 All Classes Files Functions Variables Friends Groups Pages
cofflowstatsarray.h
1 /*
2  * cofflows.h
3  *
4  * Created on: 14.03.2014
5  * Author: andreas
6  */
7 
8 #ifndef COFFLOWSTATSARRAY_H_
9 #define COFFLOWSTATSARRAY_H_
10 
11 #include <iostream>
12 #include <map>
13 
14 #include "rofl/common/openflow/cofflowstats.h"
15 
16 namespace rofl {
17 namespace openflow {
18 
20 
21  uint8_t ofp_version;
22  std::map<uint32_t, cofflow_stats_reply> array;
23 
24 public:
25 
29  cofflowstatsarray(uint8_t ofp_version = OFP_VERSION_UNKNOWN);
30 
34  virtual
36 
41 
46  operator= (cofflowstatsarray const& flows);
47 
51  bool
52  operator== (cofflowstatsarray const& flows);
53 
58  operator+= (cofflowstatsarray const& flows);
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<uint32_t, cofflow_stats_reply> const&
110  get_flow_stats() const { return array; };
111 
115  std::map<uint32_t, cofflow_stats_reply>&
116  set_flow_stats() { return array; };
117 
118 public:
119 
124  add_flow_stats(uint32_t flow_id);
125 
129  void
130  drop_flow_stats(uint32_t flow_id);
131 
136  set_flow_stats(uint32_t flow_id);
137 
141  cofflow_stats_reply const&
142  get_flow_stats(uint32_t flow_id) const;
143 
147  bool
148  has_flow_stats(uint32_t flow_id);
149 
150 public:
151 
152  friend std::ostream&
153  operator<< (std::ostream& os, cofflowstatsarray const& flowstatsarray) {
154  os << rofl::indent(0) << "<cofflowstatsarray #flows:" << (int)flowstatsarray.array.size() << " >" << std::endl;
155  rofl::indent i(2);
156  for (std::map<uint32_t, cofflow_stats_reply>::const_iterator
157  it = flowstatsarray.array.begin(); it != flowstatsarray.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: cofflowstatsarray.h:19
virtual size_t length() const
Definition: cofflowstatsarray.cc:95
Definition: logging.h:76
Definition: cofflowstats.h:240