klao@962: /* -*- C++ -*- klao@962: * klao@962: * src/lemon/undir_graph_extender.h - Part of LEMON, a generic C++ klao@962: * optimization library klao@962: * klao@962: * Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi klao@962: * Kutatocsoport (Egervary Combinatorial Optimization Research Group, 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: klao@962: // FIXME: Marci use opposite logic in his graph wrappers. It would klao@962: // be reasonable to syncronize... klao@962: bool forward; klao@962: klao@962: public: klao@962: Edge() {} klao@962: /// Construct a direct edge from undirect edge and a direction. klao@962: Edge(const UndirEdge &ue, bool _forward) : klao@962: UndirEdge(ue), forward(_forward) {} klao@962: /// Invalid edge constructor klao@962: Edge(Invalid i) : UndirEdge(i), forward(false) {} 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