Skip to content

Commit

Permalink
refactoring refs #12
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed Feb 28, 2024
1 parent 3e6c659 commit 1a77c40
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/utils/common/SUMOVehicleClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ StringBijection<SUMOVehicleShape> SumoVehicleShapeStrings(
static std::map<int, std::vector<std::string> > vehicleClassNamesListCached;
static std::map<std::string, SVCPermissions> parseVehicleClassesCached;
static std::map<SVCPermissions, std::string> getVehicleClassNamesCached;
static std::string vehicleClassNameAll = "all";
static std::string VehicleClassNameAll = "all";

// ===========================================================================
// additional constants
Expand Down Expand Up @@ -277,7 +277,7 @@ StopOffset::operator!=(StopOffset const& other) const {
const std::string&
getVehicleClassNames(SVCPermissions permissions, bool expand) {
if ((permissions & SVCAll) == SVCAll && !expand) {
return vehicleClassNameAll;
return VehicleClassNameAll;
}
// check if previously was cached
if (getVehicleClassNamesCached.count(permissions) == 0) {
Expand Down Expand Up @@ -330,7 +330,7 @@ getVehicleClassCompoundID(const std::string& name) {

SVCPermissions
parseVehicleClasses(const std::string& allowedS) {
if (allowedS == "all") {
if (allowedS == VehicleClassNameAll) {
return SVCAll;
}
// check if allowedS was previously cached
Expand Down Expand Up @@ -359,7 +359,7 @@ parseVehicleClasses(const std::string& allowedS) {

bool
canParseVehicleClasses(const std::string& classes) {
if (classes == "all") {
if (classes == VehicleClassNameAll) {
return true;
}
// check if was previously cached
Expand Down Expand Up @@ -400,7 +400,7 @@ invertPermissions(SVCPermissions permissions) {
SVCPermissions
parseVehicleClasses(const std::vector<std::string>& allowedS) {
SVCPermissions result = 0;
if (std::find(allowedS.begin(), allowedS.end(), "all") != allowedS.end()) {
if (std::find(allowedS.begin(), allowedS.end(), VehicleClassNameAll) != allowedS.end()) {
return SVCAll;
}
for (std::vector<std::string>::const_iterator i = allowedS.begin(); i != allowedS.end(); ++i) {
Expand All @@ -420,7 +420,7 @@ writePermissions(OutputDevice& into, SVCPermissions permissions) {
if (permissions == SVCAll) {
return;
} else if (permissions == 0) {
into.writeAttr(SUMO_ATTR_DISALLOW, "all");
into.writeAttr(SUMO_ATTR_DISALLOW, VehicleClassNameAll);
return;
} else {
int num_allowed = 0;
Expand Down

0 comments on commit 1a77c40

Please sign in to comment.