-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize RestrictionParser performance
- Loading branch information
1 parent
01e2a2d
commit 6a8439e
Showing
3 changed files
with
72 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#ifndef QUERY_NODE_HPP | ||
#define QUERY_NODE_HPP | ||
|
||
#include "util/typedefs.hpp" | ||
|
||
#include "util/coordinate.hpp" | ||
|
||
#include <cstdint> | ||
#include <limits> | ||
|
||
namespace osrm | ||
{ | ||
namespace extractor | ||
{ | ||
|
||
struct NodeLocation | ||
{ | ||
using key_type = OSMNodeID; // type of NodeID | ||
using value_type = std::int32_t; // type of lat,lons | ||
|
||
explicit NodeLocation(const util::FixedLongitude lon_, | ||
const util::FixedLatitude lat_, | ||
const key_type node_id_) | ||
: lon(lon_), lat(lat_), node_id(node_id_) | ||
{ | ||
} | ||
NodeLocation() | ||
: lon{std::numeric_limits<value_type>::max()}, lat{std::numeric_limits<value_type>::max()}, | ||
node_id(SPECIAL_OSM_NODEID) | ||
{ | ||
} | ||
|
||
util::FixedLongitude lon; | ||
util::FixedLatitude lat; | ||
key_type node_id; | ||
|
||
static NodeLocation min_value() | ||
{ | ||
return NodeLocation( | ||
util::FixedLongitude{static_cast<value_type>(-180 * COORDINATE_PRECISION)}, | ||
util::FixedLatitude{static_cast<value_type>(-90 * COORDINATE_PRECISION)}, | ||
MIN_OSM_NODEID); | ||
} | ||
|
||
static NodeLocation max_value() | ||
{ | ||
return NodeLocation( | ||
util::FixedLongitude{static_cast<value_type>(180 * COORDINATE_PRECISION)}, | ||
util::FixedLatitude{static_cast<value_type>(90 * COORDINATE_PRECISION)}, | ||
MAX_OSM_NODEID); | ||
} | ||
}; | ||
} // namespace extractor | ||
} // namespace osrm | ||
|
||
#endif // QUERY_NODE_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters