The graph adadptors can be alteration observed.
In most cases it uses the adapted graph alteration notifiers.
Only special case is now the UndirGraphAdaptor, where
we have to proxy the signals from the graph.
The SubBidirGraphAdaptor is removed, because it doest not
gives more feature than the EdgeSubGraphAdaptor<UndirGraphAdaptor<Graph>>.
The ResGraphAdaptor is based on this composition.
3 * This file is a part of LEMON, a generic C++ optimization library
5 * Copyright (C) 2003-2006
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
19 #include <lemon/concept_check.h>
20 #include <lemon/concept/maps.h>
21 #include <lemon/maps.h>
23 #include "test_tools.h"
25 using namespace lemon;
26 using namespace lemon::concept;
33 typedef A argument_type;
34 typedef B result_type;
36 B operator()(const A &) const {return B();}
39 int func(A) {return 3;}
41 int binc(int, B) {return 4;}
43 typedef ReadMap<A,double> DoubleMap;
46 { // checking graph components
48 checkConcept<ReadMap<A,B>, ReadMap<A,B> >();
49 checkConcept<WriteMap<A,B>, WriteMap<A,B> >();
50 checkConcept<ReadWriteMap<A,B>, ReadWriteMap<A,B> >();
51 checkConcept<ReferenceMap<A,B,B&,const B&>, ReferenceMap<A,B,B&,const B&> >();
53 checkConcept<ReadMap<A,double>, AddMap<DoubleMap,DoubleMap> >();
54 checkConcept<ReadMap<A,double>, SubMap<DoubleMap,DoubleMap> >();
55 checkConcept<ReadMap<A,double>, MulMap<DoubleMap,DoubleMap> >();
56 checkConcept<ReadMap<A,double>, DivMap<DoubleMap,DoubleMap> >();
57 checkConcept<ReadMap<A,double>, NegMap<DoubleMap> >();
58 checkConcept<ReadMap<A,double>, AbsMap<DoubleMap> >();
59 checkConcept<ReadMap<A,double>, ShiftMap<DoubleMap> >();
60 checkConcept<ReadMap<A,double>, ScaleMap<DoubleMap> >();
62 checkConcept<ReadMap<B,double>, ComposeMap<DoubleMap,ReadMap<B,A> > >();
64 checkConcept<ReadMap<A,B>, FunctorMap<F, A, B> >();
68 a=mapFunctor(constMap<A,int>(2))(A());
69 check(a==2,"Something is wrong with mapFunctor");
72 b=functorMap(F())[A()];
74 a=functorMap(&func)[A()];
75 check(a==3,"Something is wrong with functorMap");
77 a=combineMap(constMap<B, int, 1>(), identityMap<B>(), &binc)[B()];
78 check(a==4,"Something is wrong with combineMap");
81 std::cout << __FILE__ ": All tests passed.\n";