DGtal  1.5.beta
CGraphVisitor.h
1 
17 #pragma once
18 
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>
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;
122 
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
137  {
138  // check non-const methods.
139  myX.expand();
140  myX.expand( myVPred );
141  myX.ignore();
142  myX.terminate();
143  // check const methods.
145  }
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 Datas --------------------------------
155 private:
156  T myX; // do not require T to be default constructible.
159  bool myBool;
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)
void sameType(const T &, const T &)
Definition: ConceptUtils.h:117
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: Defines the concept of a visitor onto a graph, that is an object that traverses vertices of the ...
BOOST_CONCEPT_ASSERT((boost::CopyConstructible< Data >))
BOOST_CONCEPT_ASSERT((boost::SimpleAssociativeContainer< MarkSet >))
BOOST_STATIC_ASSERT((boost::is_convertible< Node, std::pair< Vertex, Data > >::value))
BOOST_STATIC_ASSERT((ConceptUtils::SameType< Vertex, typename Graph::Vertex >::value))
BOOST_CONCEPT_ASSERT((boost::DefaultConstructible< Data >))
BOOST_CONCEPT_ASSERT((boost::Assignable< Data >))
BOOST_CONCEPT_ASSERT((CUndirectedSimpleLocalGraph< Graph >))
CVertexPredicateArchetype< Vertex > VertexPredicate
BOOST_CONCEPT_ASSERT((boost::UniqueAssociativeContainer< MarkSet >))
BOOST_STATIC_ASSERT((ConceptUtils::SameType< Vertex, typename MarkSet::key_type >::value))
BOOST_STATIC_ASSERT((ConceptUtils::SameType< Size, typename Graph::Size >::value))
Aim: Represents the concept of local graph: each vertex has neighboring vertices, but we do not neces...
Go to http://www.sgi.com/tech/stl/Assignable.html.
Definition: Boost.dox:32
Go to http://www.sgi.com/tech/stl/CopyConstructible.html.
Definition: Boost.dox:34
Go to http://www.sgi.com/tech/stl/DefaultConstructible.html.
Definition: Boost.dox:30
Go to http://www.sgi.com/tech/stl/SimpleAssociativeContainer.html.
Definition: Boost.dox:146
Go to http://www.sgi.com/tech/stl/UniqueAssociativeContainer.html.
Definition: Boost.dox:140
HalfEdgeDataStructure::Size Size
TriMesh::Vertex Vertex