Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

UpwardPlanarizerModule.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/Module.h>
36 
37 namespace ogdf {
38 
44 public:
46  UpwardPlanarizerModule() : m_useCost(false), m_useForbid(false) { }
47 
48  // destruction
50 
69  ReturnType call(UpwardPlanRep& UPR, const EdgeArray<int>* cost = nullptr,
70  const EdgeArray<bool>* forbid = nullptr) {
71  m_useCost = (cost != nullptr);
72  m_useForbid = (forbid != nullptr);
73 
74  if (!useCost()) {
75  cost = new EdgeArray<int>(UPR.original(), 1);
76  }
77  if (!useForbid()) {
78  forbid = new EdgeArray<bool>(UPR.original(), 0);
79  }
80 
81 
82  ReturnType R = doCall(UPR, *cost, *forbid);
83 
84  if (!useCost()) {
85  delete cost;
86  }
87  if (!useForbid()) {
88  delete forbid;
89  }
90  return R;
91  }
92 
94  ReturnType operator()(UpwardPlanRep& UPR, const EdgeArray<int>* cost = nullptr,
95  const EdgeArray<bool>* forbid = nullptr) {
96  return call(UPR, cost, forbid);
97  }
98 
100  bool useCost() const { return m_useCost; }
101 
103  bool useForbid() const { return m_useForbid; }
104 
105 protected:
123  virtual ReturnType doCall(UpwardPlanRep& UPR, const EdgeArray<int>& cost,
124  const EdgeArray<bool>& forbid) = 0;
125 
127 
128 private:
129  bool m_useCost;
130  bool m_useForbid;
131 };
132 
133 }
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
UpwardPlanRep.h
Declaration of a base class for planar representations of graphs and cluster graphs.
ogdf::UpwardPlanarizerModule::UpwardPlanarizerModule
UpwardPlanarizerModule()
Initializes an upward planarizer module.
Definition: UpwardPlanarizerModule.h:46
ogdf::UpwardPlanarizerModule::operator()
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)
Definition: UpwardPlanarizerModule.h:94
ogdf::UpwardPlanarizerModule::m_useCost
bool m_useCost
True iff edge costs are given.
Definition: UpwardPlanarizerModule.h:129
ogdf::UpwardPlanarizerModule::m_useForbid
bool m_useForbid
True iff forbidden edges are given.
Definition: UpwardPlanarizerModule.h:130
OGDF_MALLOC_NEW_DELETE
#define OGDF_MALLOC_NEW_DELETE
Makes the class use malloc for memory allocation.
Definition: memory.h:91
ogdf::Module
Base class for modules.
Definition: Module.h:47
ogdf::UpwardPlanarizerModule::~UpwardPlanarizerModule
virtual ~UpwardPlanarizerModule()
Definition: UpwardPlanarizerModule.h:49
ogdf::UpwardPlanarizerModule::useCost
bool useCost() const
Returns true iff edge costs are given.
Definition: UpwardPlanarizerModule.h:100
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::UpwardPlanarizerModule
Interface for upward planarization algorithms.
Definition: UpwardPlanarizerModule.h:43
ogdf::UpwardPlanarizerModule::useForbid
bool useForbid() const
Returns true iff forbidden edges are given.
Definition: UpwardPlanarizerModule.h:103
ogdf::UpwardPlanRep
Upward planarized representations (of a connected component) of a graph.
Definition: UpwardPlanRep.h:50
Module.h
Declares base class for all module types.
ogdf::UpwardPlanarizerModule::call
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.
Definition: UpwardPlanarizerModule.h:69
ogdf::Module::ReturnType
ReturnType
The return type of a module.
Definition: Module.h:50
ogdf::GraphCopyBase::original
const Graph & original() const
Returns a reference to the original graph.
Definition: GraphCopy.h:98
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:709