Apply clang format
This commit is contained in:
committed by
Michael Krasnyk
parent
580c5e39ae
commit
c2fd64d3cc
@@ -14,10 +14,7 @@ namespace extractor
|
||||
namespace detail
|
||||
{
|
||||
|
||||
inline const char * checkedString(const char * str)
|
||||
{
|
||||
return str ? str : "";
|
||||
}
|
||||
inline const char *checkedString(const char *str) { return str ? str : ""; }
|
||||
|
||||
} // namespace detail
|
||||
|
||||
@@ -25,10 +22,7 @@ struct ExtractionRelation
|
||||
{
|
||||
using AttributesMap = std::unordered_map<std::string, std::string>;
|
||||
|
||||
ExtractionRelation()
|
||||
: is_restriction(false)
|
||||
{
|
||||
}
|
||||
ExtractionRelation() : is_restriction(false) {}
|
||||
|
||||
void clear()
|
||||
{
|
||||
@@ -36,15 +30,9 @@ struct ExtractionRelation
|
||||
values.clear();
|
||||
}
|
||||
|
||||
bool IsRestriction() const
|
||||
{
|
||||
return is_restriction;
|
||||
}
|
||||
bool IsRestriction() const { return is_restriction; }
|
||||
|
||||
AttributesMap & GetMember(util::OsmIDTyped id)
|
||||
{
|
||||
return values[id.Hash()];
|
||||
}
|
||||
AttributesMap &GetMember(util::OsmIDTyped id) { return values[id.Hash()]; }
|
||||
|
||||
bool is_restriction;
|
||||
std::unordered_map<util::OsmIDTyped::HashType, AttributesMap> values;
|
||||
@@ -53,18 +41,18 @@ struct ExtractionRelation
|
||||
// It contains data of all parsed relations for each node/way element
|
||||
class ExtractionRelationContainer
|
||||
{
|
||||
public:
|
||||
public:
|
||||
using AttributesMap = ExtractionRelation::AttributesMap;
|
||||
using RelationList = std::vector<AttributesMap>;
|
||||
|
||||
void AddRelation(const ExtractionRelation & rel)
|
||||
void AddRelation(const ExtractionRelation &rel)
|
||||
{
|
||||
BOOST_ASSERT(!rel.is_restriction);
|
||||
for (auto it : rel.values)
|
||||
data[it.first].push_back(it.second);
|
||||
}
|
||||
|
||||
const RelationList & Get(const util::OsmIDTyped & id) const
|
||||
const RelationList &Get(const util::OsmIDTyped &id) const
|
||||
{
|
||||
const auto it = data.find(id.Hash());
|
||||
if (it != data.end())
|
||||
@@ -74,7 +62,7 @@ public:
|
||||
return empty;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
// TODO: need to store more common data
|
||||
std::unordered_map<util::OsmIDTyped::HashType, RelationList> data;
|
||||
};
|
||||
|
||||
@@ -90,7 +90,6 @@ class ExtractorCallbacks
|
||||
// warning: caller needs to take care of synchronization!
|
||||
void ProcessWay(const osmium::Way ¤t_way, const ExtractionWay &result_way);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,14 +62,14 @@ class ScriptingEnvironment
|
||||
virtual void ProcessTurn(ExtractionTurn &turn) = 0;
|
||||
virtual void ProcessSegment(ExtractionSegment &segment) = 0;
|
||||
|
||||
virtual void
|
||||
ProcessElements(const osmium::memory::Buffer &buffer,
|
||||
const RestrictionParser &restriction_parser,
|
||||
const ExtractionRelationContainer &relations,
|
||||
std::vector<std::pair<const osmium::Node &, ExtractionNode>> &resulting_nodes,
|
||||
std::vector<std::pair<const osmium::Way &, ExtractionWay>> &resulting_ways,
|
||||
std::vector<std::pair<const osmium::Relation &, ExtractionRelation>> &resulting_relations,
|
||||
std::vector<InputConditionalTurnRestriction> &resulting_restrictions) = 0;
|
||||
virtual void ProcessElements(
|
||||
const osmium::memory::Buffer &buffer,
|
||||
const RestrictionParser &restriction_parser,
|
||||
const ExtractionRelationContainer &relations,
|
||||
std::vector<std::pair<const osmium::Node &, ExtractionNode>> &resulting_nodes,
|
||||
std::vector<std::pair<const osmium::Way &, ExtractionWay>> &resulting_ways,
|
||||
std::vector<std::pair<const osmium::Relation &, ExtractionRelation>> &resulting_relations,
|
||||
std::vector<InputConditionalTurnRestriction> &resulting_restrictions) = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef SCRIPTING_ENVIRONMENT_LUA_HPP
|
||||
#define SCRIPTING_ENVIRONMENT_LUA_HPP
|
||||
|
||||
#include "extractor/extraction_relation.hpp"
|
||||
#include "extractor/raster_source.hpp"
|
||||
#include "extractor/scripting_environment.hpp"
|
||||
#include "extractor/extraction_relation.hpp"
|
||||
|
||||
#include <tbb/enumerable_thread_specific.h>
|
||||
|
||||
@@ -20,8 +20,12 @@ namespace extractor
|
||||
|
||||
struct LuaScriptingContext final
|
||||
{
|
||||
void ProcessNode(const osmium::Node &, ExtractionNode &result, const ExtractionRelationContainer::RelationList &relations);
|
||||
void ProcessWay(const osmium::Way &, ExtractionWay &result, const ExtractionRelationContainer::RelationList &relations);
|
||||
void ProcessNode(const osmium::Node &,
|
||||
ExtractionNode &result,
|
||||
const ExtractionRelationContainer::RelationList &relations);
|
||||
void ProcessWay(const osmium::Way &,
|
||||
ExtractionWay &result,
|
||||
const ExtractionRelationContainer::RelationList &relations);
|
||||
void ProcessRelation(const osmium::Relation &, ExtractionRelation &result);
|
||||
|
||||
ProfileProperties properties;
|
||||
@@ -69,14 +73,14 @@ class Sol2ScriptingEnvironment final : public ScriptingEnvironment
|
||||
void ProcessTurn(ExtractionTurn &turn) override;
|
||||
void ProcessSegment(ExtractionSegment &segment) override;
|
||||
|
||||
void
|
||||
ProcessElements(const osmium::memory::Buffer &buffer,
|
||||
const RestrictionParser &restriction_parser,
|
||||
const ExtractionRelationContainer &relations,
|
||||
std::vector<std::pair<const osmium::Node &, ExtractionNode>> &resulting_nodes,
|
||||
std::vector<std::pair<const osmium::Way &, ExtractionWay>> &resulting_ways,
|
||||
std::vector<std::pair<const osmium::Relation &, ExtractionRelation>> &resulting_relations,
|
||||
std::vector<InputConditionalTurnRestriction> &resulting_restrictions) override;
|
||||
void ProcessElements(
|
||||
const osmium::memory::Buffer &buffer,
|
||||
const RestrictionParser &restriction_parser,
|
||||
const ExtractionRelationContainer &relations,
|
||||
std::vector<std::pair<const osmium::Node &, ExtractionNode>> &resulting_nodes,
|
||||
std::vector<std::pair<const osmium::Way &, ExtractionWay>> &resulting_ways,
|
||||
std::vector<std::pair<const osmium::Relation &, ExtractionRelation>> &resulting_relations,
|
||||
std::vector<InputConditionalTurnRestriction> &resulting_restrictions) override;
|
||||
|
||||
private:
|
||||
LuaScriptingContext &GetSol2Context();
|
||||
|
||||
@@ -10,26 +10,24 @@ namespace util
|
||||
|
||||
class OsmIDTyped
|
||||
{
|
||||
public:
|
||||
public:
|
||||
using HashType = std::uint64_t;
|
||||
|
||||
OsmIDTyped(std::uint64_t id_, std::uint8_t type_)
|
||||
: id(id_)
|
||||
, type(type_)
|
||||
OsmIDTyped(std::uint64_t id_, std::uint8_t type_) : id(id_), type(type_)
|
||||
{
|
||||
// check if type value not above type size bound
|
||||
BOOST_ASSERT(id_ < (std::uint64_t(1) << 56));
|
||||
}
|
||||
|
||||
bool operator == (const OsmIDTyped &other) { return (id == other.id && type == other.type); }
|
||||
bool operator != (const OsmIDTyped &other) { return (id != other.id || type != other.type); }
|
||||
bool operator==(const OsmIDTyped &other) { return (id == other.id && type == other.type); }
|
||||
bool operator!=(const OsmIDTyped &other) { return (id != other.id || type != other.type); }
|
||||
|
||||
inline HashType Hash() const { return (std::uint64_t(id) | std::uint64_t(type) << 56); }
|
||||
|
||||
std::uint64_t GetID() const { return id; }
|
||||
std::uint8_t GetType() const { return type; }
|
||||
|
||||
private:
|
||||
private:
|
||||
std::uint64_t id : 56;
|
||||
std::uint8_t type;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user