Open
Graph Drawing
Framework

 v.2012.05
 

PQLeaf.h
Go to the documentation of this file.
00001 /*
00002  * $Revision: 2299 $
00003  * 
00004  * last checkin:
00005  *   $Author: gutwenger $ 
00006  *   $Date: 2012-05-07 15:57:08 +0200 (Mon, 07 May 2012) $ 
00007  ***************************************************************/
00008  
00043 #ifdef _MSC_VER
00044 #pragma once
00045 #endif
00046 
00047 
00048 #ifndef OGDF_PQ_LEAF_H
00049 #define OGDF_PQ_LEAF_H
00050 
00051 
00052 
00053 #include <ogdf/internal/planarity/PQNode.h>
00054 
00055 namespace ogdf {
00056 
00057 
00068 template<class T,class X,class Y> 
00069 class PQLeaf : public PQNode<T,X,Y>
00070 {
00071 public:
00072  
00089     PQLeaf(
00090         int count,
00091         int stat,
00092         PQLeafKey<T,X,Y>* keyPtr,
00093         PQNodeKey<T,X,Y>* infoPtr)
00094         : PQNode<T,X,Y>(count,infoPtr)
00095     {
00096         m_status = stat;
00097         m_pointerToKey = keyPtr;
00098         m_mark = UNMARKED;
00099         keyPtr->setNodePointer(this);
00100     }
00101 
00102     // Constructor
00103     PQLeaf(
00104         int count,
00105         int stat,
00106         PQLeafKey<T,X,Y>* keyPtr)
00107         : PQNode<T,X,Y>(count)
00108     {
00109         m_status = stat;
00110         m_pointerToKey = keyPtr;
00111         m_mark = UNMARKED;
00112         keyPtr->setNodePointer(this);
00113     } 
00114 
00126     virtual ~PQLeaf() {}
00127 
00135     virtual PQLeafKey<T,X,Y>* getKey() const { return m_pointerToKey; }
00136 
00149     virtual bool setKey(PQLeafKey<T,X,Y>* pointerToKey)
00150     {
00151         m_pointerToKey = pointerToKey;
00152         if (pointerToKey != 0)
00153         { 
00154             m_pointerToKey->setNodePointer(this);
00155             return true;
00156         }
00157         else
00158             return false;
00159     }
00160 
00168     virtual PQInternalKey<T,X,Y>* getInternal() const { return 0; }
00169     
00184     virtual bool setInternal(PQInternalKey<T,X,Y>* pointerToInternal)
00185     {
00186         if (pointerToInternal != 0)
00187             return false;
00188         else
00189             return true;
00190     }
00191 
00193 
00199     virtual int  mark() const { return m_mark; }      
00200 
00202     virtual void mark(int m) { m_mark = m; }
00203 
00205 
00215     virtual int status() const { return m_status; }
00216     
00218     virtual void status(int s) { m_status = s; }
00219 
00221 
00227     virtual PQNodeRoot::PQNodeType type() const { return PQNodeRoot::leaf; }
00228     
00230     virtual void type(PQNodeRoot::PQNodeType) { }
00231 
00232 private:
00233 
00239     int m_mark;
00240 
00248     PQLeafKey<T,X,Y>* m_pointerToKey;
00249 
00254     int m_status;
00255 
00256 };
00257 
00258 }
00259 
00260 #endif
00261 
00262