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_WHA_INFO_H 00049 #define OGDF_WHA_INFO_H 00050 00051 00052 #include <ogdf/internal/planarity/PQNodeRoot.h> 00053 00054 00055 namespace ogdf{ 00056 00067 enum whaType { 00068 W_TYPE, B_TYPE, H_TYPE, A_TYPE 00069 }; 00070 00071 00072 /* 00073 00074 NOTICE: 00075 00076 A compiler bug occurs, when declaring a template class friend of a 00077 nontemplate class. This forces us to reject making MaxSequencePQTree 00078 a friend of whaInfo. 00079 00080 template<class T, class Y> class MaxSequencePQTree; 00081 class whaKey; 00082 */ 00083 00084 class whaInfo 00085 { 00086 /* 00087 friend class whaKey; 00088 template<class T, class Y> friend class MaxSequencePQTree; 00089 */ 00090 00091 public: 00092 00093 //The deleteType is set to type b (= keep all leaves in the frontier). 00094 whaInfo() { 00095 m_a = 0; 00096 m_h = 0; 00097 m_w = 0; 00098 m_deleteTyp = B_TYPE; 00099 m_pertLeafCount = 0; 00100 m_notVisitedCount = 0; 00101 m_aChild = 0; 00102 m_hChild1 = 0; 00103 m_hChild2 = 0; 00104 m_hChild2Sib = 0; 00105 } 00106 00107 00108 ~whaInfo() {} 00109 00110 00111 void defaultValues() { 00112 m_a = 0; 00113 m_h = 0; 00114 m_w = 0; 00115 m_deleteTyp = B_TYPE; 00116 m_pertLeafCount = 0; 00117 m_notVisitedCount = 0; 00118 } 00119 00120 00121 //private: 00122 00123 00124 // number of pertinent leaves in the frontier of the node respectively the 00125 // number of leaves that have to be deleted in the frontier of the node to 00126 // make it an empty node. 00127 int m_h; 00128 00129 // number of pertinent leaves in the frontier of the node that have to be 00130 // deleted in order to create a node of type h, that is a node, where a 00131 // permutation of the leaves of the node exist such that the remaining 00132 // pertinent leaves form a consecutive sequence on one end of the permutation. 00133 int m_w; 00134 00135 // number of pertinent leaves in the frontier of the node that have to be 00136 // deleted in order to create a node of type $a$, that is a node, where a 00137 // permutation of the leaves of the node exist such that the remaining 00138 // pertinent leaves form a consecutive somewhere within the permutation. 00139 int m_a; 00140 00141 // deleteType is type of the node being either 00142 // W_TYPE, B_TYPE, H_TYPE or A_TYPE. 00143 int m_deleteTyp; 00144 00145 //the number of pertinent leaves in the frontier of a node. 00146 int m_pertLeafCount; 00147 00148 //counts the number of pertinent children, that have not been 00149 // processed yet during the computation of the w,h,a-numbering. 00150 int m_notVisitedCount; 00151 00152 // a pointer to the child of node that has to be of type a if the 00153 // node itself has been determined to be of type a. 00154 PQNodeRoot *m_aChild; 00155 00156 // a pointer to the child of node that has to be of type h if the 00157 // node itself has been determined to be of type h. 00158 PQNodeRoot *m_hChild1; 00159 00160 // a pointer to the child of node that has to be of type h if the 00161 // node itself has been determined to be of type a and m_aChild does 00162 // contain the empty pointer. 00163 PQNodeRoot *m_hChild2; 00164 00165 00166 // m_hChild2Sib is a pointer to the pertinent sibling of m_hChild2. This 00167 // pointer is necessary if the sequence of pertinent children is not unique. 00168 PQNodeRoot *m_hChild2Sib; 00169 00170 OGDF_NEW_DELETE 00171 }; 00172 00173 00174 class whaKey : public PQNodeKey<edge,whaInfo*,bool> 00175 { 00176 public: 00177 00178 whaKey(whaInfo* i) : PQNodeKey<edge,whaInfo*,bool>(i) {} 00179 00180 virtual ~whaKey() {} 00181 00182 const char* print() 00183 { 00184 if (!m_printString) 00185 m_printString = new char[128]; 00186 ogdf::sprintf(m_printString,128,"w=%d, h=%d, a=%d", 00187 m_userStructInfo->m_w,m_userStructInfo->m_h, 00188 m_userStructInfo->m_a); 00189 return m_printString; 00190 } 00191 }; 00192 00193 } 00194 00195 #endif 00196 00197