Skip to content

Commit

Permalink
refactor(lanelet2_map_validator): move custom implementation to lanel…
Browse files Browse the repository at this point in the history
…et::autoware::validation (#152)

Signed-off-by: Mamoru Sobue <[email protected]>
  • Loading branch information
soblin authored Nov 19, 2024
1 parent aac87c4 commit 7540d85
Show file tree
Hide file tree
Showing 20 changed files with 49 additions and 121 deletions.
10 changes: 2 additions & 8 deletions map/autoware_lanelet2_map_validator/src/common/cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@

namespace po = boost::program_options;

namespace lanelet
{
namespace autoware
{
namespace validation
namespace lanelet::autoware::validation
{

MetaConfig parseCommandLine(int argc, const char * argv[])
Expand Down Expand Up @@ -102,6 +98,4 @@ MetaConfig parseCommandLine(int argc, const char * argv[])
return config;
}

} // namespace validation
} // namespace autoware
} // namespace lanelet
} // namespace lanelet::autoware::validation
10 changes: 2 additions & 8 deletions map/autoware_lanelet2_map_validator/src/common/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@

// cSpell:words indegree Indegree

namespace lanelet
{
namespace autoware
{
namespace validation
namespace lanelet::autoware::validation
{

std::unique_ptr<lanelet::Projector> getProjector(
Expand Down Expand Up @@ -416,6 +412,4 @@ void process_requirements(json json_data, const MetaConfig & validator_config)
}
}

} // namespace validation
} // namespace autoware
} // namespace lanelet
} // namespace lanelet::autoware::validation
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@
#include <iostream>
#include <string>

namespace lanelet
{
namespace autoware
{
namespace validation
namespace lanelet::autoware::validation
{
struct MetaConfig
{
Expand All @@ -38,8 +34,6 @@ struct MetaConfig

MetaConfig parseCommandLine(int argc, const char * argv[]);

} // namespace validation
} // namespace autoware
} // namespace lanelet
} // namespace lanelet::autoware::validation

#endif // LANELET2_MAP_VALIDATOR__CLI_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@
#include <string>
#include <vector>

namespace lanelet
{
namespace autoware
{
namespace validation
namespace lanelet::autoware::validation
{
template <typename T>
void appendIssues(std::vector<T> & to, std::vector<T> && from)
Expand Down Expand Up @@ -76,8 +72,6 @@ void checkPrimitivesType(
}
}

} // namespace validation
} // namespace autoware
} // namespace lanelet
} // namespace lanelet::autoware::validation

#endif // LANELET2_MAP_VALIDATOR__UTILS_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ constexpr const char * utm = "utm";
} // namespace projector_names
} // namespace

namespace lanelet
{
namespace autoware
{
namespace validation
namespace lanelet::autoware::validation
{
struct ValidatorInfo
{
Expand Down Expand Up @@ -90,8 +86,6 @@ lanelet::validation::ValidationConfig replace_validator(

void process_requirements(
json json_data, const lanelet::autoware::validation::MetaConfig & validator_config);
} // namespace validation
} // namespace autoware
} // namespace lanelet
} // namespace lanelet::autoware::validation

#endif // LANELET2_MAP_VALIDATOR__VALIDATION_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
#include <lanelet2_validation/Validation.h>
#include <lanelet2_validation/ValidatorFactory.h>

namespace lanelet
{
namespace validation
namespace lanelet::autoware::validation
{
class MissingRegulatoryElementsForCrosswalksValidator : public lanelet::validation::MapValidator
{
Expand All @@ -33,8 +31,7 @@ class MissingRegulatoryElementsForCrosswalksValidator : public lanelet::validati
lanelet::validation::Issues checkMissingRegulatoryElementsForCrosswalks(
const lanelet::LaneletMap & map);
};
} // namespace validation
} // namespace lanelet
} // namespace lanelet::autoware::validation

// clang-format off
#endif // LANELET2_MAP_VALIDATOR__VALIDATORS__CROSSWALK__MISSING_REGULATORY_ELEMENTS_FOR_CROSSWALKS_HPP_ // NOLINT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
#include <lanelet2_validation/Validation.h>
#include <lanelet2_validation/ValidatorFactory.h>

namespace lanelet
{
namespace validation
namespace lanelet::autoware::validation
{
class RegulatoryElementsDetailsForCrosswalksValidator : public lanelet::validation::MapValidator
{
Expand All @@ -33,8 +31,7 @@ class RegulatoryElementsDetailsForCrosswalksValidator : public lanelet::validati
private:
lanelet::validation::Issues checkRegulatoryElementOfCrosswalks(const lanelet::LaneletMap & map);
};
} // namespace validation
} // namespace lanelet
} // namespace lanelet::autoware::validation

// clang-format off
#endif // LANELET2_MAP_VALIDATOR__VALIDATORS__CROSSWALK__REGULATORY_ELEMENT_DETAILS_FOR_CROSSWALKS_HPP_ // NOLINT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
#include <lanelet2_validation/Validation.h>
#include <lanelet2_validation/ValidatorFactory.h>

namespace lanelet
{
namespace validation
namespace lanelet::autoware::validation
{
class MissingRegulatoryElementsForStopLinesValidator : public lanelet::validation::MapValidator
{
Expand All @@ -33,8 +31,7 @@ class MissingRegulatoryElementsForStopLinesValidator : public lanelet::validatio
lanelet::validation::Issues checkMissingRegulatoryElementsForStopLines(
const lanelet::LaneletMap & map);
};
} // namespace validation
} // namespace lanelet
} // namespace lanelet::autoware::validation

// clang-format off
#endif // LANELET2_MAP_VALIDATOR__VALIDATORS__STOP_LINE__MISSING_REGULATORY_ELEMENTS_FOR_STOP_LINES_HPP_ // NOLINT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
#include <lanelet2_validation/Validation.h>
#include <lanelet2_validation/ValidatorFactory.h>

namespace lanelet
{
namespace validation
namespace lanelet::autoware::validation
{
class MissingRegulatoryElementsForTrafficLightsValidator : public lanelet::validation::MapValidator
{
Expand All @@ -36,8 +34,7 @@ class MissingRegulatoryElementsForTrafficLightsValidator : public lanelet::valid
lanelet::validation::Issues checkMissingRegulatoryElementsForTrafficLights(
const lanelet::LaneletMap & map);
};
} // namespace validation
} // namespace lanelet
} // namespace lanelet::autoware::validation

// clang-format off
#endif // LANELET2_MAP_VALIDATOR__VALIDATORS__TRAFFIC_LIGHT__MISSING_REGULATORY_ELEMENTS_FOR_TRAFFIC_LIGHTS_HPP_ // NOLINT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@

#include <vector>

namespace lanelet
{
namespace validation
namespace lanelet::autoware::validation
{
class RegulatoryElementsDetailsForTrafficLightsValidator : public lanelet::validation::MapValidator
{
Expand All @@ -40,8 +38,7 @@ class RegulatoryElementsDetailsForTrafficLightsValidator : public lanelet::valid
lanelet::validation::Issues checkRegulatoryElementOfTrafficLights(
const lanelet::LaneletMap & map);
};
} // namespace validation
} // namespace lanelet
} // namespace lanelet::autoware::validation

// clang-format off
#endif // LANELET2_MAP_VALIDATOR__VALIDATORS__TRAFFIC_LIGHT__REGULATORY_ELEMENT_DETAILS_FOR_TRAFFIC_LIGHTS_HPP_ // NOLINT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@

#include <set>

namespace lanelet
{
namespace validation
namespace lanelet::autoware::validation
{
namespace
{
Expand Down Expand Up @@ -91,5 +89,4 @@ MissingRegulatoryElementsForCrosswalksValidator::checkMissingRegulatoryElementsF

return issues;
}
} // namespace validation
} // namespace lanelet
} // namespace lanelet::autoware::validation
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
#include <lanelet2_core/LaneletMap.h>
#include <lanelet2_validation/Validation.h>

namespace lanelet
{
namespace validation
namespace lanelet::autoware::validation
{
namespace
{
Expand Down Expand Up @@ -125,5 +123,4 @@ RegulatoryElementsDetailsForCrosswalksValidator::checkRegulatoryElementOfCrosswa
return issues;
}

} // namespace validation
} // namespace lanelet
} // namespace lanelet::autoware::validation
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
#include <algorithm>
#include <set>

namespace lanelet
{
namespace validation
namespace lanelet::autoware::validation
{
namespace
{
Expand Down Expand Up @@ -102,5 +100,4 @@ MissingRegulatoryElementsForStopLinesValidator::checkMissingRegulatoryElementsFo
return issues;
}

} // namespace validation
} // namespace lanelet
} // namespace lanelet::autoware::validation
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
#include <algorithm>
#include <set>

namespace lanelet
{
namespace validation
namespace lanelet::autoware::validation
{
namespace
{
Expand Down Expand Up @@ -92,5 +90,4 @@ MissingRegulatoryElementsForTrafficLightsValidator::checkMissingRegulatoryElemen
return issues;
}

} // namespace validation
} // namespace lanelet
} // namespace lanelet::autoware::validation
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
#include <lanelet2_core/LaneletMap.h>
#include <lanelet2_validation/Validation.h>

namespace lanelet
{
namespace validation
namespace lanelet::autoware::validation
{
namespace
{
Expand Down Expand Up @@ -111,5 +109,4 @@ RegulatoryElementsDetailsForTrafficLightsValidator::checkRegulatoryElementOfTraf
return issues;
}

} // namespace validation
} // namespace lanelet
} // namespace lanelet::autoware::validation
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@

#include "validator_template.hpp"

namespace lanelet
{
namespace validation
namespace lanelet::autoware::validation
{
namespace
{
Expand All @@ -32,5 +30,4 @@ lanelet::validation::Issues ValidatorTemplate::operator()(const lanelet::Lanelet

return issues;
}
} // namespace validation
} // namespace lanelet
} // namespace lanelet::autoware::validation
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
#include <lanelet2_validation/Validation.h>
#include <lanelet2_validation/ValidatorFactory.h>

namespace lanelet
{
namespace validation
namespace lanelet::autoware::validation
{
class ValidatorTemplate : public lanelet::validation::MapValidator
{
Expand All @@ -32,7 +30,6 @@ class ValidatorTemplate : public lanelet::validation::MapValidator

private:
};
} // namespace validation
} // namespace lanelet
} // namespace lanelet::autoware::validation

#endif // VALIDATORS__VALIDATOR_TEMPLATE_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@

using json = nlohmann::json;

namespace lanelet
{
namespace autoware
{
namespace validation
namespace lanelet::autoware::validation
{

class JsonProcessingTest : public ::testing::Test
Expand Down Expand Up @@ -156,6 +152,4 @@ TEST_F(JsonProcessingTest, SummarizeValidatorResults)
EXPECT_NE(output.find("Total of 1 errors were found"), std::string::npos);
EXPECT_EQ(output.find("warnings were found"), std::string::npos);
}
} // namespace validation
} // namespace autoware
} // namespace lanelet
} // namespace lanelet::autoware::validation
Loading

0 comments on commit 7540d85

Please sign in to comment.