Skip to content
Snippets Groups Projects
graph-path-validation.hh 3.05 KiB
Newer Older
// Copyright (c) 2014, LAAS-CNRS
// Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
//
// This file is part of hpp-manipulation.
// hpp-manipulation is free software: you can redistribute it
// and/or modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation, either version
// 3 of the License, or (at your option) any later version.
//
// hpp-manipulation is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// General Lesser Public License for more details.  You should have
// received a copy of the GNU Lesser General Public License along with
// hpp-manipulation. If not, see <http://www.gnu.org/licenses/>.


#ifndef HPP_MANIPULATION_GRAPHPATHVALIDATOR_HH
# define HPP_MANIPULATION_GRAPHPATHVALIDATOR_HH

# include <hpp/core/path.hh>
# include <hpp/core/path-vector.hh>
# include <hpp/core/path-validation.hh>

# include "hpp/manipulation/fwd.hh"
# include "hpp/manipulation/graph/graph.hh"
# include "hpp/manipulation/graph/node.hh"

namespace hpp {
  namespace manipulation {
    using hpp::core::PathValidation;
    using hpp::core::PathValidationPtr_t;
    using hpp::core::Path;
    using hpp::core::PathPtr_t;
    using hpp::core::PathVector;
    using hpp::core::PathVectorPtr_t;
    using graph::GraphPtr_t;

    /// Path validation for a constraint graph
    ///
    /// This class encapsulates another path validation class.
    /// The encapsulated path validation is responsible for collision
    /// checking, whereas this class checks if a path is valid regarding
    /// the constraint graph.
    class HPP_MANIPULATION_DLLAPI GraphPathValidation : public PathValidation
    {
      public:
        /// Check that the path is valid regarding the constraint graph and call
        /// the encapsulated PathValidation::validate.
        bool validate (const PathPtr_t& path, bool reverse, PathPtr_t& validPart);

        /// Create a new instance of this class.
        /// \param pathValidation a PathValidation that is responsible for collision
        //         checking.
        //  \param graph A pointer to the constraint graph.
        static GraphPathValidationPtr_t create (const PathValidationPtr_t& pathValidation, const GraphPtr_t& graph);

      protected:
        /// Constructor
        GraphPathValidation (const PathValidationPtr_t& pathValidation, const GraphPtr_t& graph);

      private:
        /// Do validation regarding the constraint graph for PathVector
        bool impl_validate (const PathVectorPtr_t& path, bool reverse, PathPtr_t& validPart);
        /// Do validation regarding the constraint graph for Path 
        bool impl_validate (const PathPtr_t& path, bool reverse, PathPtr_t& validPart);
        /// The encapsulated PathValidation.
        PathValidationPtr_t pathValidation_;
        /// Pointer to the constraint graph.
        GraphPtr_t constraintGraph_;
    };
  } // namespace manipulation
} // namespace hpp

#endif // HPP_MANIPULATION_GRAPHPATHVALIDATOR_HH