1.1 --- a/lemon/bfs.h Fri Mar 02 17:56:22 2007 +0000
1.2 +++ b/lemon/bfs.h Fri Mar 02 18:04:28 2007 +0000
1.3 @@ -488,11 +488,11 @@
1.4 ///parameter should be initially false.
1.5 ///
1.6 ///\param target The target node.
1.7 - ///\retval reached Indicates that the target node is reached.
1.8 + ///\retval reach Indicates that the target node is reached.
1.9 ///\return The processed node.
1.10 ///
1.11 ///\warning The queue must not be empty!
1.12 - Node processNextNode(Node target, bool& reached)
1.13 + Node processNextNode(Node target, bool& reach)
1.14 {
1.15 if(_queue_tail==_queue_next_dist) {
1.16 _curr_dist++;
1.17 @@ -507,7 +507,7 @@
1.18 _reached->set(m,true);
1.19 _pred->set(m,e);
1.20 _dist->set(m,_curr_dist);
1.21 - reached = reached || (target == m);
1.22 + reach = reach || (target == m);
1.23 }
1.24 return n;
1.25 }
1.26 @@ -521,12 +521,12 @@
1.27 ///should be initially false.
1.28 ///
1.29 ///\param nm The nodemaps of possible targets.
1.30 - ///\retval reached Indicates that one of the target nodes is reached.
1.31 + ///\retval reach Indicates that one of the target nodes is reached.
1.32 ///\return The processed node.
1.33 ///
1.34 ///\warning The queue must not be empty!
1.35 template<class NM>
1.36 - Node processNextNode(const NM& nm, bool& reached)
1.37 + Node processNextNode(const NM& nm, bool& reach)
1.38 {
1.39 if(_queue_tail==_queue_next_dist) {
1.40 _curr_dist++;
1.41 @@ -541,7 +541,7 @@
1.42 _reached->set(m,true);
1.43 _pred->set(m,e);
1.44 _dist->set(m,_curr_dist);
1.45 - reached = reached || nm[m];
1.46 + reached = reach || nm[m];
1.47 }
1.48 return n;
1.49 }
1.50 @@ -604,8 +604,8 @@
1.51 ///
1.52 void start(Node dest)
1.53 {
1.54 - bool reached = false;
1.55 - while ( !emptyQueue() && !reached) processNextNode(dest, reached);
1.56 + bool reach = false;
1.57 + while ( !emptyQueue() && !reach) processNextNode(dest, reach);
1.58 }
1.59
1.60 ///Executes the algorithm until a condition is met.
1.61 @@ -622,8 +622,8 @@
1.62 template<class NM>
1.63 void start(const NM &nm)
1.64 {
1.65 - bool reached = false;
1.66 - while ( !emptyQueue() && !reached) processNextNode(nm, reached);
1.67 + bool reach = false;
1.68 + while ( !emptyQueue() && !reach) processNextNode(nm, reach);
1.69 }
1.70
1.71 ///Runs %BFS algorithm from node \c s.
1.72 @@ -882,8 +882,8 @@
1.73 /// \param g is the initial value of \ref _g
1.74 /// \param s is the initial value of \ref _source
1.75 BfsWizardBase(const GR &g, Node s=INVALID) :
1.76 - _g((void *)&g), _reached(0), _processed(0), _pred(0),
1.77 - _dist(0), _source(s) {}
1.78 + _g(reinterpret_cast<void*>(const_cast<GR*>(&g))),
1.79 + _reached(0), _processed(0), _pred(0), _dist(0), _source(s) {}
1.80
1.81 };
1.82
1.83 @@ -957,12 +957,15 @@
1.84 void run()
1.85 {
1.86 if(Base::_source==INVALID) throw UninitializedParameter();
1.87 - Bfs<Graph,TR> alg(*(Graph*)Base::_g);
1.88 + Bfs<Graph,TR> alg(*reinterpret_cast<const Graph*>(Base::_g));
1.89 if(Base::_reached)
1.90 - alg.reachedMap(*(ReachedMap*)Base::_reached);
1.91 - if(Base::_processed) alg.processedMap(*(ProcessedMap*)Base::_processed);
1.92 - if(Base::_pred) alg.predMap(*(PredMap*)Base::_pred);
1.93 - if(Base::_dist) alg.distMap(*(DistMap*)Base::_dist);
1.94 + alg.reachedMap(*reinterpret_cast<ReachedMap*>(Base::_reached));
1.95 + if(Base::_processed)
1.96 + alg.processedMap(*reinterpret_cast<ProcessedMap*>(Base::_processed));
1.97 + if(Base::_pred)
1.98 + alg.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
1.99 + if(Base::_dist)
1.100 + alg.distMap(*reinterpret_cast<DistMap*>(Base::_dist));
1.101 alg.run(Base::_source);
1.102 }
1.103
1.104 @@ -992,7 +995,7 @@
1.105 template<class T>
1.106 BfsWizard<DefPredMapBase<T> > predMap(const T &t)
1.107 {
1.108 - Base::_pred=(void *)&t;
1.109 + Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
1.110 return BfsWizard<DefPredMapBase<T> >(*this);
1.111 }
1.112
1.113 @@ -1013,7 +1016,7 @@
1.114 template<class T>
1.115 BfsWizard<DefReachedMapBase<T> > reachedMap(const T &t)
1.116 {
1.117 - Base::_pred=(void *)&t;
1.118 + Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
1.119 return BfsWizard<DefReachedMapBase<T> >(*this);
1.120 }
1.121
1.122 @@ -1034,7 +1037,7 @@
1.123 template<class T>
1.124 BfsWizard<DefProcessedMapBase<T> > processedMap(const T &t)
1.125 {
1.126 - Base::_pred=(void *)&t;
1.127 + Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
1.128 return BfsWizard<DefProcessedMapBase<T> >(*this);
1.129 }
1.130
1.131 @@ -1055,7 +1058,7 @@
1.132 template<class T>
1.133 BfsWizard<DefDistMapBase<T> > distMap(const T &t)
1.134 {
1.135 - Base::_dist=(void *)&t;
1.136 + Base::_dist=reinterpret_cast<void*>(const_cast<T*>(&t));
1.137 return BfsWizard<DefDistMapBase<T> >(*this);
1.138 }
1.139
1.140 @@ -1404,11 +1407,11 @@
1.141 /// parameter should be initially false.
1.142 ///
1.143 /// \param target The target node.
1.144 - /// \retval reached Indicates that the target node is reached.
1.145 + /// \retval reach Indicates that the target node is reached.
1.146 /// \return The processed node.
1.147 ///
1.148 /// \warning The queue must not be empty!
1.149 - Node processNextNode(Node target, bool& reached) {
1.150 + Node processNextNode(Node target, bool& reach) {
1.151 Node n = _list[++_list_front];
1.152 _visitor->process(n);
1.153 Edge e;
1.154 @@ -1419,7 +1422,7 @@
1.155 _visitor->reach(m);
1.156 _reached->set(m, true);
1.157 _list[++_list_back] = m;
1.158 - reached = reached || (target == m);
1.159 + reach = reach || (target == m);
1.160 } else {
1.161 _visitor->examine(e);
1.162 }
1.163 @@ -1441,7 +1444,7 @@
1.164 ///
1.165 /// \warning The queue must not be empty!
1.166 template <typename NM>
1.167 - Node processNextNode(const NM& nm, bool& reached) {
1.168 + Node processNextNode(const NM& nm, bool& reach) {
1.169 Node n = _list[++_list_front];
1.170 _visitor->process(n);
1.171 Edge e;
1.172 @@ -1452,7 +1455,7 @@
1.173 _visitor->reach(m);
1.174 _reached->set(m, true);
1.175 _list[++_list_back] = m;
1.176 - reached = reached || nm[m];
1.177 + reach = reach || nm[m];
1.178 } else {
1.179 _visitor->examine(e);
1.180 }
1.181 @@ -1499,9 +1502,9 @@
1.182 /// \pre init() must be called and at least one node should be added
1.183 /// with addSource() before using this function.
1.184 void start(Node dest) {
1.185 - bool reached = false;
1.186 - while (!emptyQueue() && !reached) {
1.187 - processNextNode(dest, reached);
1.188 + bool reach = false;
1.189 + while (!emptyQueue() && !reach) {
1.190 + processNextNode(dest, reach);
1.191 }
1.192 }
1.193
1.194 @@ -1517,9 +1520,9 @@
1.195 /// <tt>nm[v]</tt> true.
1.196 template <typename NM>
1.197 void start(const NM &nm) {
1.198 - bool reached = false;
1.199 - while (!emptyQueue() && !reached) {
1.200 - processNextNode(nm, reached);
1.201 + bool reach = false;
1.202 + while (!emptyQueue() && !reach) {
1.203 + processNextNode(nm, reach);
1.204 }
1.205 }
1.206