Version: 6.3.1
Public Member Functions | Protected Member Functions | Private Attributes

MyIterator< VALUE > Class Template Reference

Inheritance diagram for MyIterator< VALUE >:
Inheritance graph
[legend]

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_MeshElementnext ()
 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_MeshElementmyElem
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 
)

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)

Definition at line 287 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 MyElemIterator, and MyNodeIterator.

template<typename VALUE>
bool MyIterator< VALUE >.more ( ) [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 ( ) [virtual]

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

Implements SMDS_Iterator< VALUE >.

Definition at line 290 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 ( ) [virtual]

Return the current object and step to the next one.

Implements SMDS_Iterator< VALUE >.

Definition at line 84 of file SMESHDS_GroupOnGeom.cxx.

Referenced by MyIterator< const SMDS_MeshNode * >.MyIterator().

  {
    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;
  }
template<typename VALUE>
VALUE MyIterator< VALUE >.next ( ) [virtual]

Return the current object and step to the next one.

Implements SMDS_Iterator< VALUE >.

Definition at line 300 of file SMESHDS_SubMesh.cxx.

  {
    VALUE elem = 0;
    if ( myMore )
      elem = myElemIt->next();
    return elem;
  }
template<typename VALUE>
virtual void SMDS_Iterator< VALUE >.remove ( ) [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 ( ) [virtual, inherited]

Delete the current element and step to the next one.

Definition at line 44 of file SMDS_Iterator.hxx.

{}

Field Documentation

template<typename VALUE>
const SMDS_MeshElement* MyIterator< VALUE >.myElem [private]
template<typename VALUE>
SMDS_ElemIteratorPtr MyIterator< VALUE >.myElemIt [private]
template<typename VALUE>
boost::shared_ptr< SMDS_Iterator<VALUE> > MyIterator< VALUE >.myElemIt [private]

Definition at line 314 of file SMESHDS_SubMesh.cxx.

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

Definition at line 312 of file SMESHDS_SubMesh.cxx.

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

Definition at line 313 of file SMESHDS_SubMesh.cxx.

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

Definition at line 313 of file SMESHDS_SubMesh.cxx.

template<typename VALUE>
SMDSAbs_ElementType MyIterator< VALUE >.myType [private]
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS