Skip to content

Conversation

@Grufoony
Copy link
Collaborator

No description provided.

@Grufoony Grufoony requested a review from sbaldu November 14, 2024 09:40
std::string line;
std::getline(ifs, line);
assert((void("Invalid file format."), line == "nodeId;lat;lon"));
double dLat, dLon;

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note

MISRA 12.3 rule
continue;
}
std::istringstream iss{line};
std::string nodeId, lat, lon;

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note

MISRA 12.3 rule
std::getline(iss, nodeId, ';');
std::getline(iss, lat, ';');
std::getline(iss, lon, '\n');
dLat = lat == "Nan" ? 0. : std::stod(lat);

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.1 rule Note

MISRA 12.1 rule
std::getline(iss, lat, ';');
std::getline(iss, lon, '\n');
dLat = lat == "Nan" ? 0. : std::stod(lat);
dLon = lon == "Nan" ? 0. : std::stod(lon);

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.1 rule Note

MISRA 12.1 rule
std::getline(iss, lon, '\n');
dLat = lat == "Nan" ? 0. : std::stod(lat);
dLon = lon == "Nan" ? 0. : std::stod(lon);
if (m_nodes.contains(std::stoul(nodeId))) {

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 14.4 rule Note

MISRA 14.4 rule
std::ofstream file{path};
// Column names
file << "nodeId;lat;lon\n";
for (const auto& [id, node] : m_nodes) {

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note

MISRA 12.3 rule
file << "nodeId;lat;lon\n";
for (const auto& [id, node] : m_nodes) {
file << id << ';';
if (node->coords().has_value()) {

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 14.4 rule Note

MISRA 14.4 rule
} else {
file << "Nan;Nan";
}
file << '\n';

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 10.1 rule Note

MISRA 10.1 rule
void exportMatrix(std::string path = "./matrix.dsm", bool isAdj = true);
/// @brief Export the nodes' coordinates to a file
/// @param path The path to the file to export the nodes' coordinates to (default: ./nodes.dsm)
void exportCoordinates(std::string const& path = "./coordinates.csv");

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 17.8 rule Note

MISRA 17.8 rule
void exportMatrix(std::string path = "./matrix.dsm", bool isAdj = true);
/// @brief Export the nodes' coordinates to a file
/// @param path The path to the file to export the nodes' coordinates to (default: ./nodes.dsm)
void exportCoordinates(std::string const& path = "./coordinates.csv");

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 13.4 rule Note

MISRA 13.4 rule
@Grufoony Grufoony merged commit 303f541 into main Nov 14, 2024
24 checks passed
@Grufoony Grufoony deleted the feature_addCoordinatesExport branch November 14, 2024 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants