Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Levchenko <ldo2.msiu@gmail.com>2020-10-29 12:33:26 +0300
committerVladimir Byko-Ianko <bykoianko@gmail.com>2020-11-23 11:02:58 +0300
commit8289ca4924391c58bb7cbc618dc9eaefd1e77d8c (patch)
treed0b1bd7cf7c585ff8d7c4b13c3808a9f2ce3d975 /routing
parent28ebc878b97806e03eb499d1174b0ed6b6931065 (diff)
More code style fixes
Diffstat (limited to 'routing')
-rw-r--r--routing/geometry.cpp30
-rw-r--r--routing/geometry.hpp9
-rw-r--r--routing/index_graph_loader.cpp1
-rw-r--r--routing/index_graph_loader.hpp1
4 files changed, 16 insertions, 25 deletions
diff --git a/routing/geometry.cpp b/routing/geometry.cpp
index fa287e2053..de50790bd6 100644
--- a/routing/geometry.cpp
+++ b/routing/geometry.cpp
@@ -23,9 +23,6 @@ using namespace std;
namespace
{
-// @TODO(bykoianko) Consider setting cache size based on available memory.
-// Maximum road geometry cache size in items.
-size_t constexpr kRoadsCacheSize = 5000;
double CalcFerryDurationHours(string const & durationHours, double roadLenKm)
{
@@ -41,7 +38,8 @@ double CalcFerryDurationHours(string const & durationHours, double roadLenKm)
CHECK(strings::to_double(durationHours.c_str(), durationH), (durationHours));
// See: https://confluence.mail.ru/download/attachments/249123157/image2019-8-22_16-15-53.png
- // Shortly: we drop some points: (x: lengthKm, y: durationH), that are upper or lower these two lines.
+ // Shortly: we drop some points: (x: lengthKm, y: durationH), that are upper or lower these two
+ // lines.
double constexpr kUpperBoundIntercept = 4.0;
double constexpr kUpperBoundSlope = 0.037;
if (kUpperBoundIntercept + kUpperBoundSlope * roadLenKm - durationH < 0)
@@ -60,8 +58,8 @@ class GeometryLoaderImpl final : public GeometryLoader
{
public:
GeometryLoaderImpl(DataSource const & dataSource, MwmSet::MwmHandle const & handle,
- shared_ptr<VehicleModelInterface> vehicleModel,
- AttrLoader attrLoader, bool loadAltitudes);
+ shared_ptr<VehicleModelInterface> vehicleModel, AttrLoader attrLoader,
+ bool loadAltitudes);
// GeometryLoader overrides:
void Load(uint32_t featureId, RoadGeometry & road) override;
@@ -253,18 +251,9 @@ double RoadGeometry::GetRoadLengthM() const
}
// Geometry ----------------------------------------------------------------------------------------
-Geometry::Geometry(unique_ptr<GeometryLoader> loader)
- : m_loader(move(loader))
- , m_featureIdToRoad(make_unique<RoutingFifoCache>(
- kRoadsCacheSize,
- [this](uint32_t featureId, RoadGeometry & road) { m_loader->Load(featureId, road); }))
-{
- CHECK(m_loader, ());
-}
-
Geometry::Geometry(unique_ptr<GeometryLoader> loader, size_t roadsCacheSize)
- : m_loader(move(loader))
- , m_featureIdToRoad(make_unique<RoutingFifoCache>(
+ : m_loader(move(loader))
+ , m_featureIdToRoad(make_unique<RoutingFifoCache>(
roadsCacheSize,
[this](uint32_t featureId, RoadGeometry & road) { m_loader->Load(featureId, road); }))
{
@@ -283,8 +272,7 @@ RoadGeometry const & Geometry::GetRoad(uint32_t featureId)
unique_ptr<GeometryLoader> GeometryLoader::Create(DataSource const & dataSource,
MwmSet::MwmHandle const & handle,
shared_ptr<VehicleModelInterface> vehicleModel,
- AttrLoader && attrLoader,
- bool loadAltitudes)
+ AttrLoader && attrLoader, bool loadAltitudes)
{
CHECK(handle.IsAlive(), ());
return make_unique<GeometryLoaderImpl>(dataSource, handle, vehicleModel, move(attrLoader),
@@ -292,8 +280,8 @@ unique_ptr<GeometryLoader> GeometryLoader::Create(DataSource const & dataSource,
}
// static
-unique_ptr<GeometryLoader> GeometryLoader::CreateFromFile(string const & fileName,
- shared_ptr<VehicleModelInterface> vehicleModel)
+unique_ptr<GeometryLoader> GeometryLoader::CreateFromFile(
+ string const & fileName, shared_ptr<VehicleModelInterface> vehicleModel)
{
return make_unique<FileGeometryLoader>(fileName, vehicleModel);
}
diff --git a/routing/geometry.hpp b/routing/geometry.hpp
index 2605543c30..a056e1070c 100644
--- a/routing/geometry.hpp
+++ b/routing/geometry.hpp
@@ -28,6 +28,10 @@ class DataSource;
namespace routing
{
+// @TODO(bykoianko) Consider setting cache size based on available memory.
+// Maximum road geometry cache size in items.
+size_t constexpr kRoadsCacheSize = 5000;
+
class RoadGeometry final
{
public:
@@ -135,8 +139,9 @@ class Geometry final
{
public:
Geometry() = default;
- explicit Geometry(std::unique_ptr<GeometryLoader> loader);
- Geometry(std::unique_ptr<GeometryLoader> loader, size_t roadsCacheSize);
+ /// \brief Geometry constructor
+ /// \param roadsCacheSize in-memory geometry elements count limit
+ Geometry(std::unique_ptr<GeometryLoader> loader, size_t roadsCacheSize = kRoadsCacheSize);
/// \note The reference returned by the method is valid until the next call of GetRoad()
/// of GetPoint() methods.
diff --git a/routing/index_graph_loader.cpp b/routing/index_graph_loader.cpp
index a8ca36e978..56f3e9177e 100644
--- a/routing/index_graph_loader.cpp
+++ b/routing/index_graph_loader.cpp
@@ -280,5 +280,4 @@ uint32_t DeserializeIndexGraphNumRoads(MwmValue const & mwmValue, VehicleType ve
ReaderSource<FilesContainerR::TReader> src(reader);
return IndexGraphSerializer::DeserializeNumRoads(src, GetVehicleMask(vehicleType));
}
-
} // namespace routing
diff --git a/routing/index_graph_loader.hpp b/routing/index_graph_loader.hpp
index b459e43025..06dc271259 100644
--- a/routing/index_graph_loader.hpp
+++ b/routing/index_graph_loader.hpp
@@ -38,5 +38,4 @@ public:
void DeserializeIndexGraph(MwmValue const & mwmValue, VehicleType vehicleType, IndexGraph & graph);
uint32_t DeserializeIndexGraphNumRoads(MwmValue const & mwmValue, VehicleType vehicleType);
-
} // namespace routing