diff --git a/src/core/include/iDynTree/Core/EigenHelpers.h b/src/core/include/iDynTree/Core/EigenHelpers.h index 6eb9d4217b6..ea298b31812 100644 --- a/src/core/include/iDynTree/Core/EigenHelpers.h +++ b/src/core/include/iDynTree/Core/EigenHelpers.h @@ -63,6 +63,7 @@ inline Eigen::Map toEigen(const VectorDynSize & vec) return Eigen::Map(vec.data(),vec.size()); } +#if SWIG_VERSION >= 0x030000 inline Eigen::Map toEigen(Span vec) { return Eigen::Map(vec.data(),vec.size()); @@ -72,6 +73,7 @@ inline Eigen::Map toEigen(iDynTree::Span vec) { return Eigen::Map(vec.data(),vec.size()); } +#endif inline Eigen::Map > toEigen(const MatrixDynSize & mat) { diff --git a/src/core/include/iDynTree/Core/VectorDynSize.h b/src/core/include/iDynTree/Core/VectorDynSize.h index 09d71166c51..bdbe05aa4d9 100644 --- a/src/core/include/iDynTree/Core/VectorDynSize.h +++ b/src/core/include/iDynTree/Core/VectorDynSize.h @@ -11,10 +11,11 @@ #ifndef IDYNTREE_DYNAMIC_SIZE_VECTOR_H #define IDYNTREE_DYNAMIC_SIZE_VECTOR_H - +#if SWIG_VERSION >= 0x030000 +#include +#endif #include -#include namespace iDynTree { @@ -97,6 +98,7 @@ namespace iDynTree */ VectorDynSize & operator=(const VectorDynSize& vec); +#if SWIG_VERSION >= 0x030000 /** * Copy assignment operator. * @@ -107,7 +109,7 @@ namespace iDynTree * \warning performs dynamic memory allocation operations */ VectorDynSize & operator=(const Span& vec); - +#endif /** * @name Vector interface methods. * Methods exposing a vector-like interface to PositionRaw. @@ -187,6 +189,7 @@ namespace iDynTree */ void fillBuffer(double * buf) const; +#if SWIG_VERSION >= 0x030000 /** Typedefs to enable make_span. */ ///@{ @@ -198,6 +201,7 @@ namespace iDynTree typedef typename std::allocator_traits>::const_pointer const_pointer; ///@} +#endif /** @name Output helpers. * Output helpers. diff --git a/src/core/include/iDynTree/Core/VectorFixSize.h b/src/core/include/iDynTree/Core/VectorFixSize.h index 9357df979aa..9213e879ac6 100644 --- a/src/core/include/iDynTree/Core/VectorFixSize.h +++ b/src/core/include/iDynTree/Core/VectorFixSize.h @@ -12,7 +12,9 @@ #define IDYNTREE_VECTOR_FIX_SIZE_H #include +#if SWIG_VERSION >= 0x030000 #include +#endif #include #include #include @@ -69,6 +71,7 @@ namespace iDynTree ///@} +#if SWIG_VERSION >= 0x030000 /** * Copy assignment operator for spans. * @@ -76,6 +79,7 @@ namespace iDynTree * */ VectorFixSize & operator=(const Span& vec); +#endif /** * Raw data accessor @@ -120,6 +124,7 @@ namespace iDynTree std::string reservedToString() const; ///@} +#if SWIG_VERSION >= 0x030000 /** Typedefs to enable make_span. */ ///@{ @@ -131,6 +136,7 @@ namespace iDynTree typedef typename std::allocator_traits>::const_pointer const_pointer; ///@} +#endif }; @@ -185,12 +191,14 @@ namespace iDynTree return VecSize; } +#if SWIG_VERSION >= 0x030000 template VectorFixSize & VectorFixSize::operator=(const Span& vec) { assert(VecSize == vec.size()); std::memcpy(this->m_data, vec.data(), VecSize*sizeof(double)); return *this; } +#endif template double VectorFixSize::operator()(const unsigned int index) const diff --git a/src/core/src/VectorDynSize.cpp b/src/core/src/VectorDynSize.cpp index 225ed074e50..9ff70ae189b 100644 --- a/src/core/src/VectorDynSize.cpp +++ b/src/core/src/VectorDynSize.cpp @@ -95,6 +95,7 @@ VectorDynSize& VectorDynSize::operator=(const VectorDynSize& vec) return *this; } +#if SWIG_VERSION >= 0x030000 VectorDynSize &VectorDynSize::operator=(const Span &vec) { // if the size don't match, reallocate the data @@ -114,7 +115,7 @@ VectorDynSize &VectorDynSize::operator=(const Span &vec) return *this; } - +#endif void VectorDynSize::zero() { @@ -267,8 +268,4 @@ std::string VectorDynSize::reservedToString() const return this->toString(); } - - - - }