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
+4 -4
View File
@@ -37,7 +37,7 @@ template <typename Data> class ConcurrentQueue
public:
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);
m_not_full.wait(lock,
@@ -47,9 +47,9 @@ template <typename Data> class ConcurrentQueue
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);
m_not_empty.wait(lock,
@@ -60,7 +60,7 @@ template <typename Data> class ConcurrentQueue
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);
if (m_internal_queue.empty())
+20 -20
View File
@@ -50,7 +50,7 @@ template <typename ElementT> struct DeallocatingVectorIteratorState
std::size_t index;
std::vector<ElementT *> *bucket_list;
inline DeallocatingVectorIteratorState &operator=(const DeallocatingVectorIteratorState &other)
DeallocatingVectorIteratorState &operator=(const DeallocatingVectorIteratorState &other)
{
index = other.index;
bucket_list = other.bucket_list;
@@ -175,13 +175,13 @@ class DeallocatingVector
~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);
bucket_list.swap(other.bucket_list);
}
inline void clear()
void clear()
{
// Delete[]'ing ptr's to all Buckets
for (auto bucket : bucket_list)
@@ -196,7 +196,7 @@ class DeallocatingVector
current_size = 0;
}
inline void push_back(const ElementT &element)
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> inline void emplace_back(Ts &&... element)
template <typename... Ts> 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;
}
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)
{
@@ -248,50 +248,50 @@ class DeallocatingVector
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);
}
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);
}
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 _index = index % ELEMENTS_PER_BLOCK;
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 _index = index % ELEMENTS_PER_BLOCK;
return (bucket_list[_bucket][_index]);
}
inline ElementT &back()
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 inline ElementT &back() const
const 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 inline void append(InputIterator first, const InputIterator last)
const void append(InputIterator first, const InputIterator last)
{
InputIterator position = first;
while (position != last)
+1 -1
View File
@@ -65,7 +65,7 @@ struct EdgeBasedNode
(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;
//The coordinates of the midpoint are given by:
+4 -4
View File
@@ -40,17 +40,17 @@ class HashTable
public:
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));
}
inline void Clear()
void 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)
{
@@ -62,7 +62,7 @@ class HashTable
return Value();
}
inline const bool Holds(Key const &key) const
const bool Holds(Key const &key) const
{
for (const auto &key_val_pair : table)
{
+2 -2
View File
@@ -42,8 +42,8 @@ class HilbertCode
HilbertCode(const HilbertCode &) = delete;
private:
inline uint64_t BitInterleaving(const uint32_t a, const uint32_t b) const;
inline void TransposeCoordinate(uint32_t *X) const;
uint64_t BitInterleaving(const uint32_t a, const uint32_t b) const;
void TransposeCoordinate(uint32_t *X) const;
};
#endif /* HILBERTVALUE_H_ */
+1 -1
View File
@@ -51,7 +51,7 @@ struct ImportNode : public ExternalMemoryNode
{
HashTable<std::string, std::string> keyVals;
inline void Clear();
void Clear();
};
#endif /* IMPORTNODE_H_ */
+5 -3
View File
@@ -219,18 +219,20 @@ struct ArrayRenderer : mapbox::util::static_visitor<>
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;
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;
mapbox::util::apply_visitor(ArrayRenderer(out), value);
}
} // anonymous namespace to guard against duplicate symbols
} // namespace JSON
#endif // JSON_CONTAINER_H
+4 -2
View File
@@ -54,8 +54,9 @@ struct SimpleEdgeData
using NodeBasedDynamicGraph = DynamicGraph<NodeBasedEdgeData>;
using SimpleNodeBasedDynamicGraph = DynamicGraph<SimpleEdgeData>;
namespace {
// 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)
{
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>
inline std::shared_ptr<SimpleNodeBasedDynamicGraph>
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");
@@ -240,5 +241,6 @@ 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_
+8 -4
View File
@@ -156,14 +156,17 @@ struct PhantomNodes
PhantomNode target_phantom;
};
inline std::ostream& operator<<(std::ostream &out, const PhantomNodes & pn)
namespace
{
out << "source_coord: " << pn.source_phantom.location << "\n";
out << "target_coord: " << pn.target_phantom.location << std::endl;
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;
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 << ", " <<
"node2: " << pn.reverse_node_id << ", " <<
@@ -177,5 +180,6 @@ inline 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
+2 -2
View File
@@ -133,7 +133,7 @@ public:
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);
// internal_idx 0 is implicitly stored in block_offsets[block_idx]
@@ -170,7 +170,7 @@ public:
}
private:
inline unsigned PrefixSumAtIndex(int index, const BlockT& block) const;
unsigned PrefixSumAtIndex(int index, const BlockT& block) const;
// contains offset for each differential block
OffsetContainerT block_offsets;
+4 -4
View File
@@ -102,19 +102,19 @@ struct InputRestrictionContainer
struct CmpRestrictionContainerByFrom
{
using value_type = InputRestrictionContainer;
inline bool operator()(const InputRestrictionContainer &a, const InputRestrictionContainer &b)
bool operator()(const InputRestrictionContainer &a, const InputRestrictionContainer &b)
const
{
return a.fromWay < b.fromWay;
}
inline value_type max_value() const { return InputRestrictionContainer::max_value(); }
inline value_type min_value() const { return InputRestrictionContainer::min_value(); }
value_type max_value() const { return InputRestrictionContainer::max_value(); }
value_type min_value() const { return InputRestrictionContainer::min_value(); }
};
struct CmpRestrictionContainerByTo
{
using value_type = InputRestrictionContainer;
inline bool operator()(const InputRestrictionContainer &a, const InputRestrictionContainer &b)
bool operator()(const InputRestrictionContainer &a, const InputRestrictionContainer &b)
const
{
return a.toWay < b.toWay;
+2 -2
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);
}
@@ -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);
}
+2 -2
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); }
inline NodeIterator GetTarget(const EdgeIterator e) const
NodeIterator GetTarget(const EdgeIterator e) const
{
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; }
+19 -19
View File
@@ -77,7 +77,7 @@ class StaticRTree
int32_t min_lon, max_lon;
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 std::vector<NodeInfo> &coordinate_list)
{
@@ -103,7 +103,7 @@ class StaticRTree
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);
max_lon = std::max(max_lon, other.max_lon);
@@ -115,7 +115,7 @@ class StaticRTree
BOOST_ASSERT(max_lon != std::numeric_limits<int>::min());
}
inline FixedPointCoordinate Centroid() const
FixedPointCoordinate Centroid() const
{
FixedPointCoordinate centroid;
// The coordinates of the midpoints are given by:
@@ -125,7 +125,7 @@ class StaticRTree
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_right(other.max_lat, other.max_lon);
@@ -136,7 +136,7 @@ class StaticRTree
Contains(lower_left));
}
inline float GetMinDist(const FixedPointCoordinate &location) const
float GetMinDist(const FixedPointCoordinate &location) const
{
const bool is_contained = Contains(location);
if (is_contained)
@@ -205,7 +205,7 @@ class StaticRTree
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();
// Get minmax distance to each of the four sides
@@ -238,14 +238,14 @@ class StaticRTree
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 lons_contained = (location.lon >= min_lon) && (location.lon <= max_lon);
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
<< " " << rect.max_lat / COORDINATE_PRECISION << ","
@@ -278,7 +278,7 @@ class StaticRTree
uint64_t m_hilbert_value;
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;
}
@@ -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;
inline bool operator<(const QueryCandidate &other) const
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()) {}
inline bool operator<(const IncrementalQueryCandidate &other) const
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:
inline void SetForwardAndReverseWeightsOnPhantomNode(const EdgeDataT & nearest_edge,
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
inline void FixUpRoundingIssue(const FixedPointCoordinate &input_coordinate,
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>
inline float ExploreTreeNode(const TreeNode &parent,
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;
}
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())
{
@@ -1192,10 +1192,10 @@ class StaticRTree
BOOST_ASSERT_MSG(leaves_stream.good(), "Reading from leaf file failed.");
}
inline bool EdgesAreEquivalent(const FixedPointCoordinate &a,
const FixedPointCoordinate &b,
const FixedPointCoordinate &c,
const FixedPointCoordinate &d) const
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);
}
+2 -2
View File
@@ -44,7 +44,7 @@ struct TurnInstructionsClass
TurnInstructionsClass() = delete;
TurnInstructionsClass(const TurnInstructionsClass&) = delete;
static inline TurnInstruction GetTurnDirectionOfInstruction(const double angle)
static TurnInstruction GetTurnDirectionOfInstruction(const double angle)
{
if (angle >= 23 && angle < 67)
{
@@ -77,7 +77,7 @@ struct TurnInstructionsClass
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)
{
+1 -1
View File
@@ -68,7 +68,7 @@ class XORFastHash
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 msb = (((originalValue) >> 16) & 0xffff);