DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
ModuloComputer.h
1
16
17
#pragma once
18
30
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>
79
class
ModuloComputer
80
{
81
public
:
82
typedef
TInteger
Integer
;
83
typedef
typename
NumberTraits<Integer>::ParamType
IntegerParamType
;
84
85
typedef
typename
NumberTraits<TInteger>::UnsignedVersion
UnsignedInteger
;
86
typedef
typename
NumberTraits<UnsignedInteger>::ParamType
UnsignedIntegerParamType
;
87
88
BOOST_CONCEPT_ASSERT
((
concepts::CInteger<Integer>
));
89
94
ModuloComputer
(
UnsignedIntegerParamType
m );
95
100
void
increment
(
UnsignedInteger
& i )
const
;
101
106
void
decrement
(
UnsignedInteger
& i )
const
;
107
112
UnsignedInteger
next
(
UnsignedIntegerParamType
i )
const
;
113
118
UnsignedInteger
previous
(
UnsignedIntegerParamType
i )
const
;
119
125
UnsignedInteger
cast
(
IntegerParamType
i )
const
;
126
135
bool
less
(
UnsignedIntegerParamType
i,
UnsignedIntegerParamType
j )
const
;
136
144
UnsignedInteger
posDiff
(
UnsignedIntegerParamType
j,
UnsignedIntegerParamType
i )
const
;
145
146
public
:
151
void
selfDisplay
( std::ostream & out )
const
;
152
157
bool
isValid
()
const
;
158
159
// ------------------------- Private Data --------------------------------
160
private
:
164
UnsignedInteger
k
;
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)
DGtal::ModuloComputer
implements basic functions on modular arithmetic.
Definition
ModuloComputer.h:80
DGtal::ModuloComputer::Integer
TInteger Integer
Definition
ModuloComputer.h:82
DGtal::ModuloComputer::decrement
void decrement(UnsignedInteger &i) const
DGtal::ModuloComputer::previous
UnsignedInteger previous(UnsignedIntegerParamType i) const
DGtal::ModuloComputer::IntegerParamType
NumberTraits< Integer >::ParamType IntegerParamType
Definition
ModuloComputer.h:83
DGtal::ModuloComputer::isValid
bool isValid() const
DGtal::ModuloComputer::increment
void increment(UnsignedInteger &i) const
DGtal::ModuloComputer::UnsignedInteger
NumberTraits< TInteger >::UnsignedVersion UnsignedInteger
Definition
ModuloComputer.h:85
DGtal::ModuloComputer::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::ModuloComputer::posDiff
UnsignedInteger posDiff(UnsignedIntegerParamType j, UnsignedIntegerParamType i) const
DGtal::ModuloComputer::UnsignedIntegerParamType
NumberTraits< UnsignedInteger >::ParamType UnsignedIntegerParamType
Definition
ModuloComputer.h:86
DGtal::ModuloComputer::next
UnsignedInteger next(UnsignedIntegerParamType i) const
DGtal::ModuloComputer::operator=
ModuloComputer & operator=(const ModuloComputer &other)
DGtal::ModuloComputer::k
UnsignedInteger k
Definition
ModuloComputer.h:164
DGtal::ModuloComputer::ModuloComputer
ModuloComputer(UnsignedIntegerParamType m)
DGtal::ModuloComputer::cast
UnsignedInteger cast(IntegerParamType i) const
DGtal::ModuloComputer::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CInteger< Integer >))
DGtal::ModuloComputer::ModuloComputer
ModuloComputer()
DGtal::ModuloComputer::less
bool less(UnsignedIntegerParamType i, UnsignedIntegerParamType j) const
DGtal::ModuloComputer::ModuloComputer
ModuloComputer(const ModuloComputer &other)
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal::NumberTraitsImpl< std::decay< T >::type >::UnsignedVersion
T UnsignedVersion
Definition
NumberTraits.h:90
DGtal::NumberTraitsImpl< std::decay< T >::type >::ParamType
boost::call_traits< T >::param_type ParamType
Definition
NumberTraits.h:96
DGtal::concepts::CInteger
Aim: Concept checking for Integer Numbers. More precisely, this concept is a refinement of both CEucl...
Definition
CInteger.h:88
src
DGtal
arithmetic
ModuloComputer.h
Generated on
for DGtal by
1.18.0