diff -r 289d80c33f04 -r 1a770e9f80b2 src/lemon/undir_graph_extender.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/lemon/undir_graph_extender.h Fri Nov 05 00:31:49 2004 +0000 @@ -0,0 +1,193 @@ +/* -*- C++ -*- + * + * src/lemon/undir_graph_extender.h - Part of LEMON, a generic C++ + * optimization library + * + * Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi + * Kutatocsoport (Egervary Combinatorial Optimization Research Group, + * EGRES). + * + * Permission to use, modify and distribute this software is granted + * provided that this copyright notice appears in all copies. For + * precise terms see the accompanying LICENSE file. + * + * This software is provided "AS IS" with no warranty of any kind, + * express or implied, and with no claim as to its suitability for any + * purpose. + * + */ + +#ifndef LEMON_UNDIR_GRAPH_EXTENDER_H +#define LEMON_UNDIR_GRAPH_EXTENDER_H + +#include + +namespace lemon { + + template + class UndirGraphExtender : public _Base { + typedef _Base Parent; + typedef UndirGraphExtender Graph; + + public: + + typedef typename Parent::Edge UndirEdge; + typedef typename Parent::Node Node; + + class Edge : public UndirEdge { + friend class Graph; + + protected: + // FIXME: Marci use opposite logic in his graph wrappers. It would + // be reasonable to syncronize... + bool forward; + + public: + Edge() {} + /// Construct a direct edge from undirect edge and a direction. + Edge(const UndirEdge &ue, bool _forward) : + UndirEdge(ue), forward(_forward) {} + /// Invalid edge constructor + Edge(Invalid i) : UndirEdge(i), forward(false) {} + + bool operator==(const Edge &that) const { + return forward==that.forward && UndirEdge(*this)==UndirEdge(that); + } + bool operator!=(const Edge &that) const { + return forward!=that.forward || UndirEdge(*this)!=UndirEdge(that); + } + bool operator<(const Edge &that) const { + return forward