klao@962: /* -*- C++ -*- klao@962: * ladanyi@1435: * lemon/undir_graph_extender.h - Part of LEMON, a generic C++ klao@962: * optimization library klao@962: * alpar@1164: * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi alpar@1359: * Kutatocsoport (Egervary Research Group on Combinatorial Optimization, klao@962: * EGRES). klao@962: * klao@962: * Permission to use, modify and distribute this software is granted klao@962: * provided that this copyright notice appears in all copies. For klao@962: * precise terms see the accompanying LICENSE file. klao@962: * klao@962: * This software is provided "AS IS" with no warranty of any kind, klao@962: * express or implied, and with no claim as to its suitability for any klao@962: * purpose. klao@962: * klao@962: */ klao@962: klao@962: #ifndef LEMON_UNDIR_GRAPH_EXTENDER_H klao@962: #define LEMON_UNDIR_GRAPH_EXTENDER_H klao@962: klao@962: #include klao@962: klao@962: namespace lemon { klao@962: klao@962: template klao@962: class UndirGraphExtender : public _Base { klao@962: typedef _Base Parent; klao@962: typedef UndirGraphExtender Graph; klao@962: klao@962: public: klao@962: klao@962: typedef typename Parent::Edge UndirEdge; klao@962: typedef typename Parent::Node Node; klao@962: klao@962: class Edge : public UndirEdge { klao@978: friend class UndirGraphExtender; klao@962: klao@962: protected: alpar@1401: // FIXME: Marci use opposite logic in his graph adaptors. It would klao@962: // be reasonable to syncronize... klao@962: bool forward; klao@962: klao@962: Edge(const UndirEdge &ue, bool _forward) : klao@1158: UndirEdge(ue), forward(_forward) {} klao@1158: deba@1627: public: deba@1627: Edge() {} klao@1158: klao@962: /// Invalid edge constructor klao@1053: Edge(Invalid i) : UndirEdge(i), forward(true) {} klao@962: klao@962: bool operator==(const Edge &that) const { klao@962: return forward==that.forward && UndirEdge(*this)==UndirEdge(that); klao@962: } klao@962: bool operator!=(const Edge &that) const { klao@962: return forward!=that.forward || UndirEdge(*this)!=UndirEdge(that); klao@962: } klao@962: bool operator<(const Edge &that) const { klao@962: return forward