Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
Normalize.hpp
Go to the documentation of this file.
1
6// Copyright (c) 2017 Czech Technical University in Prague | Faculty of Information Technology. All rights reserved.
7
8#pragma once
9
10#include <utility>
11
12#include "DefaultTypes.hpp"
13
14namespace graph {
15
17// ---------------------------------------------------------------------------------------------------------------------
18
19 public:
20
21 template<typename TNode>
22 static DefaultNodeType normalizeNode(TNode &&node);
23
24 template<typename TEdge>
25 static DefaultEdgeType normalizeEdge(TEdge &&edge);
26
27 template<typename TEdge>
29
30 template<typename TEdge>
32
33 template<typename TWeight>
34 static DefaultWeightType normalizeWeight(TWeight &&weight);
35
36// ---------------------------------------------------------------------------------------------------------------------
37
38 template<typename TCoordinate>
40 TCoordinate> &&obstacle);
41
42};
43
44// =====================================================================================================================
45
46template<typename TNode>
48 return DefaultNodeType(std::forward<TNode>(node));
49}
50
51template<typename TEdge>
53 DefaultNodeType first = normalizeNode(edge.first);
55 return DefaultEdgeType(std::move(first), std::move(second));
56}
57
58template<typename TEdge>
60 DefaultNodeType first = normalizeNode(edge.first);
62 DefaultWeightType weight = normalizeWeight(edge.weight());
63 return DefaultWeightedEdgeType(std::move(first), std::move(second), weight);
64}
65
66template<typename TEdge>
68 DefaultNodeType first = normalizeNode(edge.first);
70 DefaultWeightType weight = normalizeWeight(edge.capacity());
71 return DefaultCapacityEdgeType(std::move(first), std::move(second), weight);
72}
73
74template<typename TWeight>
76 return DefaultWeightType(std::forward<TWeight>(weight));
77}
78
79// ---------------------------------------------------------------------------------------------------------------------
80
81template<typename TCoordinate>
83 TCoordinate> &&obstacle) {
84 DefaultCoordinateType first = DefaultCoordinateType(obstacle.first);
86 return ext::make_pair(first, second);
87}
88
89// =====================================================================================================================
90
91} // namespace graph
92
Definition: CapacityEdge.hpp:21
Definition: WeightedEdge.hpp:21
Class extending the pair class from the standard library. Original reason is to allow printing of the...
Definition: pair.hpp:43
Definition: Normalize.hpp:16
static DefaultNodeType normalizeNode(TNode &&node)
Definition: Normalize.hpp:47
static DefaultWeightedEdgeType normalizeWeightedEdge(TEdge &&edge)
Definition: Normalize.hpp:59
static DefaultCapacityEdgeType normalizeCapacityEdge(TEdge &&edge)
Definition: Normalize.hpp:67
static DefaultEdgeType normalizeEdge(TEdge &&edge)
Definition: Normalize.hpp:52
static ext::pair< DefaultCoordinateType, DefaultCoordinateType > normalizeObstacle(ext::pair< TCoordinate, TCoordinate > &&obstacle)
Definition: Normalize.hpp:82
static DefaultWeightType normalizeWeight(TWeight &&weight)
Definition: Normalize.hpp:75
Definition: Object.h:16
long DefaultCoordinateType
Definition: DefaultCoordinateType.hpp:10
edge::WeightedEdge< DefaultNodeType, DefaultWeightType > DefaultWeightedEdgeType
Definition: DefaultWeightedEdgeType.hpp:14
edge::CapacityEdge< DefaultNodeType, DefaultCapacityType > DefaultCapacityEdgeType
Definition: DefaultCapacityEdgeType.hpp:14
object::Object DefaultNodeType
Definition: DefaultNodeType.hpp:10
double DefaultWeightType
Definition: DefaultWeightType.hpp:10
ext::pair< DefaultNodeType, DefaultNodeType > DefaultEdgeType
Definition: DefaultEdgeType.hpp:12
p second
Definition: ToRegExpAlgebraic.h:126
Definition: CapacityEdge.hpp:18
constexpr auto make_pair(T1 &&x, T2 &&y)
Definition: pair.hpp:79
Definition: ReconstructPath.hpp:14
Definition: Node.cpp:11