]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
0020832: EDF 1359 SMESH : Automatic meshing of boundary layers
authoreap <eap@opencascade.com>
Wed, 15 Dec 2010 10:54:06 +0000 (10:54 +0000)
committereap <eap@opencascade.com>
Wed, 15 Dec 2010 10:54:06 +0000 (10:54 +0000)
+ SMDS_IteratorOnIterators.hxx

src/SMDS/Makefile.am
src/SMDS/SMDS_IteratorOnIterators.hxx [new file with mode: 0644]

index 869c6677ce71f57ae4132368443632243e868b83..328654d1aad8ba54b57ae2163b4dbeb549743c20 100644 (file)
@@ -61,7 +61,8 @@ salomeinclude_HEADERS = \
        SMDS_SetIterator.hxx \
        SMESH_SMDS.hxx \
        SMDS_MeshInfo.hxx \
-       SMDS_StdIterator.hxx
+       SMDS_StdIterator.hxx \
+       SMDS_IteratorOnIterators.hxx
 
 
 # Libraries targets
diff --git a/src/SMDS/SMDS_IteratorOnIterators.hxx b/src/SMDS/SMDS_IteratorOnIterators.hxx
new file mode 100644 (file)
index 0000000..2712f50
--- /dev/null
@@ -0,0 +1,64 @@
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+//  SMESH SMDS : implementaion of Salome mesh data structure
+// File      : SMDS_IteratorOnIterators.hxx
+// Author    : Edward AGAPOV (eap)
+//
+#ifndef SMDS_IteratorOnIterators_HeaderFile
+#define SMDS_IteratorOnIterators_HeaderFile
+
+#include "SMDS_Iterator.hxx"
+
+///////////////////////////////////////////////////////////////////////////////
+/// SMDS_Iterator iterating over all elements provides by other iterators
+///
+/// Other iterators must implement SMDS_Iterator iterface and
+/// must be provided within a stl-like container
+/// BE CAREFUL: iterator pointed value is static_cast'ed to VALUE
+///////////////////////////////////////////////////////////////////////////////
+
+template<typename VALUE,
+         typename CONTAINER_OF_ITERATORS >
+class SMDS_IteratorOnIterators : public SMDS_Iterator<VALUE>
+{
+protected:
+  CONTAINER_OF_ITERATORS _iterators;
+  typename CONTAINER_OF_ITERATORS::iterator _beg, _end;
+public:
+  SMDS_IteratorOnIterators(const CONTAINER_OF_ITERATORS& iterators):
+    _iterators( iterators ), _beg( _iterators.begin()), _end(_iterators.end() ) {}
+
+  /// Return true iff there are other object in this iterator
+  virtual bool more() { return _beg != _end && (*_beg)->more(); }
+
+  /// Return the current object and step to the next one
+  virtual VALUE next()
+  {
+    VALUE __v = (VALUE)(*_beg)->next();
+    while ( _beg != _end && !(*_beg)->more())
+      ++_beg;
+    return __v;
+  }
+};
+
+#endif