DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
testSTLMapToVertexMapAdapter.cpp
Go to the documentation of this file.
1
16
29
31
#include <iostream>
32
#include <vector>
33
#include "DGtal/helpers/StdDefs.h"
34
35
#include "DGtal/base/Common.h"
36
#include "DGtal/graph/CVertexMap.h"
37
#include "DGtal/graph/STLMapToVertexMapAdapter.h"
38
#include <map>
40
41
42
43
using namespace
std
;
44
using namespace
DGtal
;
45
using namespace
DGtal::concepts
;
46
52
54
// Functions for testing class Adjacency.
56
57
bool
testMapToVertexMap
()
58
{
59
typedef
Z2i::Point
Point
;
60
typedef
Z2i::Point
Vertex
;
61
typedef
int
Value
;
62
typedef
map<Vertex, Value>
Map
;
63
typedef
STLMapToVertexMapAdapter<Map>
VertexMap;
64
VertexMap myMap;
65
BOOST_CONCEPT_ASSERT((
CVertexMap<VertexMap>
));
66
myMap.setValue(
Point
(1,1), 10);
67
myMap.setValue(
Point
(2,3), 2);
68
69
return
(myMap(
Point
(1,1)) == 10 && myMap(
Point
(2,3)) == 2);
70
}
71
72
73
75
// Standard services - public :
76
77
int
main
(
int
/*argc*/
,
char
**
/*argv*/
)
78
{
79
trace
.
beginBlock
(
"Testing class STLMapToVertexMapAdapter"
);
80
81
bool
res =
testMapToVertexMap
();
// && ... other tests
82
trace
.
emphase
() << ( res ?
"Passed."
:
"Error."
) << endl;
83
trace
.
endBlock
();
84
return
res ? 0 : 1;
85
}
86
// //
DGtal::STLMapToVertexMapAdapter
Aim: This class adapts any map of the STL to match with the CVertexMap concept.
Definition
STLMapToVertexMapAdapter.h:63
DGtal::Point
DGtal::Trace::beginBlock
void beginBlock(const std::string &keyword="")
DGtal::Trace::emphase
std::ostream & emphase()
DGtal::Trace::endBlock
double endBlock()
DGtal::Z2i::Point
Space::Point Point
Definition
StdDefs.h:95
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::trace
Trace trace
std
STL namespace.
DGtal::Value
DGtal::concepts::CVertexMap
Aim: models of CVertexMap concept implement mapping between graph vertices and values.
Definition
CVertexMap.h:98
Map
std::unordered_map< Cell, CubicalCellData > Map
Definition
testCubicalComplex.cpp:57
main
int main(int, char **)
Definition
testIntegerComputer.cpp:331
testMapToVertexMap
bool testMapToVertexMap()
Definition
testSTLMapToVertexMapAdapter.cpp:57
Vertex
TriMesh::Vertex Vertex
Definition
testTriangulatedSurface.cpp:57
tests
graph
testSTLMapToVertexMapAdapter.cpp
Generated on
for DGtal by
1.18.0