Fix c++ formatting
This commit is contained in:
parent
2640a319c1
commit
24ab71a346
@ -52,7 +52,6 @@ class DataWatchdog
|
|||||||
const auto shared_timestamp =
|
const auto shared_timestamp =
|
||||||
static_cast<const storage::SharedDataTimestamp *>(shared_regions->Ptr());
|
static_cast<const storage::SharedDataTimestamp *>(shared_regions->Ptr());
|
||||||
|
|
||||||
|
|
||||||
const auto get_locked_facade = [this, shared_timestamp](
|
const auto get_locked_facade = [this, shared_timestamp](
|
||||||
const std::shared_ptr<datafacade::SharedMemoryDataFacade> &facade) {
|
const std::shared_ptr<datafacade::SharedMemoryDataFacade> &facade) {
|
||||||
if (current_timestamp.region == storage::REGION_1)
|
if (current_timestamp.region == storage::REGION_1)
|
||||||
@ -117,10 +116,8 @@ class DataWatchdog
|
|||||||
current_timestamp = *shared_timestamp;
|
current_timestamp = *shared_timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto new_facade =
|
auto new_facade = std::make_shared<datafacade::SharedMemoryDataFacade>(
|
||||||
std::make_shared<datafacade::SharedMemoryDataFacade>(shared_barriers,
|
shared_barriers, current_timestamp.region, current_timestamp.timestamp);
|
||||||
current_timestamp.region,
|
|
||||||
current_timestamp.timestamp);
|
|
||||||
cached_facade = new_facade;
|
cached_facade = new_facade;
|
||||||
|
|
||||||
return get_locked_facade(new_facade);
|
return get_locked_facade(new_facade);
|
||||||
|
@ -72,7 +72,8 @@ class SharedMemoryDataFacade : public ContiguousInternalMemoryDataFacadeBase
|
|||||||
SharedMemoryDataFacade(const std::shared_ptr<storage::SharedBarriers> &shared_barriers_,
|
SharedMemoryDataFacade(const std::shared_ptr<storage::SharedBarriers> &shared_barriers_,
|
||||||
storage::SharedDataType data_region_,
|
storage::SharedDataType data_region_,
|
||||||
unsigned shared_timestamp_)
|
unsigned shared_timestamp_)
|
||||||
: shared_barriers(shared_barriers_), data_region(data_region_), shared_timestamp(shared_timestamp_)
|
: shared_barriers(shared_barriers_), data_region(data_region_),
|
||||||
|
shared_timestamp(shared_timestamp_)
|
||||||
{
|
{
|
||||||
util::Log(logDEBUG) << "Loading new data with shared timestamp " << shared_timestamp;
|
util::Log(logDEBUG) << "Loading new data with shared timestamp " << shared_timestamp;
|
||||||
|
|
||||||
@ -80,7 +81,8 @@ class SharedMemoryDataFacade : public ContiguousInternalMemoryDataFacadeBase
|
|||||||
m_large_memory = storage::makeSharedMemory(data_region);
|
m_large_memory = storage::makeSharedMemory(data_region);
|
||||||
|
|
||||||
InitializeInternalPointers(*reinterpret_cast<storage::DataLayout *>(m_large_memory->Ptr()),
|
InitializeInternalPointers(*reinterpret_cast<storage::DataLayout *>(m_large_memory->Ptr()),
|
||||||
reinterpret_cast<char *>(m_large_memory->Ptr()) + sizeof(storage::DataLayout));
|
reinterpret_cast<char *>(m_large_memory->Ptr()) +
|
||||||
|
sizeof(storage::DataLayout));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
|
|
||||||
#include "extractor/guidance/turn_instruction.hpp"
|
#include "extractor/guidance/turn_instruction.hpp"
|
||||||
|
|
||||||
#include <boost/range/algorithm/min_element.hpp>
|
|
||||||
#include <boost/range/algorithm/find_if.hpp>
|
|
||||||
#include <boost/range/algorithm/count_if.hpp>
|
#include <boost/range/algorithm/count_if.hpp>
|
||||||
|
#include <boost/range/algorithm/find_if.hpp>
|
||||||
|
#include <boost/range/algorithm/min_element.hpp>
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
@ -133,8 +133,7 @@ template <typename Self> struct EnableShapeOps
|
|||||||
// search a given eid in the intersection
|
// search a given eid in the intersection
|
||||||
auto FindEid(const EdgeID eid) const
|
auto FindEid(const EdgeID eid) const
|
||||||
{
|
{
|
||||||
return boost::range::find_if(
|
return boost::range::find_if(*self(), [eid](const auto &road) { return road.eid == eid; });
|
||||||
*self(), [eid](const auto &road) { return road.eid == eid; });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// find the maximum value based on a conversion operator
|
// find the maximum value based on a conversion operator
|
||||||
@ -247,8 +246,8 @@ template <typename Self> struct EnableIntersectionOps
|
|||||||
auto findClosestTurn(const double angle, const UnaryPredicate filter) const
|
auto findClosestTurn(const double angle, const UnaryPredicate filter) const
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(!self()->empty());
|
BOOST_ASSERT(!self()->empty());
|
||||||
const auto candidate = boost::range::min_element(
|
const auto candidate =
|
||||||
*self(), [angle, &filter](const auto &lhs, const auto &rhs) {
|
boost::range::min_element(*self(), [angle, &filter](const auto &lhs, const auto &rhs) {
|
||||||
const auto filtered_lhs = filter(lhs), filtered_rhs = filter(rhs);
|
const auto filtered_lhs = filter(lhs), filtered_rhs = filter(rhs);
|
||||||
const auto deviation_lhs = util::angularDeviation(lhs.angle, angle),
|
const auto deviation_lhs = util::angularDeviation(lhs.angle, angle),
|
||||||
deviation_rhs = util::angularDeviation(rhs.angle, angle);
|
deviation_rhs = util::angularDeviation(rhs.angle, angle);
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
|
|
||||||
//FWD declarations
|
// FWD declarations
|
||||||
namespace util
|
namespace util
|
||||||
{
|
{
|
||||||
class NameTable;
|
class NameTable;
|
||||||
} // namespace util
|
} // namespace util
|
||||||
|
|
||||||
namespace extractor
|
namespace extractor
|
||||||
@ -30,7 +30,6 @@ namespace guidance
|
|||||||
class IntersectionGenerator;
|
class IntersectionGenerator;
|
||||||
class CoordinateExtractor;
|
class CoordinateExtractor;
|
||||||
|
|
||||||
|
|
||||||
class MergableRoadDetector
|
class MergableRoadDetector
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -312,7 +312,7 @@ bool MergableRoadDetector::HaveSameDirection(const NodeID intersection_node,
|
|||||||
*/
|
*/
|
||||||
const auto prune = [](auto &data_vector) {
|
const auto prune = [](auto &data_vector) {
|
||||||
BOOST_ASSERT(data_vector.size() >= 3);
|
BOOST_ASSERT(data_vector.size() >= 3);
|
||||||
//erase the first third of the vector
|
// erase the first third of the vector
|
||||||
data_vector.erase(data_vector.begin(), data_vector.begin() + data_vector.size() / 3);
|
data_vector.erase(data_vector.begin(), data_vector.begin() + data_vector.size() / 3);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
#include "util/coordinate_calculation.hpp"
|
#include "util/coordinate_calculation.hpp"
|
||||||
#include "util/guidance/name_announcements.hpp"
|
#include "util/guidance/name_announcements.hpp"
|
||||||
|
|
||||||
#include <cmath>
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <cmath>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include "extractor/guidance/constants.hpp"
|
|
||||||
#include "extractor/guidance/turn_handler.hpp"
|
#include "extractor/guidance/turn_handler.hpp"
|
||||||
|
#include "extractor/guidance/constants.hpp"
|
||||||
|
|
||||||
#include "util/bearing.hpp"
|
#include "util/bearing.hpp"
|
||||||
#include "util/guidance/name_announcements.hpp"
|
#include "util/guidance/name_announcements.hpp"
|
||||||
|
@ -73,10 +73,8 @@ RegionsLayout getRegionsLayout(SharedBarriers &barriers)
|
|||||||
static_cast<const SharedDataTimestamp *>(shared_region->Ptr());
|
static_cast<const SharedDataTimestamp *>(shared_region->Ptr());
|
||||||
if (shared_timestamp->region == REGION_1)
|
if (shared_timestamp->region == REGION_1)
|
||||||
{
|
{
|
||||||
return RegionsLayout{REGION_1,
|
return RegionsLayout{
|
||||||
barriers.region_1_mutex,
|
REGION_1, barriers.region_1_mutex, REGION_2, barriers.region_2_mutex};
|
||||||
REGION_2,
|
|
||||||
barriers.region_2_mutex};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_ASSERT(shared_timestamp->region == REGION_2);
|
BOOST_ASSERT(shared_timestamp->region == REGION_2);
|
||||||
|
@ -179,7 +179,7 @@ catch (const std::bad_alloc &e)
|
|||||||
util::Log(logERROR) << "Please provide more memory or consider using a larger swapfile";
|
util::Log(logERROR) << "Please provide more memory or consider using a larger swapfile";
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
catch (const std::exception& e)
|
catch (const std::exception &e)
|
||||||
{
|
{
|
||||||
std::cerr << "[exception] " << e.what();
|
std::cerr << "[exception] " << e.what();
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
@ -167,7 +167,7 @@ catch (const std::bad_alloc &e)
|
|||||||
util::Log(logERROR) << "Please provide more memory or consider using a larger swapfile";
|
util::Log(logERROR) << "Please provide more memory or consider using a larger swapfile";
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
catch (const std::exception& e)
|
catch (const std::exception &e)
|
||||||
{
|
{
|
||||||
std::cerr << "[exception] " << e.what();
|
std::cerr << "[exception] " << e.what();
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
@ -373,7 +373,7 @@ catch (const std::bad_alloc &e)
|
|||||||
util::Log(logWARNING) << "Please provide more memory or consider using a larger swapfile";
|
util::Log(logWARNING) << "Please provide more memory or consider using a larger swapfile";
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
catch (const std::exception& e)
|
catch (const std::exception &e)
|
||||||
{
|
{
|
||||||
std::cerr << "[exception] " << e.what();
|
std::cerr << "[exception] " << e.what();
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
@ -91,7 +91,7 @@ bool generateDataStoreOptions(const int argc,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[ noreturn ]] void CleanupSharedBarriers(int signum)
|
[[noreturn]] void CleanupSharedBarriers(int signum)
|
||||||
{ // Here the lock state of named mutexes is unknown, make a hard cleanup
|
{ // Here the lock state of named mutexes is unknown, make a hard cleanup
|
||||||
osrm::storage::SharedBarriers::resetCurrentRegion();
|
osrm::storage::SharedBarriers::resetCurrentRegion();
|
||||||
std::_Exit(128 + signum);
|
std::_Exit(128 + signum);
|
||||||
|
Loading…
Reference in New Issue
Block a user