Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
PQLeaf.h
Go to the documentation of this file.
1
32#pragma once
33
36
37namespace ogdf {
38template<class T, class X, class Y>
39class PQInternalKey;
40template<class T, class X, class Y>
41class PQLeafKey;
42template<class T, class X, class Y>
43class PQNodeKey;
44
54template<class T, class X, class Y>
55class PQLeaf : public PQNode<T, X, Y> {
56public:
74 PQNodeKey<T, X, Y>* infoPtr)
75 : PQNode<T, X, Y>(count, infoPtr) {
76 m_status = stat;
77 m_pointerToKey = keyPtr;
79 keyPtr->setNodePointer(this);
80 }
81
82 // Constructor
84 : PQNode<T, X, Y>(count) {
85 m_status = stat;
86 m_pointerToKey = keyPtr;
88 keyPtr->setNodePointer(this);
89 }
90
102 virtual ~PQLeaf() { }
103
111 virtual PQLeafKey<T, X, Y>* getKey() const { return m_pointerToKey; }
112
125 virtual bool setKey(PQLeafKey<T, X, Y>* pointerToKey) {
126 m_pointerToKey = pointerToKey;
127 if (pointerToKey != nullptr) {
129 return true;
130 } else {
131 return false;
132 }
133 }
134
142 virtual PQInternalKey<T, X, Y>* getInternal() const { return nullptr; }
143
158 virtual bool setInternal(PQInternalKey<T, X, Y>* pointerToInternal) {
159 if (pointerToInternal != nullptr) {
160 return false;
161 } else {
162 return true;
163 }
164 }
165
167
173 virtual PQNodeRoot::PQNodeMark mark() const { return m_mark; }
174
176 virtual void mark(PQNodeRoot::PQNodeMark m) { m_mark = m; }
177
179
189 virtual PQNodeRoot::PQNodeStatus status() const { return m_status; }
190
192 virtual void status(PQNodeRoot::PQNodeStatus s) { m_status = s; }
193
195
202
204 virtual void type(PQNodeRoot::PQNodeType) { }
205
206private:
213
222
228};
229
230}
Declaration and implementation of the class PQNode.
Declaration and implementation of the class PQNodeRoot.
void setNodePointer(PQNode< T, X, Y > *pqNode)
The function setNodePointer() sets the private member m_nodePointer.
Definition PQBasicKey.h:156
The class template PQInternalKey is a derived class of class template PQBasicKey.
The datastructure PQ-tree was designed to present a set of permutations on an arbitrary set of elemen...
Definition PQLeaf.h:55
virtual PQNodeRoot::PQNodeType type() const
Returns the variable PQInternalNode::m_type in the derived class PQLeaf.
Definition PQLeaf.h:201
virtual PQLeafKey< T, X, Y > * getKey() const
getKey() returns a pointer to the PQLeafKey of PQLeaf.
Definition PQLeaf.h:111
virtual PQNodeRoot::PQNodeStatus status() const
Returns the variable m_status in the derived class PQLeaf.
Definition PQLeaf.h:189
virtual void status(PQNodeRoot::PQNodeStatus s)
Sets the variable m_status in the derived class PQLeaf.
Definition PQLeaf.h:192
PQLeaf(int count, PQNodeRoot::PQNodeStatus stat, PQLeafKey< T, X, Y > *keyPtr, PQNodeKey< T, X, Y > *infoPtr)
The client may choose between two different constructors.
Definition PQLeaf.h:73
virtual PQInternalKey< T, X, Y > * getInternal() const
getInternal() returns 0.
Definition PQLeaf.h:142
PQNodeRoot::PQNodeMark m_mark
m_mark is a variable, storing if the PQLeaf is QUEUEUD, BLOCKED or UNBLOCKED (see PQNode) during the ...
Definition PQLeaf.h:212
virtual bool setInternal(PQInternalKey< T, X, Y > *pointerToInternal)
setInternal() accepts only pointers pointerToInternal = 0.
Definition PQLeaf.h:158
virtual void mark(PQNodeRoot::PQNodeMark m)
Sets the variable m_mark.
Definition PQLeaf.h:176
virtual bool setKey(PQLeafKey< T, X, Y > *pointerToKey)
setKey() sets the pointer variable m_pointerToKey to the specified address of pointerToKey that is of...
Definition PQLeaf.h:125
virtual ~PQLeaf()
The destructor does not delete any accompanying information class as PQLeafKey, PQNodeKey and PQInter...
Definition PQLeaf.h:102
virtual PQNodeRoot::PQNodeMark mark() const
Returns the variable m_mark.
Definition PQLeaf.h:173
virtual void type(PQNodeRoot::PQNodeType)
Sets the variable PQInternalNode::m_type in the derived class PQLeaf.
Definition PQLeaf.h:204
PQNodeRoot::PQNodeStatus m_status
m_status is a variable storing the status of a PQLeaf.
Definition PQLeaf.h:227
PQLeafKey< T, X, Y > * m_pointerToKey
m_pointerToKey stores the adress of the corresponding PQLeafKey.
Definition PQLeaf.h:221
PQLeaf(int count, PQNodeRoot::PQNodeStatus stat, PQLeafKey< T, X, Y > *keyPtr)
Definition PQLeaf.h:83
The class template PQLeafKey is a derived class of class template PQBasicKey.
Definition PQLeafKey.h:84
The class template PQBasicKey is an abstract base class.
Definition PQNode.h:56
The class template PQNodeKey is a derived class of class template PQBasicKey.
Definition PQNodeKey.h:54
The namespace for all OGDF objects.