DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
SimpleConstRange.h
1
16
17
#pragma once
18
32
33
#if defined(SimpleConstRange_RECURSES)
34
#error Recursive header files inclusion detected in SimpleConstRange.h
35
#else
// defined(SimpleConstRange_RECURSES)
37
#define SimpleConstRange_RECURSES
38
39
#if !defined SimpleConstRange_h
41
#define SimpleConstRange_h
42
44
// Inclusions
45
#include <iterator>
46
#include <iostream>
47
#include "DGtal/base/BasicFunctors.h"
48
#include "DGtal/base/Circulator.h"
49
#include "DGtal/base/ConstIteratorAdapter.h"
50
#include "boost/concept_check.hpp"
51
#include "boost/iterator/reverse_iterator.hpp"
53
54
namespace
DGtal
55
{
56
57
59
// class SimpleConstRange
61
72
template
<
typename
TConstIterator>
73
class
SimpleConstRange
74
{
75
76
BOOST_CONCEPT_ASSERT
((
boost::BidirectionalIterator<TConstIterator>
));
77
78
// ------------------------- inner types --------------------------------
79
public
:
80
81
typedef
TConstIterator
ConstIterator
;
82
typedef
boost::reverse_iterator<ConstIterator>
ConstReverseIterator
;
83
84
typedef
Circulator<ConstIterator>
ConstCirculator
;
85
typedef
boost::reverse_iterator<ConstCirculator>
ConstReverseCirculator
;
86
87
// ------------------------- standard services --------------------------------
88
96
SimpleConstRange
(
const
TConstIterator& itb,
const
TConstIterator& ite)
97
:
myBegin
(itb),
myEnd
(ite) {}
98
103
SimpleConstRange
(
const
SimpleConstRange
& other )
104
:
myBegin
(other.
myBegin
),
myEnd
(other.
myEnd
) {}
105
111
SimpleConstRange
&
operator=
(
const
SimpleConstRange
& other )
112
{
113
if
(
this
!= &other )
114
{
115
myBegin
= other.
myBegin
;
116
myEnd
= other.
myEnd
;
117
}
118
return
*
this
;
119
}
120
124
~SimpleConstRange
() {}
125
130
bool
isValid
()
const
{
return
true
; }
131
132
// ------------------------- display --------------------------------
137
void
selfDisplay
( std::ostream & out )
const
138
{
139
typedef
typename
IteratorCirculatorTraits<ConstIterator>::Value
Value
;
140
out <<
"[SimpleConstRange]"
<< std::endl;
141
out <<
"\t"
;
142
std::copy(
myBegin
,
myEnd
, std::ostream_iterator<Value>(out,
", "
) );
143
out << std::endl;
144
}
145
149
std::string
className
()
const
150
{
151
return
"SimpleConstRange"
;
152
}
153
154
155
// ------------------------- private data --------------------------------
156
private
:
160
TConstIterator
myBegin
;
164
TConstIterator
myEnd
;
165
166
// ------------------------- iterator services --------------------------------
167
public
:
168
173
ConstIterator
begin
()
const
{
174
return
ConstIterator
(
myBegin
);
175
}
176
181
ConstIterator
end
()
const
{
182
return
ConstIterator
(
myEnd
);
183
}
184
189
ConstReverseIterator
rbegin
()
const
{
190
return
ConstReverseIterator
(this->
end
());
191
}
192
197
ConstReverseIterator
rend
()
const
{
198
return
ConstReverseIterator
(this->
begin
());
199
}
200
205
ConstCirculator
c
()
const
{
206
return
ConstCirculator
( this->
begin
(), this->
begin
(), this->
end
() );
207
}
208
213
ConstReverseCirculator
rc
()
const
{
214
return
ConstReverseCirculator
( this->
c
() );
215
}
216
217
};
//end class SimpleConstRange
218
219
}
// namespace DGtal
220
222
223
224
#endif
// !defined SimpleConstRange_h
225
226
#undef SimpleConstRange_RECURSES
227
#endif
// else defined(SimpleConstRange_RECURSES)
DGtal::Circulator
Aim: Provides an adapter for classical iterators that can iterate through the underlying data structu...
Definition
Circulator.h:86
DGtal::SimpleConstRange::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((boost::BidirectionalIterator< TConstIterator >))
DGtal::SimpleConstRange::SimpleConstRange
SimpleConstRange(const SimpleConstRange &other)
Definition
SimpleConstRange.h:103
DGtal::SimpleConstRange::end
ConstIterator end() const
Definition
SimpleConstRange.h:181
DGtal::SimpleConstRange::ConstReverseCirculator
boost::reverse_iterator< ConstCirculator > ConstReverseCirculator
Definition
SimpleConstRange.h:85
DGtal::SimpleConstRange::className
std::string className() const
Definition
SimpleConstRange.h:149
DGtal::SimpleConstRange::rbegin
ConstReverseIterator rbegin() const
Definition
SimpleConstRange.h:189
DGtal::SimpleConstRange::isValid
bool isValid() const
Definition
SimpleConstRange.h:130
DGtal::SimpleConstRange::rc
ConstReverseCirculator rc() const
Definition
SimpleConstRange.h:213
DGtal::SimpleConstRange::~SimpleConstRange
~SimpleConstRange()
Definition
SimpleConstRange.h:124
DGtal::SimpleConstRange::myBegin
TConstIterator myBegin
Definition
SimpleConstRange.h:160
DGtal::SimpleConstRange::ConstCirculator
Circulator< ConstIterator > ConstCirculator
Definition
SimpleConstRange.h:84
DGtal::SimpleConstRange::ConstReverseIterator
boost::reverse_iterator< ConstIterator > ConstReverseIterator
Definition
SimpleConstRange.h:82
DGtal::SimpleConstRange::SimpleConstRange
SimpleConstRange(const TConstIterator &itb, const TConstIterator &ite)
Definition
SimpleConstRange.h:96
DGtal::SimpleConstRange::ConstIterator
TConstIterator ConstIterator
Definition
SimpleConstRange.h:81
DGtal::SimpleConstRange::begin
ConstIterator begin() const
Definition
SimpleConstRange.h:173
DGtal::SimpleConstRange::rend
ConstReverseIterator rend() const
Definition
SimpleConstRange.h:197
DGtal::SimpleConstRange::operator=
SimpleConstRange & operator=(const SimpleConstRange &other)
Definition
SimpleConstRange.h:111
DGtal::SimpleConstRange::c
ConstCirculator c() const
Definition
SimpleConstRange.h:205
DGtal::SimpleConstRange::myEnd
TConstIterator myEnd
Definition
SimpleConstRange.h:164
DGtal::SimpleConstRange::selfDisplay
void selfDisplay(std::ostream &out) const
Definition
SimpleConstRange.h:137
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
DGtal::Value
DGtal::IteratorCirculatorTraits::Value
IC::value_type Value
Definition
IteratorCirculatorTraits.h:303
boost::BidirectionalIterator
Go to http://www.sgi.com/tech/stl/BidirectionalIterator.html.
Definition
Boost.dox:42
src
DGtal
base
SimpleConstRange.h
Generated on
for DGtal by
1.18.0