osrm-backend/include/util/assert.hpp
Huyen Chau Nguyen 61e06fcaba
Making the turn function more flexible (#4789)
* set and store highway and access classification for the turn function
* expose highway turn classification and access turn classification and speed to the lua profile turn function
* expose whether connection road at turn is incoming or outgoing
* add lua tests for exposed information to turn function
* update docs about attributes in process_turn
* add turn_classification info to docs
* adding warning if uturn and intersection dont match
* handle u turns that do not turn into intersection[0]
* split OSM link generation in an accessible coordinate function
2018-01-24 15:39:55 -05:00

44 lines
2.0 KiB
C++

#ifndef OSRM_UTIL_ASSERT_HPP
#define OSRM_UTIL_ASSERT_HPP
#include <iostream>
#include <string>
#include "util/coordinate.hpp"
#include <boost/assert.hpp>
// Enhances BOOST_ASSERT / BOOST_ASSERT_MSG with convenience location printing
// - OSRM_ASSERT(cond, coordinate)
// - OSRM_ASSERT_MSG(cond, coordinate, msg)
#ifdef BOOST_ENABLE_ASSERT_HANDLER
#define OSRM_ASSERT_MSG(cond, loc, msg) \
do \
{ \
if (!static_cast<bool>(cond)) \
{ \
::osrm::util::FloatCoordinate c_(loc); \
std::cerr << "[Location] " << c_.toOSMLink() << '\n'; \
} \
BOOST_ASSERT_MSG(cond, msg); \
} while (0)
#define OSRM_ASSERT(cond, loc) OSRM_ASSERT_MSG(cond, loc, "")
#else
#define OSRM_ASSERT_MSG(cond, coordinate, msg) \
do \
{ \
(void)(cond); \
(void)(coordinate); \
(void)(msg); \
} while (0)
#define OSRM_ASSERT(cond, coordinate) OSRM_ASSERT_MSG(cond, coordinate, "")
#endif
#endif