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
CUndirectedSimpleLocalGraph.h
1
17
#pragma once
18
31
#if defined(CUndirectedSimpleLocalGraph_RECURSES)
32
#error Recursive header files inclusion detected in CUndirectedSimpleLocalGraph.h
33
#else // defined(CUndirectedSimpleLocalGraph_RECURSES)
34
35
#define CUndirectedSimpleLocalGraph_RECURSES
36
37
#if !defined CUndirectedSimpleLocalGraph_h
38
39
#define CUndirectedSimpleLocalGraph_h
40
42
// Inclusions
43
#include <iostream>
44
#include <boost/concept_archetype.hpp>
45
#include "DGtal/base/Common.h"
46
#include "DGtal/kernel/CInteger.h"
47
#include "DGtal/topology/CVertexMap.h"
49
50
namespace
DGtal
51
{
52
54
// class CUndirectedSimpleLocalGraph
143
template
<
typename
T>
144
struct
CUndirectedSimpleLocalGraph
145
// Use derivation for coarser concepts, like
146
// : CoarserConcept<T>
147
// Think to boost::CopyConstructible<T>, boost::DefaultConstructible<T>, ...
148
// http://www.boost.org/doc/libs/1_49_0/libs/concept_check/reference.htm
149
{
150
// ----------------------- Concept checks ------------------------------
151
public
:
152
// 1. define first provided types (i.e. inner types), like
153
typedef
typename
T::Vertex
Vertex
;
154
typedef
typename
T::Size
Size
;
155
typedef
typename
T::VertexSet
VertexSet
;
156
template
<
typename
Value>
struct
VertexMap
{
157
typedef
typename
T::template
VertexMap<Value>::Type
Type
;
158
BOOST_CONCEPT_ASSERT
((
CVertexMap
<
VertexMap<Value>
> ));
159
};
160
161
// possibly check these types so as to satisfy a concept with
162
BOOST_CONCEPT_ASSERT
((
CInteger< Size >
));
163
164
// 2. then check the presence of data members, operators and methods with
165
BOOST_CONCEPT_USAGE
(
CUndirectedSimpleLocalGraph
)
166
{
167
// check const methods.
168
checkConstConstraints
();
169
}
170
void
checkConstConstraints
()
const
171
{
172
ConceptUtils::sameType
(
mySize
,
myX
.bestCapacity() );
173
ConceptUtils::sameType
(
mySize
,
myX
.degree(
myVertex
) );
174
myX
.writeNeighbors(
myOutIt
,
myVertex
);
175
// @todo create VertexPredicate to test the other writeNeighbors method.
176
}
177
178
// ------------------------- Private Datas --------------------------------
179
private
:
180
T
myX
;
// do not require T to be default constructible.
181
Size
mySize
;
182
Vertex
myVertex
;
183
mutable
boost::output_iterator_archetype<Vertex>
myOutIt
;
184
185
// ------------------------- Internals ------------------------------------
186
private
:
187
188
};
// end of concept CUndirectedSimpleLocalGraph
189
190
}
// namespace DGtal
191
192
// //
194
195
#endif // !defined CUndirectedSimpleLocalGraph_h
196
197
#undef CUndirectedSimpleLocalGraph_RECURSES
198
#endif // else defined(CUndirectedSimpleLocalGraph_RECURSES)
Generated on Wed Dec 19 2012 19:10:21 for DGtal by
1.8.1.1