DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
CMetricSpace.h
1
16
17
#pragma once
18
30
31
#if defined(CMetricSpace_RECURSES)
32
#error Recursive header files inclusion detected in CMetricSpace.h
33
#else
// defined(CMetricSpace_RECURSES)
35
#define CMetricSpace_RECURSES
36
37
#if !defined CMetricSpace_h
39
#define CMetricSpace_h
40
42
// Inclusions
43
#include <iostream>
44
#include "DGtal/base/Common.h"
45
#include "DGtal/kernel/CSpace.h"
46
#include "DGtal/base/CQuantity.h"
48
49
namespace
DGtal
50
{
51
namespace
concepts
52
{
53
55
// class CMetricSpace
123
template
<
typename
T>
124
struct
CMetricSpace
:
boost::CopyConstructible
<T>,
boost::Assignable
<T>
125
{
126
// ----------------------- Concept checks ------------------------------
127
public
:
128
typedef
typename
T::Point
Point
;
129
typedef
typename
T::Space
Space
;
130
typedef
typename
T::Value
Value
;
131
typedef
typename
T::RawValue
RawValue
;
132
133
BOOST_CONCEPT_ASSERT
((
CSpace< Space >
));
134
BOOST_CONCEPT_ASSERT
((
CQuantity< Value >
));
135
BOOST_CONCEPT_ASSERT
((
CQuantity< RawValue >
));
136
137
BOOST_CONCEPT_USAGE
(
CMetricSpace
)
138
{
139
checkConstConstraints
();
140
}
141
142
void
checkConstConstraints
()
const
143
{
144
// const method dummyConst should take parameter myA of type A and return
145
// something of type B
146
ConceptUtils::sameType
(
myValue
,
myX
.operator()(
myPoint
,
myPoint2
) );
147
ConceptUtils::sameType
(
myRawValue
,
myX
.rawDistance(
myPoint
,
myPoint2
) );
148
ConceptUtils::sameType
(
myClosest
,
myX
.closest(
myPoint
,
myPoint2
,
myPoint3
) );
149
}
150
// ------------------------- Private Data --------------------------------
151
private
:
152
T
myX
;
// do not require T to be default constructible.
153
Point
myPoint
,
myPoint2
,
myPoint3
;
154
Value
myValue
;
155
RawValue
myRawValue
;
156
DGtal::Closest
myClosest
;
157
// ------------------------- Internals ------------------------------------
158
private
:
159
160
};
// end of concept CMetricSpace
161
}
//namespace concept
162
}
// namespace DGtal
163
164
// //
166
167
#endif
// !defined CMetricSpace_h
168
169
#undef CMetricSpace_RECURSES
170
#endif
// else defined(CMetricSpace_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::Closest
Closest
Definition
Common.h:129
DGtal::concepts::CMetricSpace
Aim: defines the concept of metric spaces.
Definition
CMetricSpace.h:125
DGtal::concepts::CMetricSpace::myX
T myX
Definition
CMetricSpace.h:152
DGtal::concepts::CMetricSpace::myPoint
Point myPoint
Definition
CMetricSpace.h:153
DGtal::concepts::CMetricSpace::Point
T::Point Point
Definition
CMetricSpace.h:128
DGtal::concepts::CMetricSpace::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((CQuantity< RawValue >))
DGtal::concepts::CMetricSpace::myClosest
DGtal::Closest myClosest
Definition
CMetricSpace.h:156
DGtal::concepts::CMetricSpace::RawValue
T::RawValue RawValue
Definition
CMetricSpace.h:131
DGtal::concepts::CMetricSpace::myPoint2
Point myPoint2
Definition
CMetricSpace.h:153
DGtal::concepts::CMetricSpace::BOOST_CONCEPT_USAGE
BOOST_CONCEPT_USAGE(CMetricSpace)
Definition
CMetricSpace.h:137
DGtal::concepts::CMetricSpace::myValue
Value myValue
Definition
CMetricSpace.h:154
DGtal::concepts::CMetricSpace::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((CQuantity< Value >))
DGtal::concepts::CMetricSpace::myPoint3
Point myPoint3
Definition
CMetricSpace.h:153
DGtal::concepts::CMetricSpace::Space
T::Space Space
Definition
CMetricSpace.h:129
DGtal::concepts::CMetricSpace::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((CSpace< Space >))
DGtal::concepts::CMetricSpace::checkConstConstraints
void checkConstConstraints() const
Definition
CMetricSpace.h:142
DGtal::concepts::CMetricSpace::myRawValue
RawValue myRawValue
Definition
CMetricSpace.h:155
DGtal::concepts::CMetricSpace::Value
T::Value Value
Definition
CMetricSpace.h:130
DGtal::concepts::CQuantity
Aim: defines the concept of quantity in DGtal.
Definition
CQuantity.h:93
DGtal::concepts::CSpace
Aim: Defines the concept describing a digital space, ie a cartesian product of integer lines.
Definition
CSpace.h:106
boost::Assignable
Go to http://www.sgi.com/tech/stl/Assignable.html.
Definition
Boost.dox:32
boost::CopyConstructible
Go to http://www.sgi.com/tech/stl/CopyConstructible.html.
Definition
Boost.dox:34
src
DGtal
geometry
volumes
distance
CMetricSpace.h
Generated on
for DGtal by
1.18.0