DGtal  1.5.beta
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)
35 #define ModuloComputer_RECURSES
36 
37 #if !defined ModuloComputer_h
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 
174 
175  private:
176 
182  ModuloComputer ( const ModuloComputer & other );
183 
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)
implements basic functions on modular arithmetic.
void decrement(UnsignedInteger &i) const
UnsignedInteger previous(UnsignedIntegerParamType i) const
NumberTraits< Integer >::ParamType IntegerParamType
bool isValid() const
void increment(UnsignedInteger &i) const
NumberTraits< TInteger >::UnsignedVersion UnsignedInteger
void selfDisplay(std::ostream &out) const
UnsignedInteger posDiff(UnsignedIntegerParamType j, UnsignedIntegerParamType i) const
NumberTraits< UnsignedInteger >::ParamType UnsignedIntegerParamType
UnsignedInteger next(UnsignedIntegerParamType i) const
ModuloComputer & operator=(const ModuloComputer &other)
ModuloComputer(UnsignedIntegerParamType m)
UnsignedInteger cast(IntegerParamType i) const
BOOST_CONCEPT_ASSERT((concepts::CInteger< Integer >))
bool less(UnsignedIntegerParamType i, UnsignedIntegerParamType j) const
ModuloComputer(const ModuloComputer &other)
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
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
Aim: The traits class for all models of Cinteger.
Definition: NumberTraits.h:564
Aim: Concept checking for Integer Numbers. More precisely, this concept is a refinement of both CEucl...
Definition: CInteger.h:88