DGtal  1.0.0
testSTLMapToVertexMapAdapter.cpp File Reference
#include <iostream>
#include <vector>
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/base/Common.h"
#include "DGtal/graph/CVertexMap.h"
#include "DGtal/graph/STLMapToVertexMapAdapter.h"
#include <map>
Include dependency graph for testSTLMapToVertexMapAdapter.cpp:

Go to the source code of this file.


bool testMapToVertexMap ()
int main (int, char **)

Detailed Description

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Jérémy Gaillard (jerem.nosp@m.y.ga.nosp@m.illar.nosp@m.d@in.nosp@m.sa-ly.nosp@m.on.f.nosp@m.r ) Institut National des Sciences Appliquées - INSA, France

Functions for testing class STLMapToVertexMapAdapter.

This file is part of the DGtal library.

Definition in file testSTLMapToVertexMapAdapter.cpp.

Function Documentation

◆ main()

int main ( int  ,
char **   

Definition at line 77 of file testSTLMapToVertexMapAdapter.cpp.

78 {
79  trace.beginBlock ( "Testing class STLMapToVertexMapAdapter" );
81  bool res = testMapToVertexMap(); // && ... other tests
82  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
83  trace.endBlock();
84  return res ? 0 : 1;
85 }
void beginBlock(const std::string &keyword="")
Trace trace
Definition: Common.h:144
double endBlock()
std::ostream & emphase()
bool testMapToVertexMap()

References DGtal::Trace::beginBlock(), DGtal::Trace::emphase(), DGtal::Trace::endBlock(), testMapToVertexMap(), and DGtal::trace.

◆ testMapToVertexMap()

bool testMapToVertexMap ( )

This file tests the adaptation of a STL map to a vertex map.

Definition at line 57 of file testSTLMapToVertexMapAdapter.cpp.

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);
69  return (myMap(Point(1,1)) == 10 && myMap(Point(2,3)) == 2);
70 }
std::unordered_map< Cell, CubicalCellData > Map
TriMesh::Vertex Vertex
MyPointD Point
Definition: testClone2.cpp:383
Aim: This class adapts any map of the STL to match with the CVertexMap concept.
Aim: models of CVertexMap concept implement mapping between graph vertices and values.
Definition: CVertexMap.h:96

Referenced by main().