Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

PQLeaf.h
Go to the documentation of this file.
1 
32 #pragma once
33 
35 
36 namespace ogdf {
37 
47 template<class T, class X, class Y>
48 class PQLeaf : public PQNode<T, X, Y> {
49 public:
67  PQNodeKey<T, X, Y>* infoPtr)
68  : PQNode<T, X, Y>(count, infoPtr) {
69  m_status = stat;
70  m_pointerToKey = keyPtr;
72  keyPtr->setNodePointer(this);
73  }
74 
75  // Constructor
77  : PQNode<T, X, Y>(count) {
78  m_status = stat;
79  m_pointerToKey = keyPtr;
81  keyPtr->setNodePointer(this);
82  }
83 
95  virtual ~PQLeaf() { }
96 
104  virtual PQLeafKey<T, X, Y>* getKey() const { return m_pointerToKey; }
105 
118  virtual bool setKey(PQLeafKey<T, X, Y>* pointerToKey) {
119  m_pointerToKey = pointerToKey;
120  if (pointerToKey != nullptr) {
121  m_pointerToKey->setNodePointer(this);
122  return true;
123  } else {
124  return false;
125  }
126  }
127 
135  virtual PQInternalKey<T, X, Y>* getInternal() const { return nullptr; }
136 
151  virtual bool setInternal(PQInternalKey<T, X, Y>* pointerToInternal) {
152  if (pointerToInternal != nullptr) {
153  return false;
154  } else {
155  return true;
156  }
157  }
158 
160 
166  virtual PQNodeRoot::PQNodeMark mark() const { return m_mark; }
167 
169  virtual void mark(PQNodeRoot::PQNodeMark m) { m_mark = m; }
170 
172 
182  virtual PQNodeRoot::PQNodeStatus status() const { return m_status; }
183 
185  virtual void status(PQNodeRoot::PQNodeStatus s) { m_status = s; }
186 
188 
195 
197  virtual void type(PQNodeRoot::PQNodeType) { }
198 
199 private:
206 
215 
221 };
222 
223 }
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
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:66
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:205
ogdf::PQLeaf::~PQLeaf
virtual ~PQLeaf()
The destructor does not delete any accompanying information class as PQLeafKey, PQNodeKey and PQInter...
Definition: PQLeaf.h:95
ogdf::PQLeafKey
The class template PQLeafKey is a derived class of class template PQBasicKey.
Definition: PQLeafKey.h:87
ogdf::PQLeaf::mark
virtual void mark(PQNodeRoot::PQNodeMark m)
Sets the variable m_mark.
Definition: PQLeaf.h:169
ogdf::PQNodeRoot::PQNodeMark::Unmarked
@ Unmarked
ogdf::PQLeaf::PQLeaf
PQLeaf(int count, PQNodeRoot::PQNodeStatus stat, PQLeafKey< T, X, Y > *keyPtr)
Definition: PQLeaf.h:76
ogdf::PQLeaf::status
virtual void status(PQNodeRoot::PQNodeStatus s)
Sets the variable m_status in the derived class PQLeaf.
Definition: PQLeaf.h:185
ogdf::PQNodeRoot::PQNodeType
PQNodeType
Definition: PQNodeRoot.h:46
ogdf::PQNodeRoot::PQNodeType::Leaf
@ Leaf
ogdf::PQInternalKey
The class template PQInternalKey is a derived class of class template PQBasicKey.
Definition: PQInternalKey.h:58
ogdf::PQLeaf::m_status
PQNodeRoot::PQNodeStatus m_status
m_status is a variable storing the status of a PQLeaf.
Definition: PQLeaf.h:220
ogdf::PQNodeRoot::PQNodeMark
PQNodeMark
Definition: PQNodeRoot.h:73
ogdf::PQLeaf::type
virtual void type(PQNodeRoot::PQNodeType)
Sets the variable PQInternalNode::m_type in the derived class PQLeaf.
Definition: PQLeaf.h:197
ogdf::PQLeaf::mark
virtual PQNodeRoot::PQNodeMark mark() const
Returns the variable m_mark.
Definition: PQLeaf.h:166
ogdf::PQLeaf::setInternal
virtual bool setInternal(PQInternalKey< T, X, Y > *pointerToInternal)
setInternal() accepts only pointers pointerToInternal = 0.
Definition: PQLeaf.h:151
ogdf::PQLeaf
The datastructure PQ-tree was designed to present a set of permutations on an arbitrary set of elemen...
Definition: PQLeaf.h:48
ogdf::PQBasicKey::setNodePointer
void setNodePointer(PQNode< T, X, Y > *pqNode)
The function setNodePointer() sets the private member m_nodePointer.
Definition: PQBasicKey.h:154
ogdf::PQLeaf::status
virtual PQNodeRoot::PQNodeStatus status() const
Returns the variable m_status in the derived class PQLeaf.
Definition: PQLeaf.h:182
ogdf::PQLeaf::type
virtual PQNodeRoot::PQNodeType type() const
Returns the variable PQInternalNode::m_type in the derived class PQLeaf.
Definition: PQLeaf.h:194
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:118
ogdf::PQNodeKey
The class template PQNodeKey is a derived class of class template PQBasicKey.
Definition: PQNode.h:50
ogdf::PQLeaf::getKey
virtual PQLeafKey< T, X, Y > * getKey() const
getKey() returns a pointer to the PQLeafKey of PQLeaf.
Definition: PQLeaf.h:104
ogdf::PQNodeRoot::PQNodeStatus
PQNodeStatus
Definition: PQNodeRoot.h:51
ogdf::PQLeaf::m_pointerToKey
PQLeafKey< T, X, Y > * m_pointerToKey
m_pointerToKey stores the adress of the corresponding PQLeafKey.
Definition: PQLeaf.h:214
ogdf::PQLeaf::getInternal
virtual PQInternalKey< T, X, Y > * getInternal() const
getInternal() returns 0.
Definition: PQLeaf.h:135
ogdf::PQNode
The class template PQBasicKey is an abstract base class.
Definition: PQBasicKey.h:109