DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
CGraphVisitor.h
1
16
17
#pragma once
18
30
31
#if defined(CGraphVisitor_RECURSES)
32
#error Recursive header files inclusion detected in CGraphVisitor.h
33
#else
// defined(CGraphVisitor_RECURSES)
35
#define CGraphVisitor_RECURSES
36
37
#if !defined CGraphVisitor_h
39
#define CGraphVisitor_h
40
42
// Inclusions
43
#include <iostream>
44
#include "boost/tuple/tuple.hpp"
45
#include "DGtal/base/Common.h"
46
#include "DGtal/graph/CVertexPredicate.h"
47
#include "DGtal/graph/CVertexPredicateArchetype.h"
48
#include "DGtal/graph/CUndirectedSimpleLocalGraph.h"
50
51
// @since 0.8 In DGtal::concepts
52
namespace
DGtal
{
53
namespace
concepts
{
54
56
// class CGraphVisitor
109
template
<
typename
T>
110
struct
CGraphVisitor
:
boost::CopyConstructible
<T>
111
{
112
// ----------------------- Concept checks ------------------------------
113
public
:
114
// 1. define first provided types (i.e. inner types), like
115
typedef
typename
T::Graph
Graph
;
116
typedef
typename
T::Vertex
Vertex
;
117
typedef
typename
T::Size
Size
;
118
typedef
typename
T::Data
Data
;
119
typedef
typename
T::MarkSet
MarkSet
;
120
typedef
typename
T::Node
Node
;
121
typedef
CVertexPredicateArchetype<Vertex>
VertexPredicate
;
122
123
BOOST_CONCEPT_ASSERT
((
CUndirectedSimpleLocalGraph< Graph >
));
124
BOOST_STATIC_ASSERT
((
ConceptUtils::SameType<Vertex, typename Graph::Vertex>::value
));
125
BOOST_STATIC_ASSERT
((
ConceptUtils::SameType<Size, typename Graph::Size>::value
));
126
BOOST_CONCEPT_ASSERT
((
boost::SimpleAssociativeContainer< MarkSet >
));
127
BOOST_CONCEPT_ASSERT
((
boost::UniqueAssociativeContainer< MarkSet >
));
128
BOOST_STATIC_ASSERT
((
ConceptUtils::SameType<Vertex, typename MarkSet::key_type>::value
));
129
BOOST_CONCEPT_ASSERT
((
boost::DefaultConstructible< Data >
));
130
BOOST_CONCEPT_ASSERT
((
boost::Assignable< Data >
));
131
BOOST_CONCEPT_ASSERT
((
boost::CopyConstructible< Data >
));
132
BOOST_STATIC_ASSERT
(( boost::is_convertible<
Node
, std::pair<Vertex,Data> >::value ));
133
134
// To test if two types A and Y are equals, use
135
// 2. then check the presence of data members, operators and methods with
136
BOOST_CONCEPT_USAGE
(
CGraphVisitor
)
137
{
138
// check non-const methods.
139
myX
.expand();
140
myX
.expand(
myVPred
);
141
myX
.ignore();
142
myX
.terminate();
143
// check const methods.
144
checkConstConstraints
();
145
}
146
void
checkConstConstraints
()
const
147
{
148
ConceptUtils::sameType
(
myGraph
,
myX
.graph() );
149
ConceptUtils::sameType
(
myNode
,
myX
.current() );
150
ConceptUtils::sameType
(
myBool
,
myX
.finished() );
151
ConceptUtils::sameType
(
myMarkSet
,
myX
.markedVertices() );
152
ConceptUtils::sameType
(
myMarkSet
,
myX
.visitedVertices() );
153
}
154
// ------------------------- Private Data --------------------------------
155
private
:
156
T
myX
;
// do not require T to be default constructible.
157
Graph
myGraph
;
158
Node
myNode
;
159
bool
myBool
;
160
VertexPredicate
myVPred
;
161
MarkSet
myMarkSet
;
162
163
};
// end of concept CGraphVisitor
164
165
}
// namespace concepts
166
}
// namespace DGtal
167
168
// //
170
171
#endif
// !defined CGraphVisitor_h
172
173
#undef CGraphVisitor_RECURSES
174
#endif
// else defined(CGraphVisitor_RECURSES)
DGtal::concepts::ConceptUtils::sameType
void sameType(const T &, const T &)
Definition
ConceptUtils.h:117
DGtal::concepts
Aim: Gathers several functions useful for concept checks.
Definition
CPositiveIrreducibleFraction.h:54
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
DGtal::concepts::CGraphVisitor
Aim: Defines the concept of a visitor onto a graph, that is an object that traverses vertices of the ...
Definition
CGraphVisitor.h:111
DGtal::concepts::CGraphVisitor::myGraph
Graph myGraph
Definition
CGraphVisitor.h:157
DGtal::concepts::CGraphVisitor::myMarkSet
MarkSet myMarkSet
Definition
CGraphVisitor.h:161
DGtal::concepts::CGraphVisitor::myNode
Node myNode
Definition
CGraphVisitor.h:158
DGtal::concepts::CGraphVisitor::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((boost::CopyConstructible< Data >))
DGtal::concepts::CGraphVisitor::Node
T::Node Node
Definition
CGraphVisitor.h:120
DGtal::concepts::CGraphVisitor::myBool
bool myBool
Definition
CGraphVisitor.h:159
DGtal::concepts::CGraphVisitor::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((boost::SimpleAssociativeContainer< MarkSet >))
DGtal::concepts::CGraphVisitor::BOOST_STATIC_ASSERT
BOOST_STATIC_ASSERT((boost::is_convertible< Node, std::pair< Vertex, Data > >::value))
DGtal::concepts::CGraphVisitor::BOOST_STATIC_ASSERT
BOOST_STATIC_ASSERT((ConceptUtils::SameType< Vertex, typename Graph::Vertex >::value))
DGtal::concepts::CGraphVisitor::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((boost::DefaultConstructible< Data >))
DGtal::concepts::CGraphVisitor::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((boost::Assignable< Data >))
DGtal::concepts::CGraphVisitor::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((CUndirectedSimpleLocalGraph< Graph >))
DGtal::concepts::CGraphVisitor::VertexPredicate
CVertexPredicateArchetype< Vertex > VertexPredicate
Definition
CGraphVisitor.h:121
DGtal::concepts::CGraphVisitor::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((boost::UniqueAssociativeContainer< MarkSet >))
DGtal::concepts::CGraphVisitor::Vertex
T::Vertex Vertex
Definition
CGraphVisitor.h:116
DGtal::concepts::CGraphVisitor::myX
T myX
Definition
CGraphVisitor.h:156
DGtal::concepts::CGraphVisitor::BOOST_STATIC_ASSERT
BOOST_STATIC_ASSERT((ConceptUtils::SameType< Vertex, typename MarkSet::key_type >::value))
DGtal::concepts::CGraphVisitor::myVPred
VertexPredicate myVPred
Definition
CGraphVisitor.h:160
DGtal::concepts::CGraphVisitor::Data
T::Data Data
Definition
CGraphVisitor.h:118
DGtal::concepts::CGraphVisitor::Graph
T::Graph Graph
Definition
CGraphVisitor.h:115
DGtal::concepts::CGraphVisitor::checkConstConstraints
void checkConstConstraints() const
Definition
CGraphVisitor.h:146
DGtal::concepts::CGraphVisitor::BOOST_STATIC_ASSERT
BOOST_STATIC_ASSERT((ConceptUtils::SameType< Size, typename Graph::Size >::value))
DGtal::concepts::CGraphVisitor::Size
T::Size Size
Definition
CGraphVisitor.h:117
DGtal::concepts::CGraphVisitor::MarkSet
T::MarkSet MarkSet
Definition
CGraphVisitor.h:119
DGtal::concepts::CGraphVisitor::BOOST_CONCEPT_USAGE
BOOST_CONCEPT_USAGE(CGraphVisitor)
Definition
CGraphVisitor.h:136
DGtal::concepts::CUndirectedSimpleLocalGraph
Aim: Represents the concept of local graph: each vertex has neighboring vertices, but we do not neces...
Definition
CUndirectedSimpleLocalGraph.h:101
DGtal::concepts::CVertexPredicateArchetype
Aim: Defines a an archetype for concept CVertexPredicate.
Definition
CVertexPredicateArchetype.h:60
DGtal::concepts::ConceptUtils::SameType::value
static const bool value
Definition
ConceptUtils.h:107
boost::Assignable
Go to http://www.sgi.com/tech/stl/Assignable.html.
Definition
Boost.dox:32
boost::CopyConstructible
Go to http://www.sgi.com/tech/stl/CopyConstructible.html.
Definition
Boost.dox:34
boost::DefaultConstructible
Go to http://www.sgi.com/tech/stl/DefaultConstructible.html.
Definition
Boost.dox:30
boost::SimpleAssociativeContainer
Go to http://www.sgi.com/tech/stl/SimpleAssociativeContainer.html.
Definition
Boost.dox:146
boost::UniqueAssociativeContainer
Go to http://www.sgi.com/tech/stl/UniqueAssociativeContainer.html.
Definition
Boost.dox:140
src
DGtal
graph
CGraphVisitor.h
Generated on
for DGtal by
1.18.0