Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

MDMFLengthAttribute.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/basic.h>
35 
36 namespace ogdf {
37 namespace embedder {
38 
46 public:
48  MDMFLengthAttribute() { a = b = 0; }
49 
51  MDMFLengthAttribute(int _a, int _b = 0) : a(_a), b(_b) { }
52 
54  MDMFLengthAttribute(const MDMFLengthAttribute& x) : a(x.a), b(x.b) { }
55 
58 
60  a = x.a;
61  b = x.b;
62  return *this;
63  }
64 
66  a += x.a;
67  b += x.b;
68  return *this;
69  }
70 
72  a -= x.a;
73  b -= x.b;
74  return *this;
75  }
76 
77  //the two components:
78  int a;
79  int b;
80 };
81 
82 inline bool operator==(const MDMFLengthAttribute& x, const MDMFLengthAttribute& y) {
83  return x.a == y.a && x.b == y.b;
84 }
85 
86 inline bool operator!=(const MDMFLengthAttribute& x, const MDMFLengthAttribute& y) {
87  return !(x == y);
88 }
89 
90 inline bool operator<(const MDMFLengthAttribute& x, const MDMFLengthAttribute& y) {
91  return x.a < y.a || (x.a == y.a && x.b < y.b);
92 }
93 
94 inline bool operator>(const MDMFLengthAttribute& x, const MDMFLengthAttribute& y) { return y < x; }
95 
96 inline bool operator>=(const MDMFLengthAttribute& x, const MDMFLengthAttribute& y) {
97  return !(x < y);
98 }
99 
100 inline bool operator<=(const MDMFLengthAttribute& x, const MDMFLengthAttribute& y) {
101  return !(y < x);
102 }
103 
105  x += y;
106  return x;
107 }
108 
110  x -= y;
111  return x;
112 }
113 
114 inline std::ostream& operator<<(std::ostream& s, const MDMFLengthAttribute& x) {
115  s << x.a << ", " << x.b;
116  return s;
117 }
118 
119 }
120 }
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
ogdf::embedder::MDMFLengthAttribute
Auxiliary length attribute.
Definition: MDMFLengthAttribute.h:45
ogdf::embedder::operator>=
bool operator>=(const MDMFLengthAttribute &x, const MDMFLengthAttribute &y)
Definition: MDMFLengthAttribute.h:96
ogdf::embedder::MDMFLengthAttribute::operator=
MDMFLengthAttribute & operator=(const MDMFLengthAttribute &x)
Definition: MDMFLengthAttribute.h:59
ogdf::embedder::operator<
bool operator<(const MDMFLengthAttribute &x, const MDMFLengthAttribute &y)
Definition: MDMFLengthAttribute.h:90
ogdf::embedder::operator==
bool operator==(const MDMFLengthAttribute &x, const MDMFLengthAttribute &y)
Definition: MDMFLengthAttribute.h:82
ogdf::embedder::MDMFLengthAttribute::b
int b
Definition: MDMFLengthAttribute.h:79
ogdf::embedder::MDMFLengthAttribute::operator-=
MDMFLengthAttribute & operator-=(const MDMFLengthAttribute &x)
Definition: MDMFLengthAttribute.h:71
ogdf::embedder::MDMFLengthAttribute::operator+=
MDMFLengthAttribute & operator+=(const MDMFLengthAttribute &x)
Definition: MDMFLengthAttribute.h:65
ogdf::embedder::operator+
MDMFLengthAttribute operator+(MDMFLengthAttribute x, const MDMFLengthAttribute &y)
Definition: MDMFLengthAttribute.h:104
ogdf::embedder::MDMFLengthAttribute::MDMFLengthAttribute
MDMFLengthAttribute()
Default constructor for (0, 0)
Definition: MDMFLengthAttribute.h:48
ogdf::embedder::operator<<
std::ostream & operator<<(std::ostream &s, const MDMFLengthAttribute &x)
Definition: MDMFLengthAttribute.h:114
ogdf::embedder::operator!=
bool operator!=(const MDMFLengthAttribute &x, const MDMFLengthAttribute &y)
Definition: MDMFLengthAttribute.h:86
ogdf::embedder::operator<=
bool operator<=(const MDMFLengthAttribute &x, const MDMFLengthAttribute &y)
Definition: MDMFLengthAttribute.h:100
ogdf::embedder::operator-
MDMFLengthAttribute operator-(MDMFLengthAttribute x, const MDMFLengthAttribute &y)
Definition: MDMFLengthAttribute.h:109
basic.h
Basic declarations, included by all source files.
ogdf::embedder::MDMFLengthAttribute::a
int a
Definition: MDMFLengthAttribute.h:78
ogdf::embedder::MDMFLengthAttribute::MDMFLengthAttribute
MDMFLengthAttribute(const MDMFLengthAttribute &x)
Copy constructor.
Definition: MDMFLengthAttribute.h:54
ogdf::embedder::MDMFLengthAttribute::MDMFLengthAttribute
MDMFLengthAttribute(int _a, int _b=0)
Converting constructor from int, default second is 0.
Definition: MDMFLengthAttribute.h:51
ogdf::embedder::MDMFLengthAttribute::~MDMFLengthAttribute
~MDMFLengthAttribute()
Destructor.
Definition: MDMFLengthAttribute.h:57
ogdf::embedder::operator>
bool operator>(const MDMFLengthAttribute &x, const MDMFLengthAttribute &y)
Definition: MDMFLengthAttribute.h:94