Commit 15beca88 authored by Sylvain Thery's avatar Sylvain Thery

return to old style next(d) because of possible dangerous usage of next with return value

parent e0f1b877
...@@ -87,11 +87,11 @@ public: ...@@ -87,11 +87,11 @@ public:
Dart alpha_1(Dart d) ; Dart alpha_1(Dart d) ;
virtual Dart begin() ; virtual Dart begin() const ;
virtual Dart end() ; virtual Dart end() const ;
virtual Dart next(Dart& d) ; virtual void next(Dart& d) const ;
virtual bool foreach_dart_of_vertex(Dart d, FunctorType& f, unsigned int thread = 0) ; virtual bool foreach_dart_of_vertex(Dart d, FunctorType& f, unsigned int thread = 0) ;
......
...@@ -139,7 +139,7 @@ inline Dart ImplicitHierarchicalMap::alpha_1(Dart d) ...@@ -139,7 +139,7 @@ inline Dart ImplicitHierarchicalMap::alpha_1(Dart d)
return Map2::alpha_1(d) ; return Map2::alpha_1(d) ;
} }
inline Dart ImplicitHierarchicalMap::begin() inline Dart ImplicitHierarchicalMap::begin() const
{ {
Dart d = Map2::begin() ; Dart d = Map2::begin() ;
while(d != Map2::end() && m_dartLevel[d] > m_curLevel) while(d != Map2::end() && m_dartLevel[d] > m_curLevel)
...@@ -147,18 +147,17 @@ inline Dart ImplicitHierarchicalMap::begin() ...@@ -147,18 +147,17 @@ inline Dart ImplicitHierarchicalMap::begin()
return d ; return d ;
} }
inline Dart ImplicitHierarchicalMap::end() inline Dart ImplicitHierarchicalMap::end() const
{ {
return Map2::end() ; return Map2::end() ;
} }
inline Dart ImplicitHierarchicalMap::next(Dart& d) inline void ImplicitHierarchicalMap::next(Dart& d) const
{ {
do do
{ {
Map2::next(d) ; Map2::next(d) ;
} while(d != Map2::end() && m_dartLevel[d] > m_curLevel) ; } while(d != Map2::end() && m_dartLevel[d] > m_curLevel) ;
return d;
} }
inline bool ImplicitHierarchicalMap::foreach_dart_of_vertex(Dart d, FunctorType& f, unsigned int thread) inline bool ImplicitHierarchicalMap::foreach_dart_of_vertex(Dart d, FunctorType& f, unsigned int thread)
......
...@@ -360,11 +360,11 @@ public: ...@@ -360,11 +360,11 @@ public:
*************************************************************************/ *************************************************************************/
//@{ //@{
virtual Dart begin() ; virtual Dart begin() const;
virtual Dart end() ; virtual Dart end() const;
virtual Dart next(Dart& d) ; virtual void next(Dart& d) const ;
virtual bool foreach_dart_of_vertex(Dart d, FunctorType& f, unsigned int thread = 0) ; virtual bool foreach_dart_of_vertex(Dart d, FunctorType& f, unsigned int thread = 0) ;
......
...@@ -200,7 +200,7 @@ inline Dart ImplicitHierarchicalMap3::alpha_2(Dart d) ...@@ -200,7 +200,7 @@ inline Dart ImplicitHierarchicalMap3::alpha_2(Dart d)
return phi2(phi3(d)); return phi2(phi3(d));
} }
inline Dart ImplicitHierarchicalMap3::begin() inline Dart ImplicitHierarchicalMap3::begin() const
{ {
Dart d = Map3::begin() ; Dart d = Map3::begin() ;
while(m_dartLevel[d] > m_curLevel) while(m_dartLevel[d] > m_curLevel)
...@@ -208,18 +208,17 @@ inline Dart ImplicitHierarchicalMap3::begin() ...@@ -208,18 +208,17 @@ inline Dart ImplicitHierarchicalMap3::begin()
return d ; return d ;
} }
inline Dart ImplicitHierarchicalMap3::end() inline Dart ImplicitHierarchicalMap3::end() const
{ {
return Map3::end() ; return Map3::end() ;
} }
inline Dart ImplicitHierarchicalMap3::next(Dart& d) inline void ImplicitHierarchicalMap3::next(Dart& d) const
{ {
do do
{ {
Map3::next(d) ; Map3::next(d) ;
} while(d != Map3::end() && m_dartLevel[d] > m_curLevel) ; } while(d != Map3::end() && m_dartLevel[d] > m_curLevel) ;
return d;
} }
inline bool ImplicitHierarchicalMap3::foreach_dart_of_vertex(Dart d, FunctorType& f, unsigned int thread) inline bool ImplicitHierarchicalMap3::foreach_dart_of_vertex(Dart d, FunctorType& f, unsigned int thread)
......
...@@ -53,9 +53,9 @@ namespace CGoGN ...@@ -53,9 +53,9 @@ namespace CGoGN
class MapBrowser class MapBrowser
{ {
public: public:
virtual Dart begin() = 0; virtual Dart begin() const = 0;
virtual Dart end() = 0; virtual Dart end() const = 0;
virtual Dart next(Dart& d) = 0; virtual void next(Dart& d) const = 0;
}; };
class AttributeHandlerGen ; class AttributeHandlerGen ;
...@@ -259,7 +259,7 @@ public: ...@@ -259,7 +259,7 @@ public:
/** /**
* get the insertion level of a dart (use only in MRMaps) * get the insertion level of a dart (use only in MRMaps)
*/ */
unsigned int getDartLevel(Dart d) ; unsigned int getDartLevel(Dart d) const ;
/** /**
* get the number of darts inserted in the given leveldart (use only in MRMaps) * get the number of darts inserted in the given leveldart (use only in MRMaps)
...@@ -526,20 +526,20 @@ public: ...@@ -526,20 +526,20 @@ public:
* Begin of map * Begin of map
* @return the first dart of the map * @return the first dart of the map
*/ */
Dart begin() ; Dart begin() const;
/** /**
* End of map * End of map
* @return the end iterator (next of last) of the map * @return the end iterator (next of last) of the map
*/ */
Dart end() ; Dart end() const;
/** /**
* allow to go from a dart to the next * allow to go from a dart to the next
* in the order of storage * in the order of storage
* @param d reference to the dart to be modified * @param d reference to the dart to be modified
*/ */
Dart next(Dart& d) ; void next(Dart& d) const ;
/** /**
* Apply a functor on each dart of the map * Apply a functor on each dart of the map
......
...@@ -194,7 +194,7 @@ inline unsigned int GenericMap::dartIndex(Dart d) const ...@@ -194,7 +194,7 @@ inline unsigned int GenericMap::dartIndex(Dart d) const
return d.index; return d.index;
} }
inline unsigned int GenericMap::getDartLevel(Dart d) inline unsigned int GenericMap::getDartLevel(Dart d) const
{ {
return (*m_mrLevels)[d.index] ; return (*m_mrLevels)[d.index] ;
} }
...@@ -339,7 +339,7 @@ inline AttributeMultiVector<unsigned int>* GenericMap::getEmbeddingAttributeVect ...@@ -339,7 +339,7 @@ inline AttributeMultiVector<unsigned int>* GenericMap::getEmbeddingAttributeVect
* DARTS TRAVERSALS * * DARTS TRAVERSALS *
****************************************/ ****************************************/
inline Dart GenericMap::begin() inline Dart GenericMap::begin() const
{ {
if (m_isMultiRes) if (m_isMultiRes)
{ {
...@@ -352,7 +352,7 @@ inline Dart GenericMap::begin() ...@@ -352,7 +352,7 @@ inline Dart GenericMap::begin()
return Dart::create(m_attribs[DART].begin()) ; return Dart::create(m_attribs[DART].begin()) ;
} }
inline Dart GenericMap::end() inline Dart GenericMap::end() const
{ {
if (m_isMultiRes) if (m_isMultiRes)
return Dart::create(m_mrattribs.end()) ; return Dart::create(m_mrattribs.end()) ;
...@@ -360,7 +360,7 @@ inline Dart GenericMap::end() ...@@ -360,7 +360,7 @@ inline Dart GenericMap::end()
return Dart::create(m_attribs[DART].end()) ; return Dart::create(m_attribs[DART].end()) ;
} }
inline Dart GenericMap::next(Dart& d) inline void GenericMap::next(Dart& d) const
{ {
if (m_isMultiRes) if (m_isMultiRes)
{ {
...@@ -371,7 +371,6 @@ inline Dart GenericMap::next(Dart& d) ...@@ -371,7 +371,6 @@ inline Dart GenericMap::next(Dart& d)
} }
else else
m_attribs[DART].next(d.index) ; m_attribs[DART].next(d.index) ;
return d;
} }
/**************************************** /****************************************
......
...@@ -47,17 +47,17 @@ public: ...@@ -47,17 +47,17 @@ public:
m_map(m), m_selector(fs) m_map(m), m_selector(fs)
{} {}
Dart begin() Dart begin() const
{ {
return m_map.begin() ; return m_map.begin() ;
} }
Dart end() Dart end() const
{ {
return m_map.end() ; return m_map.end() ;
} }
void next(Dart& d) void next(Dart& d) const
{ {
do do
{ {
...@@ -112,17 +112,17 @@ public: ...@@ -112,17 +112,17 @@ public:
m_end = NIL ; m_end = NIL ;
} }
Dart begin() Dart begin() const
{ {
return m_first ; return m_first ;
} }
Dart end() Dart end() const
{ {
return NIL ; return NIL ;
} }
void next(Dart& d) void next(Dart& d) const
{ {
assert(d != NIL) ; assert(d != NIL) ;
d = m_links[d] ; d = m_links[d] ;
......
...@@ -57,7 +57,7 @@ Dart TraversorCell<MAP>::begin() ...@@ -57,7 +57,7 @@ Dart TraversorCell<MAP>::begin()
current = m.begin() ; current = m.begin() ;
while(current != m.end() && (m.isBoundaryMarked(current) || !m_good(current))) while(current != m.end() && (m.isBoundaryMarked(current) || !m_good(current)))
current = m.next(current) ; m.next(current) ;
if(current == m.end()) if(current == m.end())
current = NIL ; current = NIL ;
...@@ -92,7 +92,7 @@ Dart TraversorCell<MAP>::next() ...@@ -92,7 +92,7 @@ Dart TraversorCell<MAP>::next()
while(current != NIL && (ismarked || m.isBoundaryMarked(current) || !m_good(current))) while(current != NIL && (ismarked || m.isBoundaryMarked(current) || !m_good(current)))
{ {
current = m.next(current) ; m.next(current) ;
if(current == m.end()) if(current == m.end())
current = NIL ; current = NIL ;
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment