alpar@919: /* -*- C++ -*- alpar@921: * src/lemon/sym_map.h - Part of LEMON, a generic C++ optimization library alpar@919: * alpar@919: * Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport alpar@919: * (Egervary Combinatorial Optimization Research Group, EGRES). alpar@919: * alpar@919: * Permission to use, modify and distribute this software is granted alpar@919: * provided that this copyright notice appears in all copies. For alpar@919: * precise terms see the accompanying LICENSE file. alpar@919: * alpar@919: * This software is provided "AS IS" with no warranty of any kind, alpar@919: * express or implied, and with no claim as to its suitability for any alpar@919: * purpose. alpar@919: * alpar@919: */ alpar@919: alpar@921: #ifndef LEMON_SYM_MAP_H alpar@921: #define LEMON_SYM_MAP_H alpar@919: alpar@919: ///\ingroup graphmaps alpar@919: ///\file alpar@919: ///\brief Graph maps that construates and destruates alpar@919: ///their elements dynamically. alpar@919: alpar@921: namespace lemon { alpar@919: alpar@919: /// \addtogroup graphmaps alpar@919: /// @{ alpar@919: alpar@919: /** The SymEdgeIt is wrapper class for the EdgeIt. It can be used to alpar@919: * iterate on the symmetric maps when all of the edge - reverse edge pair alpar@919: * has different parity. alpar@919: */ alpar@919: alpar@919: alpar@919: template alpar@919: class SymEdgeIt : public EdgeIt { alpar@919: public: alpar@919: alpar@919: /** Default constructor. alpar@919: */ alpar@919: SymEdgeIt() alpar@919: : EdgeIt() {} alpar@919: alpar@919: /** Graph initialized constructor. alpar@919: */ alpar@919: SymEdgeIt(const Graph& graph) alpar@919: : EdgeIt(graph) { alpar@919: while ( (EdgeIt::n & 1) && EdgeIt::n != -1) { alpar@919: EdgeIt::operator++(); alpar@919: } alpar@919: } alpar@919: alpar@919: /** Creating invelid SymEdgeIt. alpar@919: */ alpar@919: SymEdgeIt(Invalid invalid) alpar@919: : EdgeIt(invalid) {} alpar@919: alpar@919: /** SymEdgeIt from the given Edge. alpar@919: */ alpar@919: SymEdgeIt(const Graph& graph, const Edge& edge) alpar@919: : EdgeIt(graph, edge) { alpar@919: while ( (EdgeIt::n & 1) && EdgeIt::n != -1) { alpar@919: EdgeIt::operator++(); alpar@919: } alpar@919: } alpar@919: alpar@919: /** Increase operator. alpar@919: */ alpar@919: SymEdgeIt& operator++() { alpar@919: EdgeIt::operator++(); alpar@919: while ( (EdgeIt::n & 1) && EdgeIt::n != -1) { alpar@919: EdgeIt::operator++(); alpar@919: } alpar@919: return *this; alpar@919: } alpar@919: }; alpar@919: alpar@919: /** The SymMap template class is graph map structure what alpar@919: * wraps an other map structure to use as symmetric map structure. alpar@919: * alpar@919: * The template parameter is the MapRegistry that the maps alpar@919: * will belong to and the ValueType. alpar@919: */ alpar@919: template