remove inline keywords

This commit is contained in:
Dennis Luxen 2014-10-21 18:06:58 +02:00
parent d42772a261
commit 81b0447024
26 changed files with 125 additions and 115 deletions

View File

@ -108,7 +108,7 @@ class IteratorbasedCRC32
return crc; return crc;
} }
inline unsigned cpuid() const unsigned cpuid() const
{ {
unsigned eax = 0, ebx = 0, ecx = 0, edx = 0; unsigned eax = 0, ebx = 0, ecx = 0, edx = 0;
// on X64 this calls hardware cpuid(.) instr. otherwise a dummy impl. // on X64 this calls hardware cpuid(.) instr. otherwise a dummy impl.
@ -117,7 +117,7 @@ class IteratorbasedCRC32
} }
#if defined(__MINGW64__) || defined(_MSC_VER) #if defined(__MINGW64__) || defined(_MSC_VER)
inline void void
__get_cpuid(int param, unsigned *eax, unsigned *ebx, unsigned *ecx, unsigned *edx) const __get_cpuid(int param, unsigned *eax, unsigned *ebx, unsigned *ecx, unsigned *edx) const
{ {
*ecx = 0; *ecx = 0;

View File

@ -137,7 +137,7 @@ class Contractor
{ {
explicit ThreadDataContainer(int number_of_nodes) : number_of_nodes(number_of_nodes) {} explicit ThreadDataContainer(int number_of_nodes) : number_of_nodes(number_of_nodes) {}
inline ContractorThreadData* getThreadData() ContractorThreadData* getThreadData()
{ {
bool exists = false; bool exists = false;
auto& ref = data.local(exists); auto& ref = data.local(exists);
@ -551,7 +551,7 @@ class Contractor
thread_data_list.data.clear(); thread_data_list.data.clear();
} }
template <class Edge> inline void GetEdges(DeallocatingVector<Edge> &edges) template <class Edge> void GetEdges(DeallocatingVector<Edge> &edges)
{ {
Percent p(contractor_graph->GetNumberOfNodes()); Percent p(contractor_graph->GetNumberOfNodes());
SimpleLogger().Write() << "Getting edges of minimized graph"; SimpleLogger().Write() << "Getting edges of minimized graph";
@ -607,7 +607,7 @@ class Contractor
} }
private: private:
inline void Dijkstra(const int max_distance, void Dijkstra(const int max_distance,
const unsigned number_of_targets, const unsigned number_of_targets,
const int maxNodes, const int maxNodes,
ContractorThreadData *const data, ContractorThreadData *const data,
@ -673,7 +673,7 @@ class Contractor
} }
} }
inline float EvaluateNodePriority(ContractorThreadData *const data, float EvaluateNodePriority(ContractorThreadData *const data,
NodePriorityData *const node_data, NodePriorityData *const node_data,
const NodeID node) const NodeID node)
{ {
@ -700,7 +700,7 @@ class Contractor
} }
template <bool RUNSIMULATION> template <bool RUNSIMULATION>
inline bool bool
ContractNode(ContractorThreadData *data, const NodeID node, ContractionStats *stats = nullptr) ContractNode(ContractorThreadData *data, const NodeID node, ContractionStats *stats = nullptr)
{ {
ContractorHeap &heap = data->heap; ContractorHeap &heap = data->heap;
@ -829,7 +829,7 @@ class Contractor
return true; return true;
} }
inline void DeleteIncomingEdges(ContractorThreadData *data, const NodeID node) void DeleteIncomingEdges(ContractorThreadData *data, const NodeID node)
{ {
std::vector<NodeID> &neighbours = data->neighbours; std::vector<NodeID> &neighbours = data->neighbours;
neighbours.clear(); neighbours.clear();
@ -853,7 +853,7 @@ class Contractor
} }
} }
inline bool UpdateNodeNeighbours(std::vector<float> &priorities, bool UpdateNodeNeighbours(std::vector<float> &priorities,
std::vector<NodePriorityData> &node_data, std::vector<NodePriorityData> &node_data,
ContractorThreadData *const data, ContractorThreadData *const data,
const NodeID node) const NodeID node)
@ -884,7 +884,7 @@ class Contractor
return true; return true;
} }
inline bool IsNodeIndependent( bool IsNodeIndependent(
const std::vector<float> &priorities, const std::vector<float> &priorities,
ContractorThreadData *const data, ContractorThreadData *const data,
NodeID node) const NodeID node) const
@ -949,7 +949,7 @@ class Contractor
} }
// This bias function takes up 22 assembly instructions in total on X86 // This bias function takes up 22 assembly instructions in total on X86
inline bool bias(const NodeID a, const NodeID b) const bool bias(const NodeID a, const NodeID b) const
{ {
const unsigned short hasha = fast_hash(a); const unsigned short hasha = fast_hash(a);
const unsigned short hashb = fast_hash(b); const unsigned short hashb = fast_hash(b);

View File

@ -37,7 +37,7 @@ template <typename Data> class ConcurrentQueue
public: public:
explicit ConcurrentQueue(const size_t max_size) : m_internal_queue(max_size) {} explicit ConcurrentQueue(const size_t max_size) : m_internal_queue(max_size) {}
inline void push(const Data &data) void push(const Data &data)
{ {
std::unique_lock<std::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
m_not_full.wait(lock, m_not_full.wait(lock,
@ -47,9 +47,9 @@ template <typename Data> class ConcurrentQueue
m_not_empty.notify_one(); m_not_empty.notify_one();
} }
inline bool empty() const { return m_internal_queue.empty(); } bool empty() const { return m_internal_queue.empty(); }
inline void wait_and_pop(Data &popped_value) void wait_and_pop(Data &popped_value)
{ {
std::unique_lock<std::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
m_not_empty.wait(lock, m_not_empty.wait(lock,
@ -60,7 +60,7 @@ template <typename Data> class ConcurrentQueue
m_not_full.notify_one(); m_not_full.notify_one();
} }
inline bool try_pop(Data &popped_value) bool try_pop(Data &popped_value)
{ {
std::unique_lock<std::mutex> lock(m_mutex); std::unique_lock<std::mutex> lock(m_mutex);
if (m_internal_queue.empty()) if (m_internal_queue.empty())

View File

@ -50,7 +50,7 @@ template <typename ElementT> struct DeallocatingVectorIteratorState
std::size_t index; std::size_t index;
std::vector<ElementT *> *bucket_list; std::vector<ElementT *> *bucket_list;
inline DeallocatingVectorIteratorState &operator=(const DeallocatingVectorIteratorState &other) DeallocatingVectorIteratorState &operator=(const DeallocatingVectorIteratorState &other)
{ {
index = other.index; index = other.index;
bucket_list = other.bucket_list; bucket_list = other.bucket_list;
@ -175,13 +175,13 @@ class DeallocatingVector
~DeallocatingVector() { clear(); } ~DeallocatingVector() { clear(); }
inline void swap(DeallocatingVector<ElementT, ELEMENTS_PER_BLOCK> &other) void swap(DeallocatingVector<ElementT, ELEMENTS_PER_BLOCK> &other)
{ {
std::swap(current_size, other.current_size); std::swap(current_size, other.current_size);
bucket_list.swap(other.bucket_list); bucket_list.swap(other.bucket_list);
} }
inline void clear() void clear()
{ {
// Delete[]'ing ptr's to all Buckets // Delete[]'ing ptr's to all Buckets
for (auto bucket : bucket_list) for (auto bucket : bucket_list)
@ -196,7 +196,7 @@ class DeallocatingVector
current_size = 0; current_size = 0;
} }
inline void push_back(const ElementT &element) void push_back(const ElementT &element)
{ {
const std::size_t current_capacity = capacity(); const std::size_t current_capacity = capacity();
if (current_size == current_capacity) if (current_size == current_capacity)
@ -209,7 +209,7 @@ class DeallocatingVector
++current_size; ++current_size;
} }
template <typename... Ts> inline void emplace_back(Ts &&... element) template <typename... Ts> void emplace_back(Ts &&... element)
{ {
const std::size_t current_capacity = capacity(); const std::size_t current_capacity = capacity();
if (current_size == current_capacity) if (current_size == current_capacity)
@ -222,9 +222,9 @@ class DeallocatingVector
++current_size; ++current_size;
} }
inline void reserve(const std::size_t) const { /* don't do anything */ } void reserve(const std::size_t) const { /* don't do anything */ }
inline void resize(const std::size_t new_size) void resize(const std::size_t new_size)
{ {
if (new_size >= current_size) if (new_size >= current_size)
{ {
@ -248,50 +248,50 @@ class DeallocatingVector
current_size = new_size; current_size = new_size;
} }
inline std::size_t size() const { return current_size; } std::size_t size() const { return current_size; }
inline std::size_t capacity() const { return bucket_list.size() * ELEMENTS_PER_BLOCK; } std::size_t capacity() const { return bucket_list.size() * ELEMENTS_PER_BLOCK; }
inline iterator begin() { return iterator(static_cast<std::size_t>(0), &bucket_list); } iterator begin() { return iterator(static_cast<std::size_t>(0), &bucket_list); }
inline iterator end() { return iterator(size(), &bucket_list); } iterator end() { return iterator(size(), &bucket_list); }
inline deallocation_iterator dbegin() deallocation_iterator dbegin()
{ {
return deallocation_iterator(static_cast<std::size_t>(0), &bucket_list); return deallocation_iterator(static_cast<std::size_t>(0), &bucket_list);
} }
inline deallocation_iterator dend() { return deallocation_iterator(size(), &bucket_list); } deallocation_iterator dend() { return deallocation_iterator(size(), &bucket_list); }
inline const_iterator begin() const const_iterator begin() const
{ {
return const_iterator(static_cast<std::size_t>(0), &bucket_list); return const_iterator(static_cast<std::size_t>(0), &bucket_list);
} }
inline const_iterator end() const { return const_iterator(size(), &bucket_list); } const_iterator end() const { return const_iterator(size(), &bucket_list); }
inline ElementT &operator[](const std::size_t index) ElementT &operator[](const std::size_t index)
{ {
const std::size_t _bucket = index / ELEMENTS_PER_BLOCK; const std::size_t _bucket = index / ELEMENTS_PER_BLOCK;
const std::size_t _index = index % ELEMENTS_PER_BLOCK; const std::size_t _index = index % ELEMENTS_PER_BLOCK;
return (bucket_list[_bucket][_index]); return (bucket_list[_bucket][_index]);
} }
const inline ElementT &operator[](const std::size_t index) const const ElementT &operator[](const std::size_t index) const
{ {
const std::size_t _bucket = index / ELEMENTS_PER_BLOCK; const std::size_t _bucket = index / ELEMENTS_PER_BLOCK;
const std::size_t _index = index % ELEMENTS_PER_BLOCK; const std::size_t _index = index % ELEMENTS_PER_BLOCK;
return (bucket_list[_bucket][_index]); return (bucket_list[_bucket][_index]);
} }
inline ElementT &back() ElementT &back()
{ {
const std::size_t _bucket = current_size / ELEMENTS_PER_BLOCK; const std::size_t _bucket = current_size / ELEMENTS_PER_BLOCK;
const std::size_t _index = current_size % ELEMENTS_PER_BLOCK; const std::size_t _index = current_size % ELEMENTS_PER_BLOCK;
return (bucket_list[_bucket][_index]); return (bucket_list[_bucket][_index]);
} }
const inline ElementT &back() const const ElementT &back() const
{ {
const std::size_t _bucket = current_size / ELEMENTS_PER_BLOCK; const std::size_t _bucket = current_size / ELEMENTS_PER_BLOCK;
const std::size_t _index = current_size % ELEMENTS_PER_BLOCK; const std::size_t _index = current_size % ELEMENTS_PER_BLOCK;
@ -299,7 +299,7 @@ class DeallocatingVector
} }
template<class InputIterator> template<class InputIterator>
const inline void append(InputIterator first, const InputIterator last) const void append(InputIterator first, const InputIterator last)
{ {
InputIterator position = first; InputIterator position = first;
while (position != last) while (position != last)

View File

@ -65,7 +65,7 @@ struct EdgeBasedNode
(reverse_edge_based_node_id != SPECIAL_NODEID)); (reverse_edge_based_node_id != SPECIAL_NODEID));
} }
static inline FixedPointCoordinate Centroid(const FixedPointCoordinate & a, const FixedPointCoordinate & b) static FixedPointCoordinate Centroid(const FixedPointCoordinate & a, const FixedPointCoordinate & b)
{ {
FixedPointCoordinate centroid; FixedPointCoordinate centroid;
//The coordinates of the midpoint are given by: //The coordinates of the midpoint are given by:

View File

@ -40,17 +40,17 @@ class HashTable
public: public:
HashTable() {} HashTable() {}
inline void Add(Key const &key, Value const &value) void Add(Key const &key, Value const &value)
{ {
table.emplace_back(std::move(key), std::move(value)); table.emplace_back(std::move(key), std::move(value));
} }
inline void Clear() void Clear()
{ {
table.clear(); table.clear();
} }
inline const Value Find(Key const &key) const const Value Find(Key const &key) const
{ {
for (const auto &key_val_pair : table) for (const auto &key_val_pair : table)
{ {
@ -62,7 +62,7 @@ class HashTable
return Value(); return Value();
} }
inline const bool Holds(Key const &key) const const bool Holds(Key const &key) const
{ {
for (const auto &key_val_pair : table) for (const auto &key_val_pair : table)
{ {

View File

@ -42,8 +42,8 @@ class HilbertCode
HilbertCode(const HilbertCode &) = delete; HilbertCode(const HilbertCode &) = delete;
private: private:
inline uint64_t BitInterleaving(const uint32_t a, const uint32_t b) const; uint64_t BitInterleaving(const uint32_t a, const uint32_t b) const;
inline void TransposeCoordinate(uint32_t *X) const; void TransposeCoordinate(uint32_t *X) const;
}; };
#endif /* HILBERTVALUE_H_ */ #endif /* HILBERTVALUE_H_ */

View File

@ -51,7 +51,7 @@ struct ImportNode : public ExternalMemoryNode
{ {
HashTable<std::string, std::string> keyVals; HashTable<std::string, std::string> keyVals;
inline void Clear(); void Clear();
}; };
#endif /* IMPORTNODE_H_ */ #endif /* IMPORTNODE_H_ */

View File

@ -219,18 +219,20 @@ struct ArrayRenderer : mapbox::util::static_visitor<>
std::vector<char> &out; std::vector<char> &out;
}; };
inline void render(std::ostream &out, const Object &object) namespace
{
void render(std::ostream &out, const Object &object)
{ {
Value value = object; Value value = object;
mapbox::util::apply_visitor(Renderer(out), value); mapbox::util::apply_visitor(Renderer(out), value);
} }
inline void render(std::vector<char> &out, const Object &object) void render(std::vector<char> &out, const Object &object)
{ {
Value value = object; Value value = object;
mapbox::util::apply_visitor(ArrayRenderer(out), value); mapbox::util::apply_visitor(ArrayRenderer(out), value);
} }
} // anonymous namespace to guard against duplicate symbols
} // namespace JSON } // namespace JSON
#endif // JSON_CONTAINER_H #endif // JSON_CONTAINER_H

View File

@ -54,8 +54,9 @@ struct SimpleEdgeData
using NodeBasedDynamicGraph = DynamicGraph<NodeBasedEdgeData>; using NodeBasedDynamicGraph = DynamicGraph<NodeBasedEdgeData>;
using SimpleNodeBasedDynamicGraph = DynamicGraph<SimpleEdgeData>; using SimpleNodeBasedDynamicGraph = DynamicGraph<SimpleEdgeData>;
namespace {
// Factory method to create NodeBasedDynamicGraph from ImportEdges // Factory method to create NodeBasedDynamicGraph from ImportEdges
inline std::shared_ptr<NodeBasedDynamicGraph> std::shared_ptr<NodeBasedDynamicGraph>
NodeBasedDynamicGraphFromImportEdges(int number_of_nodes, std::vector<ImportEdge> &input_edge_list) NodeBasedDynamicGraphFromImportEdges(int number_of_nodes, std::vector<ImportEdge> &input_edge_list)
{ {
static_assert(sizeof(NodeBasedEdgeData) == 16, "changing node based edge data size changes memory consumption"); static_assert(sizeof(NodeBasedEdgeData) == 16, "changing node based edge data size changes memory consumption");
@ -169,7 +170,7 @@ NodeBasedDynamicGraphFromImportEdges(int number_of_nodes, std::vector<ImportEdge
} }
template<class SimpleEdgeT> template<class SimpleEdgeT>
inline std::shared_ptr<SimpleNodeBasedDynamicGraph> std::shared_ptr<SimpleNodeBasedDynamicGraph>
SimpleNodeBasedDynamicGraphFromEdges(int number_of_nodes, std::vector<SimpleEdgeT> &input_edge_list) SimpleNodeBasedDynamicGraphFromEdges(int number_of_nodes, std::vector<SimpleEdgeT> &input_edge_list)
{ {
static_assert(sizeof(NodeBasedEdgeData) == 16, "changing node based edge data size changes memory consumption"); static_assert(sizeof(NodeBasedEdgeData) == 16, "changing node based edge data size changes memory consumption");
@ -240,5 +241,6 @@ SimpleNodeBasedDynamicGraphFromEdges(int number_of_nodes, std::vector<SimpleEdge
auto graph = std::make_shared<SimpleNodeBasedDynamicGraph>(number_of_nodes, edges_list); auto graph = std::make_shared<SimpleNodeBasedDynamicGraph>(number_of_nodes, edges_list);
return graph; return graph;
} }
}
#endif // NODE_BASED_GRAPH_H_ #endif // NODE_BASED_GRAPH_H_

View File

@ -156,14 +156,17 @@ struct PhantomNodes
PhantomNode target_phantom; PhantomNode target_phantom;
}; };
inline std::ostream& operator<<(std::ostream &out, const PhantomNodes & pn) namespace
{
std::ostream& operator<<(std::ostream &out, const PhantomNodes &pn)
{ {
out << "source_coord: " << pn.source_phantom.location << "\n"; out << "source_coord: " << pn.source_phantom.location << "\n";
out << "target_coord: " << pn.target_phantom.location << std::endl; out << "target_coord: " << pn.target_phantom.location << std::endl;
return out; return out;
} }
inline std::ostream& operator<<(std::ostream &out, const PhantomNode & pn) std::ostream& operator<<(std::ostream &out, const PhantomNode &pn)
{ {
out << "node1: " << pn.forward_node_id << ", " << out << "node1: " << pn.forward_node_id << ", " <<
"node2: " << pn.reverse_node_id << ", " << "node2: " << pn.reverse_node_id << ", " <<
@ -177,5 +180,6 @@ inline std::ostream& operator<<(std::ostream &out, const PhantomNode & pn)
"loc: " << pn.location; "loc: " << pn.location;
return out; return out;
} }
} // anonymous namespace to guard against duplicate symbols
#endif // PHANTOM_NODES_H #endif // PHANTOM_NODES_H

View File

@ -133,7 +133,7 @@ public:
sum_lengths = lengths_prefix_sum; sum_lengths = lengths_prefix_sum;
} }
inline RangeT GetRange(const unsigned id) const RangeT GetRange(const unsigned id) const
{ {
BOOST_ASSERT(id < block_offsets.size() + diff_blocks.size() * BLOCK_SIZE); BOOST_ASSERT(id < block_offsets.size() + diff_blocks.size() * BLOCK_SIZE);
// internal_idx 0 is implicitly stored in block_offsets[block_idx] // internal_idx 0 is implicitly stored in block_offsets[block_idx]
@ -170,7 +170,7 @@ public:
} }
private: private:
inline unsigned PrefixSumAtIndex(int index, const BlockT& block) const; unsigned PrefixSumAtIndex(int index, const BlockT& block) const;
// contains offset for each differential block // contains offset for each differential block
OffsetContainerT block_offsets; OffsetContainerT block_offsets;

View File

@ -102,19 +102,19 @@ struct InputRestrictionContainer
struct CmpRestrictionContainerByFrom struct CmpRestrictionContainerByFrom
{ {
using value_type = InputRestrictionContainer; using value_type = InputRestrictionContainer;
inline bool operator()(const InputRestrictionContainer &a, const InputRestrictionContainer &b) bool operator()(const InputRestrictionContainer &a, const InputRestrictionContainer &b)
const const
{ {
return a.fromWay < b.fromWay; return a.fromWay < b.fromWay;
} }
inline value_type max_value() const { return InputRestrictionContainer::max_value(); } value_type max_value() const { return InputRestrictionContainer::max_value(); }
inline value_type min_value() const { return InputRestrictionContainer::min_value(); } value_type min_value() const { return InputRestrictionContainer::min_value(); }
}; };
struct CmpRestrictionContainerByTo struct CmpRestrictionContainerByTo
{ {
using value_type = InputRestrictionContainer; using value_type = InputRestrictionContainer;
inline bool operator()(const InputRestrictionContainer &a, const InputRestrictionContainer &b) bool operator()(const InputRestrictionContainer &a, const InputRestrictionContainer &b)
const const
{ {
return a.toWay < b.toWay; return a.toWay < b.toWay;

View File

@ -48,7 +48,7 @@ struct RestrictionSource
{ {
} }
friend inline bool operator==(const RestrictionSource &lhs, const RestrictionSource &rhs) friend bool operator==(const RestrictionSource &lhs, const RestrictionSource &rhs)
{ {
return (lhs.start_node == rhs.start_node && lhs.via_node == rhs.via_node); return (lhs.start_node == rhs.start_node && lhs.via_node == rhs.via_node);
} }
@ -63,7 +63,7 @@ struct RestrictionTarget
{ {
} }
friend inline bool operator==(const RestrictionTarget &lhs, const RestrictionTarget &rhs) friend bool operator==(const RestrictionTarget &lhs, const RestrictionTarget &rhs)
{ {
return (lhs.target_node == rhs.target_node && lhs.is_only == rhs.is_only); return (lhs.target_node == rhs.target_node && lhs.is_only == rhs.is_only);
} }

View File

@ -135,12 +135,12 @@ template <typename EdgeDataT, bool UseSharedMemory = false> class StaticGraph
unsigned GetOutDegree(const NodeIterator n) const { return EndEdges(n) - BeginEdges(n); } unsigned GetOutDegree(const NodeIterator n) const { return EndEdges(n) - BeginEdges(n); }
inline NodeIterator GetTarget(const EdgeIterator e) const NodeIterator GetTarget(const EdgeIterator e) const
{ {
return NodeIterator(edge_array[e].target); return NodeIterator(edge_array[e].target);
} }
inline EdgeDataT &GetEdgeData(const EdgeIterator e) { return edge_array[e].data; } EdgeDataT &GetEdgeData(const EdgeIterator e) { return edge_array[e].data; }
const EdgeDataT &GetEdgeData(const EdgeIterator e) const { return edge_array[e].data; } const EdgeDataT &GetEdgeData(const EdgeIterator e) const { return edge_array[e].data; }

View File

@ -77,7 +77,7 @@ class StaticRTree
int32_t min_lon, max_lon; int32_t min_lon, max_lon;
int32_t min_lat, max_lat; int32_t min_lat, max_lat;
inline void InitializeMBRectangle(const std::array<EdgeDataT, LEAF_NODE_SIZE> &objects, void InitializeMBRectangle(const std::array<EdgeDataT, LEAF_NODE_SIZE> &objects,
const uint32_t element_count, const uint32_t element_count,
const std::vector<NodeInfo> &coordinate_list) const std::vector<NodeInfo> &coordinate_list)
{ {
@ -103,7 +103,7 @@ class StaticRTree
BOOST_ASSERT(max_lon != std::numeric_limits<int>::min()); BOOST_ASSERT(max_lon != std::numeric_limits<int>::min());
} }
inline void MergeBoundingBoxes(const RectangleInt2D &other) void MergeBoundingBoxes(const RectangleInt2D &other)
{ {
min_lon = std::min(min_lon, other.min_lon); min_lon = std::min(min_lon, other.min_lon);
max_lon = std::max(max_lon, other.max_lon); max_lon = std::max(max_lon, other.max_lon);
@ -115,7 +115,7 @@ class StaticRTree
BOOST_ASSERT(max_lon != std::numeric_limits<int>::min()); BOOST_ASSERT(max_lon != std::numeric_limits<int>::min());
} }
inline FixedPointCoordinate Centroid() const FixedPointCoordinate Centroid() const
{ {
FixedPointCoordinate centroid; FixedPointCoordinate centroid;
// The coordinates of the midpoints are given by: // The coordinates of the midpoints are given by:
@ -125,7 +125,7 @@ class StaticRTree
return centroid; return centroid;
} }
inline bool Intersects(const RectangleInt2D &other) const bool Intersects(const RectangleInt2D &other) const
{ {
FixedPointCoordinate upper_left(other.max_lat, other.min_lon); FixedPointCoordinate upper_left(other.max_lat, other.min_lon);
FixedPointCoordinate upper_right(other.max_lat, other.max_lon); FixedPointCoordinate upper_right(other.max_lat, other.max_lon);
@ -136,7 +136,7 @@ class StaticRTree
Contains(lower_left)); Contains(lower_left));
} }
inline float GetMinDist(const FixedPointCoordinate &location) const float GetMinDist(const FixedPointCoordinate &location) const
{ {
const bool is_contained = Contains(location); const bool is_contained = Contains(location);
if (is_contained) if (is_contained)
@ -205,7 +205,7 @@ class StaticRTree
return min_dist; return min_dist;
} }
inline float GetMinMaxDist(const FixedPointCoordinate &location) const float GetMinMaxDist(const FixedPointCoordinate &location) const
{ {
float min_max_dist = std::numeric_limits<float>::max(); float min_max_dist = std::numeric_limits<float>::max();
// Get minmax distance to each of the four sides // Get minmax distance to each of the four sides
@ -238,14 +238,14 @@ class StaticRTree
return min_max_dist; return min_max_dist;
} }
inline bool Contains(const FixedPointCoordinate &location) const bool Contains(const FixedPointCoordinate &location) const
{ {
const bool lats_contained = (location.lat >= min_lat) && (location.lat <= max_lat); const bool lats_contained = (location.lat >= min_lat) && (location.lat <= max_lat);
const bool lons_contained = (location.lon >= min_lon) && (location.lon <= max_lon); const bool lons_contained = (location.lon >= min_lon) && (location.lon <= max_lon);
return lats_contained && lons_contained; return lats_contained && lons_contained;
} }
inline friend std::ostream &operator<<(std::ostream &out, const RectangleInt2D &rect) friend std::ostream &operator<<(std::ostream &out, const RectangleInt2D &rect)
{ {
out << rect.min_lat / COORDINATE_PRECISION << "," << rect.min_lon / COORDINATE_PRECISION out << rect.min_lat / COORDINATE_PRECISION << "," << rect.min_lon / COORDINATE_PRECISION
<< " " << rect.max_lat / COORDINATE_PRECISION << "," << " " << rect.max_lat / COORDINATE_PRECISION << ","
@ -278,7 +278,7 @@ class StaticRTree
uint64_t m_hilbert_value; uint64_t m_hilbert_value;
uint32_t m_array_index; uint32_t m_array_index;
inline bool operator<(const WrappedInputElement &other) const bool operator<(const WrappedInputElement &other) const
{ {
return m_hilbert_value < other.m_hilbert_value; return m_hilbert_value < other.m_hilbert_value;
} }
@ -300,7 +300,7 @@ class StaticRTree
QueryCandidate() : min_dist(std::numeric_limits<float>::max()), node_id(UINT_MAX) {} QueryCandidate() : min_dist(std::numeric_limits<float>::max()), node_id(UINT_MAX) {}
float min_dist; float min_dist;
uint32_t node_id; uint32_t node_id;
inline bool operator<(const QueryCandidate &other) const bool operator<(const QueryCandidate &other) const
{ {
// Attn: this is reversed order. std::pq is a max pq! // Attn: this is reversed order. std::pq is a max pq!
return other.min_dist < min_dist; return other.min_dist < min_dist;
@ -317,7 +317,7 @@ class StaticRTree
IncrementalQueryCandidate() : min_dist(std::numeric_limits<float>::max()) {} IncrementalQueryCandidate() : min_dist(std::numeric_limits<float>::max()) {}
inline bool operator<(const IncrementalQueryCandidate &other) const bool operator<(const IncrementalQueryCandidate &other) const
{ {
// Attn: this is reversed order. std::pq is a max pq! // Attn: this is reversed order. std::pq is a max pq!
return other.min_dist < min_dist; return other.min_dist < min_dist;
@ -1110,7 +1110,7 @@ class StaticRTree
private: private:
inline void SetForwardAndReverseWeightsOnPhantomNode(const EdgeDataT & nearest_edge, void SetForwardAndReverseWeightsOnPhantomNode(const EdgeDataT & nearest_edge,
PhantomNode &result_phantom_node) const PhantomNode &result_phantom_node) const
{ {
const float distance_1 = FixedPointCoordinate::ApproximateEuclideanDistance( const float distance_1 = FixedPointCoordinate::ApproximateEuclideanDistance(
@ -1130,7 +1130,7 @@ class StaticRTree
} }
// fixup locations if too close to inputs // fixup locations if too close to inputs
inline void FixUpRoundingIssue(const FixedPointCoordinate &input_coordinate, void FixUpRoundingIssue(const FixedPointCoordinate &input_coordinate,
PhantomNode &result_phantom_node) const PhantomNode &result_phantom_node) const
{ {
if (1 == std::abs(input_coordinate.lon - result_phantom_node.location.lon)) if (1 == std::abs(input_coordinate.lon - result_phantom_node.location.lon))
@ -1144,7 +1144,7 @@ class StaticRTree
} }
template <class QueueT> template <class QueueT>
inline float ExploreTreeNode(const TreeNode &parent, float ExploreTreeNode(const TreeNode &parent,
const FixedPointCoordinate &input_coordinate, const FixedPointCoordinate &input_coordinate,
const float min_dist, const float min_dist,
const float min_max_dist, const float min_max_dist,
@ -1173,7 +1173,7 @@ class StaticRTree
return new_min_max_dist; return new_min_max_dist;
} }
inline void LoadLeafFromDisk(const uint32_t leaf_id, LeafNode &result_node) void LoadLeafFromDisk(const uint32_t leaf_id, LeafNode &result_node)
{ {
if (!leaves_stream.is_open()) if (!leaves_stream.is_open())
{ {
@ -1192,7 +1192,7 @@ class StaticRTree
BOOST_ASSERT_MSG(leaves_stream.good(), "Reading from leaf file failed."); BOOST_ASSERT_MSG(leaves_stream.good(), "Reading from leaf file failed.");
} }
inline bool EdgesAreEquivalent(const FixedPointCoordinate &a, bool EdgesAreEquivalent(const FixedPointCoordinate &a,
const FixedPointCoordinate &b, const FixedPointCoordinate &b,
const FixedPointCoordinate &c, const FixedPointCoordinate &c,
const FixedPointCoordinate &d) const const FixedPointCoordinate &d) const

View File

@ -44,7 +44,7 @@ struct TurnInstructionsClass
TurnInstructionsClass() = delete; TurnInstructionsClass() = delete;
TurnInstructionsClass(const TurnInstructionsClass&) = delete; TurnInstructionsClass(const TurnInstructionsClass&) = delete;
static inline TurnInstruction GetTurnDirectionOfInstruction(const double angle) static TurnInstruction GetTurnDirectionOfInstruction(const double angle)
{ {
if (angle >= 23 && angle < 67) if (angle >= 23 && angle < 67)
{ {
@ -77,7 +77,7 @@ struct TurnInstructionsClass
return TurnInstruction::UTurn; return TurnInstruction::UTurn;
} }
static inline bool TurnIsNecessary(const TurnInstruction turn_instruction) static bool TurnIsNecessary(const TurnInstruction turn_instruction)
{ {
if (TurnInstruction::NoTurn == turn_instruction || TurnInstruction::StayOnRoundAbout == turn_instruction) if (TurnInstruction::NoTurn == turn_instruction || TurnInstruction::StayOnRoundAbout == turn_instruction)
{ {

View File

@ -68,7 +68,7 @@ class XORFastHash
std::random_shuffle(table2.begin(), table2.end()); std::random_shuffle(table2.begin(), table2.end());
} }
inline unsigned short operator()(const unsigned originalValue) const unsigned short operator()(const unsigned originalValue) const
{ {
unsigned short lsb = ((originalValue)&0xffff); unsigned short lsb = ((originalValue)&0xffff);
unsigned short msb = (((originalValue) >> 16) & 0xffff); unsigned short msb = (((originalValue) >> 16) & 0xffff);

View File

@ -299,7 +299,7 @@ template <class DataFacadeT> class JSONDescriptor final : public BaseDescriptor<
} }
// TODO: reorder parameters // TODO: reorder parameters
inline void BuildTextualDescription(DescriptionFactory &description_factory, void BuildTextualDescription(DescriptionFactory &description_factory,
JSON::Array &json_instruction_array, JSON::Array &json_instruction_array,
const int route_length, const int route_length,
std::vector<Segment> &route_segments_list) std::vector<Segment> &route_segments_list)

View File

@ -102,10 +102,12 @@ struct FixedPointCoordinate
static float RadianToDegree(const float radian); static float RadianToDegree(const float radian);
}; };
inline std::ostream &operator<<(std::ostream &out_stream, FixedPointCoordinate const &coordinate) namespace
{
std::ostream &operator<<(std::ostream &out_stream, FixedPointCoordinate const &coordinate)
{ {
coordinate.Output(out_stream); coordinate.Output(out_stream);
return out_stream; return out_stream;
} }
} // anonymous namespace to guard against duplicate symbols
#endif /* FIXED_POINT_COORDINATE_H_ */ #endif /* FIXED_POINT_COORDINATE_H_ */

View File

@ -370,7 +370,7 @@ template <class DataFacadeT> class AlternativeRouting final : private BasicRouti
private: private:
// unpack alternate <s,..,v,..,t> by exploring search spaces from v // unpack alternate <s,..,v,..,t> by exploring search spaces from v
inline void RetrievePackedAlternatePath(const QueryHeap &forward_heap1, void RetrievePackedAlternatePath(const QueryHeap &forward_heap1,
const QueryHeap &reverse_heap1, const QueryHeap &reverse_heap1,
const QueryHeap &forward_heap2, const QueryHeap &forward_heap2,
const QueryHeap &reverse_heap2, const QueryHeap &reverse_heap2,
@ -394,7 +394,7 @@ template <class DataFacadeT> class AlternativeRouting final : private BasicRouti
// compute and unpack <s,..,v> and <v,..,t> by exploring search spaces // compute and unpack <s,..,v> and <v,..,t> by exploring search spaces
// from v and intersecting against queues. only half-searches have to be // from v and intersecting against queues. only half-searches have to be
// done at this stage // done at this stage
inline void ComputeLengthAndSharingOfViaPath(const NodeID via_node, void ComputeLengthAndSharingOfViaPath(const NodeID via_node,
int *real_length_of_via_path, int *real_length_of_via_path,
int *sharing_of_via_path, int *sharing_of_via_path,
const std::vector<NodeID> &packed_shortest_path, const std::vector<NodeID> &packed_shortest_path,
@ -551,7 +551,7 @@ template <class DataFacadeT> class AlternativeRouting final : private BasicRouti
// variable // variable
} }
// inline int approximateAmountOfSharing( // int approximateAmountOfSharing(
// const NodeID alternate_path_middle_node_id, // const NodeID alternate_path_middle_node_id,
// QueryHeap & forward_heap, // QueryHeap & forward_heap,
// QueryHeap & reverse_heap, // QueryHeap & reverse_heap,
@ -598,7 +598,7 @@ template <class DataFacadeT> class AlternativeRouting final : private BasicRouti
// todo: reorder parameters // todo: reorder parameters
template <bool is_forward_directed> template <bool is_forward_directed>
inline void AlternativeRoutingStep(QueryHeap &forward_heap, void AlternativeRoutingStep(QueryHeap &forward_heap,
QueryHeap &reverse_heap, QueryHeap &reverse_heap,
NodeID *middle_node, NodeID *middle_node,
int *upper_bound_to_shortest_path_distance, int *upper_bound_to_shortest_path_distance,
@ -674,7 +674,7 @@ template <class DataFacadeT> class AlternativeRouting final : private BasicRouti
} }
// conduct T-Test // conduct T-Test
inline bool ViaNodeCandidatePassesTTest(QueryHeap &existing_forward_heap, bool ViaNodeCandidatePassesTTest(QueryHeap &existing_forward_heap,
QueryHeap &existing_reverse_heap, QueryHeap &existing_reverse_heap,
QueryHeap &new_forward_heap, QueryHeap &new_forward_heap,
QueryHeap &new_reverse_heap, QueryHeap &new_reverse_heap,

View File

@ -58,7 +58,7 @@ template <class DataFacadeT> class BasicRoutingInterface
explicit BasicRoutingInterface(DataFacadeT *facade) : facade(facade) {} explicit BasicRoutingInterface(DataFacadeT *facade) : facade(facade) {}
virtual ~BasicRoutingInterface() {}; virtual ~BasicRoutingInterface() {};
inline void RoutingStep(SearchEngineData::QueryHeap &forward_heap, void RoutingStep(SearchEngineData::QueryHeap &forward_heap,
SearchEngineData::QueryHeap &reverse_heap, SearchEngineData::QueryHeap &reverse_heap,
NodeID *middle_node_id, NodeID *middle_node_id,
int *upper_bound, int *upper_bound,
@ -145,7 +145,7 @@ template <class DataFacadeT> class BasicRoutingInterface
} }
} }
inline void UnpackPath(const std::vector<NodeID> &packed_path, void UnpackPath(const std::vector<NodeID> &packed_path,
const PhantomNodes &phantom_node_pair, const PhantomNodes &phantom_node_pair,
std::vector<PathData> &unpacked_path) const std::vector<PathData> &unpacked_path) const
{ {
@ -330,7 +330,7 @@ template <class DataFacadeT> class BasicRoutingInterface
} }
} }
inline void UnpackEdge(const NodeID s, const NodeID t, std::vector<NodeID> &unpacked_path) const void UnpackEdge(const NodeID s, const NodeID t, std::vector<NodeID> &unpacked_path) const
{ {
std::stack<std::pair<NodeID, NodeID>> recursion_stack; std::stack<std::pair<NodeID, NodeID>> recursion_stack;
recursion_stack.emplace(s, t); recursion_stack.emplace(s, t);
@ -386,7 +386,7 @@ template <class DataFacadeT> class BasicRoutingInterface
unpacked_path.emplace_back(t); unpacked_path.emplace_back(t);
} }
inline void RetrievePackedPathFromHeap(const SearchEngineData::QueryHeap &forward_heap, void RetrievePackedPathFromHeap(const SearchEngineData::QueryHeap &forward_heap,
const SearchEngineData::QueryHeap &reverse_heap, const SearchEngineData::QueryHeap &reverse_heap,
const NodeID middle_node_id, const NodeID middle_node_id,
std::vector<NodeID> &packed_path) const std::vector<NodeID> &packed_path) const
@ -397,7 +397,7 @@ template <class DataFacadeT> class BasicRoutingInterface
RetrievePackedPathFromSingleHeap(reverse_heap, middle_node_id, packed_path); RetrievePackedPathFromSingleHeap(reverse_heap, middle_node_id, packed_path);
} }
inline void RetrievePackedPathFromSingleHeap(const SearchEngineData::QueryHeap &search_heap, void RetrievePackedPathFromSingleHeap(const SearchEngineData::QueryHeap &search_heap,
const NodeID middle_node_id, const NodeID middle_node_id,
std::vector<NodeID> &packed_path) const std::vector<NodeID> &packed_path) const
{ {

View File

@ -204,7 +204,7 @@ template <class DataFacadeT> class ManyToManyRouting final : public BasicRouting
} }
template <bool forward_direction> template <bool forward_direction>
inline void void
RelaxOutgoingEdges(const NodeID node, const EdgeWeight distance, QueryHeap &query_heap) const RelaxOutgoingEdges(const NodeID node, const EdgeWeight distance, QueryHeap &query_heap) const
{ {
for (auto edge : super::facade->GetAdjacentEdgeRange(node)) for (auto edge : super::facade->GetAdjacentEdgeRange(node))
@ -237,7 +237,7 @@ template <class DataFacadeT> class ManyToManyRouting final : public BasicRouting
// Stalling // Stalling
template <bool forward_direction> template <bool forward_direction>
inline bool StallAtNode(const NodeID node, const EdgeWeight distance, QueryHeap &query_heap) bool StallAtNode(const NodeID node, const EdgeWeight distance, QueryHeap &query_heap)
const const
{ {
for (auto edge : super::facade->GetAdjacentEdgeRange(node)) for (auto edge : super::facade->GetAdjacentEdgeRange(node))

View File

@ -111,13 +111,13 @@ struct SharedDataLayout
} }
template<typename T> template<typename T>
inline void SetBlockSize(BlockID bid, uint64_t entries) void SetBlockSize(BlockID bid, uint64_t entries)
{ {
num_entries[bid] = entries; num_entries[bid] = entries;
entry_size[bid] = sizeof(T); entry_size[bid] = sizeof(T);
} }
inline uint64_t GetBlockSize(BlockID bid) const uint64_t GetBlockSize(BlockID bid) const
{ {
// special encoding // special encoding
if (bid == GEOMETRIES_INDICATORS) if (bid == GEOMETRIES_INDICATORS)
@ -128,12 +128,12 @@ struct SharedDataLayout
return num_entries[bid] * entry_size[bid]; return num_entries[bid] * entry_size[bid];
} }
inline uint64_t GetSizeOfLayout() const uint64_t GetSizeOfLayout() const
{ {
return GetBlockOffset(NUM_BLOCKS) + NUM_BLOCKS*2*sizeof(CANARY); return GetBlockOffset(NUM_BLOCKS) + NUM_BLOCKS*2*sizeof(CANARY);
} }
inline uint64_t GetBlockOffset(BlockID bid) const uint64_t GetBlockOffset(BlockID bid) const
{ {
uint64_t result = sizeof(CANARY); uint64_t result = sizeof(CANARY);
for (auto i = 0; i < bid; i++) for (auto i = 0; i < bid; i++)
@ -144,7 +144,7 @@ struct SharedDataLayout
} }
template<typename T, bool WRITE_CANARY=false> template<typename T, bool WRITE_CANARY=false>
inline T* GetBlockPtr(char* shared_memory, BlockID bid) T* GetBlockPtr(char* shared_memory, BlockID bid)
{ {
T* ptr = (T*)(shared_memory + GetBlockOffset(bid)); T* ptr = (T*)(shared_memory + GetBlockOffset(bid));
if (WRITE_CANARY) if (WRITE_CANARY)

View File

@ -270,14 +270,14 @@ RequestParser::consume(Request &req, char input, http::CompressionType *compress
} }
} }
inline bool RequestParser::isChar(int character) { return character >= 0 && character <= 127; } bool RequestParser::isChar(int character) { return character >= 0 && character <= 127; }
inline bool RequestParser::isCTL(int character) bool RequestParser::isCTL(int character)
{ {
return (character >= 0 && character <= 31) || (character == 127); return (character >= 0 && character <= 31) || (character == 127);
} }
inline bool RequestParser::isTSpecial(int character) bool RequestParser::isTSpecial(int character)
{ {
switch (character) switch (character)
{ {
@ -306,5 +306,5 @@ inline bool RequestParser::isTSpecial(int character)
} }
} }
inline bool RequestParser::isDigit(int character) { return character >= '0' && character <= '9'; } bool RequestParser::isDigit(int character) { return character >= '0' && character <= '9'; }
} }

View File

@ -51,13 +51,13 @@ class RequestParser
private: private:
boost::tribool consume(Request &req, char input, CompressionType *compressionType); boost::tribool consume(Request &req, char input, CompressionType *compressionType);
inline bool isChar(int c); bool isChar(int c);
inline bool isCTL(int c); bool isCTL(int c);
inline bool isTSpecial(int c); bool isTSpecial(int c);
inline bool isDigit(int c); bool isDigit(int c);
enum state enum state
{ method_start, { method_start,