To arrive at a later point in time: Revert "remove inline keywords"
This reverts commit 81b0447024
.
This commit is contained in:
parent
81b0447024
commit
511c21029e
@ -108,7 +108,7 @@ class IteratorbasedCRC32
|
||||
return crc;
|
||||
}
|
||||
|
||||
unsigned cpuid() const
|
||||
inline unsigned cpuid() const
|
||||
{
|
||||
unsigned eax = 0, ebx = 0, ecx = 0, edx = 0;
|
||||
// on X64 this calls hardware cpuid(.) instr. otherwise a dummy impl.
|
||||
@ -117,7 +117,7 @@ class IteratorbasedCRC32
|
||||
}
|
||||
|
||||
#if defined(__MINGW64__) || defined(_MSC_VER)
|
||||
void
|
||||
inline void
|
||||
__get_cpuid(int param, unsigned *eax, unsigned *ebx, unsigned *ecx, unsigned *edx) const
|
||||
{
|
||||
*ecx = 0;
|
||||
|
@ -137,7 +137,7 @@ class Contractor
|
||||
{
|
||||
explicit ThreadDataContainer(int number_of_nodes) : number_of_nodes(number_of_nodes) {}
|
||||
|
||||
ContractorThreadData* getThreadData()
|
||||
inline ContractorThreadData* getThreadData()
|
||||
{
|
||||
bool exists = false;
|
||||
auto& ref = data.local(exists);
|
||||
@ -551,7 +551,7 @@ class Contractor
|
||||
thread_data_list.data.clear();
|
||||
}
|
||||
|
||||
template <class Edge> void GetEdges(DeallocatingVector<Edge> &edges)
|
||||
template <class Edge> inline void GetEdges(DeallocatingVector<Edge> &edges)
|
||||
{
|
||||
Percent p(contractor_graph->GetNumberOfNodes());
|
||||
SimpleLogger().Write() << "Getting edges of minimized graph";
|
||||
@ -607,7 +607,7 @@ class Contractor
|
||||
}
|
||||
|
||||
private:
|
||||
void Dijkstra(const int max_distance,
|
||||
inline void Dijkstra(const int max_distance,
|
||||
const unsigned number_of_targets,
|
||||
const int maxNodes,
|
||||
ContractorThreadData *const data,
|
||||
@ -673,7 +673,7 @@ class Contractor
|
||||
}
|
||||
}
|
||||
|
||||
float EvaluateNodePriority(ContractorThreadData *const data,
|
||||
inline float EvaluateNodePriority(ContractorThreadData *const data,
|
||||
NodePriorityData *const node_data,
|
||||
const NodeID node)
|
||||
{
|
||||
@ -700,7 +700,7 @@ class Contractor
|
||||
}
|
||||
|
||||
template <bool RUNSIMULATION>
|
||||
bool
|
||||
inline bool
|
||||
ContractNode(ContractorThreadData *data, const NodeID node, ContractionStats *stats = nullptr)
|
||||
{
|
||||
ContractorHeap &heap = data->heap;
|
||||
@ -829,7 +829,7 @@ class Contractor
|
||||
return true;
|
||||
}
|
||||
|
||||
void DeleteIncomingEdges(ContractorThreadData *data, const NodeID node)
|
||||
inline void DeleteIncomingEdges(ContractorThreadData *data, const NodeID node)
|
||||
{
|
||||
std::vector<NodeID> &neighbours = data->neighbours;
|
||||
neighbours.clear();
|
||||
@ -853,7 +853,7 @@ class Contractor
|
||||
}
|
||||
}
|
||||
|
||||
bool UpdateNodeNeighbours(std::vector<float> &priorities,
|
||||
inline bool UpdateNodeNeighbours(std::vector<float> &priorities,
|
||||
std::vector<NodePriorityData> &node_data,
|
||||
ContractorThreadData *const data,
|
||||
const NodeID node)
|
||||
@ -884,7 +884,7 @@ class Contractor
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsNodeIndependent(
|
||||
inline bool IsNodeIndependent(
|
||||
const std::vector<float> &priorities,
|
||||
ContractorThreadData *const data,
|
||||
NodeID node) const
|
||||
@ -949,7 +949,7 @@ class Contractor
|
||||
}
|
||||
|
||||
// This bias function takes up 22 assembly instructions in total on X86
|
||||
bool bias(const NodeID a, const NodeID b) const
|
||||
inline bool bias(const NodeID a, const NodeID b) const
|
||||
{
|
||||
const unsigned short hasha = fast_hash(a);
|
||||
const unsigned short hashb = fast_hash(b);
|
||||
|
@ -37,7 +37,7 @@ template <typename Data> class ConcurrentQueue
|
||||
public:
|
||||
explicit ConcurrentQueue(const size_t max_size) : m_internal_queue(max_size) {}
|
||||
|
||||
void push(const Data &data)
|
||||
inline void push(const Data &data)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
m_not_full.wait(lock,
|
||||
@ -47,9 +47,9 @@ template <typename Data> class ConcurrentQueue
|
||||
m_not_empty.notify_one();
|
||||
}
|
||||
|
||||
bool empty() const { return m_internal_queue.empty(); }
|
||||
inline bool empty() const { return m_internal_queue.empty(); }
|
||||
|
||||
void wait_and_pop(Data &popped_value)
|
||||
inline void wait_and_pop(Data &popped_value)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
m_not_empty.wait(lock,
|
||||
@ -60,7 +60,7 @@ template <typename Data> class ConcurrentQueue
|
||||
m_not_full.notify_one();
|
||||
}
|
||||
|
||||
bool try_pop(Data &popped_value)
|
||||
inline bool try_pop(Data &popped_value)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
if (m_internal_queue.empty())
|
||||
|
@ -50,7 +50,7 @@ template <typename ElementT> struct DeallocatingVectorIteratorState
|
||||
std::size_t index;
|
||||
std::vector<ElementT *> *bucket_list;
|
||||
|
||||
DeallocatingVectorIteratorState &operator=(const DeallocatingVectorIteratorState &other)
|
||||
inline DeallocatingVectorIteratorState &operator=(const DeallocatingVectorIteratorState &other)
|
||||
{
|
||||
index = other.index;
|
||||
bucket_list = other.bucket_list;
|
||||
@ -175,13 +175,13 @@ class DeallocatingVector
|
||||
|
||||
~DeallocatingVector() { clear(); }
|
||||
|
||||
void swap(DeallocatingVector<ElementT, ELEMENTS_PER_BLOCK> &other)
|
||||
inline void swap(DeallocatingVector<ElementT, ELEMENTS_PER_BLOCK> &other)
|
||||
{
|
||||
std::swap(current_size, other.current_size);
|
||||
bucket_list.swap(other.bucket_list);
|
||||
}
|
||||
|
||||
void clear()
|
||||
inline void clear()
|
||||
{
|
||||
// Delete[]'ing ptr's to all Buckets
|
||||
for (auto bucket : bucket_list)
|
||||
@ -196,7 +196,7 @@ class DeallocatingVector
|
||||
current_size = 0;
|
||||
}
|
||||
|
||||
void push_back(const ElementT &element)
|
||||
inline void push_back(const ElementT &element)
|
||||
{
|
||||
const std::size_t current_capacity = capacity();
|
||||
if (current_size == current_capacity)
|
||||
@ -209,7 +209,7 @@ class DeallocatingVector
|
||||
++current_size;
|
||||
}
|
||||
|
||||
template <typename... Ts> void emplace_back(Ts &&... element)
|
||||
template <typename... Ts> inline void emplace_back(Ts &&... element)
|
||||
{
|
||||
const std::size_t current_capacity = capacity();
|
||||
if (current_size == current_capacity)
|
||||
@ -222,9 +222,9 @@ class DeallocatingVector
|
||||
++current_size;
|
||||
}
|
||||
|
||||
void reserve(const std::size_t) const { /* don't do anything */ }
|
||||
inline void reserve(const std::size_t) const { /* don't do anything */ }
|
||||
|
||||
void resize(const std::size_t new_size)
|
||||
inline void resize(const std::size_t new_size)
|
||||
{
|
||||
if (new_size >= current_size)
|
||||
{
|
||||
@ -248,50 +248,50 @@ class DeallocatingVector
|
||||
current_size = new_size;
|
||||
}
|
||||
|
||||
std::size_t size() const { return current_size; }
|
||||
inline std::size_t size() const { return current_size; }
|
||||
|
||||
std::size_t capacity() const { return bucket_list.size() * ELEMENTS_PER_BLOCK; }
|
||||
inline std::size_t capacity() const { return bucket_list.size() * ELEMENTS_PER_BLOCK; }
|
||||
|
||||
iterator begin() { return iterator(static_cast<std::size_t>(0), &bucket_list); }
|
||||
inline iterator begin() { return iterator(static_cast<std::size_t>(0), &bucket_list); }
|
||||
|
||||
iterator end() { return iterator(size(), &bucket_list); }
|
||||
inline iterator end() { return iterator(size(), &bucket_list); }
|
||||
|
||||
deallocation_iterator dbegin()
|
||||
inline deallocation_iterator dbegin()
|
||||
{
|
||||
return deallocation_iterator(static_cast<std::size_t>(0), &bucket_list);
|
||||
}
|
||||
|
||||
deallocation_iterator dend() { return deallocation_iterator(size(), &bucket_list); }
|
||||
inline deallocation_iterator dend() { return deallocation_iterator(size(), &bucket_list); }
|
||||
|
||||
const_iterator begin() const
|
||||
inline const_iterator begin() const
|
||||
{
|
||||
return const_iterator(static_cast<std::size_t>(0), &bucket_list);
|
||||
}
|
||||
|
||||
const_iterator end() const { return const_iterator(size(), &bucket_list); }
|
||||
inline const_iterator end() const { return const_iterator(size(), &bucket_list); }
|
||||
|
||||
ElementT &operator[](const std::size_t index)
|
||||
inline ElementT &operator[](const std::size_t index)
|
||||
{
|
||||
const std::size_t _bucket = index / ELEMENTS_PER_BLOCK;
|
||||
const std::size_t _index = index % ELEMENTS_PER_BLOCK;
|
||||
return (bucket_list[_bucket][_index]);
|
||||
}
|
||||
|
||||
const ElementT &operator[](const std::size_t index) const
|
||||
const inline ElementT &operator[](const std::size_t index) const
|
||||
{
|
||||
const std::size_t _bucket = index / ELEMENTS_PER_BLOCK;
|
||||
const std::size_t _index = index % ELEMENTS_PER_BLOCK;
|
||||
return (bucket_list[_bucket][_index]);
|
||||
}
|
||||
|
||||
ElementT &back()
|
||||
inline ElementT &back()
|
||||
{
|
||||
const std::size_t _bucket = current_size / ELEMENTS_PER_BLOCK;
|
||||
const std::size_t _index = current_size % ELEMENTS_PER_BLOCK;
|
||||
return (bucket_list[_bucket][_index]);
|
||||
}
|
||||
|
||||
const ElementT &back() const
|
||||
const inline ElementT &back() const
|
||||
{
|
||||
const std::size_t _bucket = current_size / ELEMENTS_PER_BLOCK;
|
||||
const std::size_t _index = current_size % ELEMENTS_PER_BLOCK;
|
||||
@ -299,7 +299,7 @@ class DeallocatingVector
|
||||
}
|
||||
|
||||
template<class InputIterator>
|
||||
const void append(InputIterator first, const InputIterator last)
|
||||
const inline void append(InputIterator first, const InputIterator last)
|
||||
{
|
||||
InputIterator position = first;
|
||||
while (position != last)
|
||||
|
@ -65,7 +65,7 @@ struct EdgeBasedNode
|
||||
(reverse_edge_based_node_id != SPECIAL_NODEID));
|
||||
}
|
||||
|
||||
static FixedPointCoordinate Centroid(const FixedPointCoordinate & a, const FixedPointCoordinate & b)
|
||||
static inline FixedPointCoordinate Centroid(const FixedPointCoordinate & a, const FixedPointCoordinate & b)
|
||||
{
|
||||
FixedPointCoordinate centroid;
|
||||
//The coordinates of the midpoint are given by:
|
||||
|
@ -40,17 +40,17 @@ class HashTable
|
||||
public:
|
||||
HashTable() {}
|
||||
|
||||
void Add(Key const &key, Value const &value)
|
||||
inline void Add(Key const &key, Value const &value)
|
||||
{
|
||||
table.emplace_back(std::move(key), std::move(value));
|
||||
}
|
||||
|
||||
void Clear()
|
||||
inline void Clear()
|
||||
{
|
||||
table.clear();
|
||||
}
|
||||
|
||||
const Value Find(Key const &key) const
|
||||
inline const Value Find(Key const &key) const
|
||||
{
|
||||
for (const auto &key_val_pair : table)
|
||||
{
|
||||
@ -62,7 +62,7 @@ class HashTable
|
||||
return Value();
|
||||
}
|
||||
|
||||
const bool Holds(Key const &key) const
|
||||
inline const bool Holds(Key const &key) const
|
||||
{
|
||||
for (const auto &key_val_pair : table)
|
||||
{
|
||||
|
@ -42,8 +42,8 @@ class HilbertCode
|
||||
HilbertCode(const HilbertCode &) = delete;
|
||||
|
||||
private:
|
||||
uint64_t BitInterleaving(const uint32_t a, const uint32_t b) const;
|
||||
void TransposeCoordinate(uint32_t *X) const;
|
||||
inline uint64_t BitInterleaving(const uint32_t a, const uint32_t b) const;
|
||||
inline void TransposeCoordinate(uint32_t *X) const;
|
||||
};
|
||||
|
||||
#endif /* HILBERTVALUE_H_ */
|
||||
|
@ -51,7 +51,7 @@ struct ImportNode : public ExternalMemoryNode
|
||||
{
|
||||
HashTable<std::string, std::string> keyVals;
|
||||
|
||||
void Clear();
|
||||
inline void Clear();
|
||||
};
|
||||
|
||||
#endif /* IMPORTNODE_H_ */
|
||||
|
@ -219,20 +219,18 @@ struct ArrayRenderer : mapbox::util::static_visitor<>
|
||||
std::vector<char> &out;
|
||||
};
|
||||
|
||||
namespace
|
||||
{
|
||||
void render(std::ostream &out, const Object &object)
|
||||
inline void render(std::ostream &out, const Object &object)
|
||||
{
|
||||
Value value = object;
|
||||
mapbox::util::apply_visitor(Renderer(out), value);
|
||||
}
|
||||
|
||||
void render(std::vector<char> &out, const Object &object)
|
||||
inline void render(std::vector<char> &out, const Object &object)
|
||||
{
|
||||
Value value = object;
|
||||
mapbox::util::apply_visitor(ArrayRenderer(out), value);
|
||||
}
|
||||
} // anonymous namespace to guard against duplicate symbols
|
||||
|
||||
} // namespace JSON
|
||||
|
||||
#endif // JSON_CONTAINER_H
|
||||
|
@ -54,9 +54,8 @@ struct SimpleEdgeData
|
||||
using NodeBasedDynamicGraph = DynamicGraph<NodeBasedEdgeData>;
|
||||
using SimpleNodeBasedDynamicGraph = DynamicGraph<SimpleEdgeData>;
|
||||
|
||||
namespace {
|
||||
// Factory method to create NodeBasedDynamicGraph from ImportEdges
|
||||
std::shared_ptr<NodeBasedDynamicGraph>
|
||||
inline std::shared_ptr<NodeBasedDynamicGraph>
|
||||
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");
|
||||
@ -170,7 +169,7 @@ NodeBasedDynamicGraphFromImportEdges(int number_of_nodes, std::vector<ImportEdge
|
||||
}
|
||||
|
||||
template<class SimpleEdgeT>
|
||||
std::shared_ptr<SimpleNodeBasedDynamicGraph>
|
||||
inline std::shared_ptr<SimpleNodeBasedDynamicGraph>
|
||||
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");
|
||||
@ -241,6 +240,5 @@ SimpleNodeBasedDynamicGraphFromEdges(int number_of_nodes, std::vector<SimpleEdge
|
||||
auto graph = std::make_shared<SimpleNodeBasedDynamicGraph>(number_of_nodes, edges_list);
|
||||
return graph;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // NODE_BASED_GRAPH_H_
|
||||
|
@ -156,17 +156,14 @@ struct PhantomNodes
|
||||
PhantomNode target_phantom;
|
||||
};
|
||||
|
||||
namespace
|
||||
inline std::ostream& operator<<(std::ostream &out, const PhantomNodes & pn)
|
||||
{
|
||||
|
||||
std::ostream& operator<<(std::ostream &out, const PhantomNodes &pn)
|
||||
{
|
||||
out << "source_coord: " << pn.source_phantom.location << "\n";
|
||||
out << "target_coord: " << pn.target_phantom.location << std::endl;
|
||||
out << "source_coord: " << pn.source_phantom.location << "\n";
|
||||
out << "target_coord: " << pn.target_phantom.location << std::endl;
|
||||
return out;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream &out, const PhantomNode &pn)
|
||||
inline std::ostream& operator<<(std::ostream &out, const PhantomNode & pn)
|
||||
{
|
||||
out << "node1: " << pn.forward_node_id << ", " <<
|
||||
"node2: " << pn.reverse_node_id << ", " <<
|
||||
@ -180,6 +177,5 @@ std::ostream& operator<<(std::ostream &out, const PhantomNode &pn)
|
||||
"loc: " << pn.location;
|
||||
return out;
|
||||
}
|
||||
} // anonymous namespace to guard against duplicate symbols
|
||||
|
||||
#endif // PHANTOM_NODES_H
|
||||
|
@ -133,7 +133,7 @@ public:
|
||||
sum_lengths = lengths_prefix_sum;
|
||||
}
|
||||
|
||||
RangeT GetRange(const unsigned id) const
|
||||
inline RangeT GetRange(const unsigned id) const
|
||||
{
|
||||
BOOST_ASSERT(id < block_offsets.size() + diff_blocks.size() * BLOCK_SIZE);
|
||||
// internal_idx 0 is implicitly stored in block_offsets[block_idx]
|
||||
@ -170,7 +170,7 @@ public:
|
||||
}
|
||||
private:
|
||||
|
||||
unsigned PrefixSumAtIndex(int index, const BlockT& block) const;
|
||||
inline unsigned PrefixSumAtIndex(int index, const BlockT& block) const;
|
||||
|
||||
// contains offset for each differential block
|
||||
OffsetContainerT block_offsets;
|
||||
|
@ -102,19 +102,19 @@ struct InputRestrictionContainer
|
||||
struct CmpRestrictionContainerByFrom
|
||||
{
|
||||
using value_type = InputRestrictionContainer;
|
||||
bool operator()(const InputRestrictionContainer &a, const InputRestrictionContainer &b)
|
||||
inline bool operator()(const InputRestrictionContainer &a, const InputRestrictionContainer &b)
|
||||
const
|
||||
{
|
||||
return a.fromWay < b.fromWay;
|
||||
}
|
||||
value_type max_value() const { return InputRestrictionContainer::max_value(); }
|
||||
value_type min_value() const { return InputRestrictionContainer::min_value(); }
|
||||
inline value_type max_value() const { return InputRestrictionContainer::max_value(); }
|
||||
inline value_type min_value() const { return InputRestrictionContainer::min_value(); }
|
||||
};
|
||||
|
||||
struct CmpRestrictionContainerByTo
|
||||
{
|
||||
using value_type = InputRestrictionContainer;
|
||||
bool operator()(const InputRestrictionContainer &a, const InputRestrictionContainer &b)
|
||||
inline bool operator()(const InputRestrictionContainer &a, const InputRestrictionContainer &b)
|
||||
const
|
||||
{
|
||||
return a.toWay < b.toWay;
|
||||
|
@ -48,7 +48,7 @@ struct RestrictionSource
|
||||
{
|
||||
}
|
||||
|
||||
friend bool operator==(const RestrictionSource &lhs, const RestrictionSource &rhs)
|
||||
friend inline bool operator==(const RestrictionSource &lhs, const RestrictionSource &rhs)
|
||||
{
|
||||
return (lhs.start_node == rhs.start_node && lhs.via_node == rhs.via_node);
|
||||
}
|
||||
@ -63,7 +63,7 @@ struct RestrictionTarget
|
||||
{
|
||||
}
|
||||
|
||||
friend bool operator==(const RestrictionTarget &lhs, const RestrictionTarget &rhs)
|
||||
friend inline bool operator==(const RestrictionTarget &lhs, const RestrictionTarget &rhs)
|
||||
{
|
||||
return (lhs.target_node == rhs.target_node && lhs.is_only == rhs.is_only);
|
||||
}
|
||||
|
@ -135,12 +135,12 @@ template <typename EdgeDataT, bool UseSharedMemory = false> class StaticGraph
|
||||
|
||||
unsigned GetOutDegree(const NodeIterator n) const { return EndEdges(n) - BeginEdges(n); }
|
||||
|
||||
NodeIterator GetTarget(const EdgeIterator e) const
|
||||
inline NodeIterator GetTarget(const EdgeIterator e) const
|
||||
{
|
||||
return NodeIterator(edge_array[e].target);
|
||||
}
|
||||
|
||||
EdgeDataT &GetEdgeData(const EdgeIterator e) { return edge_array[e].data; }
|
||||
inline EdgeDataT &GetEdgeData(const EdgeIterator e) { return edge_array[e].data; }
|
||||
|
||||
const EdgeDataT &GetEdgeData(const EdgeIterator e) const { return edge_array[e].data; }
|
||||
|
||||
|
@ -77,7 +77,7 @@ class StaticRTree
|
||||
int32_t min_lon, max_lon;
|
||||
int32_t min_lat, max_lat;
|
||||
|
||||
void InitializeMBRectangle(const std::array<EdgeDataT, LEAF_NODE_SIZE> &objects,
|
||||
inline void InitializeMBRectangle(const std::array<EdgeDataT, LEAF_NODE_SIZE> &objects,
|
||||
const uint32_t element_count,
|
||||
const std::vector<NodeInfo> &coordinate_list)
|
||||
{
|
||||
@ -103,7 +103,7 @@ class StaticRTree
|
||||
BOOST_ASSERT(max_lon != std::numeric_limits<int>::min());
|
||||
}
|
||||
|
||||
void MergeBoundingBoxes(const RectangleInt2D &other)
|
||||
inline void MergeBoundingBoxes(const RectangleInt2D &other)
|
||||
{
|
||||
min_lon = std::min(min_lon, other.min_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());
|
||||
}
|
||||
|
||||
FixedPointCoordinate Centroid() const
|
||||
inline FixedPointCoordinate Centroid() const
|
||||
{
|
||||
FixedPointCoordinate centroid;
|
||||
// The coordinates of the midpoints are given by:
|
||||
@ -125,7 +125,7 @@ class StaticRTree
|
||||
return centroid;
|
||||
}
|
||||
|
||||
bool Intersects(const RectangleInt2D &other) const
|
||||
inline bool Intersects(const RectangleInt2D &other) const
|
||||
{
|
||||
FixedPointCoordinate upper_left(other.max_lat, other.min_lon);
|
||||
FixedPointCoordinate upper_right(other.max_lat, other.max_lon);
|
||||
@ -136,7 +136,7 @@ class StaticRTree
|
||||
Contains(lower_left));
|
||||
}
|
||||
|
||||
float GetMinDist(const FixedPointCoordinate &location) const
|
||||
inline float GetMinDist(const FixedPointCoordinate &location) const
|
||||
{
|
||||
const bool is_contained = Contains(location);
|
||||
if (is_contained)
|
||||
@ -205,7 +205,7 @@ class StaticRTree
|
||||
return min_dist;
|
||||
}
|
||||
|
||||
float GetMinMaxDist(const FixedPointCoordinate &location) const
|
||||
inline float GetMinMaxDist(const FixedPointCoordinate &location) const
|
||||
{
|
||||
float min_max_dist = std::numeric_limits<float>::max();
|
||||
// Get minmax distance to each of the four sides
|
||||
@ -238,14 +238,14 @@ class StaticRTree
|
||||
return min_max_dist;
|
||||
}
|
||||
|
||||
bool Contains(const FixedPointCoordinate &location) const
|
||||
inline bool Contains(const FixedPointCoordinate &location) const
|
||||
{
|
||||
const bool lats_contained = (location.lat >= min_lat) && (location.lat <= max_lat);
|
||||
const bool lons_contained = (location.lon >= min_lon) && (location.lon <= max_lon);
|
||||
return lats_contained && lons_contained;
|
||||
}
|
||||
|
||||
friend std::ostream &operator<<(std::ostream &out, const RectangleInt2D &rect)
|
||||
inline friend std::ostream &operator<<(std::ostream &out, const RectangleInt2D &rect)
|
||||
{
|
||||
out << rect.min_lat / COORDINATE_PRECISION << "," << rect.min_lon / COORDINATE_PRECISION
|
||||
<< " " << rect.max_lat / COORDINATE_PRECISION << ","
|
||||
@ -278,7 +278,7 @@ class StaticRTree
|
||||
uint64_t m_hilbert_value;
|
||||
uint32_t m_array_index;
|
||||
|
||||
bool operator<(const WrappedInputElement &other) const
|
||||
inline bool operator<(const WrappedInputElement &other) const
|
||||
{
|
||||
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) {}
|
||||
float min_dist;
|
||||
uint32_t node_id;
|
||||
bool operator<(const QueryCandidate &other) const
|
||||
inline bool operator<(const QueryCandidate &other) const
|
||||
{
|
||||
// Attn: this is reversed order. std::pq is a max pq!
|
||||
return other.min_dist < min_dist;
|
||||
@ -317,7 +317,7 @@ class StaticRTree
|
||||
|
||||
IncrementalQueryCandidate() : min_dist(std::numeric_limits<float>::max()) {}
|
||||
|
||||
bool operator<(const IncrementalQueryCandidate &other) const
|
||||
inline bool operator<(const IncrementalQueryCandidate &other) const
|
||||
{
|
||||
// Attn: this is reversed order. std::pq is a max pq!
|
||||
return other.min_dist < min_dist;
|
||||
@ -1110,7 +1110,7 @@ class StaticRTree
|
||||
|
||||
private:
|
||||
|
||||
void SetForwardAndReverseWeightsOnPhantomNode(const EdgeDataT & nearest_edge,
|
||||
inline void SetForwardAndReverseWeightsOnPhantomNode(const EdgeDataT & nearest_edge,
|
||||
PhantomNode &result_phantom_node) const
|
||||
{
|
||||
const float distance_1 = FixedPointCoordinate::ApproximateEuclideanDistance(
|
||||
@ -1130,7 +1130,7 @@ class StaticRTree
|
||||
}
|
||||
|
||||
// fixup locations if too close to inputs
|
||||
void FixUpRoundingIssue(const FixedPointCoordinate &input_coordinate,
|
||||
inline void FixUpRoundingIssue(const FixedPointCoordinate &input_coordinate,
|
||||
PhantomNode &result_phantom_node) const
|
||||
{
|
||||
if (1 == std::abs(input_coordinate.lon - result_phantom_node.location.lon))
|
||||
@ -1144,7 +1144,7 @@ class StaticRTree
|
||||
}
|
||||
|
||||
template <class QueueT>
|
||||
float ExploreTreeNode(const TreeNode &parent,
|
||||
inline float ExploreTreeNode(const TreeNode &parent,
|
||||
const FixedPointCoordinate &input_coordinate,
|
||||
const float min_dist,
|
||||
const float min_max_dist,
|
||||
@ -1173,7 +1173,7 @@ class StaticRTree
|
||||
return new_min_max_dist;
|
||||
}
|
||||
|
||||
void LoadLeafFromDisk(const uint32_t leaf_id, LeafNode &result_node)
|
||||
inline void LoadLeafFromDisk(const uint32_t leaf_id, LeafNode &result_node)
|
||||
{
|
||||
if (!leaves_stream.is_open())
|
||||
{
|
||||
@ -1192,10 +1192,10 @@ class StaticRTree
|
||||
BOOST_ASSERT_MSG(leaves_stream.good(), "Reading from leaf file failed.");
|
||||
}
|
||||
|
||||
bool EdgesAreEquivalent(const FixedPointCoordinate &a,
|
||||
const FixedPointCoordinate &b,
|
||||
const FixedPointCoordinate &c,
|
||||
const FixedPointCoordinate &d) const
|
||||
inline bool EdgesAreEquivalent(const FixedPointCoordinate &a,
|
||||
const FixedPointCoordinate &b,
|
||||
const FixedPointCoordinate &c,
|
||||
const FixedPointCoordinate &d) const
|
||||
{
|
||||
return (a == b && c == d) || (a == c && b == d) || (a == d && b == c);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ struct TurnInstructionsClass
|
||||
TurnInstructionsClass() = delete;
|
||||
TurnInstructionsClass(const TurnInstructionsClass&) = delete;
|
||||
|
||||
static TurnInstruction GetTurnDirectionOfInstruction(const double angle)
|
||||
static inline TurnInstruction GetTurnDirectionOfInstruction(const double angle)
|
||||
{
|
||||
if (angle >= 23 && angle < 67)
|
||||
{
|
||||
@ -77,7 +77,7 @@ struct TurnInstructionsClass
|
||||
return TurnInstruction::UTurn;
|
||||
}
|
||||
|
||||
static bool TurnIsNecessary(const TurnInstruction turn_instruction)
|
||||
static inline bool TurnIsNecessary(const TurnInstruction turn_instruction)
|
||||
{
|
||||
if (TurnInstruction::NoTurn == turn_instruction || TurnInstruction::StayOnRoundAbout == turn_instruction)
|
||||
{
|
||||
|
@ -68,7 +68,7 @@ class XORFastHash
|
||||
std::random_shuffle(table2.begin(), table2.end());
|
||||
}
|
||||
|
||||
unsigned short operator()(const unsigned originalValue) const
|
||||
inline unsigned short operator()(const unsigned originalValue) const
|
||||
{
|
||||
unsigned short lsb = ((originalValue)&0xffff);
|
||||
unsigned short msb = (((originalValue) >> 16) & 0xffff);
|
||||
|
@ -299,10 +299,10 @@ template <class DataFacadeT> class JSONDescriptor final : public BaseDescriptor<
|
||||
}
|
||||
|
||||
// TODO: reorder parameters
|
||||
void BuildTextualDescription(DescriptionFactory &description_factory,
|
||||
JSON::Array &json_instruction_array,
|
||||
const int route_length,
|
||||
std::vector<Segment> &route_segments_list)
|
||||
inline void BuildTextualDescription(DescriptionFactory &description_factory,
|
||||
JSON::Array &json_instruction_array,
|
||||
const int route_length,
|
||||
std::vector<Segment> &route_segments_list)
|
||||
{
|
||||
// Segment information has following format:
|
||||
//["instruction id","streetname",length,position,time,"length","earth_direction",azimuth]
|
||||
|
@ -102,12 +102,10 @@ struct FixedPointCoordinate
|
||||
static float RadianToDegree(const float radian);
|
||||
};
|
||||
|
||||
namespace
|
||||
{
|
||||
std::ostream &operator<<(std::ostream &out_stream, FixedPointCoordinate const &coordinate)
|
||||
inline std::ostream &operator<<(std::ostream &out_stream, FixedPointCoordinate const &coordinate)
|
||||
{
|
||||
coordinate.Output(out_stream);
|
||||
return out_stream;
|
||||
}
|
||||
} // anonymous namespace to guard against duplicate symbols
|
||||
|
||||
#endif /* FIXED_POINT_COORDINATE_H_ */
|
||||
|
@ -370,7 +370,7 @@ template <class DataFacadeT> class AlternativeRouting final : private BasicRouti
|
||||
|
||||
private:
|
||||
// unpack alternate <s,..,v,..,t> by exploring search spaces from v
|
||||
void RetrievePackedAlternatePath(const QueryHeap &forward_heap1,
|
||||
inline void RetrievePackedAlternatePath(const QueryHeap &forward_heap1,
|
||||
const QueryHeap &reverse_heap1,
|
||||
const QueryHeap &forward_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
|
||||
// from v and intersecting against queues. only half-searches have to be
|
||||
// done at this stage
|
||||
void ComputeLengthAndSharingOfViaPath(const NodeID via_node,
|
||||
inline void ComputeLengthAndSharingOfViaPath(const NodeID via_node,
|
||||
int *real_length_of_via_path,
|
||||
int *sharing_of_via_path,
|
||||
const std::vector<NodeID> &packed_shortest_path,
|
||||
@ -551,7 +551,7 @@ template <class DataFacadeT> class AlternativeRouting final : private BasicRouti
|
||||
// variable
|
||||
}
|
||||
|
||||
// int approximateAmountOfSharing(
|
||||
// inline int approximateAmountOfSharing(
|
||||
// const NodeID alternate_path_middle_node_id,
|
||||
// QueryHeap & forward_heap,
|
||||
// QueryHeap & reverse_heap,
|
||||
@ -598,7 +598,7 @@ template <class DataFacadeT> class AlternativeRouting final : private BasicRouti
|
||||
|
||||
// todo: reorder parameters
|
||||
template <bool is_forward_directed>
|
||||
void AlternativeRoutingStep(QueryHeap &forward_heap,
|
||||
inline void AlternativeRoutingStep(QueryHeap &forward_heap,
|
||||
QueryHeap &reverse_heap,
|
||||
NodeID *middle_node,
|
||||
int *upper_bound_to_shortest_path_distance,
|
||||
@ -674,7 +674,7 @@ template <class DataFacadeT> class AlternativeRouting final : private BasicRouti
|
||||
}
|
||||
|
||||
// conduct T-Test
|
||||
bool ViaNodeCandidatePassesTTest(QueryHeap &existing_forward_heap,
|
||||
inline bool ViaNodeCandidatePassesTTest(QueryHeap &existing_forward_heap,
|
||||
QueryHeap &existing_reverse_heap,
|
||||
QueryHeap &new_forward_heap,
|
||||
QueryHeap &new_reverse_heap,
|
||||
|
@ -58,7 +58,7 @@ template <class DataFacadeT> class BasicRoutingInterface
|
||||
explicit BasicRoutingInterface(DataFacadeT *facade) : facade(facade) {}
|
||||
virtual ~BasicRoutingInterface() {};
|
||||
|
||||
void RoutingStep(SearchEngineData::QueryHeap &forward_heap,
|
||||
inline void RoutingStep(SearchEngineData::QueryHeap &forward_heap,
|
||||
SearchEngineData::QueryHeap &reverse_heap,
|
||||
NodeID *middle_node_id,
|
||||
int *upper_bound,
|
||||
@ -145,7 +145,7 @@ template <class DataFacadeT> class BasicRoutingInterface
|
||||
}
|
||||
}
|
||||
|
||||
void UnpackPath(const std::vector<NodeID> &packed_path,
|
||||
inline void UnpackPath(const std::vector<NodeID> &packed_path,
|
||||
const PhantomNodes &phantom_node_pair,
|
||||
std::vector<PathData> &unpacked_path) const
|
||||
{
|
||||
@ -330,7 +330,7 @@ template <class DataFacadeT> class BasicRoutingInterface
|
||||
}
|
||||
}
|
||||
|
||||
void UnpackEdge(const NodeID s, const NodeID t, std::vector<NodeID> &unpacked_path) const
|
||||
inline void UnpackEdge(const NodeID s, const NodeID t, std::vector<NodeID> &unpacked_path) const
|
||||
{
|
||||
std::stack<std::pair<NodeID, NodeID>> recursion_stack;
|
||||
recursion_stack.emplace(s, t);
|
||||
@ -386,7 +386,7 @@ template <class DataFacadeT> class BasicRoutingInterface
|
||||
unpacked_path.emplace_back(t);
|
||||
}
|
||||
|
||||
void RetrievePackedPathFromHeap(const SearchEngineData::QueryHeap &forward_heap,
|
||||
inline void RetrievePackedPathFromHeap(const SearchEngineData::QueryHeap &forward_heap,
|
||||
const SearchEngineData::QueryHeap &reverse_heap,
|
||||
const NodeID middle_node_id,
|
||||
std::vector<NodeID> &packed_path) const
|
||||
@ -397,7 +397,7 @@ template <class DataFacadeT> class BasicRoutingInterface
|
||||
RetrievePackedPathFromSingleHeap(reverse_heap, middle_node_id, packed_path);
|
||||
}
|
||||
|
||||
void RetrievePackedPathFromSingleHeap(const SearchEngineData::QueryHeap &search_heap,
|
||||
inline void RetrievePackedPathFromSingleHeap(const SearchEngineData::QueryHeap &search_heap,
|
||||
const NodeID middle_node_id,
|
||||
std::vector<NodeID> &packed_path) const
|
||||
{
|
||||
|
@ -204,7 +204,7 @@ template <class DataFacadeT> class ManyToManyRouting final : public BasicRouting
|
||||
}
|
||||
|
||||
template <bool forward_direction>
|
||||
void
|
||||
inline void
|
||||
RelaxOutgoingEdges(const NodeID node, const EdgeWeight distance, QueryHeap &query_heap) const
|
||||
{
|
||||
for (auto edge : super::facade->GetAdjacentEdgeRange(node))
|
||||
@ -237,7 +237,7 @@ template <class DataFacadeT> class ManyToManyRouting final : public BasicRouting
|
||||
|
||||
// Stalling
|
||||
template <bool forward_direction>
|
||||
bool StallAtNode(const NodeID node, const EdgeWeight distance, QueryHeap &query_heap)
|
||||
inline bool StallAtNode(const NodeID node, const EdgeWeight distance, QueryHeap &query_heap)
|
||||
const
|
||||
{
|
||||
for (auto edge : super::facade->GetAdjacentEdgeRange(node))
|
||||
|
@ -111,13 +111,13 @@ struct SharedDataLayout
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void SetBlockSize(BlockID bid, uint64_t entries)
|
||||
inline void SetBlockSize(BlockID bid, uint64_t entries)
|
||||
{
|
||||
num_entries[bid] = entries;
|
||||
entry_size[bid] = sizeof(T);
|
||||
}
|
||||
|
||||
uint64_t GetBlockSize(BlockID bid) const
|
||||
inline uint64_t GetBlockSize(BlockID bid) const
|
||||
{
|
||||
// special encoding
|
||||
if (bid == GEOMETRIES_INDICATORS)
|
||||
@ -128,12 +128,12 @@ struct SharedDataLayout
|
||||
return num_entries[bid] * entry_size[bid];
|
||||
}
|
||||
|
||||
uint64_t GetSizeOfLayout() const
|
||||
inline uint64_t GetSizeOfLayout() const
|
||||
{
|
||||
return GetBlockOffset(NUM_BLOCKS) + NUM_BLOCKS*2*sizeof(CANARY);
|
||||
}
|
||||
|
||||
uint64_t GetBlockOffset(BlockID bid) const
|
||||
inline uint64_t GetBlockOffset(BlockID bid) const
|
||||
{
|
||||
uint64_t result = sizeof(CANARY);
|
||||
for (auto i = 0; i < bid; i++)
|
||||
@ -144,7 +144,7 @@ struct SharedDataLayout
|
||||
}
|
||||
|
||||
template<typename T, bool WRITE_CANARY=false>
|
||||
T* GetBlockPtr(char* shared_memory, BlockID bid)
|
||||
inline T* GetBlockPtr(char* shared_memory, BlockID bid)
|
||||
{
|
||||
T* ptr = (T*)(shared_memory + GetBlockOffset(bid));
|
||||
if (WRITE_CANARY)
|
||||
|
@ -270,14 +270,14 @@ RequestParser::consume(Request &req, char input, http::CompressionType *compress
|
||||
}
|
||||
}
|
||||
|
||||
bool RequestParser::isChar(int character) { return character >= 0 && character <= 127; }
|
||||
inline bool RequestParser::isChar(int character) { return character >= 0 && character <= 127; }
|
||||
|
||||
bool RequestParser::isCTL(int character)
|
||||
inline bool RequestParser::isCTL(int character)
|
||||
{
|
||||
return (character >= 0 && character <= 31) || (character == 127);
|
||||
}
|
||||
|
||||
bool RequestParser::isTSpecial(int character)
|
||||
inline bool RequestParser::isTSpecial(int character)
|
||||
{
|
||||
switch (character)
|
||||
{
|
||||
@ -306,5 +306,5 @@ bool RequestParser::isTSpecial(int character)
|
||||
}
|
||||
}
|
||||
|
||||
bool RequestParser::isDigit(int character) { return character >= '0' && character <= '9'; }
|
||||
inline bool RequestParser::isDigit(int character) { return character >= '0' && character <= '9'; }
|
||||
}
|
||||
|
@ -51,13 +51,13 @@ class RequestParser
|
||||
private:
|
||||
boost::tribool consume(Request &req, char input, CompressionType *compressionType);
|
||||
|
||||
bool isChar(int c);
|
||||
inline bool isChar(int c);
|
||||
|
||||
bool isCTL(int c);
|
||||
inline bool isCTL(int c);
|
||||
|
||||
bool isTSpecial(int c);
|
||||
inline bool isTSpecial(int c);
|
||||
|
||||
bool isDigit(int c);
|
||||
inline bool isDigit(int c);
|
||||
|
||||
enum state
|
||||
{ method_start,
|
||||
|
Loading…
Reference in New Issue
Block a user