Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions siteupdate/cplusplus/classes/ClinchedSegmentEntry.cpp

This file was deleted.

19 changes: 8 additions & 11 deletions siteupdate/cplusplus/classes/TravelerList/TravelerList.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,6 @@ class TravelerList
public:
std::mutex ap_mi_mtx, ao_mi_mtx, sr_mi_mtx;
std::unordered_set<HighwaySegment*> clinched_segments;
std::list<ClinchedSegmentEntry> list_entries;
std::string traveler_name;
std::unordered_map<Region*, double> active_preview_mileage_by_region; // total mileage per region, active+preview only
std::unordered_map<Region*, double> active_only_mileage_by_region; // total mileage per region, active only
Expand All@@ -35,6 +34,7 @@ class TravelerList
active_systems_clinched = 0;
preview_systems_traveled = 0;
preview_systems_clinched = 0;
unsigned int list_entries = 0;
traveler_num = new unsigned int[args->numthreads];
// deleted on termination of program
traveler_name = travname.substr(0, travname.size()-5); // strip ".list" from end of travname
Expand DownExpand Up@@ -133,17 +133,15 @@ class TravelerList
// r is a route match, r.root is our root, and we need to find
// canonical waypoint labels, ignoring case and leading
// "+" or "*" when matching
std::list<Waypoint*> canonical_waypoints;
std::vector<unsigned int> canonical_waypoint_indices;
std::vector<unsigned int> point_indices;
unsigned int checking_index = 0;
for (Waypoint *w : r->point_list)
{ std::string lower_label = lower(w->label);
lower(fields[2]);
lower(fields[3]);
while (lower_label.front() == '+' || lower_label.front() == '*') lower_label.erase(lower_label.begin());
if (fields[2] == lower_label || fields[3] == lower_label)
{ canonical_waypoints.push_back(w);
canonical_waypoint_indices.push_back(checking_index);
{ point_indices.push_back(checking_index);
r->liu_mtx.lock();
r->labels_in_use.insert(upper(lower_label));
r->liu_mtx.unlock();
Expand All@@ -152,8 +150,7 @@ class TravelerList
{ lower_label = lower(alt);
while (lower_label.front() == '+') lower_label.erase(lower_label.begin());
if (fields[2] == lower_label || fields[3] == lower_label)
{ canonical_waypoints.push_back(w);
canonical_waypoint_indices.push_back(checking_index);
{ point_indices.push_back(checking_index);
r->liu_mtx.lock();
r->labels_in_use.insert(upper(lower_label));
r->liu_mtx.unlock();
Expand All@@ -166,7 +163,7 @@ class TravelerList
}
checking_index++;
}
if (canonical_waypoints.size() != 2)
if (point_indices.size() != 2)
{ bool invalid_char = 0;
for (size_t c = 0; c < trim_line.size(); c++)
if (trim_line[c] < 0x20 || trim_line[c] >= 0x7F)
Expand All@@ -178,11 +175,11 @@ class TravelerList
log << '\n';
splist << orig_line << endlines[l];
}
else { list_entries.emplace_back(/**line,*/ r, canonical_waypoint_indices[0], canonical_waypoint_indices[1]);
else { list_entries++;
// find the segments we just matched and store this traveler with the
// segments and the segments with the traveler (might not need both
// ultimately)
for (unsigned int wp_pos = canonical_waypoint_indices[0]; wp_pos < canonical_waypoint_indices[1]; wp_pos++)
for (unsigned int wp_pos = point_indices[0]; wp_pos < point_indices[1]; wp_pos++)
{ HighwaySegment *hs = r->segment_list[wp_pos];
hs->add_clinched_by(this);
clinched_segments.insert(hs);
Expand All@@ -204,7 +201,7 @@ class TravelerList
}
}
delete[] listdata;
log << "Processed " << list_entries.size() << " good lines marking " << clinched_segments.size() << " segments traveled.\n";
log << "Processed " << list_entries << " good lines marking " << clinched_segments.size() << " segments traveled.\n";
log.close();
splist.close();
}
Expand Down
7 changes: 2 additions & 5 deletions siteupdate/cplusplus/classes/TravelerList/splitregion.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,7 +2,7 @@
if (args->splitregion == upper(fields[0]))
{ // first, comment out original line
splist << "##### " << orig_line << newline;
HighwaySegment *orig_hs = r->segment_list[canonical_waypoint_indices[0]];
HighwaySegment *orig_hs = r->segment_list[point_indices[0]];
HighwaySegment *new_hs = 0;
if (!orig_hs->concurrent)
std::cout << "ERROR: " << orig_hs->str() << " not concurrent" << std::endl;
Expand All@@ -17,10 +17,7 @@ if (args->splitregion == upper(fields[0]))
else { if (count > 1) std::cout << "DEBUG: multiple matches found for " << orig_hs->str() << std::endl;
// get lines from associated connected route.
// assumption: each chopped route in old full region corresponds 1:1 to a connected route in new chopped regions
splist << new_hs->route->con_route->list_lines(canonical_waypoint_indices[0],
canonical_waypoint_indices[1] -
canonical_waypoint_indices[0],
newline, 2) << endlines[l];
splist << new_hs->route->con_route->list_lines(point_indices[0], point_indices[1] - point_indices[0], newline, 2) << endlines[l];
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions siteupdate/cplusplus/functions/lower.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,10 +4,8 @@ std::string lower(std::string str)
return str;
}

//#ifdef TravelerList__cstr
char *lower(char *str)
{ for (char *c = str; *c != 0; c++)
if (*c >= 'A' && *c <= 'Z') *c += 32;
return str;
}
//#endif
1 change: 0 additions & 1 deletion siteupdate/cplusplus/siteupdate.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -61,7 +61,6 @@ class HGEdge;
#include "classes/Waypoint/Waypoint.h"
#include "classes/Waypoint/Waypoint.cpp"
#include "classes/WaypointQuadtree/WaypointQuadtree.cpp"
#include "classes/ClinchedSegmentEntry.cpp"
#include "classes/HighwaySegment/HighwaySegment.h"
#include "classes/ClinchedDBValues.cpp"
#include "classes/Route/Route.cpp"
Expand Down