DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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/CUnsignedInteger.h"
47 #include "DGtal/kernel/CInteger.h"
49 
50 namespace DGtal
51 {
52 
54  // template class ModuloComputer
79  template <typename TInteger>
81  {
82  public:
85 
88 
91 
97 
102  void increment( UnsignedInteger & i ) const;
103 
108  void decrement( UnsignedInteger & i ) const;
109 
115 
121 
128 
138 
147 
148  public:
153  void selfDisplay ( std::ostream & out ) const;
154 
159  bool isValid() const;
160 
161  // ------------------------- Private Datas --------------------------------
162  private:
167 
168  // ------------------------- Hidden services ------------------------------
169  protected:
170 
175  ModuloComputer();
176 
177  private:
178 
184  ModuloComputer ( const ModuloComputer & other );
185 
192  ModuloComputer & operator= ( const ModuloComputer & other );
193 
194  // ------------------------- Internals ------------------------------------
195  private:
196 
197  }; // end of class ModuloComputer
198 
206  template <typename T>
207  std::ostream&
208  operator<< ( std::ostream & out,
209  const ModuloComputer<T> & object )
210  {
211  object.selfDisplay( out );
212  return out;
213  }
214 
215 } // namespace DGtal
216 
217 
219 // Includes inline functions.
220 #include "DGtal/arithmetic/ModuloComputer.ih"
221 
222 // //
224 
225 #endif // !defined ModuloComputer_h
226 
227 #undef ModuloComputer_RECURSES
228 #endif // else defined(ModuloComputer_RECURSES)