DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
CBinner.h
1
16
17
#pragma once
18
30
31
#if defined(CBinner_RECURSES)
32
#error Recursive header files inclusion detected in CBinner.h
33
#else
// defined(CBinner_RECURSES)
35
#define CBinner_RECURSES
36
37
#if !defined CBinner_h
39
#define CBinner_h
40
42
// Inclusions
43
#include <iostream>
44
#include <boost/type_traits/is_integral.hpp>
45
#include <boost/type_traits/is_unsigned.hpp>
46
#include "DGtal/base/Common.h"
47
#include "DGtal/kernel/CEuclideanRing.h"
49
50
namespace
DGtal
51
{
52
namespace
concepts
53
{
55
// class CBinner
96
template
<
typename
T>
97
struct
CBinner
:
boost::CopyConstructible
<T>
98
{
99
// ----------------------- Concept checks ------------------------------
100
public
:
101
typedef
typename
T::Quantity
Quantity
;
102
typedef
typename
T::Bin
Bin
;
103
BOOST_CONCEPT_ASSERT
((
CEuclideanRing< Quantity >
));
104
BOOST_STATIC_ASSERT
((
boost::is_integral<Bin>::value
));
105
BOOST_STATIC_ASSERT
((
boost::is_unsigned<Bin>::value
));
106
107
// 2. then check the presence of data members, operators and methods with
108
BOOST_CONCEPT_USAGE
(
CBinner
)
109
{
110
myClone
=
new
T(
myQ
,
myQ
,
myBin
);
111
checkConstConstraints
();
112
}
113
void
checkConstConstraints
()
const
114
{
115
ConceptUtils::sameType
(
myBin
,
myX
(
myQ
) );
116
}
117
// ------------------------- Private Data --------------------------------
118
private
:
119
T
myX
;
// do not require T to be default constructible.
120
Quantity
myQ
;
121
Bin
myBin
;
122
T*
myClone
;
123
124
// ------------------------- Internals ------------------------------------
125
private
:
126
127
};
// end of concept CBinner
128
}
129
}
// namespace DGtal
130
131
// //
133
134
#endif
// !defined CBinner_h
135
136
#undef CBinner_RECURSES
137
#endif
// else defined(CBinner_RECURSES)
DGtal::concepts::ConceptUtils::sameType
void sameType(const T &, const T &)
Definition
ConceptUtils.h:117
DGtal::concepts
Aim: Gathers several functions useful for concept checks.
Definition
CPositiveIrreducibleFraction.h:54
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
DGtal::concepts::CBinner
Aim: Represents an object that places a quantity into a bin, i.e. a functor that associates a natural...
Definition
CBinner.h:98
DGtal::concepts::CBinner::Bin
T::Bin Bin
Definition
CBinner.h:102
DGtal::concepts::CBinner::myQ
Quantity myQ
Definition
CBinner.h:120
DGtal::concepts::CBinner::checkConstConstraints
void checkConstConstraints() const
Definition
CBinner.h:113
DGtal::concepts::CBinner::myClone
T * myClone
Definition
CBinner.h:122
DGtal::concepts::CBinner::myX
T myX
Definition
CBinner.h:119
DGtal::concepts::CBinner::BOOST_CONCEPT_USAGE
BOOST_CONCEPT_USAGE(CBinner)
Definition
CBinner.h:108
DGtal::concepts::CBinner::Quantity
T::Quantity Quantity
Definition
CBinner.h:101
DGtal::concepts::CBinner::BOOST_STATIC_ASSERT
BOOST_STATIC_ASSERT((boost::is_unsigned< Bin >::value))
DGtal::concepts::CBinner::myBin
Bin myBin
Definition
CBinner.h:121
DGtal::concepts::CBinner::BOOST_STATIC_ASSERT
BOOST_STATIC_ASSERT((boost::is_integral< Bin >::value))
DGtal::concepts::CBinner::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((CEuclideanRing< Quantity >))
DGtal::concepts::CEuclideanRing
Aim: Defines the mathematical concept equivalent to a unitary commutative ring with a division operat...
Definition
CEuclideanRing.h:88
boost::CopyConstructible
Go to http://www.sgi.com/tech/stl/CopyConstructible.html.
Definition
Boost.dox:34
boost::is_integral
Go to http://www.boost.org/doc/libs/1_52_0/libs/type_traits/doc/html/index.html.
Definition
Boost.dox:179
boost::is_unsigned
Go to http://www.boost.org/doc/libs/1_52_0/libs/type_traits/doc/html/index.html.
Definition
Boost.dox:183
src
DGtal
math
CBinner.h
Generated on
for DGtal by
1.18.0