gravatar
kpeter (Peter Kovacs)
kpeter@inf.elte.hu
Avoid warning in adaptors.h (#67)
0 1 0
default
1 file changed with 2 insertions and 2 deletions:
↑ Collapse diff ↑
Show white space 192 line context
... ...
@@ -2112,198 +2112,198 @@
2112 2112
        if (Parent::direction(e)) {
2113 2113
          _forward->set(e, a);
2114 2114
        } else {
2115 2115
          _backward->set(e, a);
2116 2116
        }
2117 2117
      }
2118 2118

	
2119 2119
      /// \brief Returns the value associated with a key.
2120 2120
      ///
2121 2121
      /// Returns the value associated with a key.
2122 2122
      typename MapTraits<ForwardMap>::ConstReturnValue
2123 2123
      operator[](const Key& e) const {
2124 2124
        if (Parent::direction(e)) {
2125 2125
          return (*_forward)[e];
2126 2126
        } else {
2127 2127
          return (*_backward)[e];
2128 2128
        }
2129 2129
      }
2130 2130

	
2131 2131
      /// \brief Returns the value associated with a key.
2132 2132
      ///
2133 2133
      /// Returns the value associated with a key.
2134 2134
      typename MapTraits<ForwardMap>::ReturnValue
2135 2135
      operator[](const Key& e) {
2136 2136
        if (Parent::direction(e)) {
2137 2137
          return (*_forward)[e];
2138 2138
        } else {
2139 2139
          return (*_backward)[e];
2140 2140
        }
2141 2141
      }
2142 2142

	
2143 2143
    protected:
2144 2144

	
2145 2145
      ForwardMap* _forward;
2146 2146
      BackwardMap* _backward;
2147 2147

	
2148 2148
    };
2149 2149

	
2150 2150
    /// \brief Just gives back a combined arc map
2151 2151
    ///
2152 2152
    /// Just gives back a combined arc map
2153 2153
    template <typename ForwardMap, typename BackwardMap>
2154 2154
    static CombinedArcMap<ForwardMap, BackwardMap>
2155 2155
    combinedArcMap(ForwardMap& forward, BackwardMap& backward) {
2156 2156
      return CombinedArcMap<ForwardMap, BackwardMap>(forward, backward);
2157 2157
    }
2158 2158

	
2159 2159
    template <typename ForwardMap, typename BackwardMap>
2160 2160
    static CombinedArcMap<const ForwardMap, BackwardMap>
2161 2161
    combinedArcMap(const ForwardMap& forward, BackwardMap& backward) {
2162 2162
      return CombinedArcMap<const ForwardMap,
2163 2163
        BackwardMap>(forward, backward);
2164 2164
    }
2165 2165

	
2166 2166
    template <typename ForwardMap, typename BackwardMap>
2167 2167
    static CombinedArcMap<ForwardMap, const BackwardMap>
2168 2168
    combinedArcMap(ForwardMap& forward, const BackwardMap& backward) {
2169 2169
      return CombinedArcMap<ForwardMap,
2170 2170
        const BackwardMap>(forward, backward);
2171 2171
    }
2172 2172

	
2173 2173
    template <typename ForwardMap, typename BackwardMap>
2174 2174
    static CombinedArcMap<const ForwardMap, const BackwardMap>
2175 2175
    combinedArcMap(const ForwardMap& forward, const BackwardMap& backward) {
2176 2176
      return CombinedArcMap<const ForwardMap,
2177 2177
        const BackwardMap>(forward, backward);
2178 2178
    }
2179 2179

	
2180 2180
  };
2181 2181

	
2182 2182
  /// \brief Just gives back an undirected view of the given digraph
2183 2183
  ///
2184 2184
  /// Just gives back an undirected view of the given digraph
2185 2185
  template<typename Digraph>
2186 2186
  Undirector<const Digraph>
2187 2187
  undirector(const Digraph& digraph) {
2188 2188
    return Undirector<const Digraph>(digraph);
2189 2189
  }
2190 2190

	
2191 2191
  template <typename _Graph, typename _DirectionMap>
