Commits

Ioan Sucan committed f1dca8e

add macro for marking deprecated functions

  • Participants
  • Parent commits bf6e01b

Comments (0)

Files changed (3)

src/ompl/base/Planner.h

 #include "ompl/util/Console.h"
 #include "ompl/util/Time.h"
 #include "ompl/util/ClassForward.h"
+#include "ompl/util/Deprecation.h"
 #include <boost/function.hpp>
 #include <boost/concept_check.hpp>
 #include <boost/noncopyable.hpp>
                 are made. Returns true if changes were found
                 (different problem definition) and clear() was
                 called. */
-            bool use(const SpaceInformationPtr &si, const ProblemDefinitionPtr &pdef);
+            OMPL_DEPRECATED bool use(const SpaceInformationPtr &si, const ProblemDefinitionPtr &pdef);
 
             /** \brief Set the space information and problem
                 definition this class operates on, based on the
                 are made. Returns true if changes were found
                 (different problem definition) and clear() was
                 called.*/
-            bool use(const SpaceInformation *si, const ProblemDefinition *pdef);
+            OMPL_DEPRECATED bool use(const SpaceInformation *si, const ProblemDefinition *pdef);
+
+            /** \brief Set the problem definition this class operates on.
+                If a planner is not set in the constructor argument, a call
+                to this function is needed before any calls to nextStart()
+                or nextGoal() are made. Returns true if changes were found
+                (different problem definition) and clear() was called. */
+            bool use(const ProblemDefinitionPtr &pdef);
+
+            /** \brief Set the problem definition this class operates on.
+                If a planner is not set in the constructor argument, a call
+                to this function is needed before any calls to nextStart()
+                or nextGoal() are made. Returns true if changes were found
+                (different problem definition) and clear() was called. */
+            bool use(const ProblemDefinition *pdef);
 
             /** \brief Check if the problem definition was set, start
                 state are available and goal was set */

src/ompl/base/src/Planner.cpp

 {
     if (!planner_)
         throw Exception("No planner set for PlannerInputStates");
-    return use(planner_->getSpaceInformation(), planner_->getProblemDefinition());
+    return use(planner_->getProblemDefinition());
 }
 
 void ompl::base::PlannerInputStates::checkValidity(void) const
     }
 }
 
-bool ompl::base::PlannerInputStates::use(const SpaceInformationPtr &si, const ProblemDefinitionPtr &pdef)
+bool ompl::base::PlannerInputStates::use(const SpaceInformationPtr &, const ProblemDefinitionPtr &pdef)
 {
-    if (si && pdef)
-        return use(si.get(), pdef.get());
+  return use(pdef);
+}
+
+bool ompl::base::PlannerInputStates::use(const ProblemDefinitionPtr &pdef)
+{
+    if (pdef)
+        return use(pdef.get());
     else
     {
         clear();
     }
 }
 
-bool ompl::base::PlannerInputStates::use(const SpaceInformation *si, const ProblemDefinition *pdef)
+bool ompl::base::PlannerInputStates::use(const SpaceInformation *, const ProblemDefinition *pdef)
 {
-    if (pdef_ != pdef || si_ != si)
+    return use(pdef);
+}
+
+bool ompl::base::PlannerInputStates::use(const ProblemDefinition *pdef)
+{
+    if (pdef_ != pdef)
     {
         clear();
         pdef_ = pdef;
-        si_ = si;
+        si_ = pdef->getSpaceInformation().get();
         return true;
     }
     return false;

src/ompl/util/Deprecation.h

+/*********************************************************************
+* Software License Agreement (BSD License)
+*
+*  Copyright (c) 2010, Rice University
+*  All rights reserved.
+*
+*  Redistribution and use in source and binary forms, with or without
+*  modification, are permitted provided that the following conditions
+*  are met:
+*
+*   * Redistributions of source code must retain the above copyright
+*     notice, this list of conditions and the following disclaimer.
+*   * Redistributions in binary form must reproduce the above
+*     copyright notice, this list of conditions and the following
+*     disclaimer in the documentation and/or other materials provided
+*     with the distribution.
+*   * Neither the name of the Rice University nor the names of its
+*     contributors may be used to endorse or promote products derived
+*     from this software without specific prior written permission.
+*
+*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+*  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+*  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+*  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+*  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+*  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+*  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+*  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+*  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+*  POSSIBILITY OF SUCH DAMAGE.
+*********************************************************************/
+
+#ifndef OMPL_UTIL_DEPRECATION_
+#define OMPL_UTIL_DEPRECATION_
+
+/** \def OMPL_DEPRECATED
+    Macro that marks functions as deprecated */
+
+#ifdef __GNUC__
+#define OMPL_DEPRECATED __attribute__((deprecated))
+#elif defined(_MSC_VER)
+#define OMPL_DEPRECATED __declspec(deprecated)
+#elif defined(__clang__)
+#define OMPL_DEPRECATED  __attribute__((deprecated("OMPL: Use of this method is deprecated")))
+#else
+#define OMPL_DEPRECATED /* Nothing */
+#endif
+
+#endif