lemon/bits/graph_extender.h
changeset 1026 699c7eac2c6d
parent 1025 c8fa41fcc4a7
child 1027 8b2b9e61d8ce
equal deleted inserted replaced
18:f3d63681b01d 19:6520e1e2dc27
   911         return *this;
   911         return *this;
   912       }
   912       }
   913 
   913 
   914     };
   914     };
   915 
   915 
   916     class RedIt : public RedNode {
   916     class RedNodeIt : public RedNode {
   917       const BpGraph* _graph;
   917       const BpGraph* _graph;
   918     public:
   918     public:
   919 
   919 
   920       RedIt() {}
   920       RedNodeIt() {}
   921 
   921 
   922       RedIt(Invalid i) : RedNode(i) { }
   922       RedNodeIt(Invalid i) : RedNode(i) { }
   923 
   923 
   924       explicit RedIt(const BpGraph& graph) : _graph(&graph) {
   924       explicit RedNodeIt(const BpGraph& graph) : _graph(&graph) {
   925         _graph->first(static_cast<RedNode&>(*this));
   925         _graph->first(static_cast<RedNode&>(*this));
   926       }
   926       }
   927 
   927 
   928       RedIt(const BpGraph& graph, const RedNode& node)
   928       RedNodeIt(const BpGraph& graph, const RedNode& node)
   929         : RedNode(node), _graph(&graph) {}
   929         : RedNode(node), _graph(&graph) {}
   930 
   930 
   931       RedIt& operator++() {
   931       RedNodeIt& operator++() {
   932         _graph->next(static_cast<RedNode&>(*this));
   932         _graph->next(static_cast<RedNode&>(*this));
   933         return *this;
   933         return *this;
   934       }
   934       }
   935 
   935 
   936     };
   936     };
   937 
   937 
   938     class BlueIt : public BlueNode {
   938     class BlueNodeIt : public BlueNode {
   939       const BpGraph* _graph;
   939       const BpGraph* _graph;
   940     public:
   940     public:
   941 
   941 
   942       BlueIt() {}
   942       BlueNodeIt() {}
   943 
   943 
   944       BlueIt(Invalid i) : BlueNode(i) { }
   944       BlueNodeIt(Invalid i) : BlueNode(i) { }
   945 
   945 
   946       explicit BlueIt(const BpGraph& graph) : _graph(&graph) {
   946       explicit BlueNodeIt(const BpGraph& graph) : _graph(&graph) {
   947         _graph->first(static_cast<BlueNode&>(*this));
   947         _graph->first(static_cast<BlueNode&>(*this));
   948       }
   948       }
   949 
   949 
   950       BlueIt(const BpGraph& graph, const BlueNode& node)
   950       BlueNodeIt(const BpGraph& graph, const BlueNode& node)
   951         : BlueNode(node), _graph(&graph) {}
   951         : BlueNode(node), _graph(&graph) {}
   952 
   952 
   953       BlueIt& operator++() {
   953       BlueNodeIt& operator++() {
   954         _graph->next(static_cast<BlueNode&>(*this));
   954         _graph->next(static_cast<BlueNode&>(*this));
   955         return *this;
   955         return *this;
   956       }
   956       }
   957 
   957 
   958     };
   958     };
  1142       }
  1142       }
  1143 
  1143 
  1144     };
  1144     };
  1145 
  1145 
  1146     template <typename _Value>
  1146     template <typename _Value>
  1147     class RedMap
  1147     class RedNodeMap
  1148       : public MapExtender<DefaultMap<BpGraph, RedNode, _Value> > {
  1148       : public MapExtender<DefaultMap<BpGraph, RedNode, _Value> > {
  1149       typedef MapExtender<DefaultMap<BpGraph, RedNode, _Value> > Parent;
  1149       typedef MapExtender<DefaultMap<BpGraph, RedNode, _Value> > Parent;
  1150 
  1150 
  1151     public:
  1151     public:
  1152       explicit RedMap(const BpGraph& bpgraph)
  1152       explicit RedNodeMap(const BpGraph& bpgraph)
  1153         : Parent(bpgraph) {}
  1153         : Parent(bpgraph) {}
  1154       RedMap(const BpGraph& bpgraph, const _Value& value)
  1154       RedNodeMap(const BpGraph& bpgraph, const _Value& value)
  1155         : Parent(bpgraph, value) {}
  1155         : Parent(bpgraph, value) {}
  1156 
  1156 
  1157     private:
  1157     private:
  1158       RedMap& operator=(const RedMap& cmap) {
  1158       RedNodeMap& operator=(const RedNodeMap& cmap) {
  1159         return operator=<RedMap>(cmap);
  1159         return operator=<RedNodeMap>(cmap);
  1160       }
  1160       }
  1161 
  1161 
  1162       template <typename CMap>
  1162       template <typename CMap>
  1163       RedMap& operator=(const CMap& cmap) {
  1163       RedNodeMap& operator=(const CMap& cmap) {
  1164         Parent::operator=(cmap);
  1164         Parent::operator=(cmap);
  1165         return *this;
  1165         return *this;
  1166       }
  1166       }
  1167 
  1167 
  1168     };
  1168     };
  1169 
  1169 
  1170     template <typename _Value>
  1170     template <typename _Value>
  1171     class BlueMap
  1171     class BlueNodeMap
  1172       : public MapExtender<DefaultMap<BpGraph, BlueNode, _Value> > {
  1172       : public MapExtender<DefaultMap<BpGraph, BlueNode, _Value> > {
  1173       typedef MapExtender<DefaultMap<BpGraph, BlueNode, _Value> > Parent;
  1173       typedef MapExtender<DefaultMap<BpGraph, BlueNode, _Value> > Parent;
  1174 
  1174 
  1175     public:
  1175     public:
  1176       explicit BlueMap(const BpGraph& bpgraph)
  1176       explicit BlueNodeMap(const BpGraph& bpgraph)
  1177         : Parent(bpgraph) {}
  1177         : Parent(bpgraph) {}
  1178       BlueMap(const BpGraph& bpgraph, const _Value& value)
  1178       BlueNodeMap(const BpGraph& bpgraph, const _Value& value)
  1179         : Parent(bpgraph, value) {}
  1179         : Parent(bpgraph, value) {}
  1180 
  1180 
  1181     private:
  1181     private:
  1182       BlueMap& operator=(const BlueMap& cmap) {
  1182       BlueNodeMap& operator=(const BlueNodeMap& cmap) {
  1183         return operator=<BlueMap>(cmap);
  1183         return operator=<BlueNodeMap>(cmap);
  1184       }
  1184       }
  1185 
  1185 
  1186       template <typename CMap>
  1186       template <typename CMap>
  1187       BlueMap& operator=(const CMap& cmap) {
  1187       BlueNodeMap& operator=(const CMap& cmap) {
  1188         Parent::operator=(cmap);
  1188         Parent::operator=(cmap);
  1189         return *this;
  1189         return *this;
  1190       }
  1190       }
  1191 
  1191 
  1192     };
  1192     };