fix a couple of OCLint warning, i.e. short variable names and useless parantheses
This commit is contained in:
parent
19f4ebf3c5
commit
7dac8c621c
@ -27,21 +27,21 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "ImportEdge.h"
|
||||
|
||||
bool NodeBasedEdge::operator<(const NodeBasedEdge &e) const
|
||||
bool NodeBasedEdge::operator<(const NodeBasedEdge & other) const
|
||||
{
|
||||
if (source == e.source)
|
||||
if (source == other.source)
|
||||
{
|
||||
if (target == e.target)
|
||||
if (target == other.target)
|
||||
{
|
||||
if (weight == e.weight)
|
||||
if (weight == other.weight)
|
||||
{
|
||||
return (forward && backward && ((!e.forward) || (!e.backward)));
|
||||
return forward && backward && ((!other.forward) || (!other.backward));
|
||||
}
|
||||
return (weight < e.weight);
|
||||
return weight < other.weight;
|
||||
}
|
||||
return (target < e.target);
|
||||
return target < other.target;
|
||||
}
|
||||
return (source < e.source);
|
||||
return source < other.source;
|
||||
}
|
||||
|
||||
NodeBasedEdge::NodeBasedEdge(NodeID source,
|
||||
@ -63,28 +63,28 @@ NodeBasedEdge::NodeBasedEdge(NodeID source,
|
||||
BOOST_ASSERT_MSG(type > 0, "negative edge type");
|
||||
}
|
||||
|
||||
bool EdgeBasedEdge::operator<(const EdgeBasedEdge &e) const
|
||||
bool EdgeBasedEdge::operator<(const EdgeBasedEdge &other) const
|
||||
{
|
||||
if (source == e.source)
|
||||
if (source == other.source)
|
||||
{
|
||||
if (target == e.target)
|
||||
if (target == other.target)
|
||||
{
|
||||
if (weight == e.weight)
|
||||
if (weight == other.weight)
|
||||
{
|
||||
return (forward && backward && ((!e.forward) || (!e.backward)));
|
||||
return forward && backward && ((!other.forward) || (!other.backward));
|
||||
}
|
||||
return (weight < e.weight);
|
||||
return weight < other.weight;
|
||||
}
|
||||
return (target < e.target);
|
||||
return target < other.target;
|
||||
}
|
||||
return (source < e.source);
|
||||
return source < other.source;
|
||||
}
|
||||
|
||||
template <class EdgeT>
|
||||
EdgeBasedEdge::EdgeBasedEdge(const EdgeT &myEdge)
|
||||
: source(myEdge.source), target(myEdge.target), edge_id(myEdge.data.via),
|
||||
weight(myEdge.data.distance), forward(myEdge.data.forward),
|
||||
backward(myEdge.data.backward)
|
||||
EdgeBasedEdge::EdgeBasedEdge(const EdgeT &other)
|
||||
: source(other.source), target(other.target), edge_id(other.data.via),
|
||||
weight(other.data.distance), forward(other.data.forward),
|
||||
backward(other.data.backward)
|
||||
{
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ EdgeBasedEdge::EdgeBasedEdge()
|
||||
}
|
||||
|
||||
EdgeBasedEdge::EdgeBasedEdge(
|
||||
const NodeID s, const NodeID t, const NodeID v, const EdgeWeight w, const bool f, const bool b)
|
||||
: source(s), target(t), edge_id(v), weight(w), forward(f), backward(b)
|
||||
const NodeID source, const NodeID target, const NodeID edge_id, const EdgeWeight weight, const bool forward, const bool backward)
|
||||
: source(source), target(target), edge_id(edge_id), weight(weight), forward(forward), backward(backward)
|
||||
{
|
||||
}
|
||||
|
@ -31,8 +31,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
ExternalMemoryNode::ExternalMemoryNode(
|
||||
int lat, int lon, unsigned int id, bool bollard, bool traffic_light)
|
||||
: NodeInfo(lat, lon, id), bollard(bollard), trafficLight(traffic_light)
|
||||
int lat, int lon, unsigned int node_id, bool bollard, bool traffic_light)
|
||||
: NodeInfo(lat, lon, node_id), bollard(bollard), trafficLight(traffic_light)
|
||||
{
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ void ImportNode::Clear()
|
||||
keyVals.clear();
|
||||
lat = 0;
|
||||
lon = 0;
|
||||
id = 0;
|
||||
node_id = 0;
|
||||
bollard = false;
|
||||
trafficLight = false;
|
||||
}
|
||||
|
@ -41,16 +41,16 @@ struct NodeInfo
|
||||
typedef NodeID key_type; // type of NodeID
|
||||
typedef int value_type; // type of lat,lons
|
||||
|
||||
NodeInfo(int lat, int lon, NodeID id) : lat(lat), lon(lon), id(id) {}
|
||||
NodeInfo(int lat, int lon, NodeID node_id) : lat(lat), lon(lon), node_id(node_id) {}
|
||||
NodeInfo()
|
||||
: lat(std::numeric_limits<int>::max()), lon(std::numeric_limits<int>::max()),
|
||||
id(std::numeric_limits<unsigned>::max())
|
||||
node_id(std::numeric_limits<unsigned>::max())
|
||||
{
|
||||
}
|
||||
|
||||
int lat;
|
||||
int lon;
|
||||
NodeID id;
|
||||
NodeID node_id;
|
||||
|
||||
static NodeInfo min_value()
|
||||
{
|
||||
|
@ -243,17 +243,17 @@ void ExtractionContainers::PrepareData(const std::string &output_file_name,
|
||||
auto node_id_iterator = used_node_id_list.begin();
|
||||
while (node_id_iterator != used_node_id_list.end() && node_iterator != all_nodes_list.end())
|
||||
{
|
||||
if (*node_id_iterator < node_iterator->id)
|
||||
if (*node_id_iterator < node_iterator->node_id)
|
||||
{
|
||||
++node_id_iterator;
|
||||
continue;
|
||||
}
|
||||
if (*node_id_iterator > node_iterator->id)
|
||||
if (*node_id_iterator > node_iterator->node_id)
|
||||
{
|
||||
++node_iterator;
|
||||
continue;
|
||||
}
|
||||
BOOST_ASSERT(*node_id_iterator == node_iterator->id);
|
||||
BOOST_ASSERT(*node_id_iterator == node_iterator->node_id);
|
||||
|
||||
file_out_stream.write((char *)&(*node_iterator), sizeof(ExternalMemoryNode));
|
||||
|
||||
@ -291,18 +291,18 @@ void ExtractionContainers::PrepareData(const std::string &output_file_name,
|
||||
auto edge_iterator = all_edges_list.begin();
|
||||
while (edge_iterator != all_edges_list.end() && node_iterator != all_nodes_list.end())
|
||||
{
|
||||
if (edge_iterator->start < node_iterator->id)
|
||||
if (edge_iterator->start < node_iterator->node_id)
|
||||
{
|
||||
++edge_iterator;
|
||||
continue;
|
||||
}
|
||||
if (edge_iterator->start > node_iterator->id)
|
||||
if (edge_iterator->start > node_iterator->node_id)
|
||||
{
|
||||
node_iterator++;
|
||||
continue;
|
||||
}
|
||||
|
||||
BOOST_ASSERT(edge_iterator->start == node_iterator->id);
|
||||
BOOST_ASSERT(edge_iterator->start == node_iterator->node_id);
|
||||
edge_iterator->source_coordinate.lat = node_iterator->lat;
|
||||
edge_iterator->source_coordinate.lon = node_iterator->lon;
|
||||
++edge_iterator;
|
||||
@ -327,17 +327,17 @@ void ExtractionContainers::PrepareData(const std::string &output_file_name,
|
||||
|
||||
while (edge_iterator != all_edges_list.end() && node_iterator != all_nodes_list.end())
|
||||
{
|
||||
if (edge_iterator->target < node_iterator->id)
|
||||
if (edge_iterator->target < node_iterator->node_id)
|
||||
{
|
||||
++edge_iterator;
|
||||
continue;
|
||||
}
|
||||
if (edge_iterator->target > node_iterator->id)
|
||||
if (edge_iterator->target > node_iterator->node_id)
|
||||
{
|
||||
++node_iterator;
|
||||
continue;
|
||||
}
|
||||
BOOST_ASSERT(edge_iterator->target == node_iterator->id);
|
||||
BOOST_ASSERT(edge_iterator->target == node_iterator->node_id);
|
||||
if (edge_iterator->source_coordinate.lat != std::numeric_limits<int>::min() &&
|
||||
edge_iterator->source_coordinate.lon != std::numeric_limits<int>::min())
|
||||
{
|
||||
|
@ -95,7 +95,7 @@ struct CmpWayByID
|
||||
struct Cmp
|
||||
{
|
||||
typedef NodeID value_type;
|
||||
bool operator()(const NodeID a, const NodeID b) const { return a < b; }
|
||||
bool operator()(const NodeID left, const NodeID right) const { return left < right; }
|
||||
value_type max_value() { return 0xffffffff; }
|
||||
value_type min_value() { return 0x0; }
|
||||
};
|
||||
@ -103,9 +103,9 @@ struct Cmp
|
||||
struct CmpNodeByID
|
||||
{
|
||||
typedef ExternalMemoryNode value_type;
|
||||
bool operator()(const ExternalMemoryNode &a, const ExternalMemoryNode &b) const
|
||||
bool operator()(const ExternalMemoryNode &left, const ExternalMemoryNode &right) const
|
||||
{
|
||||
return a.id < b.id;
|
||||
return left.node_id < right.node_id;
|
||||
}
|
||||
value_type max_value() { return ExternalMemoryNode::max_value(); }
|
||||
value_type min_value() { return ExternalMemoryNode::min_value(); }
|
||||
|
@ -232,7 +232,7 @@ inline void PBFParser::parseDenseNode(ParserThreadData *thread_data)
|
||||
m_lastDenseID += dense.id(i);
|
||||
m_lastDenseLatitude += dense.lat(i);
|
||||
m_lastDenseLongitude += dense.lon(i);
|
||||
extracted_nodes_vector[i].id = m_lastDenseID;
|
||||
extracted_nodes_vector[i].node_id = m_lastDenseID;
|
||||
extracted_nodes_vector[i].lat =
|
||||
COORDINATE_PRECISION *
|
||||
((double)m_lastDenseLatitude * thread_data->PBFprimitiveBlock.granularity() +
|
||||
@ -405,24 +405,24 @@ inline void PBFParser::parseWay(ParserThreadData *thread_data)
|
||||
std::vector<ExtractionWay> parsed_way_vector(number_of_ways);
|
||||
for (int i = 0; i < number_of_ways; ++i)
|
||||
{
|
||||
const OSMPBF::Way &inputWay =
|
||||
const OSMPBF::Way &input_way =
|
||||
thread_data->PBFprimitiveBlock.primitivegroup(thread_data->currentGroupID).ways(i);
|
||||
parsed_way_vector[i].id = inputWay.id();
|
||||
unsigned pathNode(0);
|
||||
const int number_of_referenced_nodes = inputWay.refs_size();
|
||||
parsed_way_vector[i].id = input_way.id();
|
||||
unsigned node_id_in_path = 0;
|
||||
const int number_of_referenced_nodes = input_way.refs_size();
|
||||
for (int j = 0; j < number_of_referenced_nodes; ++j)
|
||||
{
|
||||
pathNode += inputWay.refs(j);
|
||||
parsed_way_vector[i].path.push_back(pathNode);
|
||||
node_id_in_path += input_way.refs(j);
|
||||
parsed_way_vector[i].path.push_back(node_id_in_path);
|
||||
}
|
||||
assert(inputWay.keys_size() == inputWay.vals_size());
|
||||
const int number_of_keys = inputWay.keys_size();
|
||||
assert(input_way.keys_size() == input_way.vals_size());
|
||||
const int number_of_keys = input_way.keys_size();
|
||||
for (int j = 0; j < number_of_keys; ++j)
|
||||
{
|
||||
const std::string &key =
|
||||
thread_data->PBFprimitiveBlock.stringtable().s(inputWay.keys(j));
|
||||
thread_data->PBFprimitiveBlock.stringtable().s(input_way.keys(j));
|
||||
const std::string &val =
|
||||
thread_data->PBFprimitiveBlock.stringtable().s(inputWay.vals(j));
|
||||
thread_data->PBFprimitiveBlock.stringtable().s(input_way.vals(j));
|
||||
parsed_way_vector[i].keyVals.emplace(key, val);
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ void ScriptingEnvironment::initLuaState(lua_State* lua_state)
|
||||
.def(luabind::constructor<>())
|
||||
.def_readwrite("lat", &ImportNode::lat)
|
||||
.def_readwrite("lon", &ImportNode::lon)
|
||||
.def_readonly("id", &ImportNode::id)
|
||||
.def_readonly("id", &ImportNode::node_id)
|
||||
.def_readwrite("bollard", &ImportNode::bollard)
|
||||
.def_readwrite("traffic_light", &ImportNode::trafficLight)
|
||||
.def_readwrite("tags", &ImportNode::keyVals)];
|
||||
|
@ -287,7 +287,7 @@ ImportNode XMLParser::ReadXMLNode()
|
||||
attribute = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"id");
|
||||
if (attribute != NULL)
|
||||
{
|
||||
node.id = stringToUint((const char *)attribute);
|
||||
node.node_id = stringToUint((const char *)attribute);
|
||||
xmlFree(attribute);
|
||||
}
|
||||
|
||||
|
@ -76,17 +76,17 @@ NodeID readBinaryOSRMGraphFromStream(std::istream &input_stream,
|
||||
std::unordered_map<NodeID, NodeID> ext_to_int_id_map;
|
||||
input_stream.read((char *)&n, sizeof(NodeID));
|
||||
SimpleLogger().Write() << "Importing n = " << n << " nodes ";
|
||||
ExternalMemoryNode node;
|
||||
ExternalMemoryNode current_node;
|
||||
for (NodeID i = 0; i < n; ++i)
|
||||
{
|
||||
input_stream.read((char *)&node, sizeof(ExternalMemoryNode));
|
||||
int_to_ext_node_id_map->emplace_back(node.lat, node.lon, node.id);
|
||||
ext_to_int_id_map.emplace(node.id, i);
|
||||
if (node.bollard)
|
||||
input_stream.read((char *)¤t_node, sizeof(ExternalMemoryNode));
|
||||
int_to_ext_node_id_map->emplace_back(current_node.lat, current_node.lon, current_node.node_id);
|
||||
ext_to_int_id_map.emplace(current_node.node_id, i);
|
||||
if (current_node.bollard)
|
||||
{
|
||||
barrier_node_list.emplace_back(i);
|
||||
}
|
||||
if (node.trafficLight)
|
||||
if (current_node.trafficLight)
|
||||
{
|
||||
traffic_light_node_list.emplace_back(i);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user