DGtal 1.4.0
Loading...
Searching...
No Matches
testSTLMapToVertexMapAdapter.cpp
Go to the documentation of this file.
1
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
43using namespace std;
44using namespace DGtal;
45using namespace DGtal::concepts;
46
54// Functions for testing class Adjacency.
56
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
77int 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;
84 return res ? 0 : 1;
85}
86// //
Aim: This class adapts any map of the STL to match with the CVertexMap concept.
void beginBlock(const std::string &keyword="")
std::ostream & emphase()
double endBlock()
Aim: Gathers several functions useful for concept checks.
DGtal is the top-level namespace which contains all DGtal functions and types.
Trace trace
Definition Common.h:153
STL namespace.
Aim: models of CVertexMap concept implement mapping between graph vertices and values.
Definition CVertexMap.h:98
int main()
Definition testBits.cpp:56
MyPointD Point
std::unordered_map< Cell, CubicalCellData > Map
bool testMapToVertexMap()
TriMesh::Vertex Vertex