Revised OpenFlow Library  v0.6.0dev
 All Classes Files Functions Variables Friends Groups Pages
cofgroupdescstatsarray.h
1 /*
2  * cofgroupdescs.h
3  *
4  * Created on: 14.03.2014
5  * Author: andreas
6  */
7 
8 #ifndef COFGROUPDESCSTATSARRAY_H_
9 #define COFGROUPDESCSTATSARRAY_H_
10 
11 #include <iostream>
12 #include <map>
13 
14 #include "rofl/common/openflow/cofgroupdescstats.h"
15 #include "rofl/common/logging.h"
16 
17 namespace rofl {
18 namespace openflow {
19 
21 
22  uint8_t ofp_version;
23  std::map<uint32_t, cofgroup_desc_stats_reply> array;
24 
25 public:
26 
30  cofgroupdescstatsarray(uint8_t ofp_version = rofl::openflow::OFP_VERSION_UNKNOWN);
31 
35  virtual
37 
42 
47  operator= (cofgroupdescstatsarray const& groupdescs);
48 
53  operator+= (cofgroupdescstatsarray const& groupdescs);
54 
55 public:
56 
60  virtual size_t
61  length() const;
62 
66  virtual void
67  pack(uint8_t *buf = (uint8_t*)0, size_t buflen = 0);
68 
72  virtual void
73  unpack(uint8_t *buf, size_t buflen);
74 
75 public:
76 
80  size_t
81  size() const { return array.size(); };
82 
86  void
87  clear() { array.clear(); };
88 
92  std::map<uint32_t, cofgroup_desc_stats_reply> const&
93  get_group_desc_stats() const { return array; };
94 
98  std::map<uint32_t, cofgroup_desc_stats_reply>&
99  set_group_desc_stats() { return array; };
100 
101 public:
102 
107  add_group_desc_stats(uint32_t group_id);
108 
112  void
113  drop_group_desc_stats(uint32_t group_id);
114 
119  set_group_desc_stats(uint32_t group_id);
120 
125  get_group_desc_stats(uint32_t group_id) const;
126 
130  bool
131  has_group_desc_stats(uint32_t group_id);
132 
133 public:
134 
138  uint8_t
139  get_version() const { return ofp_version; };
140 
144  void
145  set_version(uint8_t ofp_version) { this->ofp_version = ofp_version; };
146 
147 public:
148 
149  friend std::ostream&
150  operator<< (std::ostream& os, cofgroupdescstatsarray const& groupdescstatsarray) {
151  os << rofl::indent(0) << "<cofgroupdescstatsarray #groups:" << (int)groupdescstatsarray.array.size() << " >" << std::endl;
152  rofl::indent i(2);
153  for (std::map<uint32_t, cofgroup_desc_stats_reply>::const_iterator
154  it = groupdescstatsarray.array.begin(); it != groupdescstatsarray.array.end(); ++it) {
155  os << it->second;
156  }
157  return os;
158  }
159 };
160 
161 }; // end of openflow
162 }; // end of rofl
163 
164 
165 
166 
167 #endif /* COFGROUPDESCS_H_ */
Definition: cofgroupdescstatsarray.h:20
Definition: cofgroupdescstats.h:23
Definition: logging.h:76
virtual size_t length() const
Definition: cofgroupdescstatsarray.cc:67