source: source/ariba/utility/addressing/facades/comparable_v.hpp@ 5432

Last change on this file since 5432 was 5284, checked in by mies, 15 years ago

+ added new transport modules and adapted ariba to them
+ exchange endpoint descriptors an link establishment
+ clean up of base communication
+ link establishment with in the presence of multiple endpoints
+ local discovery for ipv6, ipv4 and bluetooth mac addresses

File size: 1.9 KB
Line 
1// comparable_v.hpp, created on 30.06.2009 by Sebastian Mies
2
3#ifndef COMPARABLE_V_HPP_
4#define COMPARABLE_V_HPP_
5
6#include "vfacade.hpp"
7
8/**
9 * TODO: Doc
10 *
11 * @author Sebastian Mies <mies@tm.uka.de>
12 */
13class comparable_v {
14public:
15 //--- comparable_v --------------------------------------------------------
16
17 /// implements comparison operators
18 virtual int compare_to(const comparable_v& rhs) const = 0;
19
20 /// convenience method for comparison
21 inline int compare_to(const comparable_v* rhs) const {
22 return compare_to(*rhs);
23 }
24
25 /// convenience method for comparison
26 inline bool operator==(const comparable_v& rhs) const {
27 return compare_to(rhs) == 0;
28 }
29
30 /// convenience method for comparison
31 inline bool operator!=(const comparable_v& rhs) const {
32 return compare_to(rhs) != 0;
33 }
34
35 /// convenience method for comparison
36 inline bool operator<(const comparable_v& rhs) const {
37 return compare_to(rhs) < 0;
38 }
39
40 /// convenience method for comparison
41 inline bool operator<=(const comparable_v& rhs) const {
42 return compare_to(rhs) <= 0;
43 }
44
45 /// convenience method for comparison
46 inline bool operator>(const comparable_v& rhs) const {
47 return compare_to(rhs) > 0;
48 }
49
50 /// convenience method for comparison
51 inline bool operator>=(const comparable_v& rhs) const {
52 return compare_to(rhs) >= 0;
53 }
54};
55
56typedef vfacade<comparable_v> comparable_vf;
57
58template<class NonVirtual, class AdaptorType>
59class vobject_hull<NonVirtual, comparable_v, AdaptorType> : public comparable_v {
60private:
61 typename AdaptorType::template adaptor_type<NonVirtual> obj;
62
63public:
64 template<typename T>
65 explicit vobject_hull(T& obj) :
66 obj(obj) {
67 }
68
69 explicit vobject_hull() :
70 obj() {
71 }
72
73 //--- comparable_v --------------------------------------------------------
74
75 /// implements comparison operators
76 virtual int compare_to(const comparable_v& rhs) const {
77 return obj->compare_to(rhs);
78 }
79};
80
81
82
83#endif /* COMPARABLE_V_HPP_ */
Note: See TracBrowser for help on using the repository browser.