lemon/bits/clearable_graph_extender.h
author deba
Mon, 13 Feb 2006 09:42:53 +0000
changeset 1967 5d81ba873b90
parent 1910 f95eea8c34b0
permissions -rw-r--r--
New algorithm:
MaxCardinalitySearch
MinimalCut // in UGraph
     1 /* -*- C++ -*-
     2  *
     3  * This file is a part of LEMON, a generic C++ optimization library
     4  *
     5  * Copyright (C) 2003-2006
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     8  *
     9  * Permission to use, modify and distribute this software is granted
    10  * provided that this copyright notice appears in all copies. For
    11  * precise terms see the accompanying LICENSE file.
    12  *
    13  * This software is provided "AS IS" with no warranty of any kind,
    14  * express or implied, and with no claim as to its suitability for any
    15  * purpose.
    16  *
    17  */
    18 
    19 #ifndef LEMON_CLEARABLE_GRAPH_EXTENDER_H
    20 #define LEMON_CLEARABLE_GRAPH_EXTENDER_H
    21 
    22 #include <lemon/invalid.h>
    23 
    24 
    25 namespace lemon {
    26 
    27   template <typename _Base> 
    28   class ClearableGraphExtender : public _Base {
    29   public:
    30 
    31     typedef ClearableGraphExtender Graph;
    32     typedef _Base Parent;
    33     typedef typename Parent::Node Node;
    34     typedef typename Parent::Edge Edge;
    35 
    36     void clear() {
    37       Parent::getNotifier(Node()).clear();
    38       Parent::getNotifier(Edge()).clear();
    39       Parent::clear();
    40     }
    41 
    42   };
    43 
    44   template <typename _Base> 
    45   class ClearableEdgeSetExtender : public _Base {
    46   public:
    47 
    48     typedef ClearableEdgeSetExtender Graph;
    49     typedef _Base Parent;
    50     typedef typename Parent::Node Node;
    51     typedef typename Parent::Edge Edge;
    52 
    53     void clear() {
    54       Parent::getNotifier(Edge()).clear();
    55       Parent::clear();
    56     }
    57 
    58   };
    59 
    60   template <typename _Base> 
    61   class ClearableUGraphExtender : public _Base {
    62   public:
    63 
    64     typedef ClearableUGraphExtender Graph;
    65     typedef _Base Parent;
    66     typedef typename Parent::Node Node;
    67     typedef typename Parent::UEdge UEdge;
    68     typedef typename Parent::Edge Edge;
    69 
    70     void clear() {
    71       Parent::getNotifier(Node()).clear();
    72       Parent::getNotifier(UEdge()).clear();
    73       Parent::getNotifier(Edge()).clear();
    74       Parent::clear();
    75     }
    76   };
    77 
    78   template <typename _Base> 
    79   class ClearableUEdgeSetExtender : public _Base {
    80   public:
    81 
    82     typedef ClearableUEdgeSetExtender Graph;
    83     typedef _Base Parent;
    84     typedef typename Parent::Node Node;
    85     typedef typename Parent::UEdge UEdge;
    86     typedef typename Parent::Edge Edge;
    87 
    88     void clear() {
    89       Parent::getNotifier(UEdge()).clear();
    90       Parent::getNotifier(Edge()).clear();
    91       Parent::clear();
    92     }
    93 
    94   };
    95 
    96 
    97   template <typename _Base>
    98   class ClearableBpUGraphExtender : public _Base {
    99   public:
   100 
   101     typedef _Base Parent;
   102     typedef ClearableBpUGraphExtender Graph;
   103 
   104     typedef typename Parent::Node Node;
   105     typedef typename Parent::BNode BNode;
   106     typedef typename Parent::ANode ANode;
   107     typedef typename Parent::Edge Edge;
   108     typedef typename Parent::UEdge UEdge;
   109 
   110     void clear() {
   111       Parent::getNotifier(Edge()).clear();
   112       Parent::getNotifier(UEdge()).clear();
   113       Parent::getNotifier(Node()).clear();
   114       Parent::getNotifier(BNode()).clear();
   115       Parent::getNotifier(ANode()).clear();
   116       Parent::clear();
   117     }
   118 
   119   };
   120 
   121 }
   122 
   123 #endif