COIN-OR::LEMON - Graph Library

Changeset 617:4137ef9aacc6 in lemon-1.2 for lemon/adaptors.h


Ignore:
Timestamp:
04/24/09 11:54:48 (10 years ago)
Author:
Peter Kovacs <kpeter@…>
Branch:
default
Phase:
public
Message:

Fix and uniform the usage of Graph and Parent typedefs (#268)

  • Rename Graph typedefs to GraphType? in the implementation of graph maps and MapExtender? to prevent conflicts (especially using VS). They are not public.
  • Make Parent typedefs private in all classes.
  • Replace Digraph with Graph in some places (fix faulty renamings of the script).
  • Use Graph and Digraph typedefs (more) consequently.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/adaptors.h

    r579 r617  
    110110    template <typename V>
    111111    class NodeMap : public DGR::template NodeMap<V> {
     112      typedef typename DGR::template NodeMap<V> Parent;
     113
    112114    public:
    113 
    114       typedef typename DGR::template NodeMap<V> Parent;
    115 
    116115      explicit NodeMap(const Adaptor& adaptor)
    117116        : Parent(*adaptor._digraph) {}
    118 
    119117      NodeMap(const Adaptor& adaptor, const V& value)
    120118        : Parent(*adaptor._digraph, value) { }
     
    135133    template <typename V>
    136134    class ArcMap : public DGR::template ArcMap<V> {
     135      typedef typename DGR::template ArcMap<V> Parent;
     136
    137137    public:
    138 
    139       typedef typename DGR::template ArcMap<V> Parent;
    140 
    141138      explicit ArcMap(const DigraphAdaptorBase<DGR>& adaptor)
    142139        : Parent(*adaptor._digraph) {}
    143 
    144140      ArcMap(const DigraphAdaptorBase<DGR>& adaptor, const V& value)
    145141        : Parent(*adaptor._digraph, value) {}
     
    256252    template <typename V>
    257253    class NodeMap : public GR::template NodeMap<V> {
     254      typedef typename GR::template NodeMap<V> Parent;
     255
    258256    public:
    259       typedef typename GR::template NodeMap<V> Parent;
    260257      explicit NodeMap(const GraphAdaptorBase<GR>& adapter)
    261258        : Parent(*adapter._graph) {}
     
    278275    template <typename V>
    279276    class ArcMap : public GR::template ArcMap<V> {
     277      typedef typename GR::template ArcMap<V> Parent;
     278
    280279    public:
    281       typedef typename GR::template ArcMap<V> Parent;
    282280      explicit ArcMap(const GraphAdaptorBase<GR>& adapter)
    283281        : Parent(*adapter._graph) {}
     
    299297    template <typename V>
    300298    class EdgeMap : public GR::template EdgeMap<V> {
     299      typedef typename GR::template EdgeMap<V> Parent;
     300
    301301    public:
    302       typedef typename GR::template EdgeMap<V> Parent;
    303302      explicit EdgeMap(const GraphAdaptorBase<GR>& adapter)
    304303        : Parent(*adapter._graph) {}
     
    322321  template <typename DGR>
    323322  class ReverseDigraphBase : public DigraphAdaptorBase<DGR> {
     323    typedef DigraphAdaptorBase<DGR> Parent;
    324324  public:
    325325    typedef DGR Digraph;
    326     typedef DigraphAdaptorBase<DGR> Parent;
    327326  protected:
    328327    ReverseDigraphBase() : Parent() { }
     
    375374    public DigraphAdaptorExtender<ReverseDigraphBase<DGR> > {
    376375#endif
     376    typedef DigraphAdaptorExtender<ReverseDigraphBase<DGR> > Parent;
    377377  public:
    378378    /// The type of the adapted digraph.
    379379    typedef DGR Digraph;
    380     typedef DigraphAdaptorExtender<ReverseDigraphBase<DGR> > Parent;
    381380  protected:
    382381    ReverseDigraph() { }
     
    404403  template <typename DGR, typename NF, typename AF, bool ch = true>
    405404  class SubDigraphBase : public DigraphAdaptorBase<DGR> {
     405    typedef DigraphAdaptorBase<DGR> Parent;
    406406  public:
    407407    typedef DGR Digraph;
     
    410410
    411411    typedef SubDigraphBase Adaptor;
    412     typedef DigraphAdaptorBase<DGR> Parent;
    413412  protected:
    414413    NF* _node_filter;
     
    510509      : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
    511510              LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> {
     511      typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
     512        LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent;
     513
    512514    public:
    513515      typedef V Value;
    514       typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
    515             LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent;
    516516
    517517      NodeMap(const SubDigraphBase<DGR, NF, AF, ch>& adaptor)
     
    536536      : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
    537537              LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> {
     538      typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
     539        LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent;
     540
    538541    public:
    539542      typedef V Value;
    540       typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
    541         LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent;
    542543
    543544      ArcMap(const SubDigraphBase<DGR, NF, AF, ch>& adaptor)
     
    563564  class SubDigraphBase<DGR, NF, AF, false>
    564565    : public DigraphAdaptorBase<DGR> {
     566    typedef DigraphAdaptorBase<DGR> Parent;
    565567  public:
    566568    typedef DGR Digraph;
     
    569571
    570572    typedef SubDigraphBase Adaptor;
    571     typedef DigraphAdaptorBase<Digraph> Parent;
    572573  protected:
    573574    NF* _node_filter;
     
    651652      : public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,
    652653          LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> {
     654      typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,
     655        LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent;
     656
    653657    public:
    654658      typedef V Value;
    655       typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,
    656         LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent;
    657659
    658660      NodeMap(const SubDigraphBase<DGR, NF, AF, false>& adaptor)
     
    677679      : public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,
    678680          LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> {
     681      typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,
     682        LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent;
     683
    679684    public:
    680685      typedef V Value;
    681       typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,
    682           LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent;
    683686
    684687      ArcMap(const SubDigraphBase<DGR, NF, AF, false>& adaptor)
     
    864867  template <typename GR, typename NF, typename EF, bool ch = true>
    865868  class SubGraphBase : public GraphAdaptorBase<GR> {
     869    typedef GraphAdaptorBase<GR> Parent;
    866870  public:
    867871    typedef GR Graph;
     
    870874
    871875    typedef SubGraphBase Adaptor;
    872     typedef GraphAdaptorBase<GR> Parent;
    873876  protected:
    874877
     
    10171020      : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
    10181021          LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> {
     1022      typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
     1023        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent;
     1024
    10191025    public:
    10201026      typedef V Value;
    1021       typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
    1022         LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent;
    10231027
    10241028      NodeMap(const SubGraphBase<GR, NF, EF, ch>& adaptor)
     
    10431047      : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
    10441048          LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> {
     1049      typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
     1050        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent;
     1051
    10451052    public:
    10461053      typedef V Value;
    1047       typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
    1048         LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent;
    10491054
    10501055      ArcMap(const SubGraphBase<GR, NF, EF, ch>& adaptor)
     
    10691074      : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
    10701075        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> {
     1076      typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
     1077        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent;
     1078
    10711079    public:
    10721080      typedef V Value;
    1073       typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
    1074         LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent;
    10751081
    10761082      EdgeMap(const SubGraphBase<GR, NF, EF, ch>& adaptor)
     
    10971103  class SubGraphBase<GR, NF, EF, false>
    10981104    : public GraphAdaptorBase<GR> {
     1105    typedef GraphAdaptorBase<GR> Parent;
    10991106  public:
    11001107    typedef GR Graph;
     
    11031110
    11041111    typedef SubGraphBase Adaptor;
    1105     typedef GraphAdaptorBase<GR> Parent;
    11061112  protected:
    11071113    NF* _node_filter;
     
    12121218      : public SubMapExtender<SubGraphBase<GR, NF, EF, false>,
    12131219          LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> {
     1220      typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>,
     1221        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent;
     1222
    12141223    public:
    12151224      typedef V Value;
    1216       typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>,
    1217         LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent;
    12181225
    12191226      NodeMap(const SubGraphBase<GR, NF, EF, false>& adaptor)
     
    12381245      : public SubMapExtender<SubGraphBase<GR, NF, EF, false>,
    12391246          LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> {
     1247      typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>,
     1248        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent;
     1249
    12401250    public:
    12411251      typedef V Value;
    1242       typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>,
    1243         LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent;
    12441252
    12451253      ArcMap(const SubGraphBase<GR, NF, EF, false>& adaptor)
     
    12641272      : public SubMapExtender<SubGraphBase<GR, NF, EF, false>,
    12651273        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> {
     1274      typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>,
     1275        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent;
     1276
    12661277    public:
    12671278      typedef V Value;
    1268       typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>,
    1269                   LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent;
    12701279
    12711280      EdgeMap(const SubGraphBase<GR, NF, EF, false>& adaptor)
     
    14861495                     true> > {
    14871496#endif
    1488   public:
    1489 
    1490     typedef GR Digraph;
    1491     typedef NF NodeFilterMap;
    1492 
    14931497    typedef DigraphAdaptorExtender<
    14941498      SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, Const<bool, true> >,
    14951499                     true> > Parent;
     1500
     1501  public:
     1502
     1503    typedef GR Digraph;
     1504    typedef NF NodeFilterMap;
    14961505
    14971506    typedef typename Parent::Node Node;
     
    15491558                   true> > {
    15501559
    1551   public:
    1552     typedef GR Graph;
    1553     typedef NF NodeFilterMap;
    15541560    typedef GraphAdaptorExtender<
    15551561      SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >,
    15561562                   true> > Parent;
    15571563
     1564  public:
     1565
     1566    typedef GR Graph;
     1567    typedef NF NodeFilterMap;
     1568
    15581569    typedef typename Parent::Node Node;
     1570
    15591571  protected:
    15601572    ConstMap<typename GR::Edge, Const<bool, true> > const_true_map;
     
    16301642                     AF, false> > {
    16311643#endif
    1632   public:
     1644    typedef DigraphAdaptorExtender<
     1645      SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >,
     1646                     AF, false> > Parent;
     1647
     1648  public:
     1649
    16331650    /// The type of the adapted digraph.
    16341651    typedef DGR Digraph;
    16351652    /// The type of the arc filter map.
    16361653    typedef AF ArcFilterMap;
    1637 
    1638     typedef DigraphAdaptorExtender<
    1639       SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >,
    1640                      AF, false> > Parent;
    16411654
    16421655    typedef typename Parent::Arc Arc;
     
    17391752                   EF, false> > {
    17401753#endif
    1741   public:
     1754    typedef GraphAdaptorExtender<
     1755      SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true > >,
     1756                   EF, false> > Parent;
     1757
     1758  public:
     1759
    17421760    /// The type of the adapted graph.
    17431761    typedef GR Graph;
    17441762    /// The type of the edge filter map.
    17451763    typedef EF EdgeFilterMap;
    1746 
    1747     typedef GraphAdaptorExtender<
    1748       SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true > >,
    1749                    EF, false> > Parent;
    17501764
    17511765    typedef typename Parent::Edge Edge;
     
    21122126    template <typename V>
    21132127    class NodeMap : public DGR::template NodeMap<V> {
     2128      typedef typename DGR::template NodeMap<V> Parent;
     2129
    21142130    public:
    2115 
    21162131      typedef V Value;
    2117       typedef typename DGR::template NodeMap<Value> Parent;
    21182132
    21192133      explicit NodeMap(const UndirectorBase<DGR>& adaptor)
     
    21382152    template <typename V>
    21392153    class ArcMap
    2140       : public SubMapExtender<UndirectorBase<DGR>, ArcMapBase<V> >
    2141     {
     2154      : public SubMapExtender<UndirectorBase<DGR>, ArcMapBase<V> > {
     2155      typedef SubMapExtender<UndirectorBase<DGR>, ArcMapBase<V> > Parent;
     2156
    21422157    public:
    21432158      typedef V Value;
    2144       typedef SubMapExtender<Adaptor, ArcMapBase<V> > Parent;
    21452159
    21462160      explicit ArcMap(const UndirectorBase<DGR>& adaptor)
     
    21642178    template <typename V>
    21652179    class EdgeMap : public Digraph::template ArcMap<V> {
     2180      typedef typename Digraph::template ArcMap<V> Parent;
     2181
    21662182    public:
    2167 
    21682183      typedef V Value;
    2169       typedef typename Digraph::template ArcMap<V> Parent;
    21702184
    21712185      explicit EdgeMap(const UndirectorBase<DGR>& adaptor)
     
    22392253    public GraphAdaptorExtender<UndirectorBase<DGR> > {
    22402254#endif
     2255    typedef GraphAdaptorExtender<UndirectorBase<DGR> > Parent;
    22412256  public:
    22422257    /// The type of the adapted digraph.
    22432258    typedef DGR Digraph;
    2244     typedef GraphAdaptorExtender<UndirectorBase<DGR> > Parent;
    22452259  protected:
    22462260    Undirector() { }
     
    24502464    template <typename V>
    24512465    class NodeMap : public GR::template NodeMap<V> {
     2466      typedef typename GR::template NodeMap<V> Parent;
     2467
    24522468    public:
    2453 
    2454       typedef typename GR::template NodeMap<V> Parent;
    24552469
    24562470      explicit NodeMap(const OrienterBase<GR, DM>& adapter)
     
    24752489    template <typename V>
    24762490    class ArcMap : public GR::template EdgeMap<V> {
     2491      typedef typename Graph::template EdgeMap<V> Parent;
     2492
    24772493    public:
    2478 
    2479       typedef typename Graph::template EdgeMap<V> Parent;
    24802494
    24812495      explicit ArcMap(const OrienterBase<GR, DM>& adapter)
     
    25472561    public DigraphAdaptorExtender<OrienterBase<GR, DM> > {
    25482562#endif
     2563    typedef DigraphAdaptorExtender<OrienterBase<GR, DM> > Parent;
    25492564  public:
    25502565
     
    25542569    typedef DM DirectionMap;
    25552570
    2556     typedef DigraphAdaptorExtender<OrienterBase<GR, DM> > Parent;
    25572571    typedef typename Parent::Arc Arc;
     2572
    25582573  protected:
    25592574    Orienter() { }
     2575
    25602576  public:
    25612577
     
    28672883  template <typename DGR>
    28682884  class SplitNodesBase {
     2885    typedef DigraphAdaptorBase<const DGR> Parent;
     2886
    28692887  public:
    28702888
    28712889    typedef DGR Digraph;
    2872     typedef DigraphAdaptorBase<const DGR> Parent;
    28732890    typedef SplitNodesBase Adaptor;
    28742891
     
    32293246    template <typename V>
    32303247    class NodeMap
    3231       : public SubMapExtender<SplitNodesBase<DGR>, NodeMapBase<V> >
    3232     {
     3248      : public SubMapExtender<SplitNodesBase<DGR>, NodeMapBase<V> > {
     3249      typedef SubMapExtender<SplitNodesBase<DGR>, NodeMapBase<V> > Parent;
     3250
    32333251    public:
    32343252      typedef V Value;
    3235       typedef SubMapExtender<SplitNodesBase<DGR>, NodeMapBase<Value> > Parent;
    32363253
    32373254      NodeMap(const SplitNodesBase<DGR>& adaptor)
     
    32553272    template <typename V>
    32563273    class ArcMap
    3257       : public SubMapExtender<SplitNodesBase<DGR>, ArcMapBase<V> >
    3258     {
     3274      : public SubMapExtender<SplitNodesBase<DGR>, ArcMapBase<V> > {
     3275      typedef SubMapExtender<SplitNodesBase<DGR>, ArcMapBase<V> > Parent;
     3276
    32593277    public:
    32603278      typedef V Value;
    3261       typedef SubMapExtender<SplitNodesBase<DGR>, ArcMapBase<Value> > Parent;
    32623279
    32633280      ArcMap(const SplitNodesBase<DGR>& adaptor)
     
    33253342    : public DigraphAdaptorExtender<SplitNodesBase<const DGR> > {
    33263343#endif
     3344    typedef DigraphAdaptorExtender<SplitNodesBase<const DGR> > Parent;
     3345
    33273346  public:
    33283347    typedef DGR Digraph;
    3329     typedef DigraphAdaptorExtender<SplitNodesBase<const DGR> > Parent;
    33303348
    33313349    typedef typename DGR::Node DigraphNode;
Note: See TracChangeset for help on using the changeset viewer.