Revised OpenFlow Library  v0.6.0dev
 All Classes Files Functions Variables Friends Groups Pages
cdptid.h
1 /*
2  * cdptid.h
3  *
4  * Created on: 19.04.2014
5  * Author: andreas
6  */
7 
8 #ifndef CDPTID_H_
9 #define CDPTID_H_
10 
11 #include <inttypes.h>
12 #include <string>
13 #include <iostream>
14 #include <ios>
15 
16 #include "rofl/common/logging.h"
17 
18 namespace rofl {
19 
24 class cdptid {
25 
26  uint64_t id;
27  std::string s_id;
28 
29 public:
30 
34  cdptid(
35  uint64_t dptid = 0) :
36  id(dptid) {
37  std::stringstream sstr; sstr << id;
38  s_id = sstr.str();
39  };
40 
44  ~cdptid() {};
45 
49  cdptid(
50  cdptid const& dptid) {
51  *this = dptid;
52  };
53 
57  cdptid&
58  operator= (
59  cdptid const& dptid) {
60  if (this == &dptid)
61  return *this;
62  id = dptid.id;
63  return *this;
64  };
65 
69  bool
70  operator== (
71  cdptid const& dptid) const {
72  return (id == dptid.id);
73  };
74 
78  bool
79  operator!= (
80  cdptid const& dptid) const {
81  return (id != dptid.id);
82  };
83 
87  bool
88  operator< (
89  cdptid const& dptid) const {
90  return (id < dptid.id);
91  };
92 
93 public:
94 
98  const uint64_t&
99  get_dptid() const { return id; };
100 
104  const std::string&
105  get_dptid_s() const { return s_id; };
106 
107 public:
108 
109  friend std::ostream&
110  operator<< (std::ostream& os, const cdptid& dptid) {
111  os << rofl::indent(0) << "<cdptid: " << std::hex << (unsigned long long)dptid.id << std::dec
112  << " (" << dptid.s_id << ")" << " >" << std::endl;
113  return os;
114  };
115 
116  std::string
117  str() const {
118  std::stringstream ss;
119  ss << id;
120  return ss.str();
121  };
122 };
123 
124 }; // end of namespace
125 
126 #endif /* CDPTID_H_ */
rofl-common's internal remote datapath handle.
Definition: cdptid.h:24
Definition: logging.h:76