STIR 6.4.0
FullArrayIterator.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2000 PARAPET partners
3 Copyright (C) 2000-2011, Hammersmith Imanet Ltd
4 This file is part of STIR.
5
6 SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license
7
8 See STIR/LICENSE.txt for details
9*/
10#ifndef __stir_FullArrayIterator__H__
11#define __stir_FullArrayIterator__H__
12
22
23#include "stir/common.h"
24#include <iterator>
25#include "boost/iterator/iterator_adaptor.hpp"
26
27START_NAMESPACE_STIR
28
47template <typename topleveliterT, typename restiterT, typename elemT, typename _Ref, typename _Ptr>
48class FullArrayIterator
49{
50public:
51 typedef std::forward_iterator_tag iterator_category;
52 typedef std::ptrdiff_t difference_type;
53
54 typedef elemT value_type;
55 typedef _Ref reference;
56 typedef _Ptr pointer;
57
58public:
61
63 inline FullArrayIterator(const FullArrayIterator&);
64
66 inline FullArrayIterator(const topleveliterT& top_level_iter,
67 const topleveliterT& last_top_level_iter,
68 const restiterT& rest_iter,
69 const restiterT& last_rest_iter);
70
72
75 template <typename othertopleveliterT, typename otherrestiterT, typename _otherRef, typename _otherPtr>
76 FullArrayIterator(FullArrayIterator<othertopleveliterT, otherrestiterT, elemT, _otherRef, _otherPtr> const& other,
77 typename boost::enable_if_convertible<othertopleveliterT, topleveliterT>::type* = 0,
78 typename boost::enable_if_convertible<otherrestiterT, restiterT>::type* = 0)
79 : current_top_level_iter(other.current_top_level_iter),
80 last_top_level_iter(other.last_top_level_iter),
81 current_rest_iter(other.current_rest_iter),
82 last_rest_iter(other.last_rest_iter)
83 {}
84
86
98 inline FullArrayIterator(unsigned);
99
100 // assignment is generated by compiler
101 // inline FullArrayIterator& operator=(const FullArrayIterator&);
102
104 inline FullArrayIterator& operator++();
105
107 inline FullArrayIterator operator++(int);
108
110 inline bool operator==(const FullArrayIterator&) const;
111 inline bool operator!=(const FullArrayIterator&) const;
112
114 inline reference operator*() const;
115
117 inline pointer operator->() const;
118
119#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
120public:
121#else
122private:
123 // needed for conversion constructor
124 template <class, class, class, class, class>
125 friend class FullArrayIterator;
126#endif
127
129 topleveliterT current_top_level_iter;
130
132 topleveliterT last_top_level_iter;
133
135 restiterT current_rest_iter;
136
138 restiterT last_rest_iter;
139};
140
141END_NAMESPACE_STIR
142
144
145#endif
inline implementations for stir::FullArrayIterator.
FullArrayIterator(FullArrayIterator< othertopleveliterT, otherrestiterT, elemT, _otherRef, _otherPtr > const &other, typename boost::enable_if_convertible< othertopleveliterT, topleveliterT >::type *=0, typename boost::enable_if_convertible< otherrestiterT, restiterT >::type *=0)
some magic trickery to be able to assign iterators to const iterators etc, but not to incompatible ty...
Definition FullArrayIterator.h:76
FullArrayIterator(unsigned)
constructor with 0 (only 0, not another number)
Definition FullArrayIterator.inl:37
bool operator==(const FullArrayIterator &) const
comparison operator
Definition FullArrayIterator.inl:73
FullArrayIterator(const topleveliterT &top_level_iter, const topleveliterT &last_top_level_iter, const restiterT &rest_iter, const restiterT &last_rest_iter)
constructor to initialise the members
Definition FullArrayIterator.inl:52
FullArrayIterator(const FullArrayIterator &)
copy constructor
reference operator*() const
dereferencing operator
Definition FullArrayIterator.inl:100
FullArrayIterator()
default constructor
Definition FullArrayIterator.inl:29
pointer operator->() const
member-selection operator
Definition FullArrayIterator.inl:107
FullArrayIterator operator++(int)
postfix increment
Definition FullArrayIterator.inl:141
FullArrayIterator & operator++()
prefix increment
Definition FullArrayIterator.inl:118
basic configuration include file