DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
CStack.h
1
16
17
#pragma once
18
30
31
#if defined(CStack_RECURSES)
32
#error Recursive header files inclusion detected in CStack.h
33
#else
// defined(CStack_RECURSES)
35
#define CStack_RECURSES
36
37
#if !defined CStack_h
39
#define CStack_h
40
42
// Inclusions
43
#include <iostream>
44
#include "DGtal/base/Common.h"
45
#include "DGtal/base/ConceptUtils.h"
47
48
namespace
DGtal
49
{
50
namespace
concepts
51
{
53
// class CStack
90
template
<
typename
T>
91
struct
CStack
:
boost::CopyConstructible
<T>,
boost::Assignable
<T>
92
{
93
// ----------------------- Concept checks ------------------------------
94
public
:
95
typedef
typename
T::value_type
Value
;
96
typedef
typename
T::size_type
Size
;
97
98
BOOST_CONCEPT_USAGE
(
CStack
)
99
{
100
concepts::ConceptUtils::sameType
(
myV
,
myX
.top() );
101
myX
.push(
myV
);
102
myX
.pop();
103
104
// check const methods.
105
checkConstConstraints
();
106
}
107
void
checkConstConstraints
()
const
108
{
109
concepts::ConceptUtils::sameType
(
myS
,
myX
.size() );
110
concepts::ConceptUtils::sameType
(
myB
,
myX
.empty() );
111
concepts::ConceptUtils::sameType
(
myV
,
myX
.top() );
112
}
113
// ------------------------- Private Data --------------------------------
114
private
:
115
T
myX
;
// do not require T to be default constructible.
116
Value
myV
;
117
Size
myS
;
118
bool
myB
;
119
120
};
// end of concept CStack
121
}
//namespace concepts
122
}
// namespace DGtal
123
124
// //
126
127
#endif
// !defined CStack_h
128
129
#undef CStack_RECURSES
130
#endif
// else defined(CStack_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::CStack
Aim: This concept gathers classes that provide a stack interface.
Definition
CStack.h:92
DGtal::concepts::CStack::myV
Value myV
Definition
CStack.h:116
DGtal::concepts::CStack::Size
T::size_type Size
Definition
CStack.h:96
DGtal::concepts::CStack::myB
bool myB
Definition
CStack.h:118
DGtal::concepts::CStack::myS
Size myS
Definition
CStack.h:117
DGtal::concepts::CStack::myX
T myX
Definition
CStack.h:115
DGtal::concepts::CStack::checkConstConstraints
void checkConstConstraints() const
Definition
CStack.h:107
DGtal::concepts::CStack::Value
T::value_type Value
Definition
CStack.h:95
DGtal::concepts::CStack::BOOST_CONCEPT_USAGE
BOOST_CONCEPT_USAGE(CStack)
Definition
CStack.h:98
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
base
CStack.h
Generated on
for DGtal by
1.18.0