renamed: Util/* -> util/*

This commit is contained in:
Dennis Luxen
2015-01-27 17:44:46 +01:00
parent 203e3ef077
commit b20b7e65bf
113 changed files with 4533 additions and 971 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "douglas_peucker.hpp"
#include "../data_structures/segment_information.hpp"
#include "../Util/integer_range.hpp"
#include "../util/integer_range.hpp"
#include <boost/assert.hpp>
#include <osrm/coordinate.hpp>
+5 -8
View File
@@ -1,6 +1,6 @@
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
Copyright (c) 2015, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
@@ -28,7 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef OBJECT_ENCODER_HPP
#define OBJECT_ENCODER_HPP
#include "../Util/string_util.hpp"
#include "../util/string_util.hpp"
#include <boost/assert.hpp>
#include <boost/archive/iterators/base64_from_binary.hpp>
@@ -49,8 +49,7 @@ struct ObjectEncoder
8,
6>;
template <class ObjectT>
static void EncodeToBase64(const ObjectT &object, std::string &encoded)
template <class ObjectT> static void EncodeToBase64(const ObjectT &object, std::string &encoded)
{
const char *char_ptr_to_object = (const char *)&object;
std::vector<unsigned char> data(sizeof(object));
@@ -71,8 +70,7 @@ struct ObjectEncoder
replaceAll(encoded, "/", "_");
}
template <class ObjectT>
static void DecodeFromBase64(const std::string &input, ObjectT &object)
template <class ObjectT> static void DecodeFromBase64(const std::string &input, ObjectT &object)
{
try
{
@@ -81,8 +79,7 @@ struct ObjectEncoder
replaceAll(encoded, "-", "+");
replaceAll(encoded, "_", "/");
std::copy(binary_t(encoded.begin()),
binary_t(encoded.begin() + encoded.length() - 1),
std::copy(binary_t(encoded.begin()), binary_t(encoded.begin() + encoded.length() - 1),
(char *)&object);
}
catch (...)
+19 -33
View File
@@ -37,10 +37,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../data_structures/restriction_map.hpp"
#include "../data_structures/turn_instructions.hpp"
#include "../Util/integer_range.hpp"
#include "../Util/simple_logger.hpp"
#include "../Util/std_hash.hpp"
#include "../Util/timing_util.hpp"
#include "../util/integer_range.hpp"
#include "../util/simple_logger.hpp"
#include "../util/std_hash.hpp"
#include "../util/timing_util.hpp"
#include <osrm/coordinate.hpp>
@@ -48,7 +48,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <tbb/parallel_sort.h>
#include <cstdint>
#include <memory>
@@ -57,8 +56,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <unordered_set>
#include <vector>
template <typename GraphT>
class TarjanSCC
template <typename GraphT> class TarjanSCC
{
struct TarjanStackFrame
{
@@ -83,13 +81,12 @@ class TarjanSCC
std::size_t size_one_counter;
public:
template<class ContainerT>
template <class ContainerT>
TarjanSCC(std::shared_ptr<GraphT> graph,
const RestrictionMap &restrictions,
const ContainerT &barrier_node_list)
: components_index(graph->GetNumberOfNodes(), SPECIAL_NODEID),
m_node_based_graph(graph), m_restriction_map(restrictions),
size_one_counter(0)
: components_index(graph->GetNumberOfNodes(), SPECIAL_NODEID), m_node_based_graph(graph),
m_restriction_map(restrictions), size_one_counter(0)
{
barrier_node_set.insert(std::begin(barrier_node_list), std::end(barrier_node_list));
BOOST_ASSERT(m_node_based_graph->GetNumberOfNodes() > 0);
@@ -107,8 +104,9 @@ class TarjanSCC
unsigned component_index = 0, size_of_current_component = 0;
int index = 0;
const NodeID last_node = m_node_based_graph->GetNumberOfNodes();
std::vector<bool> processing_node_before_recursion(m_node_based_graph->GetNumberOfNodes(), true);
for(const NodeID node : osrm::irange(0u, last_node))
std::vector<bool> processing_node_before_recursion(m_node_based_graph->GetNumberOfNodes(),
true);
for (const NodeID node : osrm::irange(0u, last_node))
{
if (SPECIAL_NODEID == components_index[node])
{
@@ -150,13 +148,11 @@ class TarjanSCC
const auto vprime = m_node_based_graph->GetTarget(current_edge);
// Traverse outgoing edges
if (barrier_node_set.find(v) != barrier_node_set.end() &&
u != vprime)
if (barrier_node_set.find(v) != barrier_node_set.end() && u != vprime)
{
// continue;
}
if (to_node_of_only_restriction != std::numeric_limits<unsigned>::max() &&
vprime == to_node_of_only_restriction)
{
@@ -219,35 +215,25 @@ class TarjanSCC
}
TIMER_STOP(SCC_RUN);
SimpleLogger().Write() << "SCC run took: " << TIMER_MSEC(SCC_RUN)/1000. << "s";
SimpleLogger().Write() << "SCC run took: " << TIMER_MSEC(SCC_RUN) / 1000. << "s";
size_one_counter = std::count_if(component_size_vector.begin(),
component_size_vector.end(),
size_one_counter = std::count_if(component_size_vector.begin(), component_size_vector.end(),
[](unsigned value)
{
return 1 == value;
});
return 1 == value;
});
}
std::size_t get_number_of_components() const
{
return component_size_vector.size();
}
std::size_t get_number_of_components() const { return component_size_vector.size(); }
unsigned get_size_one_count() const
{
return size_one_counter;
}
unsigned get_size_one_count() const { return size_one_counter; }
unsigned get_component_size(const NodeID node) const
{
return component_size_vector[components_index[node]];
}
unsigned get_component_id(const NodeID node) const
{
return components_index[node];
}
unsigned get_component_id(const NodeID node) const { return components_index[node]; }
};
#endif /* TINY_COMPONENTS_HPP */