Open
Graph Drawing
Framework

 v.2012.05
 

PQInternalNode.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_INTERNAL_NODE_H
00049 #define OGDF_PQ_INTERNAL_NODE_H
00050 
00051 
00052 
00053 #include <ogdf/internal/planarity/PQNode.h>
00054 
00055 namespace ogdf {
00056 
00057 
00096 template<class T,class X,class Y>
00097 class PQInternalNode : public PQNode<T,X,Y>
00098 {
00099 public:
00100 
00101     PQInternalNode(
00102         int count,
00103         int typ,
00104         int stat,
00105         PQInternalKey<T,X,Y>* internalPtr,
00106         PQNodeKey<T,X,Y>* infoPtr)
00107         : PQNode<T,X,Y>(count,infoPtr)
00108     {
00109         m_type = typ;
00110         m_status = stat;
00111         m_mark = UNMARKED;
00112 
00113         m_pointerToInternal = internalPtr;
00114         internalPtr->setNodePointer(this);
00115     }
00116 
00117     PQInternalNode(
00118         int count,
00119         int typ,
00120         int stat,
00121         PQInternalKey<T,X,Y>* internalPtr)
00122         : PQNode<T,X,Y>(count)
00123     {
00124         m_type   = typ;
00125         m_status = stat;
00126         m_mark   = UNMARKED;
00127         m_pointerToInternal = internalPtr;
00128         internalPtr->setNodePointer(this);
00129     }
00130 
00131     PQInternalNode(
00132         int count,
00133         int typ,
00134         int stat,
00135         PQNodeKey<T,X,Y>* infoPtr)
00136         : PQNode<T,X,Y>(count,infoPtr)
00137     {
00138         m_type   = typ;
00139         m_status = stat;
00140         m_mark   = UNMARKED;
00141         m_pointerToInternal = 0;
00142     }
00143 
00144     PQInternalNode(
00145         int count,
00146         PQNodeRoot::PQNodeType typ,
00147         int stat)
00148         : PQNode<T,X,Y>(count)
00149     {
00150         m_type = typ;
00151         m_status = stat;
00152         m_mark = UNMARKED;
00153         m_pointerToInternal = 0;
00154    
00155     }
00156 
00168     ~PQInternalNode() {}
00169 
00170 
00172     virtual PQLeafKey<T,X,Y>* getKey() const { return 0; }
00173 
00186     virtual bool setKey(PQLeafKey<T,X,Y>* pointerToKey)
00187     {
00188         return (pointerToKey == 0);
00189     }
00190 
00192     virtual PQInternalKey<T,X,Y>* getInternal() const { return m_pointerToInternal; }
00193 
00205     virtual bool setInternal(PQInternalKey<T,X,Y>* pointerToInternal)
00206     {
00207         m_pointerToInternal = pointerToInternal;
00208         if (pointerToInternal != 0)
00209         {
00210             m_pointerToInternal->setNodePointer(this);
00211             return true;
00212         }
00213         else
00214             return false;
00215     }
00216 
00218 
00224     virtual int mark() const { return m_mark; }        
00225     
00227     virtual void mark(int m) { m_mark = m; }
00228 
00230 
00239     virtual int status() const { return m_status; }
00240     
00242     virtual void status(int s) { m_status = s; }
00243 
00245 
00249     virtual PQNodeRoot::PQNodeType type() const { return m_type; }      
00250     
00252     virtual void type(PQNodeRoot::PQNodeType t) { m_type = t; }
00253 
00254 private:
00255 
00261     int m_mark;  
00262 
00263 
00273     PQInternalKey<T,X,Y>* m_pointerToInternal;
00274 
00280     int m_status;
00281 
00287     PQNodeRoot::PQNodeType m_type;
00288 };
00289 
00290 }
00291 
00292 #endif
00293 
00294