DGtal  1.3.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)
34 
35 #define CPositiveIrreducibleFraction_RECURSES
36 
37 #if !defined CPositiveIrreducibleFraction_h
38 
39 #define CPositiveIrreducibleFraction_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <vector>
45 #include "DGtal/base/Common.h"
46 #include "DGtal/base/CBackInsertable.h"
47 #include "DGtal/base/CConstSinglePassRange.h"
48 #include "DGtal/kernel/CInteger.h"
50 
51 namespace DGtal
52 {
53 
54  namespace concepts
55  {
56 
58 // class CPositiveIrreducibleFraction
161 template <typename T>
164 
165 {
166  // ----------------------- Concept checks ------------------------------
167 public:
168  typedef typename T::Integer Integer;
169  typedef typename T::Quotient Quotient;
170  typedef typename T::value_type value_type;
171  typedef typename T::Value Value;
172  typedef typename T::ConstIterator ConstIterator;
173  typedef typename T::const_iterator const_iterator;
174 
177  BOOST_STATIC_ASSERT(( concepts::ConceptUtils::SameType<value_type, std::pair<Quotient,Quotient> >::value ));
179 
181  {
183  myX.push_back( myValue );
184  myX.pushBack( myValue );
186  }
188  {
200  concepts::ConceptUtils::sameType( myX, myX.previousPartial() );
204  myX.getSplit( myF1, myF2 );
205  myX.getSplitBerstel( myF1, myN1, myF2, myN2 );
206  myX.getCFrac( myQuots );
216  }
217  // ------------------------- Private Datas --------------------------------
218 private:
219  T myX; // do not require T to be default constructible.
220  T myY; // do not require T to be default constructible.
224  bool myBool;
225  mutable Quotient myN1;
226  mutable Quotient myN2;
227  mutable T myF1;
228  mutable T myF2;
229  mutable std::vector<Quotient> myQuots;
230  std::pair<Quotient,Quotient> myValue;
232  // ------------------------- Internals ------------------------------------
233 private:
234 
235 }; // end of concept CPositiveIrreducibleFraction
236 
237 } // namespace concepts
238 
239 } // namespace DGtal
240 
241 // //
243 
244 #endif // !defined CPositiveIrreducibleFraction_h
245 
246 #undef CPositiveIrreducibleFraction_RECURSES
247 #endif // else defined(CPositiveIrreducibleFraction_RECURSES)
boost::DefaultConstructible
Go to http://www.sgi.com/tech/stl/DefaultConstructible.html.
Definition: Boost.dox:30
ConstIterator
MyDigitalSurface::ConstIterator ConstIterator
Definition: greedy-plane-segmentation-ex2.cpp:93
DGtal::concepts::CPositiveIrreducibleFraction::Integer
T::Integer Integer
Definition: CPositiveIrreducibleFraction.h:168
DGtal::concepts::CPositiveIrreducibleFraction::BOOST_STATIC_ASSERT
BOOST_STATIC_ASSERT((concepts::ConceptUtils::SameType< value_type, std::pair< Quotient, Quotient > >::value))
DGtal::concepts::CInteger
Aim: Concept checking for Integer Numbers. More precisely, this concept is a refinement of both CEucl...
Definition: CInteger.h:87
DGtal::concepts::CBackInsertable
Aim: Represents types for which a std::back_insert_iterator can be constructed with std::back_inserte...
Definition: CBackInsertable.h:95
DGtal::concepts::CPositiveIrreducibleFraction::myIterator
ConstIterator myIterator
Definition: CPositiveIrreducibleFraction.h:231
DGtal::concepts::CPositiveIrreducibleFraction::Quotient
T::Quotient Quotient
Definition: CPositiveIrreducibleFraction.h:169
DGtal::concepts::CPositiveIrreducibleFraction::myP
Integer myP
Definition: CPositiveIrreducibleFraction.h:221
DGtal::concepts::CPositiveIrreducibleFraction::value_type
T::value_type value_type
Definition: CPositiveIrreducibleFraction.h:170
DGtal::concepts::CPositiveIrreducibleFraction::myF1
T myF1
Definition: CPositiveIrreducibleFraction.h:227
DGtal::concepts::CPositiveIrreducibleFraction::myValue
std::pair< Quotient, Quotient > myValue
Definition: CPositiveIrreducibleFraction.h:230
DGtal::concepts::CPositiveIrreducibleFraction::myY
T myY
Definition: CPositiveIrreducibleFraction.h:220
DGtal::concepts::CPositiveIrreducibleFraction::myF2
T myF2
Definition: CPositiveIrreducibleFraction.h:228
DGtal::concepts::CPositiveIrreducibleFraction::myX
T myX
Definition: CPositiveIrreducibleFraction.h:219
DGtal::concepts::CPositiveIrreducibleFraction::myQuots
std::vector< Quotient > myQuots
Definition: CPositiveIrreducibleFraction.h:229
DGtal::concepts::CPositiveIrreducibleFraction::ConstIterator
T::ConstIterator ConstIterator
Definition: CPositiveIrreducibleFraction.h:172
DGtal::concepts::CPositiveIrreducibleFraction::myN2
Quotient myN2
Definition: CPositiveIrreducibleFraction.h:226
DGtal::concepts::CConstSinglePassRange
Aim: Defines the concept describing a const single pass range.
Definition: CConstSinglePassRange.h:92
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
boost::CopyConstructible
Go to http://www.sgi.com/tech/stl/CopyConstructible.html.
Definition: Boost.dox:34
DGtal::concepts::CPositiveIrreducibleFraction
Aim: Defines positive irreducible fractions, i.e. fraction p/q, p and q non-negative integers,...
Definition: CPositiveIrreducibleFraction.h:162
DGtal::concepts::CPositiveIrreducibleFraction::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CInteger< Integer >))
DGtal::concepts::ConceptUtils::sameType
void sameType(const T &, const T &)
Definition: ConceptUtils.h:117
DGtal::concepts::ConceptUtils::SameType
Definition: ConceptUtils.h:106
DGtal::concepts::CPositiveIrreducibleFraction::myQ
Integer myQ
Definition: CPositiveIrreducibleFraction.h:222
Integer
Point::Coordinate Integer
Definition: examplePlaneProbingParallelepipedEstimator.cpp:44
DGtal::concepts::CPositiveIrreducibleFraction::myU
Quotient myU
Definition: CPositiveIrreducibleFraction.h:223
DGtal::concepts::CPositiveIrreducibleFraction::Value
T::Value Value
Definition: CPositiveIrreducibleFraction.h:171
DGtal::concepts::CPositiveIrreducibleFraction::BOOST_CONCEPT_USAGE
BOOST_CONCEPT_USAGE(CPositiveIrreducibleFraction)
Definition: CPositiveIrreducibleFraction.h:180
DGtal::concepts::CPositiveIrreducibleFraction::checkConstConstraints
void checkConstConstraints() const
Definition: CPositiveIrreducibleFraction.h:187
DGtal::concepts::CPositiveIrreducibleFraction::myN1
Quotient myN1
Definition: CPositiveIrreducibleFraction.h:225
DGtal::concepts::CPositiveIrreducibleFraction::myBool
bool myBool
Definition: CPositiveIrreducibleFraction.h:224
boost::Assignable
Go to http://www.sgi.com/tech/stl/Assignable.html.
Definition: Boost.dox:32
DGtal::concepts::CPositiveIrreducibleFraction::const_iterator
T::const_iterator const_iterator
Definition: CPositiveIrreducibleFraction.h:173
Value
double Value
Definition: testSimpleRandomAccessRangeFromPoint.cpp:38