Revised OpenFlow Library  v0.6.0dev
 All Classes Files Functions Variables Friends Groups Pages
cauxid.h
1 /*
2  * cauxid.h
3  *
4  * Created on: 20.05.2014
5  * Author: andreas
6  */
7 
8 #ifndef CAUXID_H_
9 #define CAUXID_H_
10 
11 #include <inttypes.h>
12 #include <iostream>
13 
14 #include "rofl/common/logging.h"
15 #include "rofl/common/croflexception.h"
16 
17 namespace rofl {
18 
19 class eAuxIdBase : public RoflException {
20 public:
21  eAuxIdBase(const std::string __arg) : RoflException(__arg) {};
22 };
23 
24 class eAuxIdNotFound : public eAuxIdBase {
25 public:
26  eAuxIdNotFound(const std::string __arg) : eAuxIdBase(__arg) {};
27 };
28 
29 
30 class cauxid {
31 
32  uint8_t id;
33 
34 public:
35 
39  cauxid(
40  uint8_t id = 0) :
41  id(id) {};
42 
46  ~cauxid() {};
47 
51  cauxid(
52  const cauxid& auxid) {
53  *this = auxid;
54  };
55 
59  cauxid&
60  operator= (
61  const cauxid& auxid) {
62  if (this == &auxid)
63  return *this;
64  id = auxid.id;
65  return *this;
66  };
67 
71  bool
72  operator< (
73  const cauxid& auxid) const {
74  return (id < auxid.id);
75  };
76 
80  bool
81  operator== (
82  const cauxid& auxid) const {
83  return (id == auxid.id);
84  };
85 
89  uint8_t const&
90  get_id() const { return id; }
91 
92 public:
93 
94  friend std::ostream&
95  operator<< (std::ostream& os, const cauxid& auxid) {
96  os << rofl::indent(0) << "<cauxid id:" << (int)auxid.id << " >" << std::endl;
97  return os;
98  };
99 
100 
104  std::string
105  str() const {
106  std::stringstream ss;
107  ss << (int)get_id();
108  return ss.str();
109  };
110 };
111 
112 }; // end of namespace rofl
113 
114 #endif /* CAUXID_H_ */
Definition: cauxid.h:30
Definition: cauxid.h:24
Definition: cauxid.h:19
Definition: logging.h:76
Definition: croflexception.h:27