DGtal  1.5.beta
CPositiveIrreducibleFraction.h
1 
17 #pragma once
18 
31 #if defined(CPositiveIrreducibleFraction_RECURSES)
32 #error Recursive header files inclusion detected in CPositiveIrreducibleFraction.h
33 #else // defined(CPositiveIrreducibleFraction_RECURSES)
35 #define CPositiveIrreducibleFraction_RECURSES
36 
37 #if !defined CPositiveIrreducibleFraction_h
39 #define CPositiveIrreducibleFraction_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <vector>
45 #include "DGtal/base/CBackInsertable.h"
46 #include "DGtal/base/CConstSinglePassRange.h"
47 #include "DGtal/kernel/CInteger.h"
49 
50 namespace DGtal
51 {
52 
53  namespace concepts
54  {
55 
57 // class CPositiveIrreducibleFraction
160 template <typename T>
163 
164 {
165  // ----------------------- Concept checks ------------------------------
166 public:
167  typedef typename T::Integer Integer;
168  typedef typename T::Quotient Quotient;
169  typedef typename T::value_type value_type;
170  typedef typename T::Value Value;
171  typedef typename T::ConstIterator ConstIterator;
172  typedef typename T::const_iterator const_iterator;
173 
176  BOOST_STATIC_ASSERT(( concepts::ConceptUtils::SameType<value_type, std::pair<Quotient,Quotient> >::value ));
178 
180  {
182  myX.push_back( myValue );
183  myX.pushBack( myValue );
185  }
187  {
199  concepts::ConceptUtils::sameType( myX, myX.previousPartial() );
203  myX.getSplit( myF1, myF2 );
204  myX.getSplitBerstel( myF1, myN1, myF2, myN2 );
205  myX.getCFrac( myQuots );
215  }
216  // ------------------------- Private Datas --------------------------------
217 private:
218  T myX; // do not require T to be default constructible.
219  T myY; // do not require T to be default constructible.
223  bool myBool;
224  mutable Quotient myN1;
225  mutable Quotient myN2;
226  mutable T myF1;
227  mutable T myF2;
228  mutable std::vector<Quotient> myQuots;
229  std::pair<Quotient,Quotient> myValue;
231  // ------------------------- Internals ------------------------------------
232 private:
233 
234 }; // end of concept CPositiveIrreducibleFraction
235 
236 } // namespace concepts
237 
238 } // namespace DGtal
239 
240 // //
242 
243 #endif // !defined CPositiveIrreducibleFraction_h
244 
245 #undef CPositiveIrreducibleFraction_RECURSES
246 #endif // else defined(CPositiveIrreducibleFraction_RECURSES)
MyDigitalSurface::ConstIterator ConstIterator
void sameType(const T &, const T &)
Definition: ConceptUtils.h:117
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: Represents types for which a std::back_insert_iterator can be constructed with std::back_inserte...
Aim: Defines the concept describing a const single pass range.
Aim: Concept checking for Integer Numbers. More precisely, this concept is a refinement of both CEucl...
Definition: CInteger.h:88
Aim: Defines positive irreducible fractions, i.e. fraction p/q, p and q non-negative integers,...
BOOST_CONCEPT_ASSERT((concepts::CInteger< Integer >))
BOOST_CONCEPT_ASSERT((concepts::CInteger< Quotient >))
BOOST_STATIC_ASSERT((concepts::ConceptUtils::SameType< value_type, Value >::value))
BOOST_STATIC_ASSERT((concepts::ConceptUtils::SameType< value_type, std::pair< Quotient, Quotient > >::value))
Go to http://www.sgi.com/tech/stl/Assignable.html.
Definition: Boost.dox:32
Go to http://www.sgi.com/tech/stl/CopyConstructible.html.
Definition: Boost.dox:34
Go to http://www.sgi.com/tech/stl/DefaultConstructible.html.
Definition: Boost.dox:30