Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

UpwardPlanarizerModule.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/Module.h>
36 
37 
38 namespace ogdf {
39 
45 {
46 
47 public:
48 
51 
52  // destruction
54 
74  const EdgeArray<int> * cost = nullptr,
75  const EdgeArray<bool> * forbid = nullptr)
76  {
77  m_useCost = (cost != nullptr);
78  m_useForbid = (forbid != nullptr);
79 
80  if(!useCost()) cost = new EdgeArray<int> (UPR.original(), 1);
81  if(!useForbid()) forbid = new EdgeArray<bool> (UPR.original(), 0);
82 
83 
84  ReturnType R = doCall(UPR, *cost, *forbid);
85 
86  if(!useCost()) delete cost;
87  if(!useForbid()) delete forbid;
88  return R;
89  }
90 
91 
94  const EdgeArray<int> * cost = nullptr,
95  const EdgeArray<bool> * forbid = nullptr) {
96  return call(UPR, cost, forbid);
97  }
98 
99 
101  bool useCost() const { return m_useCost; }
102 
104  bool useForbid() const { return m_useForbid; }
105 
106 protected:
124  virtual ReturnType doCall(
125  UpwardPlanRep &UPR,
126  const EdgeArray<int> &cost,
127  const EdgeArray<bool> &forbid) = 0;
128 
130 
131 private:
132 
133  bool m_useCost;
134  bool m_useForbid;
135 
136 };
137 
138 } // end namespace ogdf
Interface for upward planarization algorithms.
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:99
ReturnType call(UpwardPlanRep &UPR, const EdgeArray< int > *cost=nullptr, const EdgeArray< bool > *forbid=nullptr)
Computes a upward planarized representation (UPR) of the input graph G.
#define OGDF_MALLOC_NEW_DELETE
Makes the class use malloc for memory allocation.
Definition: memory.h:91
Declares base class for all module types.
bool useForbid() const
Returns true iff forbidden edges are given.
Base class for modules.
Definition: Module.h:47
Declaration of a base class for planar representations of graphs and cluster graphs.
Upward planarized representations (of a connected component) of a graph.
Definition: UpwardPlanRep.h:51
ReturnType
The return type of a module.
Definition: Module.h:51
bool useCost() const
Returns true iff edge costs are given.
ReturnType operator()(UpwardPlanRep &UPR, const EdgeArray< int > *cost=nullptr, const EdgeArray< bool > *forbid=nullptr)
Computes a upward planarized representation of the input graph (shorthand for call) ...
bool m_useForbid
True iff forbidden edges are given.
const Graph & original() const
Returns a reference to the original graph.
Definition: GraphCopy.h:287
bool m_useCost
True iff edge costs are given.
UpwardPlanarizerModule()
Initializes an upward planarizer module.
The namespace for all OGDF objects.