Class documentation of Concepts

Loading...
Searching...
No Matches
subMatrixIterator.hh
Go to the documentation of this file.
1
6#ifndef submatrixiterator_hh
7#define submatrixiterator_hh
8
9#include "matrixIterator.hh"
10#include "space/spaceSet.hh"
11
12namespace concepts {
13
14 template<class F>
15 class SubMatrixN;
16
17 // *************************************************** _SubMatrix_iterator **
18
27 template <class F, class _Ref, class _Ptr>
29 public _Matrix_iterator_base<typename F::type, _Ref, _Ptr> {
30 public:
31
32 template<class F_, class _Ref_, class _Ptr_>
33 struct MatrixType;
34
35 typedef std::forward_iterator_tag iterator_category;
36 typedef typename F::type value_type;
37 typedef _Ptr pointer;
38 typedef _Ref reference;
39 typedef size_t size_type;
40 typedef ptrdiff_t difference_type;
44 typedef typename _Base::return_type return_type;
45
46 typedef
48 typedef
50
60 template<class _RefR, class _PtrR>
62 : _Base(__x), i_(0), iend_(0), iI_(0), lastI_(0), m_(__x.m()) {
63 if (__x.i())
64 i_.reset(new typename MatrixType<F, _Ref, _Ptr>::iterator(*__x.i()));
65 if (__x.iend())
66 iend_.reset
67 (new typename MatrixType<F, _Ref, _Ptr>::iterator(*__x.iend()));
68 if (__x.iI())
69 iI_.reset(new Set<IndexRange>::index_iterator(*__x.iI()));
70 if (__x.lastI())
71 lastI_.reset(new Set<IndexRange>::index_iterator(*__x.lastI()));
72 }
73
75 return_type operator*() const {
76 conceptsAssert(i_.get(), Assertion());
77 return **i_;
78 }
80 pointer operator->() const {
81 conceptsAssert(i_.get(), Assertion());
82 return securePointer(**i_, m_);
83 }
84
86 template<class _RefR, class _PtrR>
89 if (__x.i())
90 i_.reset(new typename MatrixType<F, _Ref, _Ptr>::iterator(*__x.i()));
91 else i_.reset(0);
92 if (__x.iend())
93 iend_.reset
94 (new typename MatrixType<F, _Ref, _Ptr>::iterator(*__x.iend()));
95 else iend_.reset(0);
96 iI_ = __x.iI(); lastI_ = __x.lastI();
97 m_ = __x.m();
98 return *this;
99 }
100
103 _Self operator++(int) {
104 _Self __tmp = *this;
105 ++*this;
106 return __tmp;
107 }
108
109 inline typename MatrixType<F, _Ref, _Ptr>::iterator* i() const {
110 return i_.get();
111 }
112 inline const typename MatrixType<F, _Ref, _Ptr>::iterator* iend() const {
113 return iend_.get();
114 }
115 inline Set<IndexRange>::index_iterator* iI() const { return iI_.get(); }
116 const Set<IndexRange>::index_iterator* lastI() const {
117 return lastI_.get();
118 }
119 inline matrix_type* m() const { return m_; }
120 protected:
121 virtual std::ostream& info(std::ostream& os) const;
122 private:
124 std::shared_ptr<typename MatrixType<F, _Ref, _Ptr>::iterator> i_;
126 std::shared_ptr<const typename MatrixType<F, _Ref, _Ptr>::iterator> iend_;
128 std::shared_ptr<Set<IndexRange>::index_iterator> iI_;
130 std::shared_ptr<const Set<IndexRange>::index_iterator> lastI_;
132 matrix_type* m_;
133
137 _Self& next_();
138 };
139
141 template <class F, class _Ref, class _Ptr>
142 template<class F_, class _Ref_, class _Ptr_>
144 typedef SubMatrixN<F_> type;
145 typedef typename F_::iterator iterator;
146 };
147
149 template <class F, class _Ref, class _Ptr>
150 template<class F_>
152 MatrixType<F_, const typename F::type&, const typename F::type*>
153 {
154 typedef const SubMatrixN<F_> type;
155 typedef typename F_::const_iterator iterator;
156 };
157
158} // namespace concepts
159
160#endif // submatrixiterator_hh
_Self & operator=(const iterator &__x)
Assignment.
_Self & operator++()
Increment operator.
pointer operator->() const
Returns a pointer to the value.
_Self & operator=(const _SubMatrix_iterator< F, _RefR, _PtrR > &__x)
Assignment.
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
return_type operator*() const
Dereferencation.
_SubMatrix_iterator()
Constructor. Iterator stands at the end of any matrix.
_SubMatrix_iterator(matrix_type &m, uint r=0)
_SubMatrix_iterator(const _SubMatrix_iterator< F, _RefR, _PtrR > &__x)
Copy constructor. Also from iterator to constant iterator.
#define conceptsAssert(cond, exc)
F * securePointer(F &value, G *matrix)
Set< F > makeSet(uint n, const F &first,...)
Definition set.hh:320
Non-constant matrix for non-constant iterator.