COIN-OR::LEMON - Graph Library

Changeset 822:88226d9fe821 in lemon-0.x for src/hugo/list_graph.h


Ignore:
Timestamp:
09/08/04 14:06:45 (20 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1118
Message:

The MapFactories? have been removed from the code because
if we use macros then they increases only the complexity.

The pair iterators of the maps are separeted from the maps.

Some macros and comments has been changed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/hugo/list_graph.h

    r813 r822  
    1414
    1515#include <hugo/map_registry.h>
    16 #include <hugo/default_map_factory.h>
    17 
    18 #include <hugo/sym_map_factory.h>
     16#include <hugo/default_map.h>
     17
     18#include <hugo/sym_map.h>
    1919
    2020#include <hugo/map_defines.h>
     
    8080    class InEdgeIt;
    8181
     82    /// Creating map registries.
    8283    CREATE_MAP_REGISTRIES;
    83     CREATE_MAPS(DefaultMapFactory);
     84    /// Creating node and edge maps.
     85    CREATE_MAPS(DefaultMap);
    8486
    8587  public:
     
    444446    typedef SymListGraph Graph;
    445447
    446     KEEP_NODE_MAP(ListGraph);
    447     KEEP_EDGE_MAP(ListGraph);
    448 
     448    /// Importing maps from the base class ListGraph.
     449    KEEP_MAPS(ListGraph, SymListGraph);
     450
     451    /// Creating symmetric map registry.
    449452    CREATE_SYM_EDGE_MAP_REGISTRY;
    450     CREATE_SYM_EDGE_MAP_FACTORY(DefaultMapFactory);
    451     IMPORT_SYM_EDGE_MAP(SymEdgeMapFactory);
     453    /// Creating symmetric edge map.
     454    CREATE_SYM_EDGE_MAP(DefaultMap);
    452455
    453456    SymListGraph() : ListGraph() { }
     
    530533    class InEdgeIt;
    531534   
    532     CREATE_MAP_REGISTRIES;
    533     CREATE_MAPS(DefaultMapFactory);
     535    /// Creating node map registry.
     536    CREATE_NODE_MAP_REGISTRY;
     537    /// Creating node maps.
     538    CREATE_NODE_MAP(DefaultMap);
     539
     540    /// Creating empty map structure for edges.
     541    template <typename Value>
     542    class EdgeMap {
     543    public:
     544      EdgeMap() {}
     545      EdgeMap(const Graph&) {}
     546      EdgeMap(const Graph&, const Value&) {}
     547
     548      EdgeMap(const EdgeMap&) {}
     549      template <typename CMap> EdgeMap(const CMap&) {}
     550
     551      EdgeMap& operator=(const EdgeMap&) {}
     552      template <typename CMap> EdgeMap& operator=(const CMap&) {}
     553     
     554      class ConstIterator {
     555      public:
     556        bool operator==(const ConstIterator&) {return true;}
     557        bool operator!=(const ConstIterator&) {return false;}
     558      };
     559
     560      typedef ConstIterator Iterator;
     561     
     562      Iterator begin() { return Iterator();}
     563      Iterator end() { return Iterator();}
     564
     565      ConstIterator begin() const { return ConstIterator();}
     566      ConstIterator end() const { return ConstIterator();}
     567
     568    };
    534569   
    535570  public:
     
    849884
    850885
     886    /// Creating edge map registry.
    851887    CREATE_EDGE_MAP_REGISTRY;
    852     CREATE_EDGE_MAP_FACTORY(DefaultMapFactory);
    853     IMPORT_EDGE_MAP(EdgeMapFactory);
     888    /// Creating edge maps.
     889    CREATE_EDGE_MAP(DefaultMap);
     890
     891    /// Importing node maps from the NodeGraphType.
     892    IMPORT_NODE_MAP(NodeGraphType, graph.G, EdgeSet, graph);
    854893   
    855894   
     
    10911130      InEdgeIt &operator++() { n=G->edges[n].next_in; return *this; }
    10921131    };
    1093 
    1094    
    1095     template <typename V> class NodeMap
    1096       : public NodeGraphType::template NodeMap<V>
    1097     {
    1098       //This is a must, the constructors need it.
    1099       typedef typename NodeGraphType::template NodeMap<V> MapImpl;
    1100       typedef V Value;
    1101     public:
    1102       NodeMap() : MapImpl() {}
    1103      
    1104       NodeMap(const EdgeSet& graph)
    1105         : MapImpl(graph.G) { }
    1106 
    1107       NodeMap(const EdgeSet& graph, const Value& value)
    1108         : MapImpl(graph.G, value) { }
    1109 
    1110       NodeMap(const NodeMap& copy)
    1111         : MapImpl(static_cast<const MapImpl&>(copy)) {}
    1112 
    1113       template<typename CMap>
    1114       NodeMap(const CMap& copy)
    1115         : MapImpl(copy) { }
    1116 
    1117       NodeMap& operator=(const NodeMap& copy) {
    1118         MapImpl::operator=(static_cast<const MapImpl&>(copy));
    1119         return *this;
    1120       }
    1121 
    1122       template <typename CMap>
    1123       NodeMap& operator=(const CMap& copy) {
    1124         MapImpl::operator=(copy);
    1125         return *this;
    1126       }
    1127 
    1128     };
     1132   
    11291133  };
    11301134
Note: See TracChangeset for help on using the changeset viewer.