DGtal  0.9.2
Filtered2x2DetComputer.h
1 
17 #pragma once
18 
31 #if defined(Filtered2x2DetComputer_RECURSES)
32 #error Recursive header files inclusion detected in Filtered2x2DetComputer.h
33 #else // defined(Filtered2x2DetComputer_RECURSES)
34 
35 #define Filtered2x2DetComputer_RECURSES
36 
37 #if !defined Filtered2x2DetComputer_h
38 
39 #define Filtered2x2DetComputer_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 
46 #include "DGtal/geometry/tools/determinant/C2x2DetComputer.h"
48 
49 namespace DGtal
50 {
51 
53  // template class Filtered2x2DetComputer
82  template <typename TDetComputer>
84  {
85  // ----------------------- Types ------------------------------------
86  public:
88 
92  typedef typename TDetComputer::ArgumentInteger ArgumentInteger;
93  //NB. TDetComputer should take input coefficients of type float, double or long double
94  //this type must adhere to IEC-559 / IEEE-754 standard.
95  BOOST_STATIC_ASSERT(( std::numeric_limits<ArgumentInteger>::is_iec559 ));
96 
100  typedef ArgumentInteger Integer;
104  typedef ArgumentInteger argument_type;
105 
109  typedef typename TDetComputer::ResultInteger ResultInteger;
113  typedef ResultInteger Value;
117  typedef ResultInteger result_type;
118 
119  // ----------------------- Standard services ------------------------------
120  public:
121 
128  void init(const ArgumentInteger& aA, const ArgumentInteger& aB);
129 
138  ResultInteger operator()(const ArgumentInteger& aX, const ArgumentInteger& aY) const;
139 
149  ResultInteger operator()(const ArgumentInteger& aA, const ArgumentInteger& aB,
150  const ArgumentInteger& aX, const ArgumentInteger& aY);
151 
152  // ----------------------- Interface --------------------------------------
153  public:
154 
159  void selfDisplay ( std::ostream & out ) const;
160 
165  bool isValid() const;
166 
167  // ------------------------- Protected Datas ------------------------------
168  private:
169  // ------------------------- Private Datas --------------------------------
170  private:
171 
176  ArgumentInteger myA;
181  ArgumentInteger myB;
186  mutable TDetComputer myDetComputer;
187 
188  // ------------------------- Internals ------------------------------------
189  private:
190 
191  }; // end of class Filtered2x2DetComputer
192 
193 
200  template <typename T>
201  std::ostream&
202  operator<< ( std::ostream & out, const Filtered2x2DetComputer<T> & object );
203 
204 } // namespace DGtal
205 
206 
208 // Includes inline functions.
209 #include "DGtal/geometry/tools/determinant/Filtered2x2DetComputer.ih"
210 
211 // //
213 
214 #endif // !defined Filtered2x2DetComputer_h
215 
216 #undef Filtered2x2DetComputer_RECURSES
217 #endif // else defined(Filtered2x2DetComputer_RECURSES)
TDetComputer::ResultInteger ResultInteger
void init(const ArgumentInteger &aA, const ArgumentInteger &aB)
ResultInteger operator()(const ArgumentInteger &aX, const ArgumentInteger &aY) const
Aim: This concept gathers all models that are able to compute the (sign of the) determinant of a 2x2 ...
BOOST_STATIC_ASSERT((std::numeric_limits< ArgumentInteger >::is_iec559))
BOOST_CONCEPT_ASSERT((C2x2DetComputer< TDetComputer >))
TDetComputer::ArgumentInteger ArgumentInteger
void selfDisplay(std::ostream &out) const
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: Class that provides a way of computing the sign of the determinant of a 2x2 matrix from its four...