diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2009-11-09 07:51:31 -0500 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2009-11-09 07:51:31 -0500 |
commit | 9a0900e33e9ca4bc174cfccc26dbf4bdc38f7627 (patch) | |
tree | 5d24519203764f0c6b6dc479946e56fd92025cb2 /Eigen/src/misc/Image.h | |
parent | e4e58e8337e82ba76f6bf4fe7000acac9337056c (diff) |
last round of changes, mainly to return derived types instead of base types, and fix various compilation issues
Diffstat (limited to 'Eigen/src/misc/Image.h')
-rw-r--r-- | Eigen/src/misc/Image.h | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/Eigen/src/misc/Image.h b/Eigen/src/misc/Image.h index 01e2b160d..9ed5d5f70 100644 --- a/Eigen/src/misc/Image.h +++ b/Eigen/src/misc/Image.h @@ -25,11 +25,11 @@ #ifndef EIGEN_MISC_IMAGE_H #define EIGEN_MISC_IMAGE_H -/** \class ei_image_return_value +/** \class ei_image_retval_base * */ template<typename DecompositionType> -struct ei_traits<ei_image_return_value<DecompositionType> > +struct ei_traits<ei_image_retval_base<DecompositionType> > { typedef typename DecompositionType::MatrixType MatrixType; typedef Matrix< @@ -43,17 +43,13 @@ struct ei_traits<ei_image_return_value<DecompositionType> > > ReturnMatrixType; }; -template<typename _DecompositionType> struct ei_image_return_value - : public ReturnByValue<ei_image_return_value<_DecompositionType> > +template<typename _DecompositionType> struct ei_image_retval_base + : public ReturnByValue<ei_image_retval_base<_DecompositionType> > { typedef _DecompositionType DecompositionType; typedef typename DecompositionType::MatrixType MatrixType; - const DecompositionType& m_dec; - int m_rank, m_cols; - const MatrixType& m_originalMatrix; - - ei_image_return_value(const DecompositionType& dec, const MatrixType& originalMatrix) + ei_image_retval_base(const DecompositionType& dec, const MatrixType& originalMatrix) : m_dec(dec), m_rank(dec.rank()), m_cols(m_rank == 0 ? 1 : m_rank), m_originalMatrix(originalMatrix) @@ -61,19 +57,32 @@ template<typename _DecompositionType> struct ei_image_return_value inline int rows() const { return m_dec.rows(); } inline int cols() const { return m_cols; } + inline int rank() const { return m_rank; } + inline const DecompositionType& dec() const { return m_dec; } + inline const MatrixType& originalMatrix() const { return m_originalMatrix; } template<typename Dest> inline void evalTo(Dest& dst) const { - static_cast<const ei_image_impl<DecompositionType>*>(this)->evalTo(dst); + static_cast<const ei_image_retval<DecompositionType>*>(this)->evalTo(dst); } + + protected: + const DecompositionType& m_dec; + int m_rank, m_cols; + const MatrixType& m_originalMatrix; }; #define EIGEN_MAKE_IMAGE_HELPERS(DecompositionType) \ typedef typename DecompositionType::MatrixType MatrixType; \ typedef typename MatrixType::Scalar Scalar; \ typedef typename MatrixType::RealScalar RealScalar; \ - inline const DecompositionType& dec() const { return this->m_dec; } \ - inline const MatrixType& originalMatrix() const { return this->m_originalMatrix; } \ - inline int rank() const { return this->m_rank; } + typedef ei_image_retval_base<DecompositionType> Base; \ + using Base::dec; \ + using Base::originalMatrix; \ + using Base::rank; \ + using Base::rows; \ + using Base::cols; \ + ei_image_retval(const DecompositionType& dec, const MatrixType& originalMatrix) \ + : Base(dec, originalMatrix) {} #endif // EIGEN_MISC_IMAGE_H |