Skip to content

Commit

Permalink
refractor: removed default namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
jannikbusse committed Nov 30, 2023
1 parent 81b519e commit aa9420f
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 71 deletions.
1 change: 0 additions & 1 deletion src/libfiles/export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#endif
#endif

using namespace std;

#include "utils/settings.h"
#include "utils/interface.h"
Expand Down
32 changes: 16 additions & 16 deletions src/utils/helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ int findLane(laneSection sec, lane &l, int id)
* @param id roadId of the lane to find
* @return int position in road vector
*/
int findRoad(vector<road> roads, road &r, int id)
int findRoad(std::vector<road> roads, road &r, int id)
{
for (int i = 0; i < roads.size(); i++)
{
Expand Down Expand Up @@ -533,7 +533,7 @@ int sortRoads(road r1, road &r2, road &r3, road &r4)
}
else
{
cerr << "ERR: angles at intersection point are not defined correct.";
std::cerr << "ERR: angles at intersection point are not defined correct.\n";
return 1;
}
return 0;
Expand Down Expand Up @@ -569,7 +569,7 @@ int sortRoads(road r1, road &r2, road &r3)
}
else
{
cerr << "ERR: angles at intersection point are not defined correct.";
std::cerr << "ERR: angles at intersection point are not defined correctly.\n";
return 1;
}
return 0;
Expand Down Expand Up @@ -741,7 +741,7 @@ bool compareLanes(const lane &a, const lane &b)
* @return true int is in vector
* @return false int is not in vector
*/
bool isIn(vector<int> &v, int &i)
bool isIn(std::vector<int> &v, int &i)
{
for(auto e: v)
{
Expand Down Expand Up @@ -772,29 +772,29 @@ bool isJunction(roadNetwork data, int roadID)



void throwWarning(string msg, string origin, bool mute = false)
void throwWarning(std::string msg, std::string origin, bool mute = false)
{
setting.warnings ++;
if(!setting.silentMode && !mute)
cout <<"WARNING: " << msg << "\n\tin " << origin << endl;
cerr << "WARNING: " << msg << "\n\tin " << origin << endl;
std::cout <<"WARNING: " << msg << "\n\tin " << origin << std::endl;
std::cerr << "WARNING: " << msg << "\n\tin " << origin << std::endl;
}
void throwWarning(string msg, bool mute = false)
void throwWarning(std::string msg, bool mute = false)
{
setting.warnings ++;
if(!setting.silentMode && !mute)
cout << "WARNING: " <<msg << endl;
cerr << "WARNING: "<< msg << endl;
std::cout << "WARNING: " <<msg << std::endl;
std::cerr << "WARNING: "<< msg << std::endl;
}
void throwError(string msg, string origin)
void throwError(std::string msg, std::string origin)
{
if(!setting.silentMode)
cout << "ERR: " << msg << "\n\tin " << origin << endl;
cerr << "ERR: " << msg << "\n\tin " << origin << endl;
std::cout << "ERR: " << msg << "\n\tin " << origin << std::endl;
std::cerr << "ERR: " << msg << "\n\tin " << origin << std::endl;
}
void throwError(string msg)
void throwError(std::string msg)
{
if(!setting.silentMode)
cout << "ERR: "<< msg << endl;
cerr << "ERR: "<< msg << endl;
std::cout << "ERR: "<< msg << std::endl;
std::cerr << "ERR: "<< msg << std::endl;
}
66 changes: 33 additions & 33 deletions src/utils/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ struct connection
int fromLane = -1;
int toLane = -1;

string to_string()
std::string to_string()
{
string res =
std::string res =
"connection: " + std::to_string(id) + "\n"
"from: " + std::to_string(from) + "\n"
"to: " + std::to_string(to) + "\n"
Expand All @@ -76,11 +76,11 @@ struct connection
struct junction
{
int id = -1;
vector<connection> connections;
std::vector<connection> connections;

string to_string()
std::string to_string()
{
string res =
std::string res =
"junction " + std::to_string(id) + "\n";
for(connection c: connections)
{
Expand All @@ -98,9 +98,9 @@ struct junction
struct roadmark
{
double s = 0;
string type = "solid";
string weight = "standard";
string color = "white";
std::string type = "solid";
std::string weight = "standard";
std::string color = "white";
double width = 0.15;
};

Expand Down Expand Up @@ -136,7 +136,7 @@ struct offset
struct material
{
double s = 0;
string surface = "asphalt";
std::string surface = "asphalt";
double friction = 0.8;
double roughness = 0.015;
};
Expand All @@ -148,7 +148,7 @@ struct material
struct lane
{
int id = -1;
string type = "driving";
std::string type = "driving";
bool turnLeft = false; // determine if lane is special left turn lane
bool turnStraight = true; // determine if lane is normal lane
bool turnRight = false; // determine if lane is special right turn lane
Expand All @@ -170,7 +170,7 @@ struct laneSection
{
int id = -1;
double s = 0;
vector<lane> lanes;
std::vector<lane> lanes;
offset o;
};

Expand Down Expand Up @@ -209,12 +209,12 @@ struct link
struct object
{
int id = -1;
string type = ""; // special OpenDRIVE code to define type
std::string type = ""; // special OpenDRIVE code to define type
double s = 0;
double t = 0;
double z = 0;
double hdg = 0;
string orientation = "none";
std::string orientation = "none";
double length = 0;
double width = 0;
double height = 0;
Expand All @@ -232,18 +232,18 @@ struct object
struct sign
{
int id = -1;
string type = ""; // special OpenDRIVE code to define type
string subtype = "-1";
std::string type = ""; // special OpenDRIVE code to define type
std::string subtype = "-1";
int rule = -1;
double value = -1;
double s = 0;
double t = 0;
double z = 0;
string orientation = "none";
std::string orientation = "none";
double width = 0.4;
double height = 2;
bool dynamic = false;
string country = "OpenDRIVE";
std::string country = "OpenDRIVE";
};

/**
Expand All @@ -253,7 +253,7 @@ struct sign
struct control
{
int id = -1;
vector<sign> signs;
std::vector<sign> signs;
};

/**
Expand All @@ -273,17 +273,17 @@ struct road
int junction = -1;

//inputid has to be set to another value for roundabout roads so that ids dont clash in the linking segment
string inputPos = ""; // specifying part of original road from input file
string type = "town";
string classification = ""; // either 'main' or 'access'
std::string inputPos = ""; // specifying part of original road from input file
std::string type = "town";
std::string classification = ""; // either 'main' or 'access'

link predecessor;
link successor;

vector<geometry> geometries;
vector<laneSection> laneSections;
vector<object> objects;
vector<sign> signs;
std::vector<geometry> geometries;
std::vector<laneSection> laneSections;
std::vector<object> objects;
std::vector<sign> signs;

/**
* @brief Helper function to get the adjacent road with desired id
Expand All @@ -304,9 +304,9 @@ struct junctionGroup
{

int id;
string name;
std::string name;
std::vector<int> juncIds;
junctionGroupType type = roundaboutType;
vector<int> juncIds;

junctionGroup()
{
Expand All @@ -332,13 +332,13 @@ struct roadNetwork
{
}

string file;
string outputFile;
std::string file;
std::string outputFile;
// main data properties
vector<road> roads;
vector<junction> junctions;
vector<control> controller;
vector<junctionGroup> juncGroups;
std::vector<road> roads;
std::vector<junction> junctions;
std::vector<control> controller;
std::vector<junctionGroup> juncGroups;

// global counters
int nSignal = 0;
Expand Down
Loading

0 comments on commit aa9420f

Please sign in to comment.