Skip to content
Snippets Groups Projects
Commit 3b2307c2 authored by Nicolas Mansard's avatar Nicolas Mansard Committed by Nicolas Mansard
Browse files

[C++] Introduce API for Data check.

parent cc01159a
No related branches found
No related tags found
No related merge requests found
...@@ -191,6 +191,7 @@ SET(${PROJECT_NAME}_ALGORITHM_HEADERS ...@@ -191,6 +191,7 @@ SET(${PROJECT_NAME}_ALGORITHM_HEADERS
algorithm/frames.hpp algorithm/frames.hpp
algorithm/compute-all-terms.hpp algorithm/compute-all-terms.hpp
algorithm/copy.hpp algorithm/copy.hpp
algorithm/check.hpp
) )
SET(${PROJECT_NAME}_PARSERS_HEADERS SET(${PROJECT_NAME}_PARSERS_HEADERS
......
...@@ -350,6 +350,9 @@ namespace se3 ...@@ -350,6 +350,9 @@ namespace se3
void addJointIndexToParentSubtrees(const JointIndex joint_id); void addJointIndexToParentSubtrees(const JointIndex joint_id);
}; };
// Forward declaration needed for Data::check
template<class D> struct AlgorithmCheckerBase;
struct Data struct Data
{ {
EIGEN_MAKE_ALIGNED_OPERATOR_NEW EIGEN_MAKE_ALIGNED_OPERATOR_NEW
...@@ -505,6 +508,24 @@ namespace se3 ...@@ -505,6 +508,24 @@ namespace se3
/// ///
Data (const Model & model); Data (const Model & model);
/// Check the validity of the Data attributes with respect to the specification of some
/// algorithms.
///
/// The method is a template so that the checkers can be defined in each algorithms.
/// \param[in] checker a class, typically defined in the algorithm module, that
/// validates the attributes of data.
/// \return true if the Data are valid, false otherwise.
template<typename D>
inline bool check(const AlgorithmCheckerBase<D> & checker) { return checker.checkData(*this); }
/// Multiple check for a fusion::vector of AlgorithmCheckerBase.
///
/// Run the check test for several conditons.
/// \param[in] v fusion::vector of algo checkers. The param is typically initialize with
/// boost::fusion::make_vector( AlgoChecker1(), AlgoChecker2(), ...)
template<typename FusionVectorCheckers>
bool checkAll(const FusionVectorCheckers & v);
private: private:
void computeLastChild(const Model& model); void computeLastChild(const Model& model);
void computeParents_fromRow(const Model& model); void computeParents_fromRow(const Model& model);
......
...@@ -114,3 +114,4 @@ ADD_UNIT_TEST(joint eigen3) ...@@ -114,3 +114,4 @@ ADD_UNIT_TEST(joint eigen3)
ADD_UNIT_TEST(explog eigen3) ADD_UNIT_TEST(explog eigen3)
ADD_UNIT_TEST(finite-differences eigen3) ADD_UNIT_TEST(finite-differences eigen3)
ADD_UNIT_TEST(visitor eigen3) ADD_UNIT_TEST(visitor eigen3)
ADD_UNIT_TEST(algo-check eigen3)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment