diff -r 4b8153513f34 -r ea1fa1bc3f6d lemon/concept/graph_component.h --- a/lemon/concept/graph_component.h Mon Jun 26 15:40:35 2006 +0000 +++ b/lemon/concept/graph_component.h Wed Jun 28 15:06:24 2006 +0000 @@ -458,7 +458,7 @@ /// This class provides beside the core graph features /// core clear functions for the graph structure. /// The most of the base graphs should be conform to this concept. - class ClearableGraphComponent : virtual public BaseGraphComponent { + class BaseClearableGraphComponent : virtual public BaseGraphComponent { public: /// Erase all the Nodes and Edges from the graph. @@ -646,7 +646,7 @@ /// This class provides beside the core graph features /// iterator based iterable interface for the graph structure. - /// This concept is part of the StaticGraphConcept. + /// This concept is part of the GraphConcept. class IterableGraphComponent : virtual public BaseGraphComponent { public: @@ -817,7 +817,7 @@ /// This class provides beside the core graph features /// map interface for the graph structure. - /// This concept is part of the StaticGraphConcept. + /// This concept is part of the GraphConcept. class MappableGraphComponent : virtual public BaseGraphComponent { public: @@ -930,86 +930,160 @@ }; }; - /// \brief An empty extendable extended graph class. - /// - /// This class provides beside the core graph features - /// item addition interface for the graph structure. - /// The difference between this class and the - /// \c BaseExtendableGraphComponent is that it should - /// notify the item alteration observers. - class ExtendableGraphComponent : virtual public BaseGraphComponent { + +// /// Skeleton class which describes an edge with direction in \ref +// /// UGraph "undirected graph". + template + class UGraphEdge : public UGraph::UEdge { + typedef typename UGraph::UEdge UEdge; + typedef typename UGraph::Node Node; public: - typedef ExtendableGraphComponent Graph; + /// \e + UGraphEdge() {} - typedef BaseGraphComponent::Node Node; - typedef BaseGraphComponent::Edge Edge; + /// \e + UGraphEdge(const UGraphEdge& e) : UGraph::UEdge(e) {} - /// \brief Add a node to the graph. + /// \e + UGraphEdge(Invalid) {} + + /// \brief Directed edge from undirected edge and a source node. /// - /// Add a node to the graph and notify the observers. - Node addNode() { - return INVALID; - } - - /// \brief Add an edge to the graph. + /// Constructs a directed edge from undirected edge and a source node. /// - /// Add an edge to the graph and notify the observers. - Edge addEdge(const Node&, const Node&) { - return INVALID; + /// \note You have to specify the graph for this constructor. + UGraphEdge(const UGraph &g, + UEdge u_edge, Node n) { + ignore_unused_variable_warning(u_edge); + ignore_unused_variable_warning(g); + ignore_unused_variable_warning(n); } - template + /// \e + UGraphEdge& operator=(UGraphEdge) { return *this; } + + /// \e + bool operator==(UGraphEdge) const { return true; } + /// \e + bool operator!=(UGraphEdge) const { return false; } + + /// \e + bool operator<(UGraphEdge) const { return false; } + + template struct Constraints { void constraints() { - checkConcept(); - typename _Graph::Node node_a, node_b; - node_a = graph.addNode(); - node_b = graph.addNode(); - typename _Graph::Edge edge; - edge = graph.addEdge(node_a, node_b); + const_constraints(); } - _Graph& graph; + void const_constraints() const { + /// \bug This should be is_base_and_derived ... + UEdge ue = e; + ue = e; + + Edge e_with_source(graph,ue,n); + ignore_unused_variable_warning(e_with_source); + } + Edge e; + UEdge ue; + UGraph graph; + Node n; }; }; + - /// \brief An empty erasable extended graph class. - /// - /// This class provides beside the core graph features - /// item erase interface for the graph structure. - /// The difference between this class and the - /// \c BaseErasableGraphComponent is that it should - /// notify the item alteration observers. - class ErasableGraphComponent : virtual public BaseGraphComponent { - public: + struct BaseIterableUGraphConcept { - typedef ErasableGraphComponent Graph; + template + struct Constraints { - typedef BaseGraphComponent::Node Node; - typedef BaseGraphComponent::Edge Edge; + typedef typename Graph::UEdge UEdge; + typedef typename Graph::Edge Edge; + typedef typename Graph::Node Node; - /// \brief Erase the Node and notify the node alteration observers. - /// - /// Erase the Node and notify the node alteration observers. - void erase(const Node&) {} + void constraints() { + checkConcept(); + checkConcept, UEdge>(); + //checkConcept, Edge>(); - /// \brief Erase the Edge and notify the edge alteration observers. - /// - /// Erase the Edge and notify the edge alteration observers. - void erase(const Edge&) {} + graph.first(ue); + graph.next(ue); - template + const_constraints(); + } + void const_constraints() { + Node n; + n = graph.target(ue); + n = graph.source(ue); + n = graph.oppositeNode(n0, ue); + + bool b; + b = graph.direction(e); + Edge e = graph.direct(UEdge(), true); + e = graph.direct(UEdge(), n); + + ignore_unused_variable_warning(b); + } + + Graph graph; + Edge e; + Node n0; + UEdge ue; + }; + + }; + + + struct IterableUGraphConcept { + + template struct Constraints { void constraints() { - checkConcept(); - typename _Graph::Node node; - graph.erase(node); - typename _Graph::Edge edge; - graph.erase(edge); + /// \todo we don't need the iterable component to be base iterable + /// Don't we really??? + //checkConcept< BaseIterableUGraphConcept, Graph > (); + + checkConcept (); + + typedef typename Graph::UEdge UEdge; + typedef typename Graph::UEdgeIt UEdgeIt; + typedef typename Graph::IncEdgeIt IncEdgeIt; + + checkConcept, UEdgeIt>(); + checkConcept, IncEdgeIt>(); } + }; - _Graph& graph; + }; + + struct MappableUGraphConcept { + + template + struct Constraints { + + struct Dummy { + int value; + Dummy() : value(0) {} + Dummy(int _v) : value(_v) {} + }; + + void constraints() { + checkConcept(); + + typedef typename Graph::template UEdgeMap IntMap; + checkConcept, + IntMap >(); + + typedef typename Graph::template UEdgeMap BoolMap; + checkConcept, + BoolMap >(); + + typedef typename Graph::template UEdgeMap DummyMap; + checkConcept, + DummyMap >(); + } }; + }; }