DGtal  0.9.2
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  namespace concepts {
49 
51  // class CDigitalSurfaceTracker
84  template <typename T>
86  {
87  // ----------------------- Concept checks ------------------------------
88  public:
89  // 1. define first provided types (i.e. inner types), like
90  typedef typename T::Self Self;
91  typedef typename T::DigitalSurfaceContainer DigitalSurfaceContainer;
92  typedef typename T::Surfel Surfel;
93  // possibly check these types so as to satisfy a concept with
94  // BOOST_CONCEPT_ASSERT
95  // (( CDigitalSurfaceContainer< DigitalSurfaceContainer > ));
96  // To test if two types A and Y are equals, use
98  ( (ConceptUtils::SameType< Surfel,
99  typename DigitalSurfaceContainer::Surfel >::value) );
100  // 2. then check the presence of data members, operators and methods with
102  {
103  // x.move( Surfel ) should exist.
104  myX.move( mySurfel );
105  // check const methods.
107  }
109  {
110  // x.surface() const, returns a const DigitalSurfaceContainer &
111  ConceptUtils::sameType( myDSC, myX.surface() );
112  // x.current() const, returns a Surfel
113  ConceptUtils::sameType( mySurfel, myX.current() );
114  // x.orthDir() const, returns a Dimension
115  ConceptUtils::sameType( myDim, myX.orthDir() );
116  // x.adjacent( Surfel&, Dimension, bool ) const, returns a uint8_t
117  Surfel modifiableSurfel;
119  myX.adjacent( modifiableSurfel, myDim, myBool ) );
120  }
121 
122  // ------------------------- Private Datas --------------------------------
123  private:
124  T myX; // only if T is default constructible.
125  DigitalSurfaceContainer myDSC;
126  Surfel mySurfel;
128  bool myBool;
130 
131  // ------------------------- Internals ------------------------------------
132  private:
133 
134  }; // end of concept CDigitalSurfaceTracker
135 
136 } // namespace concepts
137 } // namespace DGtal
138 
139 // //
141 
142 #endif // !defined CDigitalSurfaceTracker_h
143 
144 #undef CDigitalSurfaceTracker_RECURSES
145 #endif // else defined(CDigitalSurfaceTracker_RECURSES)
BOOST_STATIC_ASSERT((ConceptUtils::SameType< Surfel, typename DigitalSurfaceContainer::Surfel >::value))
DGtal::uint32_t Dimension
Definition: Common.h:113
void sameType(const T &t1, const T &t2)
Go to http://www.sgi.com/tech/stl/CopyConstructible.html.
Definition: Boost.dox:34
DGtal is the top-level namespace which contains all DGtal functions and types.
boost::uint8_t uint8_t
unsigned 8-bit integer.
Definition: BasicTypes.h:59
T::DigitalSurfaceContainer DigitalSurfaceContainer