Class documentation of Concepts

Loading...
Searching...
No Matches
hashedSMatrixIterator.hh
Go to the documentation of this file.
1
6#ifndef hSparseMatrixIterator_hh
7#define hSparseMatrixIterator_hh
8
9#include "matrixIterator.hh"
10#include "basics/debug.hh"
11
12namespace concepts {
13
14 // forward declaration
15 template<class T>
16 class HashedSparseMatrix;
17
18// template<class T>
19// struct HashedSparseMatrix<T>::Value;
20
21 // *********************************************** _HashedSMatrix_iterator **
22
27 template <class _Tp, class _Ref, class _Ptr>
29 public _Matrix_iterator_base<_Tp, _Ref, _Ptr> {
30 public:
33
34 template<class _Tp_, class _Ref_, class _Ptr_>
35 struct MatrixType;
36
37 typedef std::forward_iterator_tag iterator_category;
38 typedef _Tp value_type;
39 typedef _Ptr pointer;
40 typedef _Ref reference;
41 typedef size_t size_type;
42 typedef ptrdiff_t difference_type;
46 typedef typename _Base::return_type return_type;
47
53 _HashedSMatrix_iterator(matrix_type& m, const unsigned int r = 0);
57 template<class _RefR, class _PtrR>
60 : _Base(__x), v_(__x.v()), hashBits_(__x.hashBits()),
61 pPerRow_(__x.pPerRow()), nofPages_(__x.nofPages()),
62 p_(__x.p()), pNextRow_(__x.pNextRow()), page_(__x.page()) {
63 conceptsAssert(v_ == 0 || v_->val != 0.0, Assertion());
64 }
65
67 /*return_type*/ reference operator*() const {
68 conceptsAssert(v_ != 0 && v_->val != 0.0, Assertion());
69 return v_->val;
70 }
72 pointer operator->() const {
73 conceptsAssert(v_ != 0 && v_->val != 0.0, Assertion());
74 return &v_->val;
75 }
76
78 template<class _RefR, class _PtrR>
81 v_ = __x.v(); hashBits_ = __x.hashBits();
82 pPerRow_ = __x.pPerRow(); nofPages_ = __x.nofPages();
83 p_ = __x.p(); pNextRow_ = __x.pNextRow(); page_ = __x.page();
84 conceptsAssert(v_ == 0 || v_->val != 0.0, Assertion());
85 return *this;
86 }
87
96
98 typename HashedSparseMatrix<_Tp>::Value* v() const { return v_; }
99 int hashBits() const { return hashBits_; }
100 int pPerRow() const { return pPerRow_; }
101 int nofPages() const { return nofPages_; }
102 int p() const { return p_; }
103 int pNextRow() const { return pNextRow_; }
104 typename HashedSparseMatrix<_Tp>::Value** page() const { return page_; }
105 protected:
106 virtual std::ostream& info(std::ostream& os) const;
107 private:
111 int hashBits_, pPerRow_, nofPages_;
113 int p_, pNextRow_;
115 typename HashedSparseMatrix<_Tp>::Value** page_;
116 };
117
119 template <class _Tp, class _Ref, class _Ptr>
120 template<class _Tp_, class _Ref_, class _Ptr_>
124
126 template <class _Tp, class _Ref, class _Ptr>
127 template<class _Tp_>
129 MatrixType<_Tp_, const _Tp_&, const _Tp_*>
130 {
131 typedef const HashedSparseMatrix<_Tp_> type;
132 };
133
134} // namespace concepts
135
136#endif // hSparseMatrixIterator_hh
137
HashedSparseMatrix< _Tp >::Value * v() const
Data defining the position of the iterator.
_Self pre_increment()
Pre-increment operator, exportable to Python.
pointer operator->() const
Returns a pointer to the value.
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
_Self operator++(int)
Post-increment operator.
_HashedSMatrix_iterator(matrix_type &m, const unsigned int r=0)
_Self post_increment()
Post-increment operator, exportable to Python.
_HashedSMatrix_iterator(const _HashedSMatrix_iterator< _Tp, _RefR, _PtrR > &__x)
Copy constructor. Also from iterator to constant iterator.
_Self & operator=(const _HashedSMatrix_iterator< _Tp, _RefR, _PtrR > &__x)
Assignment.
reference operator*() const
Dereferencation.
_Self & operator++()
Pre-increment operator.
_HashedSMatrix_iterator()
Constructor. Iterator stands at the end of any matrix.
_Self & operator=(const iterator &__x)
Assignment.
#define conceptsAssert(cond, exc)
Set< F > makeSet(uint n, const F &first,...)
Definition set.hh:320
Non-constant matrix for non-constant iterator.