src/lemon/concept/undir_graph.h
author klao
Thu, 25 Nov 2004 14:48:24 +0000
changeset 1021 fd1d073b6557
parent 989 ca95f8b5c931
child 1022 567f392d1d2e
permissions -rw-r--r--
Advances in UndirGraph.
* IterableExtender is complete
     1 /* -*- C++ -*-
     2  *
     3  * src/lemon/concept/undir_graph_component.h - Part of LEMON, a generic
     4  * C++ optimization library
     5  *
     6  * Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi
     7  * Kutatocsoport (Egervary Combinatorial Optimization Research Group,
     8  * EGRES).
     9  *
    10  * Permission to use, modify and distribute this software is granted
    11  * provided that this copyright notice appears in all copies. For
    12  * precise terms see the accompanying LICENSE file.
    13  *
    14  * This software is provided "AS IS" with no warranty of any kind,
    15  * express or implied, and with no claim as to its suitability for any
    16  * purpose.
    17  *
    18  */
    19 
    20 ///\ingroup concept
    21 ///\file
    22 ///\brief Undirected graphs and components of.
    23 
    24 
    25 #ifndef LEMON_CONCEPT_UNDIR_GRAPH_H
    26 #define LEMON_CONCEPT_UNDIR_GRAPH_H
    27 
    28 #include <lemon/concept/graph_component.h>
    29 
    30 namespace lemon {
    31   namespace concept {
    32 
    33     /// \todo to be done
    34     class BaseIterableUndirGraph;
    35 
    36     template <typename Graph>
    37     struct BaseIterableUndirGraphConcept {
    38       typedef typename Graph::UndirEdge UndirEdge;
    39       typedef typename Graph::Edge Edge;
    40       typedef typename Graph::Node Node;
    41 
    42       void constraints() {
    43 	checkConcept<BaseIterableGraphComponent, Graph>();
    44 	checkConcept<GraphItem<'u'>, UndirEdge >();
    45 
    46 	/// \bug this should be base_and_derived:
    47 	UndirEdge ue = e;
    48 	ue = e;
    49 
    50 	Node n;
    51 	n = graph.target(ue);
    52 	n = graph.source(ue);
    53 
    54 	graph.first(ue);
    55 	graph.next(ue);
    56       }
    57       const Graph &graph;
    58       Edge e;
    59     };
    60 
    61     template <typename Graph>
    62     struct IterableUndirGraphConcept {
    63       void constraints() {
    64 	/// \todo we don't need the iterable component should base iterable	
    65 	//	checkConcept< BaseIterableUndirGraph, Graph > ();
    66 	checkConcept< IterableGraphComponent, Graph > ();
    67 
    68 	typedef typename Graph::UndirEdge UndirEdge;
    69 	typedef typename Graph::UndirEdgeIt UndirEdgeIt;
    70 	typedef typename Graph::UndirIncEdgeIt UndirIncEdgeIt;
    71 
    72 	checkConcept< GraphIterator<Graph, UndirEdge>, UndirEdgeIt >();
    73 
    74 	checkConcept<
    75 	  GraphIncIterator<Graph, UndirEdge>,
    76 	  UndirIncEdgeIt >();
    77       }
    78     };
    79 
    80   }
    81 
    82 }
    83 
    84 #endif