Skip to content

Commit

Permalink
Do not count deleted nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
joto committed Aug 16, 2024
1 parent 7815511 commit d456b21
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/osp-stats-non-moving-node-changes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include <cstdlib>
#include <exception>
#include <iomanip>
#include <iostream>
#include <memory>
#include <string>
Expand All @@ -20,7 +21,7 @@ class StatsHandler : public osmium::diff_handler::DiffHandler {

public:
void node(const osmium::DiffNode& dnode) {
if (dnode.first()) {
if (dnode.first() || dnode.curr().deleted()) {
return;
}

Expand All @@ -40,10 +41,12 @@ class StatsHandler : public osmium::diff_handler::DiffHandler {
}

void print_result() {
std::cout << "node changes: " << count_node_changes << '\n';
std::cout << " w/same location: " << count_node_changes_same_location << '\n';
std::cout << "node changes (tagged): " << count_node_changes_tagged << '\n';
std::cout << " w/same location (tagged): " << count_node_changes_same_location_tagged << '\n';
std::cout << "node changes: " << std::setw(12) << count_node_changes << '\n';
std::cout << " same location: " << std::setw(12) << count_node_changes_same_location << '\n';
std::cout << "node changes (tagged): " << std::setw(12) << count_node_changes_tagged << '\n';
std::cout << " same location: " << std::setw(12) << count_node_changes_same_location_tagged << '\n';
std::cout << "node changes (untagged): " << std::setw(12) << (count_node_changes - count_node_changes_tagged) << '\n';
std::cout << " same location: " << std::setw(12) << (count_node_changes_same_location - count_node_changes_same_location_tagged) << '\n';
}

}; // class StatsHandler
Expand Down

0 comments on commit d456b21

Please sign in to comment.