Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00040 #ifndef OGDF_UPWARD_PLANARIZER_MODULE_H
00041 #define OGDF_UPWARD_PLANARIZER_MODULE_H
00042
00043
00044 #include <ogdf/basic/Module.h>
00045 #include <ogdf/upward/UpwardPlanRep.h>
00046
00047
00048 namespace ogdf {
00049
00054 class OGDF_EXPORT UpwardPlanarizerModule : public Module
00055 {
00056
00057 public:
00058
00060 UpwardPlanarizerModule() { }
00061
00062
00063 virtual ~UpwardPlanarizerModule() { }
00064
00083 ReturnType call(UpwardPlanRep &UPR,
00084 const EdgeArray<int> * cost = 0,
00085 const EdgeArray<bool> * forbid = 0)
00086 {
00087 m_useCost = (cost != 0);
00088 m_useForbid = (forbid != 0);
00089
00090 if(!useCost()) cost = OGDF_NEW EdgeArray<int> (UPR.original(), 1);
00091 if(!useForbid()) forbid = OGDF_NEW EdgeArray<bool> (UPR.original(), 0);
00092
00093
00094 ReturnType R = doCall(UPR, *cost, *forbid);
00095
00096 if(!useCost()) delete cost;
00097 if(!useForbid()) delete forbid;
00098 return R;
00099 };
00100
00101
00103 ReturnType operator()(UpwardPlanRep &UPR,
00104 const EdgeArray<int> * cost = 0,
00105 const EdgeArray<bool> * forbid = 0) {
00106 return call(UPR, cost, forbid);
00107 };
00108
00109
00111 bool useCost() const { return m_useCost; }
00112
00114 bool useForbid() const { return m_useForbid; }
00115
00116 protected:
00136 virtual ReturnType doCall(UpwardPlanRep &UPR,
00137 const EdgeArray<int> &cost,
00138 const EdgeArray<bool> &forbid) = 0;
00139
00140
00141 OGDF_MALLOC_NEW_DELETE
00142
00143 private:
00144
00145 bool m_useCost;
00146 bool m_useForbid;
00147
00148 };
00149
00150 }
00151
00152 #endif
00153