DGtal  1.0.0
ModuloComputer.h
1 
17 #pragma once
18 
31 #if defined(ModuloComputer_RECURSES)
32 #error Recursive header files inclusion detected in ModuloComputer.h
33 #else // defined(ModuloComputer_RECURSES)
34 
35 #define ModuloComputer_RECURSES
36 
37 #if !defined ModuloComputer_h
38 
39 #define ModuloComputer_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "DGtal/kernel/NumberTraits.h"
46 #include "DGtal/kernel/CInteger.h"
48 
49 namespace DGtal
50 {
51 
53  // template class ModuloComputer
78  template <typename TInteger>
80  {
81  public:
82  typedef TInteger Integer;
84 
87 
89 
95 
100  void increment( UnsignedInteger & i ) const;
101 
106  void decrement( UnsignedInteger & i ) const;
107 
113 
119 
126 
136 
145 
146  public:
151  void selfDisplay ( std::ostream & out ) const;
152 
157  bool isValid() const;
158 
159  // ------------------------- Private Datas --------------------------------
160  private:
165 
166  // ------------------------- Hidden services ------------------------------
167  protected:
168 
173  ModuloComputer();
174 
175  private:
176 
182  ModuloComputer ( const ModuloComputer & other );
183 
190  ModuloComputer & operator= ( const ModuloComputer & other );
191 
192  // ------------------------- Internals ------------------------------------
193  private:
194 
195  }; // end of class ModuloComputer
196 
204  template <typename T>
205  std::ostream&
206  operator<< ( std::ostream & out,
207  const ModuloComputer<T> & object )
208  {
209  object.selfDisplay( out );
210  return out;
211  }
212 
213 } // namespace DGtal
214 
215 
217 // Includes inline functions.
218 #include "DGtal/arithmetic/ModuloComputer.ih"
219 
220 // //
222 
223 #endif // !defined ModuloComputer_h
224 
225 #undef ModuloComputer_RECURSES
226 #endif // else defined(ModuloComputer_RECURSES)
NumberTraits< Integer >::ParamType IntegerParamType
bool isValid() const
boost::call_traits< std::decay< T >::type >::param_type ParamType
Defines a type that represents the "best" way to pass a parameter of type T to a function.
Definition: NumberTraits.h:96
NumberTraits< UnsignedInteger >::ParamType UnsignedIntegerParamType
ModuloComputer & operator=(const ModuloComputer &other)
Aim: Concept checking for Integer Numbers. More precisely, this concept is a refinement of both CEucl...
Definition: CInteger.h:87
UnsignedInteger cast(IntegerParamType i) const
void increment(UnsignedInteger &i) const
void decrement(UnsignedInteger &i) const
UnsignedInteger posDiff(UnsignedIntegerParamType j, UnsignedIntegerParamType i) const
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
Aim: The traits class for all models of Cinteger.
Definition: NumberTraits.h:531
UnsignedInteger next(UnsignedIntegerParamType i) const
implements basic functions on modular arithmetic.
bool less(UnsignedIntegerParamType i, UnsignedIntegerParamType j) const
DGtal is the top-level namespace which contains all DGtal functions and types.
void selfDisplay(std::ostream &out) const
UnsignedInteger previous(UnsignedIntegerParamType i) const
BOOST_CONCEPT_ASSERT((concepts::CInteger< Integer >))
NumberTraits< TInteger >::UnsignedVersion UnsignedInteger