diff --git a/Migration.md b/Migration.md index 8bd35f88..e5444ebd 100644 --- a/Migration.md +++ b/Migration.md @@ -5,20 +5,6 @@ Deprecated code produces compile-time warnings. These warning serve as notification to users that their code should be upgraded. The next major release will remove the deprecated code. -## Gazebo Math 8.X to 9.X - -### Deprecations - -1. **graph/Vertex.hh** - + The `Vertex::NullVertex` static member is deprecated. Please use - `Vertex::NullVertex()` instead. - E.g.: https://github.com/gazebosim/gz-math/pull/606/files#diff-0c0220a7e72be70337975433eeddc3f5e072ade5cd80dfb1ac03da233c39c983L153-R153 - -1. **graph/Edge.hh** - + The `Edge::NullEdge` static member is deprecated. Please use - `Vertex::NullEdge()` instead. - E.g.: https://github.com/gazebosim/gz-math/pull/606/files#diff-0c0220a7e72be70337975433eeddc3f5e072ade5cd80dfb1ac03da233c39c983L222-R222 - ## Gazebo Math 7.X to 8.X ### Breaking Changes diff --git a/include/gz/math/graph/Edge.hh b/include/gz/math/graph/Edge.hh index 61e4e1be..92f4b937 100644 --- a/include/gz/math/graph/Edge.hh +++ b/include/gz/math/graph/Edge.hh @@ -21,7 +21,6 @@ #include #include #include -#include #include #include @@ -206,8 +205,7 @@ namespace graph class UndirectedEdge : public Edge { /// \brief An invalid undirected edge. - // Deprecated in favor of NullEdge(). - public: static UndirectedEdge GZ_DEPRECATED(8) NullEdge; + public: static UndirectedEdge NullEdge; /// \brief Constructor. /// \param[in] _vertices The vertices of the edge. @@ -259,7 +257,6 @@ namespace graph }; /// \brief An invalid undirected edge. - // Deprecated in favor of NullEdge(). template UndirectedEdge UndirectedEdge::NullEdge( VertexId_P(kNullId, kNullId), E(), 1.0, kNullId); @@ -271,8 +268,7 @@ namespace graph class DirectedEdge : public Edge { /// \brief An invalid directed edge. - // Deprecated in favor of NullEdge(). - public: static DirectedEdge GZ_DEPRECATED(8) NullEdge; + public: static DirectedEdge NullEdge; /// \brief Constructor. /// \param[in] _vertices The vertices of the edge. @@ -336,19 +332,9 @@ namespace graph }; /// \brief An invalid directed edge. - // Deprecated in favor of NullEdge(). template DirectedEdge DirectedEdge::NullEdge( VertexId_P(kNullId, kNullId), E(), 1.0, kNullId); - - /// \brief An invalid edge. - template - EdgeType &NullEdge() - { - static auto e = std::make_unique( - VertexId_P(kNullId, kNullId), E(), 1.0, kNullId); - return *e; - } } } } diff --git a/include/gz/math/graph/Graph.hh b/include/gz/math/graph/Graph.hh index ec61cb07..0b48ea2d 100644 --- a/include/gz/math/graph/Graph.hh +++ b/include/gz/math/graph/Graph.hh @@ -150,7 +150,7 @@ namespace graph { std::cerr << "[Graph::AddVertex()] The limit of vertices has been " << "reached. Ignoring vertex." << std::endl; - return NullVertex(); + return Vertex::NullVertex; } } @@ -163,7 +163,7 @@ namespace graph { std::cerr << "[Graph::AddVertex()] Repeated vertex [" << id << "]" << std::endl; - return NullVertex(); + return Vertex::NullVertex; } // Link the vertex with an empty list of edges. @@ -219,7 +219,7 @@ namespace graph { std::cerr << "[Graph::AddEdge()] The limit of edges has been reached. " << "Ignoring edge." << std::endl; - return NullEdge(); + return EdgeType::NullEdge; } EdgeType newEdge(_vertices, _data, _weight, id); @@ -240,7 +240,7 @@ namespace graph for (auto const &v : {edgeVertices.first, edgeVertices.second}) { if (this->vertices.find(v) == this->vertices.end()) - return NullEdge(); + return EdgeType::NullEdge; } // Link the new edge. @@ -611,7 +611,7 @@ namespace graph { auto iter = this->vertices.find(_id); if (iter == this->vertices.end()) - return NullVertex(); + return Vertex::NullVertex; return iter->second; } @@ -624,7 +624,7 @@ namespace graph { auto iter = this->vertices.find(_id); if (iter == this->vertices.end()) - return NullVertex(); + return Vertex::NullVertex; return iter->second; } @@ -646,7 +646,7 @@ namespace graph // Quit early if there is no adjacency entry if (adjIt == this->adjList.end()) - return NullEdge(); + return EdgeType::NullEdge; // Loop over the edges in the source vertex's adjacency list for (std::set::const_iterator edgIt = adjIt->second.begin(); @@ -665,7 +665,7 @@ namespace graph } } - return NullEdge(); + return EdgeType::NullEdge; } /// \brief Get a reference to an edge using its Id. @@ -676,7 +676,7 @@ namespace graph { auto iter = this->edges.find(_id); if (iter == this->edges.end()) - return NullEdge(); + return EdgeType::NullEdge; return iter->second; } @@ -689,7 +689,7 @@ namespace graph { auto iter = this->edges.find(_id); if (iter == this->edges.end()) - return NullEdge(); + return EdgeType::NullEdge; return iter->second; } diff --git a/include/gz/math/graph/Vertex.hh b/include/gz/math/graph/Vertex.hh index db0092ed..e61fa22d 100644 --- a/include/gz/math/graph/Vertex.hh +++ b/include/gz/math/graph/Vertex.hh @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -46,7 +45,7 @@ namespace graph using VertexId_P = std::pair; /// \brief Represents an invalid Id. - constexpr VertexId kNullId = MAX_UI64; + static const VertexId kNullId = MAX_UI64; /// \brief A vertex of a graph. It stores user information, an optional name, /// and keeps an internal unique Id. This class does not enforce to choose a @@ -55,8 +54,7 @@ namespace graph class Vertex { /// \brief An invalid vertex. - // Deprecated in favor of NullVertex(). - public: static Vertex GZ_DEPRECATED(8) NullVertex; + public: static Vertex NullVertex; /// \brief Constructor. /// \param[in] _name Non-unique vertex name. @@ -138,18 +136,9 @@ namespace graph }; /// \brief An invalid vertex. - // Deprecated in favor of NullVertex(). template Vertex Vertex::NullVertex("__null__", V(), kNullId); - /// \brief An invalid vertex. - template - Vertex &NullVertex() - { - static auto v = std::make_unique>("__null__", V(), kNullId); - return *v; - } - /// \def VertexRef_M /// \brief Map of vertices. The key is the vertex Id. The value is a /// reference to the vertex.