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
Original file line numberDiff line numberDiff line change
Expand Up@@ -337,9 +337,9 @@ class HighwayGraph
void write_subgraphs_tmg( std::vector<GraphListEntry> &graph_vector, std::string path, size_t graphnum,
unsigned int threadnum, WaypointQuadtree *qt, ElapsedTime *et)
{ unsigned int cv_count, tv_count;
std::ofstream simplefile((path+graph_vector[graphnum].filename()).data());
std::ofstream collapfile((path+graph_vector[graphnum+1].filename()).data());
std::ofstream travelfile((path+graph_vector[graphnum+2].filename()).data());
std::ofstream simplefile(path+graph_vector[graphnum].filename());
std::ofstream collapfile(path+graph_vector[graphnum+1].filename());
std::ofstream travelfile(path+graph_vector[graphnum+2].filename());
std::unordered_set<HGVertex*> mv;
std::unordered_set<HGEdge*> mse, mce, mte;
std::list<TravelerList*> traveler_lists;
Expand Down
11 changes: 4 additions & 7 deletions siteupdate/cplusplus/classes/HighwaySystem.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,7 +33,6 @@ class HighwaySystem
std::list<std::pair<std::string,std::string>> &countries,
std::unordered_map<std::string, Region*> &region_hash)
{ char *c_country = 0;
std::string filename;
std::ifstream file;

// parse systems.csv line
Expand All@@ -56,9 +55,8 @@ class HighwaySystem
delete[] c_line;

// read chopped routes CSV
filename = path+"/"+systemname+".csv";
file.open(filename.data());
if (!file) el.add_error("Could not open " + filename);
file.open(path+"/"+systemname+".csv");
if (!file) el.add_error("Could not open "+path+"/"+systemname+".csv");
else { getline(file, line); // ignore header line
while(getline(file, line))
{ if (line.back() == 0x0D) line.erase(line.end()-1); // trim DOS newlines
Expand All@@ -69,9 +67,8 @@ class HighwaySystem
file.close();

// read connected routes CSV
filename = path+"/"+systemname+"_con.csv";
file.open(filename.data());
if (!file) el.add_error("Could not open " + filename);
file.open(path+"/"+systemname+"_con.csv");
if (!file) el.add_error("Could not open "+path+"/"+systemname+"_con.csv");
else { getline(file, line); // ignore header line
while(getline(file, line))
{ if (line.back() == 0x0D) line.erase(line.end()-1); // trim DOS newlines
Expand Down
2 changes: 1 addition & 1 deletion siteupdate/cplusplus/classes/Route/Route.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -197,7 +197,7 @@ void Route::write_nmp_merged(std::string filename)
filename += "/" + system->systemname;
mkdir(filename.data(), 0777);
filename += "/" + root + ".wpt";
std::ofstream wptfile(filename.data());
std::ofstream wptfile(filename);
char fstr[12];
for (Waypoint *w : point_list)
{ wptfile << w->label << ' ';
Expand Down
2 changes: 1 addition & 1 deletion siteupdate/cplusplus/classes/Route/read_wpt.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,7 +10,7 @@ void Route::read_wpt
all_wpt_files->erase(filename);
awf_mtx.unlock();
std::vector<char*> lines;
std::ifstream file(filename.data());
std::ifstream file(filename);
if (!file)
{ el->add_error("Could not open " + filename);
file.close();
Expand Down
8 changes: 3 additions & 5 deletions siteupdate/cplusplus/classes/TravelerList/TravelerList.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,16 +38,14 @@ class TravelerList
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
std::string filename = args->logfilepath+"/users/"+traveler_name+".log";
std::ofstream log(filename.data());
std::ofstream log(args->logfilepath+"/users/"+traveler_name+".log");
std::ofstream splist;
if (args->splitregionpath != "") splist.open((args->splitregionpath+"/list_files/"+travname).data());
if (args->splitregionpath != "") splist.open(args->splitregionpath+"/list_files/"+travname);
time_t StartTime = time(0);
log << "Log file created at: " << ctime(&StartTime);
filename = args->userlistfilepath+"/"+travname;
std::vector<char*> lines;
std::vector<std::string> endlines;
std::ifstream file(filename.data());
std::ifstream file(args->userlistfilepath+"/"+travname);
// we can't getline here because it only allows one delimiter, and we need two; '\r' and '\n'.
// at least one .list file contains newlines using only '\r' (0x0D):
// https://github.com/TravelMapping/UserData/blob/6309036c44102eb3325d49515b32c5eef3b3cb1e/list_files/whopperman.list
Expand Down
3 changes: 1 addition & 2 deletions siteupdate/cplusplus/classes/TravelerList/userlog.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,8 +7,7 @@ void userlog
)
{ char fstr[112];
std::cout << "." << std::flush;
std::string filename = path+traveler_name+".log";
std::ofstream log(filename.data(), std::ios::app);
std::ofstream log(path+traveler_name+".log", std::ios::app);
log << "Clinched Highway Statistics\n";
log << "Overall in active systems: " << format_clinched_mi(active_only_miles(), total_active_only_miles) << '\n';
log << "Overall in active+preview systems: " << format_clinched_mi(active_preview_miles(), total_active_preview_miles) << '\n';
Expand Down
5 changes: 2 additions & 3 deletions siteupdate/cplusplus/functions/concurrency_detection.cpp
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
// concurrency detection -- will augment our structure with list of concurrent
// segments with each segment (that has a concurrency)
cout << et.et() << "Concurrent segment detection." << flush;
filename = args.logfilepath+"/concurrencies.log";
ofstream concurrencyfile(filename.data());
ofstream concurrencyfile(args.logfilepath+"/concurrencies.log");
timestamp = time(0);
concurrencyfile << "Log file created at: " << ctime(&timestamp);
for (HighwaySystem *h : highway_systems)
Expand DownExpand Up@@ -49,7 +48,7 @@ if (args.splitregion != "")
{ for (HighwaySystem *h : highway_systems)
{ if (splitsystems.find(h->systemname) == splitsystems.end()) continue;
ofstream fralog;
if (args.splitregionpath != "") fralog.open((args.splitregionpath + "/logs/" + h->systemname + "-concurrencies.log").data());
if (args.splitregionpath != "") fralog.open(args.splitregionpath + "/logs/" + h->systemname + "-concurrencies.log");
for (Route &r : h->route_list)
{ if (r.region->code.substr(0, args.splitregion.size()) != args.splitregion) continue;
for (HighwaySegment *s : r.segment_list)
Expand Down
3 changes: 1 addition & 2 deletions siteupdate/cplusplus/functions/graph_generation.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,8 +4,7 @@ cout << et.et() << "Setting up for graphs of highway data." << endl;
HighwayGraph graph_data(all_waypoints, highway_systems, datacheckerrors, args.numthreads, et);

cout << et.et() << "Writing graph waypoint simplification log." << endl;
filename = args.logfilepath + "/waypointsimplification.log";
ofstream wslogfile(filename.data());
ofstream wslogfile(args.logfilepath + "/waypointsimplification.log");
for (string line : graph_data.waypoint_naming_log)
wslogfile << line << '\n';
wslogfile.close();
Expand Down
4 changes: 2 additions & 2 deletions siteupdate/cplusplus/functions/sql_file.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,7 @@ void sqlfile1
){
// Once all data is read in and processed, create a .sql file that will
// create all of the DB tables to be used by other parts of the project
std::ofstream sqlfile((args->databasename+".sql").data());
std::ofstream sqlfile(args->databasename+".sql");
// Note: removed "USE" line, DB name must be specified on the mysql command line

// we have to drop tables in the right order to avoid foreign key errors
Expand DownExpand Up@@ -363,7 +363,7 @@ void sqlfile2
std::vector<GraphListEntry> *graph_vector,
DatacheckEntryList *datacheckerrors
)
{ std::ofstream sqlfile((args->databasename+".sql").data(), std::ios::app);
{ std::ofstream sqlfile(args->databasename+".sql", std::ios::app);

// datacheck errors into the db
#ifndef threading_enabled
Expand Down
3 changes: 1 addition & 2 deletions siteupdate/cplusplus/functions/subgraphs/area.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,8 +2,7 @@
#ifndef threading_enabled
cout << et.et() << "Creating area data graphs." << endl;
#endif
filename = args.highwaydatapath+"/graphs/areagraphs.csv";
file.open(filename.data());
file.open(args.highwaydatapath+"/graphs/areagraphs.csv");
getline(file, line); // ignore header line
list<PlaceRadius> area_list;
while (getline(file, line))
Expand Down
3 changes: 1 addition & 2 deletions siteupdate/cplusplus/functions/subgraphs/multiregion.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,8 +2,7 @@
#ifndef threading_enabled
cout << et.et() << "Creating multiregion graphs." << endl;
#endif
filename = args.highwaydatapath+"/graphs/multiregion.csv";
file.open(filename.data());
file.open(args.highwaydatapath+"/graphs/multiregion.csv");
getline(file, line); // ignore header line

// add entries to graph_vector
Expand Down
3 changes: 1 addition & 2 deletions siteupdate/cplusplus/functions/subgraphs/multisystem.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,8 +2,7 @@
#ifndef threading_enabled
cout << et.et() << "Creating multisystem graphs." << endl;
#endif
filename = args.highwaydatapath+"/graphs/multisystem.csv";
file.open(filename.data());
file.open(args.highwaydatapath+"/graphs/multisystem.csv");
getline(file, line); // ignore header line

// add entries to graph_vector
Expand Down
3 changes: 1 addition & 2 deletions siteupdate/cplusplus/functions/subgraphs/system.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,8 +5,7 @@ cout << et.et() << "Creating system data graphs." << endl;
// We will create graph data and a graph file for only a few interesting
// systems, as many are not useful on their own
HighwaySystem *h;
filename = args.highwaydatapath+"/graphs/systemgraphs.csv";
file.open(filename.data());
file.open( args.highwaydatapath+"/graphs/systemgraphs.csv");
getline(file, line); // ignore header line

// add entries to graph_vector
Expand Down
Loading