DGtal
0.6.devel
Main Page
Related Pages
Modules
Namespaces
Data Structures
Examples
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
src
DGtal
topology
CDigitalSurfaceTracker.h
1
17
#pragma once
18
31
#if defined(CDigitalSurfaceTracker_RECURSES)
32
#error Recursive header files inclusion detected in CDigitalSurfaceTracker.h
33
#else // defined(CDigitalSurfaceTracker_RECURSES)
34
35
#define CDigitalSurfaceTracker_RECURSES
36
37
#if !defined CDigitalSurfaceTracker_h
38
39
#define CDigitalSurfaceTracker_h
40
42
// Inclusions
43
#include <iostream>
44
#include "DGtal/base/Common.h"
46
47
namespace
DGtal
48
{
49
51
// class CDigitalSurfaceTracker
102
template
<
typename
T>
103
struct
CDigitalSurfaceTracker
: boost::CopyConstructible<T>
104
{
105
// ----------------------- Concept checks ------------------------------
106
public
:
107
// 1. define first provided types (i.e. inner types), like
108
typedef
typename
T::Self
Self
;
109
typedef
typename
T::DigitalSurfaceContainer
DigitalSurfaceContainer
;
110
typedef
typename
T::Surfel
Surfel
;
111
// possibly check these types so as to satisfy a concept with
112
// BOOST_CONCEPT_ASSERT
113
// (( CDigitalSurfaceContainer< DigitalSurfaceContainer > ));
114
// To test if two types A and Y are equals, use
115
BOOST_STATIC_ASSERT
116
( (
ConceptUtils::SameType
<
Surfel
,
117
typename
DigitalSurfaceContainer::Surfel >::value) );
118
// 2. then check the presence of data members, operators and methods with
119
BOOST_CONCEPT_USAGE
(
CDigitalSurfaceTracker
)
120
{
121
// x.move( Surfel ) should exist.
122
myX
.move(
mySurfel
);
123
// check const methods.
124
checkConstConstraints
();
125
}
126
void
checkConstConstraints
()
const
127
{
128
// x.surface() const, returns a const DigitalSurfaceContainer &
129
ConceptUtils::sameType
(
myDSC
,
myX
.surface() );
130
// x.current() const, returns a Surfel
131
ConceptUtils::sameType
(
mySurfel
,
myX
.current() );
132
// x.orthDir() const, returns a Dimension
133
ConceptUtils::sameType
(
myDim
,
myX
.orthDir() );
134
// x.adjacent( Surfel&, Dimension, bool ) const, returns a uint8_t
135
Surfel
modifiableSurfel;
136
ConceptUtils::sameType
(
myInt
,
137
myX
.adjacent( modifiableSurfel,
myDim
,
myBool
) );
138
}
139
140
// ------------------------- Private Datas --------------------------------
141
private
:
142
T
myX
;
// only if T is default constructible.
143
DigitalSurfaceContainer
myDSC
;
144
Surfel
mySurfel
;
145
Dimension
myDim
;
146
bool
myBool
;
147
uint8_t
myInt
;
148
149
// ------------------------- Internals ------------------------------------
150
private
:
151
152
};
// end of concept CDigitalSurfaceTracker
153
154
}
// namespace DGtal
155
156
// //
158
159
#endif // !defined CDigitalSurfaceTracker_h
160
161
#undef CDigitalSurfaceTracker_RECURSES
162
#endif // else defined(CDigitalSurfaceTracker_RECURSES)
Generated on Wed Dec 19 2012 19:10:20 for DGtal by
1.8.1.1