Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

PQLeaf.h
Go to the documentation of this file.
1 
32 #pragma once
33 
36 
37 namespace ogdf {
38 template<class T, class X, class Y>
39 class PQInternalKey;
40 template<class T, class X, class Y>
41 class PQLeafKey;
42 template<class T, class X, class Y>
43 class PQNodeKey;
44 
54 template<class T, class X, class Y>
55 class PQLeaf : public PQNode<T, X, Y> {
56 public:
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) {
128  m_pointerToKey->setNodePointer(this);
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 
206 private:
213 
222 
228 };
229 
230 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
PQNode.h
Declaration and implementation of the class PQNode.
ogdf::PQLeaf::PQLeaf
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
ogdf::PQLeaf::m_mark
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
ogdf::PQLeaf::~PQLeaf
virtual ~PQLeaf()
The destructor does not delete any accompanying information class as PQLeafKey, PQNodeKey and PQInter...
Definition: PQLeaf.h:102
ogdf::PQLeafKey
The class template PQLeafKey is a derived class of class template PQBasicKey.
Definition: PQInternalNode.h:40
ogdf::PQLeaf::mark
virtual void mark(PQNodeRoot::PQNodeMark m)
Sets the variable m_mark.
Definition: PQLeaf.h:176
ogdf::PQNodeRoot::PQNodeMark::Unmarked
@ Unmarked
ogdf::PQLeaf::PQLeaf
PQLeaf(int count, PQNodeRoot::PQNodeStatus stat, PQLeafKey< T, X, Y > *keyPtr)
Definition: PQLeaf.h:83
PQNodeRoot.h
Declaration and implementation of the class PQNodeRoot.
ogdf::PQLeaf::status
virtual void status(PQNodeRoot::PQNodeStatus s)
Sets the variable m_status in the derived class PQLeaf.
Definition: PQLeaf.h:192
ogdf::PQNodeRoot::PQNodeType
PQNodeType
Definition: PQNodeRoot.h:45
ogdf::PQNodeRoot::PQNodeType::Leaf
@ Leaf
ogdf::PQInternalKey
The class template PQInternalKey is a derived class of class template PQBasicKey.
Definition: PQInternalKey.h:55
ogdf::PQLeaf::m_status
PQNodeRoot::PQNodeStatus m_status
m_status is a variable storing the status of a PQLeaf.
Definition: PQLeaf.h:227
ogdf::PQNodeRoot::PQNodeMark
PQNodeMark
Definition: PQNodeRoot.h:72
ogdf::PQLeaf::type
virtual void type(PQNodeRoot::PQNodeType)
Sets the variable PQInternalNode::m_type in the derived class PQLeaf.
Definition: PQLeaf.h:204
ogdf::PQLeaf::mark
virtual PQNodeRoot::PQNodeMark mark() const
Returns the variable m_mark.
Definition: PQLeaf.h:173
ogdf::PQLeaf::setInternal
virtual bool setInternal(PQInternalKey< T, X, Y > *pointerToInternal)
setInternal() accepts only pointers pointerToInternal = 0.
Definition: PQLeaf.h:158
ogdf::PQLeaf
The datastructure PQ-tree was designed to present a set of permutations on an arbitrary set of elemen...
Definition: PQLeaf.h:55
ogdf::PQLeaf::status
virtual PQNodeRoot::PQNodeStatus status() const
Returns the variable m_status in the derived class PQLeaf.
Definition: PQLeaf.h:189
ogdf::PQLeaf::type
virtual PQNodeRoot::PQNodeType type() const
Returns the variable PQInternalNode::m_type in the derived class PQLeaf.
Definition: PQLeaf.h:201
ogdf::PQLeaf::setKey
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
ogdf::PQNodeKey
The class template PQNodeKey is a derived class of class template PQBasicKey.
Definition: PQInternalNode.h:42
ogdf::PQLeaf::getKey
virtual PQLeafKey< T, X, Y > * getKey() const
getKey() returns a pointer to the PQLeafKey of PQLeaf.
Definition: PQLeaf.h:111
ogdf::PQNodeRoot::PQNodeStatus
PQNodeStatus
Definition: PQNodeRoot.h:50
ogdf::PQLeaf::m_pointerToKey
PQLeafKey< T, X, Y > * m_pointerToKey
m_pointerToKey stores the adress of the corresponding PQLeafKey.
Definition: PQLeaf.h:221
ogdf::PQLeaf::getInternal
virtual PQInternalKey< T, X, Y > * getInternal() const
getInternal() returns 0.
Definition: PQLeaf.h:142
ogdf::PQNode
The class template PQBasicKey is an abstract base class.
Definition: PQBasicKey.h:111