From e829fc43b429794f6943921ab94cdbc155a9a0f3 Mon Sep 17 00:00:00 2001 From: Jeremy Nimmer Date: Mon, 6 Jan 2025 13:23:43 -0800 Subject: [PATCH] fixup! Signed-off-by: Jeremy Nimmer --- include/gz/math/PiecewiseScalarField3.hh | 12 ++++---- include/gz/math/graph/Graph.hh | 12 ++++---- include/gz/math/graph/GraphAlgorithms.hh | 12 ++++---- src/Kmeans.cc | 12 ++++---- src/SignalStats.cc | 12 ++++---- src/SphericalCoordinates.cc | 36 ++++++++++++------------ 6 files changed, 48 insertions(+), 48 deletions(-) diff --git a/include/gz/math/PiecewiseScalarField3.hh b/include/gz/math/PiecewiseScalarField3.hh index 8bed5d3b..2bfe5b91 100644 --- a/include/gz/math/PiecewiseScalarField3.hh +++ b/include/gz/math/PiecewiseScalarField3.hh @@ -78,23 +78,23 @@ namespace gz::math { if (pieces[i].region.Empty()) { - std::ostringstream error_str; - error_str << "Region #" << i << " (" << pieces[i].region + std::ostringstream errStream; + errStream << "Region #" << i << " (" << pieces[i].region << ") in piecewise scalar field definition is empty."; - detail::LogErrorMessage(error_str.str()); + detail::LogErrorMessage(errStream.str()); } for (size_t j = i + 1; j < pieces.size(); ++j) { if (pieces[i].region.Intersects(pieces[j].region)) { - std::ostringstream error_str; - error_str << "Detected overlap between regions in " + std::ostringstream errStream; + errStream << "Detected overlap between regions in " << "piecewise scalar field definition: " << "region #" << i << " (" << pieces[i].region << ") overlaps with region #" << j << " (" << pieces[j].region << "). Region #" << i << " will take precedence when overlapping."; - detail::LogErrorMessage(error_str.str()); + detail::LogErrorMessage(errStream.str()); } } } diff --git a/include/gz/math/graph/Graph.hh b/include/gz/math/graph/Graph.hh index 149df818..3547498d 100644 --- a/include/gz/math/graph/Graph.hh +++ b/include/gz/math/graph/Graph.hh @@ -115,9 +115,9 @@ namespace graph { if (!this->AddVertex(v.Name(), v.Data(), v.Id()).Valid()) { - std::ostringstream error_str; - error_str << "Invalid vertex with Id [" << v.Id() << "]. Ignoring."; - detail::LogErrorMessage(error_str.str()); + std::ostringstream errStream; + errStream << "Invalid vertex with Id [" << v.Id() << "]. Ignoring."; + detail::LogErrorMessage(errStream.str()); } } @@ -163,9 +163,9 @@ namespace graph // The Id already exists. if (!ret.second) { - std::ostringstream error_str; - error_str << "[Graph::AddVertex()] Repeated vertex [" << id << "]"; - detail::LogErrorMessage(error_str.str()); + std::ostringstream errStream; + errStream << "[Graph::AddVertex()] Repeated vertex [" << id << "]"; + detail::LogErrorMessage(errStream.str()); return NullVertex(); } diff --git a/include/gz/math/graph/GraphAlgorithms.hh b/include/gz/math/graph/GraphAlgorithms.hh index 27fa6a3a..72923a09 100644 --- a/include/gz/math/graph/GraphAlgorithms.hh +++ b/include/gz/math/graph/GraphAlgorithms.hh @@ -218,9 +218,9 @@ namespace graph // Sanity check: The source vertex should exist. if (allVertices.find(_from) == allVertices.end()) { - std::ostringstream error_str; - error_str << "Vertex [" << _from << "] Not found"; - detail::LogErrorMessage(error_str.str()); + std::ostringstream errStream; + errStream << "Vertex [" << _from << "] Not found"; + detail::LogErrorMessage(errStream.str()); return {}; } @@ -228,9 +228,9 @@ namespace graph if (_to != kNullId && allVertices.find(_to) == allVertices.end()) { - std::ostringstream error_str; - error_str << "Vertex [" << _from << "] Not found"; - detail::LogErrorMessage(error_str.str()); + std::ostringstream errStream; + errStream << "Vertex [" << _from << "] Not found"; + detail::LogErrorMessage(errStream.str()); return {}; } diff --git a/src/Kmeans.cc b/src/Kmeans.cc index feac085a..c6643f94 100644 --- a/src/Kmeans.cc +++ b/src/Kmeans.cc @@ -79,20 +79,20 @@ bool Kmeans::Cluster(int _k, if (_k <= 0) { - std::ostringstream error_str; - error_str << "Kmeans error: The number of clusters has to" + std::ostringstream errStream; + errStream << "Kmeans error: The number of clusters has to" << " be positive but its value is [" << _k << "]"; - detail::LogErrorMessage(error_str.str()); + detail::LogErrorMessage(errStream.str()); return false; } if (_k > static_cast(this->dataPtr->obs.size())) { - std::ostringstream error_str; - error_str << "Kmeans error: The number of clusters [" << _k << "] has to be" + std::ostringstream errStream; + errStream << "Kmeans error: The number of clusters [" << _k << "] has to be" << " lower or equal to the number of observations [" << this->dataPtr->obs.size() << "]"; - detail::LogErrorMessage(error_str.str()); + detail::LogErrorMessage(errStream.str()); return false; } diff --git a/src/SignalStats.cc b/src/SignalStats.cc index b4dae789..0605b6d2 100644 --- a/src/SignalStats.cc +++ b/src/SignalStats.cc @@ -264,11 +264,11 @@ bool SignalStats::InsertStatistic(const std::string &_name) auto map = this->Map(); if (map.find(_name) != map.end()) { - std::ostringstream error_str; - error_str << "Unable to InsertStatistic [" + std::ostringstream errStream; + errStream << "Unable to InsertStatistic [" << _name << "] since it has already been inserted."; - detail::LogErrorMessage(error_str.str()); + detail::LogErrorMessage(errStream.str()); return false; } } @@ -301,11 +301,11 @@ bool SignalStats::InsertStatistic(const std::string &_name) else { // Unrecognized name string - std::ostringstream error_str; - error_str << "Unable to InsertStatistic [" + std::ostringstream errStream; + errStream << "Unable to InsertStatistic [" << _name << "] since it is an unrecognized name."; - detail::LogErrorMessage(error_str.str()); + detail::LogErrorMessage(errStream.str()); return false; } this->dataPtr->stats.push_back(stat); diff --git a/src/SphericalCoordinates.cc b/src/SphericalCoordinates.cc index 64261b64..80460bf4 100644 --- a/src/SphericalCoordinates.cc +++ b/src/SphericalCoordinates.cc @@ -291,9 +291,9 @@ void SphericalCoordinates::SetSurface(const SurfaceType &_type) } default: { - std::ostringstream error_str; - error_str << "Unknown surface type[" << this->dataPtr->surfaceType << "]"; - detail::LogErrorMessage(error_str.str()); + std::ostringstream errStream; + errStream << "Unknown surface type[" << this->dataPtr->surfaceType << "]"; + detail::LogErrorMessage(errStream.str()); break; } } @@ -309,9 +309,9 @@ void SphericalCoordinates::SetSurface( (_type != MOON_SCS) && (_type != CUSTOM_SURFACE)) { - std::ostringstream error_str; - error_str << "Unknown surface type[" << _type << "]"; - detail::LogErrorMessage(error_str.str()); + std::ostringstream errStream; + errStream << "Unknown surface type[" << _type << "]"; + detail::LogErrorMessage(errStream.str()); return; } @@ -647,9 +647,9 @@ std::optional PositionTransformTmp( break; default: { - std::ostringstream error_str; - error_str << "Invalid coordinate type[" << _in << "]"; - detail::LogErrorMessage(error_str.str()); + std::ostringstream errStream; + errStream << "Invalid coordinate type[" << _in << "]"; + detail::LogErrorMessage(errStream.str()); return std::nullopt; } } @@ -711,9 +711,9 @@ std::optional PositionTransformTmp( default: { - std::ostringstream error_str; - error_str << "Unknown coordinate type[" << _out << "]"; - detail::LogErrorMessage(error_str.str()); + std::ostringstream errStream; + errStream << "Unknown coordinate type[" << _out << "]"; + detail::LogErrorMessage(errStream.str()); return std::nullopt; } } @@ -820,9 +820,9 @@ std::optional VelocityTransformTmp( break; default: { - std::ostringstream error_str; - error_str << "Unknown coordinate type[" << _in << "]"; - detail::LogErrorMessage(error_str.str()); + std::ostringstream errStream; + errStream << "Unknown coordinate type[" << _in << "]"; + detail::LogErrorMessage(errStream.str()); return std::nullopt; } } @@ -857,9 +857,9 @@ std::optional VelocityTransformTmp( default: { - std::ostringstream error_str; - error_str << "Unknown coordinate type[" << _out << "]"; - detail::LogErrorMessage(error_str.str()); + std::ostringstream errStream; + errStream << "Unknown coordinate type[" << _out << "]"; + detail::LogErrorMessage(errStream.str()); return std::nullopt; } }