Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

FaceSet.h
Go to the documentation of this file.
1 
33 #pragma once
34 
35 #include <ogdf/basic/FaceArray.h>
36 #include <ogdf/basic/SList.h>
37 
38 
39 
40 namespace ogdf {
41 
42 
44 
57 public:
59  explicit FaceSetSimple(const CombinatorialEmbedding &E) : m_isContained(E,false) { }
60 
61  // destructor
63 
65 
70  void insert(face f) {
71  OGDF_ASSERT(f->embeddingOf() == m_isContained.embeddingOf());
72  bool &isContained = m_isContained[f];
73  if (isContained == false) {
74  isContained = true;
75  m_faces.pushFront(f);
76  }
77  }
78 
79 
81 
86  void clear() {
87  for(face f : m_faces) {
88  m_isContained[f] = false;
89  }
90  m_faces.clear();
91  }
92 
93 
95 
100  bool isMember(face f) const {
101  OGDF_ASSERT(f->embeddingOf() == m_isContained.embeddingOf());
102  return m_isContained[f];
103  }
104 
106 
109  const SListPure<face> &faces() const {
110  return m_faces;
111  }
112 
113 private:
116 
119 };
120 
121 
122 
124 
139 public:
141  explicit FaceSetPure(const CombinatorialEmbedding &E) : m_it(E,ListIterator<face>()) { }
142 
143  // destructor
145 
147 
152  void insert(face f) {
153  OGDF_ASSERT(f->embeddingOf() == m_it.embeddingOf());
154  ListIterator<face> &itF = m_it[f];
155  if (!itF.valid())
156  itF = m_faces.pushBack(f);
157  }
158 
160 
165  void remove(face f) {
166  OGDF_ASSERT(f->embeddingOf() == m_it.embeddingOf());
167  ListIterator<face> &itF = m_it[f];
168  if (itF.valid()) {
169  m_faces.del(itF);
170  itF = ListIterator<face>();
171  }
172  }
173 
174 
176 
181  void clear() {
182  for(face f : m_faces) {
183  m_it[f] = ListIterator<face>();
184  }
185  m_faces.clear();
186  }
187 
188 
190 
195  bool isMember(face f) const {
196  OGDF_ASSERT(f->embeddingOf() == m_it.embeddingOf());
197  return m_it[f].valid();
198  }
199 
201 
204  const ListPure<face> &faces() const {
205  return m_faces;
206  }
207 
208 private:
212 
215 };
216 
217 
218 
220 
235 public:
237  explicit FaceSet(const CombinatorialEmbedding &E) : m_it(E,ListIterator<face>()) { }
238 
239  // destructor
240  ~FaceSet() { }
241 
243 
248  void insert(face f) {
249  OGDF_ASSERT(f->embeddingOf() == m_it.embeddingOf());
250  ListIterator<face> &itF = m_it[f];
251  if (!itF.valid())
252  itF = m_faces.pushBack(f);
253  }
254 
256 
261  void remove(face f) {
262  OGDF_ASSERT(f->embeddingOf() == m_it.embeddingOf());
263  ListIterator<face> &itF = m_it[f];
264  if (itF.valid()) {
265  m_faces.del(itF);
266  itF = ListIterator<face>();
267  }
268  }
269 
270 
272 
277  void clear() {
278  for(face f : m_faces) {
279  m_it[f] = ListIterator<face>();
280  }
281  m_faces.clear();
282  }
283 
284 
286 
291  bool isMember(face f) const {
292  OGDF_ASSERT(f->embeddingOf() == m_it.embeddingOf());
293  return m_it[f].valid();
294  }
295 
297 
300  int size() const {
301  return m_faces.size();
302  }
303 
305 
308  const List<face> &faces() const {
309  return m_faces;
310  }
311 
312 private:
316 
319 };
320 
321 
322 } // end namespace ogdf
Declaration of singly linked lists and iterators.
List< face > m_faces
The list of faces contained in S.
Definition: FaceSet.h:318
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:99
void clear()
Removes all faces from S.
Definition: FaceSet.h:86
Singly linked lists.
Definition: SList.h:38
Doubly linked lists.
Definition: List.h:40
void clear()
Removes all faces from S.
Definition: FaceSet.h:181
ListPure< face > m_faces
The list of faces contained in S.
Definition: FaceSet.h:214
void insert(face f)
Inserts face f into set S.
Definition: FaceSet.h:70
FaceArray< ListIterator< face > > m_it
m_it[f] contains the list iterator pointing to f if f is contained in S, an invalid list iterator oth...
Definition: FaceSet.h:211
declaration and implementation of FaceArray class
const List< face > & faces() const
Returns a reference to the list of faces contained in S.
Definition: FaceSet.h:308
void clear()
Removes all faces from S.
Definition: FaceSet.h:277
Simple face sets.
Definition: FaceSet.h:56
bool isMember(face f) const
Returns true if face f is contained in S, false otherwise.
Definition: FaceSet.h:291
void insert(face f)
Inserts face f into S.
Definition: FaceSet.h:248
SListPure< face > m_faces
The list of faces contained in S.
Definition: FaceSet.h:118
bool isMember(face f) const
Returns true if face f is contained in S, false otherwise.
Definition: FaceSet.h:100
void insert(face f)
Inserts face f into S.
Definition: FaceSet.h:152
Doubly linked lists (maintaining the length of the list).
Definition: List.h:39
Faces in a combinatorial embedding.
const SListPure< face > & faces() const
Returns a reference to the list of faces contained in S.
Definition: FaceSet.h:109
Encapsulates a pointer to a list element.
Definition: List.h:41
bool isMember(face f) const
Returns true if face f is contained in S, false otherwise.
Definition: FaceSet.h:195
const ListPure< face > & faces() const
Returns a reference to the list of faces contained in S.
Definition: FaceSet.h:204
FaceSetSimple(const CombinatorialEmbedding &E)
Creates an empty face set associated with combinatorial embedding E.
Definition: FaceSet.h:59
FaceArray< ListIterator< face > > m_it
m_it[f] contains the list iterator pointing to f if f is contained in S, an invalid list iterator oth...
Definition: FaceSet.h:315
FaceSetPure(const CombinatorialEmbedding &E)
Creates an empty node set associated with combinatorial embedding E.
Definition: FaceSet.h:141
int size() const
Returns the size of S.
Definition: FaceSet.h:300
FaceArray< bool > m_isContained
m_isContained[f] is true iff f is contained in S.
Definition: FaceSet.h:115
Face sets.
Definition: FaceSet.h:138
The namespace for all OGDF objects.
FaceSet(const CombinatorialEmbedding &E)
Creates an empty node set associated with combinatorial embedding E.
Definition: FaceSet.h:237
Face sets.
Definition: FaceSet.h:234
Combinatorial embeddings of planar graphs with modification functionality.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition: basic.h:41