Back to index

salome-smesh  6.5.0
Public Member Functions | Protected Member Functions | Private Attributes
MyIterator< VALUE > Class Template Reference
Inheritance diagram for MyIterator< VALUE >:
Inheritance graph
[legend]
Collaboration diagram for MyIterator< VALUE >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 MyIterator (SMDSAbs_ElementType type, const SMESHDS_SubMesh *subMesh)
bool more ()
 Return true if and only if there are other object in this iterator.
const SMDS_MeshElement * next ()
 Return the current object and step to the next one.
 MyIterator (const set< const SMESHDS_SubMesh * > &theSubMeshes)
bool more ()
 Return true if and only if there are other object in this iterator.
VALUE next ()
 Return the current object and step to the next one.
virtual void remove ()
 Delete the current element and step to the next one.
virtual void remove ()
 Delete the current element and step to the next one.

Protected Member Functions

virtual boost::shared_ptr
< SMDS_Iterator< VALUE > > 
getElements (const SMESHDS_SubMesh *) const =0

Private Attributes

SMDSAbs_ElementType myType
SMDS_ElemIteratorPtr myElemIt
SMDS_NodeIteratorPtr myNodeIt
const SMDS_MeshElement * myElem
bool myMore
set< const SMESHDS_SubMesh * >
::const_iterator 
mySubIt
set< const SMESHDS_SubMesh * >
::const_iterator 
mySubEnd
boost::shared_ptr
< SMDS_Iterator< VALUE > > 
myElemIt

Detailed Description

template<typename VALUE>
class MyIterator< VALUE >

Definition at line 59 of file SMESHDS_GroupOnGeom.cxx.


Constructor & Destructor Documentation

template<typename VALUE>
MyIterator< VALUE >::MyIterator ( SMDSAbs_ElementType  type,
const SMESHDS_SubMesh *  subMesh 
) [inline]

Definition at line 66 of file SMESHDS_GroupOnGeom.cxx.

    : myType(type), myElem(0)
  {
    if ( subMesh ) {
      if ( myType == SMDSAbs_Node )
        myNodeIt = subMesh->GetNodes();
      else {
        myElemIt = subMesh->GetElements();
        next();
      }
    }
  }
template<typename VALUE>
MyIterator< VALUE >::MyIterator ( const set< const SMESHDS_SubMesh * > &  theSubMeshes) [inline]

Definition at line 292 of file SMESHDS_SubMesh.cxx.

    : mySubIt( theSubMeshes.begin() ), mySubEnd( theSubMeshes.end() ), myMore(false)
    {}

Member Function Documentation

template<typename VALUE>
virtual boost::shared_ptr< SMDS_Iterator<VALUE> > MyIterator< VALUE >::getElements ( const SMESHDS_SubMesh *  ) const [protected, pure virtual]

Implemented in MyNodeIterator, and MyElemIterator.

template<typename VALUE>
bool MyIterator< VALUE >::more ( ) [inline, virtual]

Return true if and only if there are other object in this iterator.

Implements SMDS_Iterator< VALUE >.

Definition at line 78 of file SMESHDS_GroupOnGeom.cxx.

  {
    if ( myType == SMDSAbs_Node && myNodeIt )
      return myNodeIt->more();
    return ( myElem != 0 );
  }
template<typename VALUE>
bool MyIterator< VALUE >::more ( ) [inline, virtual]

Return true if and only if there are other object in this iterator.

Implements SMDS_Iterator< VALUE >.

Definition at line 295 of file SMESHDS_SubMesh.cxx.

  {
    while (( !myElemIt.get() || !myElemIt->more() ) && mySubIt != mySubEnd)
    {
      myElemIt = getElements(*mySubIt);
      mySubIt++;
    }
    myMore = myElemIt.get() && myElemIt->more();
    return myMore;
  }
template<typename VALUE>
const SMDS_MeshElement* MyIterator< VALUE >::next ( ) [inline, virtual]

Return the current object and step to the next one.

Implements SMDS_Iterator< VALUE >.

Definition at line 84 of file SMESHDS_GroupOnGeom.cxx.

  {
    if ( myType == SMDSAbs_Node && myNodeIt )
      return myNodeIt->next();
    const SMDS_MeshElement* res = myElem;
    myElem = 0;
    while ( myElemIt && myElemIt->more() ) {
      myElem = myElemIt->next();
      if ( myElem && myElem->GetType() == myType )
        break;
      else
        myElem = 0;
    }
    return res;
  }

Here is the caller graph for this function:

template<typename VALUE>
VALUE MyIterator< VALUE >::next ( ) [inline, virtual]

Return the current object and step to the next one.

Implements SMDS_Iterator< VALUE >.

Definition at line 305 of file SMESHDS_SubMesh.cxx.

  {
    VALUE elem = 0;
    if ( myMore )
      elem = myElemIt->next();
    return elem;
  }
template<typename VALUE>
virtual void SMDS_Iterator< VALUE >::remove ( ) [inline, virtual, inherited]

Delete the current element and step to the next one.

Definition at line 44 of file SMDS_Iterator.hxx.

{}
virtual void SMDS_Iterator< const SMDS_MeshElement * >::remove ( ) [inline, virtual, inherited]

Delete the current element and step to the next one.

Definition at line 44 of file SMDS_Iterator.hxx.

{}

Member Data Documentation

template<typename VALUE>
const SMDS_MeshElement* MyIterator< VALUE >::myElem [private]

Definition at line 64 of file SMESHDS_GroupOnGeom.cxx.

template<typename VALUE>
SMDS_ElemIteratorPtr MyIterator< VALUE >::myElemIt [private]

Definition at line 62 of file SMESHDS_GroupOnGeom.cxx.

template<typename VALUE>
boost::shared_ptr< SMDS_Iterator<VALUE> > MyIterator< VALUE >::myElemIt [private]

Definition at line 319 of file SMESHDS_SubMesh.cxx.

template<typename VALUE>
bool MyIterator< VALUE >::myMore [private]

Definition at line 317 of file SMESHDS_SubMesh.cxx.

template<typename VALUE>
SMDS_NodeIteratorPtr MyIterator< VALUE >::myNodeIt [private]

Definition at line 63 of file SMESHDS_GroupOnGeom.cxx.

template<typename VALUE>
set<const SMESHDS_SubMesh*>::const_iterator MyIterator< VALUE >::mySubEnd [private]

Definition at line 318 of file SMESHDS_SubMesh.cxx.

template<typename VALUE>
set<const SMESHDS_SubMesh*>::const_iterator MyIterator< VALUE >::mySubIt [private]

Definition at line 318 of file SMESHDS_SubMesh.cxx.

template<typename VALUE>
SMDSAbs_ElementType MyIterator< VALUE >::myType [private]

Definition at line 61 of file SMESHDS_GroupOnGeom.cxx.


The documentation for this class was generated from the following files: