COIN-OR::LEMON - Graph Library

Changeset 2386:81b47fc5c444 in lemon-0.x for lemon/bfs.h


Ignore:
Timestamp:
03/02/07 19:04:28 (13 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3217
Message:

Hard Warning checking

  • based on the remark of the ZIB user
  • we do not use -Winline
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/bfs.h

    r2376 r2386  
    489489    ///
    490490    ///\param target The target node.
    491     ///\retval reached Indicates that the target node is reached.
     491    ///\retval reach Indicates that the target node is reached.
    492492    ///\return The processed node.
    493493    ///
    494494    ///\warning The queue must not be empty!
    495     Node processNextNode(Node target, bool& reached)
     495    Node processNextNode(Node target, bool& reach)
    496496    {
    497497      if(_queue_tail==_queue_next_dist) {
     
    508508          _pred->set(m,e);
    509509          _dist->set(m,_curr_dist);
    510           reached = reached || (target == m);
     510          reach = reach || (target == m);
    511511        }
    512512      return n;
     
    522522    ///
    523523    ///\param nm The nodemaps of possible targets.
    524     ///\retval reached Indicates that one of the target nodes is reached.
     524    ///\retval reach Indicates that one of the target nodes is reached.
    525525    ///\return The processed node.
    526526    ///
    527527    ///\warning The queue must not be empty!
    528528    template<class NM>
    529     Node processNextNode(const NM& nm, bool& reached)
     529    Node processNextNode(const NM& nm, bool& reach)
    530530    {
    531531      if(_queue_tail==_queue_next_dist) {
     
    542542          _pred->set(m,e);
    543543          _dist->set(m,_curr_dist);
    544           reached = reached || nm[m];
     544          reached = reach || nm[m];
    545545        }
    546546      return n;
     
    605605    void start(Node dest)
    606606    {
    607       bool reached = false;
    608       while ( !emptyQueue() && !reached) processNextNode(dest, reached);
     607      bool reach = false;
     608      while ( !emptyQueue() && !reach) processNextNode(dest, reach);
    609609    }
    610610   
     
    623623    void start(const NM &nm)
    624624    {
    625       bool reached = false;
    626       while ( !emptyQueue() && !reached) processNextNode(nm, reached);
     625      bool reach = false;
     626      while ( !emptyQueue() && !reach) processNextNode(nm, reach);
    627627    }
    628628   
     
    883883    /// \param s is the initial value of  \ref _source
    884884    BfsWizardBase(const GR &g, Node s=INVALID) :
    885       _g((void *)&g), _reached(0), _processed(0), _pred(0),
    886       _dist(0), _source(s) {}
     885      _g(reinterpret_cast<void*>(const_cast<GR*>(&g))),
     886      _reached(0), _processed(0), _pred(0), _dist(0), _source(s) {}
    887887
    888888  };
     
    958958    {
    959959      if(Base::_source==INVALID) throw UninitializedParameter();
    960       Bfs<Graph,TR> alg(*(Graph*)Base::_g);
     960      Bfs<Graph,TR> alg(*reinterpret_cast<const Graph*>(Base::_g));
    961961      if(Base::_reached)
    962         alg.reachedMap(*(ReachedMap*)Base::_reached);
    963       if(Base::_processed) alg.processedMap(*(ProcessedMap*)Base::_processed);
    964       if(Base::_pred) alg.predMap(*(PredMap*)Base::_pred);
    965       if(Base::_dist) alg.distMap(*(DistMap*)Base::_dist);
     962        alg.reachedMap(*reinterpret_cast<ReachedMap*>(Base::_reached));
     963      if(Base::_processed)
     964        alg.processedMap(*reinterpret_cast<ProcessedMap*>(Base::_processed));
     965      if(Base::_pred)
     966        alg.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
     967      if(Base::_dist)
     968        alg.distMap(*reinterpret_cast<DistMap*>(Base::_dist));
    966969      alg.run(Base::_source);
    967970    }
     
    993996    BfsWizard<DefPredMapBase<T> > predMap(const T &t)
    994997    {
    995       Base::_pred=(void *)&t;
     998      Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
    996999      return BfsWizard<DefPredMapBase<T> >(*this);
    9971000    }
     
    10141017    BfsWizard<DefReachedMapBase<T> > reachedMap(const T &t)
    10151018    {
    1016       Base::_pred=(void *)&t;
     1019      Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
    10171020      return BfsWizard<DefReachedMapBase<T> >(*this);
    10181021    }
     
    10351038    BfsWizard<DefProcessedMapBase<T> > processedMap(const T &t)
    10361039    {
    1037       Base::_pred=(void *)&t;
     1040      Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
    10381041      return BfsWizard<DefProcessedMapBase<T> >(*this);
    10391042    }
     
    10561059    BfsWizard<DefDistMapBase<T> > distMap(const T &t)
    10571060    {
    1058       Base::_dist=(void *)&t;
     1061      Base::_dist=reinterpret_cast<void*>(const_cast<T*>(&t));
    10591062      return BfsWizard<DefDistMapBase<T> >(*this);
    10601063    }
     
    14051408    ///
    14061409    /// \param target The target node.
    1407     /// \retval reached Indicates that the target node is reached.
     1410    /// \retval reach Indicates that the target node is reached.
    14081411    /// \return The processed node.
    14091412    ///
    14101413    /// \warning The queue must not be empty!
    1411     Node processNextNode(Node target, bool& reached) {
     1414    Node processNextNode(Node target, bool& reach) {
    14121415      Node n = _list[++_list_front];
    14131416      _visitor->process(n);
     
    14201423          _reached->set(m, true);
    14211424          _list[++_list_back] = m;
    1422           reached = reached || (target == m);
     1425          reach = reach || (target == m);
    14231426        } else {
    14241427          _visitor->examine(e);
     
    14421445    /// \warning The queue must not be empty!
    14431446    template <typename NM>
    1444     Node processNextNode(const NM& nm, bool& reached) {
     1447    Node processNextNode(const NM& nm, bool& reach) {
    14451448      Node n = _list[++_list_front];
    14461449      _visitor->process(n);
     
    14531456          _reached->set(m, true);
    14541457          _list[++_list_back] = m;
    1455           reached = reached || nm[m];
     1458          reach = reach || nm[m];
    14561459        } else {
    14571460          _visitor->examine(e);
     
    15001503    /// with addSource() before using this function.
    15011504    void start(Node dest) {
    1502       bool reached = false;
    1503       while (!emptyQueue() && !reached) {
    1504         processNextNode(dest, reached);
     1505      bool reach = false;
     1506      while (!emptyQueue() && !reach) {
     1507        processNextNode(dest, reach);
    15051508      }
    15061509    }
     
    15181521    template <typename NM>
    15191522    void start(const NM &nm) {
    1520       bool reached = false;
    1521       while (!emptyQueue() && !reached) {
    1522         processNextNode(nm, reached);
     1523      bool reach = false;
     1524      while (!emptyQueue() && !reach) {
     1525        processNextNode(nm, reach);
    15231526      }
    15241527    }
Note: See TracChangeset for help on using the changeset viewer.