DGtal  0.9.2
CCommutativeRing.h
1 
17 #pragma once
18 
33 #if defined(CCommutativeRing_RECURSES)
34 #error Recursive header files inclusion detected in CCommutativeRing.h
35 #else // defined(CCommutativeRing_RECURSES)
36 
37 #define CCommutativeRing_RECURSES
38 
39 #if !defined CCommutativeRing_h
40 
41 #define CCommutativeRing_h
42 
44 // Inclusions
45 #include <iostream>
46 #include "DGtal/base/Common.h"
47 #include "DGtal/kernel/CSignedNumber.h"
48 #include "DGtal/kernel/NumberTraits.h"
50 
51 namespace DGtal
52 {
53  namespace concepts
54  {
56  // class CCommutativeRing
99  template <typename T>
101  {
102  // ----------------------- Concept checks ------------------------------
103  public:
104 
106  {
107  ConceptUtils::sameType( c, T( 25 ) );
108  ConceptUtils::sameType( c, T( -25 ) );
109  ConceptUtils::sameType( c, T( a+b ) );
110  ConceptUtils::sameType( c, T( -a ) );
111  ConceptUtils::sameType( c, T( a-b ) );
112  ConceptUtils::sameType( c, T( a*b ) );
113  ConceptUtils::sameType( c, T( 0 ) );
114  ConceptUtils::sameType( c, T( 1 ) );
115 
117  }
118  // ------------------------- Internals ------------------------------------
119  private:
120  T a,b,c;
121 
122  };
123  }
124 } // namespace DGtal
125 
126 
127 // //
129 
130 #endif // !defined CCommutativeRing_h
131 
132 #undef CCommutativeRing_RECURSES
133 #endif // else defined(CCommutativeRing_RECURSES)
Aim: Defines the mathematical concept equivalent to a unitary commutative ring.
void sameType(const T &t1, const T &t2)
Aim: Concept checking for Signed Numbers. Models of this concept should be listed in NumberTraits cla...
Definition: CSignedNumber.h:97
DGtal is the top-level namespace which contains all DGtal functions and types.