DGtal
1.5.beta
CDigitalSet.h
1
17
#pragma once
18
35
#if defined(CDigitalSet_RECURSES)
36
#error Recursive header files inclusion detected in CDigitalSet.h
37
#else
// defined(CDigitalSet_RECURSES)
39
#define CDigitalSet_RECURSES
40
41
#if !defined CDigitalSet_h
43
#define CDigitalSet_h
44
46
// Inclusions
47
#include <iostream>
48
#include "boost/concept_check.hpp"
49
#include "DGtal/base/Common.h"
50
#include "DGtal/base/CowPtr.h"
51
#include "DGtal/kernel/CPointPredicate.h"
52
#include "DGtal/kernel/domains/CDomain.h"
54
55
namespace
DGtal
56
{
57
namespace
concepts
58
{
60
// class CDigitalSet
62
// class CDigitalSet
137
template
<
typename
T>
138
struct
CDigitalSet
:
139
boost::CopyConstructible
< T >,
140
concepts::CPointPredicate
< T >
141
{
142
// ----------------------- Concept checks ------------------------------
143
public
:
144
// 1. define first provided types (i.e. inner types), like
145
typedef
typename
T::Domain
Domain
;
146
typedef
typename
T::Point
Point
;
147
typedef
typename
T::Size
Size
;
148
typedef
typename
T::Iterator
Iterator
;
149
typedef
typename
T::ConstIterator
ConstIterator
;
150
151
BOOST_CONCEPT_ASSERT
((
concepts::CDomain<Domain>
));
152
BOOST_CONCEPT_ASSERT
((
boost_concepts::ReadableIteratorConcept<ConstIterator >
));
153
BOOST_CONCEPT_ASSERT
((
boost_concepts::SinglePassIteratorConcept<ConstIterator >
));
154
155
// 2. then check the presence of data members, operators and methods with
156
BOOST_CONCEPT_USAGE
(
CDigitalSet
)
157
{
158
checkConstConstraints
();
159
checkNonConstConstraints
();
160
}
164
void
checkConstConstraints
()
const
165
{
166
ConceptUtils::sameType
(
myDomain
,
myX
.domain() );
167
ConceptUtils::sameType
(
myDomainPtr
,
myX
.domainPointer() );
168
ConceptUtils::sameType
(
mySize
,
myX
.size() );
169
ConceptUtils::sameType
(
myBool
,
myX
.empty() );
170
171
ConceptUtils::sameType
(
myConstIterator
,
myX
.find(
myPoint
) );
172
ConceptUtils::sameType
(
myConstIterator
,
myX
.begin() );
173
ConceptUtils::sameType
(
myConstIterator
,
myX
.end() );
174
}
175
179
void
checkNonConstConstraints
()
180
{
181
myX
.insert(
myPoint
);
182
// template <typename PointInputIterator>
183
// BOOST_CONCEPT_REQUIRES
184
// ( ((boost::InputIterator<PointInputIterator>)),
185
// (void) )
186
// myX.insert( PointInputIterator, PointInputIterator );
187
myX
.insertNew(
myPoint
);
188
ConceptUtils::sameType
(
mySize
,
myX
.erase(
myPoint
) );
189
myX
.erase(
myIterator
);
190
myX
.erase(
myIterator
,
myIterator
);
191
myX
.clear();
192
ConceptUtils::sameType
(
myX
,
myX
.operator+=(
myX
) );
193
myX
.computeComplement(
myOutputIt
);
194
myX
.assignFromComplement(
myX
);
195
myX
.computeBoundingBox(
myPoint
,
myPoint
);
196
ConceptUtils::sameType
(
myIterator
,
myX
.find(
myPoint
) );
197
ConceptUtils::sameType
(
myIterator
,
myX
.begin() );
198
ConceptUtils::sameType
(
myIterator
,
myX
.end() );
199
}
200
201
// ------------------------- Private Datas --------------------------------
202
private
:
203
T
myX
;
// only if T is default constructible.
204
Domain
myDomain
;
205
CowPtr<Domain>
myDomainPtr
;
206
Size
mySize
;
207
bool
myBool
;
208
Point
myPoint
;
209
Iterator
myIterator
;
210
ConstIterator
myConstIterator
;
211
Point
*
myOutputIt
;
212
// ------------------------- Internals ------------------------------------
213
private
:
214
215
};
// end of concept CDigitalSet
216
}
217
}
// namespace DGtal
218
219
// //
221
222
#endif
// !defined CDigitalSet_h
223
224
#undef CDigitalSet_RECURSES
225
#endif
// else defined(CDigitalSet_RECURSES)
DGtal::CowPtr< Domain >
ConstIterator
MyDigitalSurface::ConstIterator ConstIterator
Definition:
greedy-plane-segmentation-ex2.cpp:93
DGtal::concepts::ConceptUtils::sameType
void sameType(const T &, const T &)
Definition:
ConceptUtils.h:117
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::concepts::CDigitalSet
Aim: Represents a set of points within the given domain. This set of points is modifiable by the user...
Definition:
CDigitalSet.h:141
DGtal::concepts::CDigitalSet::myBool
bool myBool
Definition:
CDigitalSet.h:207
DGtal::concepts::CDigitalSet::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((boost_concepts::ReadableIteratorConcept< ConstIterator >))
DGtal::concepts::CDigitalSet::Iterator
T::Iterator Iterator
Definition:
CDigitalSet.h:148
DGtal::concepts::CDigitalSet::myIterator
Iterator myIterator
Definition:
CDigitalSet.h:209
DGtal::concepts::CDigitalSet::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((boost_concepts::SinglePassIteratorConcept< ConstIterator >))
DGtal::concepts::CDigitalSet::myDomain
Domain myDomain
Definition:
CDigitalSet.h:204
DGtal::concepts::CDigitalSet::Domain
T::Domain Domain
Definition:
CDigitalSet.h:145
DGtal::concepts::CDigitalSet::Point
T::Point Point
Definition:
CDigitalSet.h:146
DGtal::concepts::CDigitalSet::myConstIterator
ConstIterator myConstIterator
Definition:
CDigitalSet.h:210
DGtal::concepts::CDigitalSet::myX
T myX
Definition:
CDigitalSet.h:203
DGtal::concepts::CDigitalSet::checkConstConstraints
void checkConstConstraints() const
Definition:
CDigitalSet.h:164
DGtal::concepts::CDigitalSet::BOOST_CONCEPT_USAGE
BOOST_CONCEPT_USAGE(CDigitalSet)
Definition:
CDigitalSet.h:156
DGtal::concepts::CDigitalSet::Size
T::Size Size
Definition:
CDigitalSet.h:147
DGtal::concepts::CDigitalSet::myDomainPtr
CowPtr< Domain > myDomainPtr
Definition:
CDigitalSet.h:205
DGtal::concepts::CDigitalSet::ConstIterator
T::ConstIterator ConstIterator
Definition:
CDigitalSet.h:149
DGtal::concepts::CDigitalSet::checkNonConstConstraints
void checkNonConstConstraints()
Definition:
CDigitalSet.h:179
DGtal::concepts::CDigitalSet::mySize
Size mySize
Definition:
CDigitalSet.h:206
DGtal::concepts::CDigitalSet::myOutputIt
Point * myOutputIt
Definition:
CDigitalSet.h:211
DGtal::concepts::CDigitalSet::myPoint
Point myPoint
Definition:
CDigitalSet.h:208
DGtal::concepts::CDigitalSet::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CDomain< Domain >))
DGtal::concepts::CDomain
Aim: This concept represents a digital domain, i.e. a non mutable subset of points of the given digit...
Definition:
CDomain.h:130
DGtal::concepts::CPointPredicate
Aim: Defines a predicate on a point.
Definition:
CPointPredicate.h:81
boost::CopyConstructible
Go to http://www.sgi.com/tech/stl/CopyConstructible.html.
Definition:
Boost.dox:34
boost_concepts::ReadableIteratorConcept
Go to http://www.boost.org/doc/libs/1_52_0/libs/iterator/doc/ReadableIterator.html.
Definition:
BoostConcepts.dox:29
boost_concepts::SinglePassIteratorConcept
Go to http://www.boost.org/doc/libs/1_52_0/libs/iterator/doc/SinglePassIterator.html.
Definition:
BoostConcepts.dox:44
Point
MyPointD Point
Definition:
testClone2.cpp:383
Size
HalfEdgeDataStructure::Size Size
Definition:
testHalfEdgeDataStructure.cpp:50
Domain
HyperRectDomain< Space > Domain
Definition:
testSimpleRandomAccessRangeFromPoint.cpp:44
src
DGtal
kernel
sets
CDigitalSet.h
Generated on Sat Nov 9 2024 12:44:34 for DGtal by
1.9.1