COIN-OR::LEMON - Graph Library

Changeset 980:0f1044b7a3af in lemon-0.x for src/lemon/default_map.h


Ignore:
Timestamp:
11/11/04 10:31:55 (19 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1368
Message:

maxNodeId() and maxEdgeId() changed to maxId(Node) and maxId(Edge)
getNodeObserverRegistry() and getEdgeObserverRegistry() changed to
getObserverRegistry(Node) and getObserverRegistry(Edge)

IdMappableGraphExtender? erased

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/default_map.h

    r979 r980  
    4343
    4444
    45   template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap, typename _Value>
     45  template <typename _Graph, typename _Item, typename _ItemIt, typename _Value>
    4646  struct DefaultMapSelector {
    47     typedef ArrayMap<_Graph, _Item, _ItemIt, _IdMap, _Value> Map;
     47    typedef ArrayMap<_Graph, _Item, _ItemIt, _Value> Map;
    4848  };
    4949
    5050  // bool
    51   template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
    52   struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, bool> {
    53     typedef VectorMap<_Graph, _Item, _IdMap, bool> Map;
     51  template <typename _Graph, typename _Item, typename _ItemIt>
     52  struct DefaultMapSelector<_Graph, _Item, _ItemIt, bool> {
     53    typedef VectorMap<_Graph, _Item, bool> Map;
    5454  };
    5555
    5656  // char
    57   template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
    58   struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, char> {
    59     typedef VectorMap<_Graph, _Item, _IdMap, char> Map;
    60   };
    61 
    62   template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
    63   struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, signed char> {
    64     typedef VectorMap<_Graph, _Item, _IdMap, signed char> Map;
    65   };
    66 
    67   template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
    68   struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, unsigned char> {
    69     typedef VectorMap<_Graph, _Item, _IdMap, unsigned char> Map;
     57  template <typename _Graph, typename _Item, typename _ItemIt>
     58  struct DefaultMapSelector<_Graph, _Item, _ItemIt, char> {
     59    typedef VectorMap<_Graph, _Item, char> Map;
     60  };
     61
     62  template <typename _Graph, typename _Item, typename _ItemIt>
     63  struct DefaultMapSelector<_Graph, _Item, _ItemIt, signed char> {
     64    typedef VectorMap<_Graph, _Item, signed char> Map;
     65  };
     66
     67  template <typename _Graph, typename _Item, typename _ItemIt>
     68  struct DefaultMapSelector<_Graph, _Item, _ItemIt, unsigned char> {
     69    typedef VectorMap<_Graph, _Item, unsigned char> Map;
    7070  };
    7171
    7272
    7373  // int
    74   template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
    75   struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, signed int> {
    76     typedef VectorMap<_Graph, _Item, _IdMap, signed int> Map;
    77   };
    78 
    79   template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
    80   struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, unsigned int> {
    81     typedef VectorMap<_Graph, _Item, _IdMap, unsigned int> Map;
     74  template <typename _Graph, typename _Item, typename _ItemIt>
     75  struct DefaultMapSelector<_Graph, _Item, _ItemIt, signed int> {
     76    typedef VectorMap<_Graph, _Item, signed int> Map;
     77  };
     78
     79  template <typename _Graph, typename _Item, typename _ItemIt>
     80  struct DefaultMapSelector<_Graph, _Item, _ItemIt, unsigned int> {
     81    typedef VectorMap<_Graph, _Item, unsigned int> Map;
    8282  };
    8383
    8484
    8585  // short
    86   template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
    87   struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, signed short> {
    88     typedef VectorMap<_Graph, _Item, _IdMap, signed short> Map;
    89   };
    90 
    91   template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
    92   struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, unsigned short> {
    93     typedef VectorMap<_Graph, _Item, _IdMap, unsigned short> Map;
     86  template <typename _Graph, typename _Item, typename _ItemIt>
     87  struct DefaultMapSelector<_Graph, _Item, _ItemIt, signed short> {
     88    typedef VectorMap<_Graph, _Item, signed short> Map;
     89  };
     90
     91  template <typename _Graph, typename _Item, typename _ItemIt>
     92  struct DefaultMapSelector<_Graph, _Item, _ItemIt, unsigned short> {
     93    typedef VectorMap<_Graph, _Item, unsigned short> Map;
    9494  };
    9595
    9696
    9797  // long
    98   template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
    99   struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, signed long> {
    100     typedef VectorMap<_Graph, _Item, _IdMap, signed long> Map;
    101   };
    102 
    103   template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
    104   struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, unsigned long> {
    105     typedef VectorMap<_Graph, _Item, _IdMap, unsigned long> Map;
     98  template <typename _Graph, typename _Item, typename _ItemIt>
     99  struct DefaultMapSelector<_Graph, _Item, _ItemIt, signed long> {
     100    typedef VectorMap<_Graph, _Item, signed long> Map;
     101  };
     102
     103  template <typename _Graph, typename _Item, typename _ItemIt>
     104  struct DefaultMapSelector<_Graph, _Item, _ItemIt, unsigned long> {
     105    typedef VectorMap<_Graph, _Item, unsigned long> Map;
    106106  };
    107107
     
    110110
    111111  // float
    112   template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
    113   struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, float> {
    114     typedef VectorMap<_Graph, _Item, _IdMap, float> Map;
     112  template <typename _Graph, typename _Item, typename _ItemIt>
     113  struct DefaultMapSelector<_Graph, _Item, _ItemIt, float> {
     114    typedef VectorMap<_Graph, _Item, float> Map;
    115115  };
    116116
    117117
    118118  // double
    119   template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
    120   struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, double> {
    121     typedef VectorMap<_Graph, _Item, _IdMap, double> Map;
     119  template <typename _Graph, typename _Item, typename _ItemIt>
     120  struct DefaultMapSelector<_Graph, _Item, _ItemIt, double> {
     121    typedef VectorMap<_Graph, _Item, double> Map;
    122122  };
    123123
    124124
    125125  // long double
    126   template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
    127   struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, long double> {
    128     typedef VectorMap<_Graph, _Item, _IdMap, long double> Map;
     126  template <typename _Graph, typename _Item, typename _ItemIt>
     127  struct DefaultMapSelector<_Graph, _Item, _ItemIt, long double> {
     128    typedef VectorMap<_Graph, _Item, long double> Map;
    129129  };
    130130
    131131
    132132  // pointer
    133   template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap, typename _Ptr>
    134   struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, _Ptr*> {
    135     typedef VectorMap<_Graph, _Item, _IdMap, _Ptr*> Map;
     133  template <typename _Graph, typename _Item, typename _ItemIt, typename _Ptr>
     134  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _Ptr*> {
     135    typedef VectorMap<_Graph, _Item, _Ptr*> Map;
    136136  };
    137137
     
    141141            typename _Item,
    142142            typename _ItemIt,
    143             typename _IdMap,
    144143            typename _Value>
    145   class DefaultMap : public DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, _Value>::Map {
     144  class DefaultMap : public DefaultMapSelector<_Graph, _Item, _ItemIt, _Value>::Map {
    146145  public:
    147     typedef typename DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, _Value>::Map Parent;
    148     typedef DefaultMap<_Graph, _Item, _ItemIt, _IdMap, bool> Map;
     146    typedef typename DefaultMapSelector<_Graph, _Item, _ItemIt, _Value>::Map Parent;
     147    typedef DefaultMap<_Graph, _Item, _ItemIt, _Value> Map;
    149148   
    150149    typedef typename Parent::Graph Graph;
    151     typedef typename Parent::Registry Registry;
    152150    typedef typename Parent::ValueType ValueType;
    153151
    154     DefaultMap(const Graph& _g, Registry& _r) : Parent(_g, _r) {}
    155     DefaultMap(const Graph& _g, Registry& _r, const ValueType& _v) : Parent(_g, _r, _v) {}
     152    DefaultMap(const Graph& _g) : Parent(_g) {}
     153    DefaultMap(const Graph& _g, const ValueType& _v) : Parent(_g, _v) {}
    156154  };
    157155
     
    167165    typedef typename Parent::Node Node;
    168166    typedef typename Parent::NodeIt NodeIt;
    169     typedef typename Parent::NodeIdMap NodeIdMap;
    170     typedef typename Parent::NodeObserverRegistry NodeObserverRegistry;
    171167
    172168    typedef typename Parent::Edge Edge;
    173169    typedef typename Parent::EdgeIt EdgeIt;
    174     typedef typename Parent::EdgeIdMap EdgeIdMap;
    175     typedef typename Parent::EdgeObserverRegistry EdgeObserverRegistry;
    176170
    177171   
    178 
    179172    template <typename _Value>
    180     class NodeMap : public DefaultMap<Graph, Node, NodeIt, NodeIdMap, _Value> {
     173    class NodeMap : public DefaultMap<Graph, Node, NodeIt, _Value> {
    181174    public:
    182175      typedef DefaultMappableGraphExtender<_Base> Graph;
     
    184177      typedef typename Graph::Node Node;
    185178      typedef typename Graph::NodeIt NodeIt;
    186       typedef typename Graph::NodeIdMap NodeIdMap;
    187 
    188       typedef DefaultMap<Graph, Node, NodeIt, NodeIdMap, _Value> Parent;
     179
     180      typedef DefaultMap<Graph, Node, NodeIt, _Value> Parent;
    189181
    190182      //typedef typename Parent::Graph Graph;
    191183      typedef typename Parent::ValueType ValueType;
    192184
    193       NodeMap(const Graph& g)
    194         : Parent(g, g.getNodeObserverRegistry()) {}
    195       NodeMap(const Graph& g, const ValueType& v)
    196         : Parent(g, g.getNodeObserverRegistry(), v) {}
     185      NodeMap(const Graph& _g)
     186        : Parent(_g) {}
     187      NodeMap(const Graph& _g, const ValueType& _v)
     188        : Parent(_g, _v) {}
    197189
    198190    };
    199191
    200192    template <typename _Value>
    201     class EdgeMap : public DefaultMap<Graph, Edge, EdgeIt, EdgeIdMap, _Value> {
     193    class EdgeMap : public DefaultMap<Graph, Edge, EdgeIt, _Value> {
    202194    public:
    203195      typedef DefaultMappableGraphExtender<_Base> Graph;
     
    205197      typedef typename Graph::Edge Edge;
    206198      typedef typename Graph::EdgeIt EdgeIt;
    207       typedef typename Graph::EdgeIdMap EdgeIdMap;
    208 
    209       typedef DefaultMap<Graph, Edge, EdgeIt, EdgeIdMap, _Value> Parent;
     199
     200      typedef DefaultMap<Graph, Edge, EdgeIt, _Value> Parent;
    210201
    211202      //typedef typename Parent::Graph Graph;
    212203      typedef typename Parent::ValueType ValueType;
    213204
    214       EdgeMap(const Graph& g)
    215         : Parent(g, g.getEdgeObserverRegistry()) {}
    216       EdgeMap(const Graph& g, const ValueType& v)
    217         : Parent(g, g.getEdgeObserverRegistry(), v) {}
     205      EdgeMap(const Graph& _g)
     206        : Parent(_g) {}
     207      EdgeMap(const Graph& _g, const ValueType& _v)
     208        : Parent(_g, _v) {}
    218209
    219210    };
Note: See TracChangeset for help on using the changeset viewer.