2192 2192
  class OrienterBase {
2193 2193
  public:
2194 2194

	
2195 2195
    typedef _Graph Graph;
2196 2196
    typedef _DirectionMap DirectionMap;
2197 2197

	
2198 2198
    typedef typename Graph::Node Node;
2199 2199
    typedef typename Graph::Edge Arc;
2200 2200

	
2201 2201
    void reverseArc(const Arc& arc) {
2202 2202
      _direction->set(arc, !(*_direction)[arc]);
2203 2203
    }
2204 2204

	
2205 2205
    void first(Node& i) const { _graph->first(i); }
2206 2206
    void first(Arc& i) const { _graph->first(i); }
2207 2207
    void firstIn(Arc& i, const Node& n) const {
2208
      bool d;
2208
      bool d = true;
2209 2209
      _graph->firstInc(i, d, n);
2210 2210
      while (i != INVALID && d == (*_direction)[i]) _graph->nextInc(i, d);
2211 2211
    }
2212 2212
    void firstOut(Arc& i, const Node& n ) const {
2213
      bool d;
2213
      bool d = true;
2214 2214
      _graph->firstInc(i, d, n);
2215 2215
      while (i != INVALID && d != (*_direction)[i]) _graph->nextInc(i, d);
2216 2216
    }
2217 2217

	
2218 2218
    void next(Node& i) const { _graph->next(i); }
2219 2219
    void next(Arc& i) const { _graph->next(i); }
2220 2220
    void nextIn(Arc& i) const {
2221 2221
      bool d = !(*_direction)[i];
2222 2222
      _graph->nextInc(i, d);
2223 2223
      while (i != INVALID && d == (*_direction)[i]) _graph->nextInc(i, d);
2224 2224
    }
2225 2225
    void nextOut(Arc& i) const {
2226 2226
      bool d = (*_direction)[i];
2227 2227
      _graph->nextInc(i, d);
2228 2228
      while (i != INVALID && d != (*_direction)[i]) _graph->nextInc(i, d);
2229 2229
    }
2230 2230

	
2231 2231
    Node source(const Arc& e) const {
2232 2232
      return (*_direction)[e] ? _graph->u(e) : _graph->v(e);
2233 2233
    }
2234 2234
    Node target(const Arc& e) const {
2235 2235
      return (*_direction)[e] ? _graph->v(e) : _graph->u(e);
2236 2236
    }
2237 2237

	
2238 2238
    typedef NodeNumTagIndicator<Graph> NodeNumTag;
2239 2239
    int nodeNum() const { return _graph->nodeNum(); }
2240 2240

	
2241 2241
    typedef EdgeNumTagIndicator<Graph> ArcNumTag;
2242 2242
    int arcNum() const { return _graph->edgeNum(); }
2243 2243

	
2244 2244
    typedef FindEdgeTagIndicator<Graph> FindArcTag;
2245 2245
    Arc findArc(const Node& u, const Node& v,
2246 2246
                const Arc& prev = INVALID) {
2247 2247
      Arc arc = prev;
2248 2248
      bool d = arc == INVALID ? true : (*_direction)[arc];
2249 2249
      if (d) {
2250 2250
        arc = _graph->findEdge(u, v, arc);
2251 2251
        while (arc != INVALID && !(*_direction)[arc]) {
2252 2252
          _graph->findEdge(u, v, arc);
2253 2253
        }
2254 2254
        if (arc != INVALID) return arc;
2255 2255
      }
2256 2256
      _graph->findEdge(v, u, arc);
2257 2257
      while (arc != INVALID && (*_direction)[arc]) {
2258 2258
        _graph->findEdge(u, v, arc);
2259 2259
      }
2260 2260
      return arc;
2261 2261
    }
2262 2262

	
2263 2263
    Node addNode() {
2264 2264
      return Node(_graph->addNode());
2265 2265
    }
2266 2266

	
2267 2267
    Arc addArc(const Node& u, const Node& v) {
2268 2268
      Arc arc = _graph->addArc(u, v);
2269 2269
      _direction->set(arc, _graph->source(arc) == u);
2270 2270
      return arc;
2271 2271
    }
2272 2272

	
2273 2273
    void erase(const Node& i) { _graph->erase(i); }
2274 2274
    void erase(const Arc& i) { _graph->erase(i); }
2275 2275

	
2276 2276
    void clear() { _graph->clear(); }
2277 2277

	
2278 2278
    int id(const Node& v) const { return _graph->id(v); }
2279 2279
    int id(const Arc& e) const { return _graph->id(e); }
2280 2280

	
2281 2281
    Node nodeFromId(int idx) const { return _graph->nodeFromId(idx); }
2282 2282
    Arc arcFromId(int idx) const { return _graph->edgeFromId(idx); }
2283 2283

	
2284 2284
    int maxNodeId() const { return _graph->maxNodeId(); }
2285 2285
    int maxArcId() const { return _graph->maxEdgeId(); }
2286 2286

	
2287 2287
    typedef typename ItemSetTraits<Graph, Node>::ItemNotifier NodeNotifier;
2288 2288
    NodeNotifier& notifier(Node) const { return _graph->notifier(Node()); }
2289 2289

	
2290 2290
    typedef typename ItemSetTraits<Graph, Arc>::ItemNotifier ArcNotifier;
2291 2291
    ArcNotifier& notifier(Arc) const { return _graph->notifier(Arc()); }
2292 2292

	
2293 2293
    template <typename _Value>
2294 2294
    class NodeMap : public _Graph::template NodeMap<_Value> {
2295 2295
    public:
2296 2296

	
2297 2297
      typedef typename _Graph::template NodeMap<_Value> Parent;
2298 2298

	
2299 2299
      explicit NodeMap(const OrienterBase& adapter)
2300 2300
        : Parent(*adapter._graph) {}
2301 2301

	
2302 2302
      NodeMap(const OrienterBase& adapter, const _Value& value)
2303 2303
        : Parent(*adapter._graph, value) {}
2304 2304

	
2305 2305
    private:
2306 2306
      NodeMap& operator=(const NodeMap& cmap) {
2307 2307
        return operator=<NodeMap>(cmap);
2308 2308
      }
2309 2309

	
0 comments (0 inline)