Fix formating

This commit is contained in:
Patrick Niklaus
2017-04-04 23:01:00 +00:00
committed by Patrick Niklaus
parent d94017dfae
commit 4ec7ca29f1
23 changed files with 86 additions and 104 deletions
+5 -1
View File
@@ -239,13 +239,17 @@ class DeallocatingVector
bucket_list.emplace_back(new ElementT[ELEMENTS_PER_BLOCK]);
}
// copying is not safe since this would only do a shallow copy
DeallocatingVector(DeallocatingVector &other) = delete;
DeallocatingVector &operator=(DeallocatingVector &other) = delete;
DeallocatingVector(DeallocatingVector &&other)
{
bucket_list = std::move(other.bucket_list);
current_size = std::move(other.current_size);
}
DeallocatingVector& operator=(DeallocatingVector &&other)
DeallocatingVector &operator=(DeallocatingVector &&other)
{
bucket_list = std::move(other.bucket_list);
current_size = std::move(other.current_size);
+1 -2
View File
@@ -36,8 +36,7 @@ template <typename EdgeDataT, bool UseSharedMemory>
void read(storage::io::FileReader &reader, DynamicGraph<EdgeDataT> &graph);
template <typename EdgeDataT, bool UseSharedMemory>
void write(storage::io::FileWriter &writer,
const DynamicGraph<EdgeDataT> &graph);
void write(storage::io::FileWriter &writer, const DynamicGraph<EdgeDataT> &graph);
}
template <typename EdgeDataT> class DynamicGraph
+1 -1
View File
@@ -9,8 +9,8 @@
#include "util/exception.hpp"
#include "util/fingerprint.hpp"
#include "util/log.hpp"
#include "util/typedefs.hpp"
#include "util/packed_vector.hpp"
#include "util/typedefs.hpp"
#include <boost/assert.hpp>
#include <boost/filesystem.hpp>
+1 -1
View File
@@ -1,8 +1,8 @@
#ifndef PACKED_VECTOR_HPP
#define PACKED_VECTOR_HPP
#include "util/vector_view.hpp"
#include "util/typedefs.hpp"
#include "util/vector_view.hpp"
#include "storage/io.hpp"
#include "storage/shared_memory_ownership.hpp"
+8 -15
View File
@@ -1,9 +1,9 @@
#ifndef OSMR_UTIL_SERIALIZATION_HPP
#define OSMR_UTIL_SERIALIZATION_HPP
#include "util/dynamic_graph.hpp"
#include "util/packed_vector.hpp"
#include "util/static_graph.hpp"
#include "util/dynamic_graph.hpp"
#include "storage/io.hpp"
#include "storage/serialization.hpp"
@@ -15,40 +15,35 @@ namespace util
namespace serialization
{
template <typename T, storage::Ownership Ownership>
inline void read(storage::io::FileReader &reader,
detail::PackedVector<T, Ownership> &vec)
inline void read(storage::io::FileReader &reader, detail::PackedVector<T, Ownership> &vec)
{
vec.num_elements =reader.ReadOne<std::uint64_t>();
vec.num_elements = reader.ReadOne<std::uint64_t>();
storage::serialization::read(reader, vec.vec);
}
template <typename T, storage::Ownership Ownership>
inline void write(storage::io::FileWriter &writer,
const detail::PackedVector<T, Ownership> &vec)
inline void write(storage::io::FileWriter &writer, const detail::PackedVector<T, Ownership> &vec)
{
writer.WriteOne(vec.num_elements);
storage::serialization::write(writer, vec.vec);
}
template <typename EdgeDataT, storage::Ownership Ownership>
inline void read(storage::io::FileReader &reader,
StaticGraph<EdgeDataT, Ownership> &graph)
inline void read(storage::io::FileReader &reader, StaticGraph<EdgeDataT, Ownership> &graph)
{
storage::serialization::read(reader, graph.node_array);
storage::serialization::read(reader, graph.edge_array);
}
template <typename EdgeDataT, storage::Ownership Ownership>
inline void write(storage::io::FileWriter &writer,
const StaticGraph<EdgeDataT, Ownership> &graph)
inline void write(storage::io::FileWriter &writer, const StaticGraph<EdgeDataT, Ownership> &graph)
{
storage::serialization::write(writer, graph.node_array);
storage::serialization::write(writer, graph.edge_array);
}
template <typename EdgeDataT>
inline void read(storage::io::FileReader &reader,
DynamicGraph<EdgeDataT> &graph)
inline void read(storage::io::FileReader &reader, DynamicGraph<EdgeDataT> &graph)
{
storage::serialization::read(reader, graph.node_array);
auto num_edges = reader.ReadElementCount64();
@@ -62,8 +57,7 @@ inline void read(storage::io::FileReader &reader,
}
template <typename EdgeDataT>
inline void write(storage::io::FileWriter &writer,
const DynamicGraph<EdgeDataT> &graph)
inline void write(storage::io::FileWriter &writer, const DynamicGraph<EdgeDataT> &graph)
{
storage::serialization::write(writer, graph.node_array);
writer.WriteElementCount64(graph.number_of_edges);
@@ -72,7 +66,6 @@ inline void write(storage::io::FileWriter &writer,
writer.WriteOne(graph.edge_list[index]);
}
}
}
}
}
+4 -2
View File
@@ -4,8 +4,8 @@
#include "util/graph_traits.hpp"
#include "util/integer_range.hpp"
#include "util/percent.hpp"
#include "util/vector_view.hpp"
#include "util/typedefs.hpp"
#include "util/vector_view.hpp"
#include "storage/shared_memory_ownership.hpp"
@@ -272,7 +272,9 @@ class StaticGraph
unsigned offset = std::distance(begin, iter);
node_array.push_back(NodeArrayEntry{offset});
}
BOOST_ASSERT_MSG(iter == end, ("Still " + std::to_string(std::distance(iter, end)) + " edges left.").c_str());
BOOST_ASSERT_MSG(
iter == end,
("Still " + std::to_string(std::distance(iter, end)) + " edges left.").c_str());
BOOST_ASSERT(node_array.size() == number_of_nodes + 1);
edge_array.resize(number_of_edges);
+1 -1
View File
@@ -9,8 +9,8 @@
#include "util/hilbert_value.hpp"
#include "util/integer_range.hpp"
#include "util/rectangle.hpp"
#include "util/vector_view.hpp"
#include "util/typedefs.hpp"
#include "util/vector_view.hpp"
#include "util/web_mercator.hpp"
#include "osrm/coordinate.hpp"
+4 -23
View File
@@ -29,9 +29,10 @@ class VectorViewIterator : public boost::iterator_facade<VectorViewIterator<Data
DataT,
boost::random_access_traversal_tag>
{
typedef boost::
iterator_facade<VectorViewIterator<DataT>, DataT, boost::random_access_traversal_tag>
base_t;
typedef boost::iterator_facade<VectorViewIterator<DataT>,
DataT,
boost::random_access_traversal_tag>
base_t;
public:
typedef typename base_t::value_type value_type;
@@ -85,17 +86,6 @@ template <typename DataT> class vector_view
m_size = size;
}
// for a vector-like interface
void resize(std::size_t size) const
{
if (m_size != size)
{
throw util::exception("Invalid resize " + std::to_string(size) +
" on immutable vector view of size " + std::to_string(m_size) +
".");
}
}
DataT &at(const std::size_t index) { return m_ptr[index]; }
const DataT &at(const std::size_t index) const { return m_ptr[index]; }
@@ -168,15 +158,6 @@ template <> class vector_view<bool>
void reset(unsigned *, std::size_t size) { m_size = size; }
// for ensuring a vector compatible interface
void resize(std::size_t size) const
{
if (m_size != size)
{
throw util::exception("Invalid resize on immutable shared memory vector.");
}
}
std::size_t size() const { return m_size; }
bool empty() const { return 0 == size(); }