DGtal 1.3.0
Loading...
Searching...
No Matches
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/Common.h"
46#include "DGtal/base/CBackInsertable.h"
47#include "DGtal/base/CConstSinglePassRange.h"
48#include "DGtal/kernel/CInteger.h"
50
51namespace DGtal
52{
53
54 namespace concepts
55 {
56
58// class CPositiveIrreducibleFraction
161template <typename T>
164
165{
166 // ----------------------- Concept checks ------------------------------
167public:
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 --------------------------------
218private:
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 ------------------------------------
233private:
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)
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