X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSALOMEDS%2FSALOMEDS_Study_i.cxx;h=5bbc01b31cb8a13b4c32a9fbdf347175fafc5064;hb=a63265d524e8436588a7bb82147a69812c153b1b;hp=3dec698bc06ab9aa388be5ea2c96f4460bd9807f;hpb=63414a08d9492c25c206579c1953ec6f390679fd;p=modules%2Fyacs.git diff --git a/src/SALOMEDS/SALOMEDS_Study_i.cxx b/src/SALOMEDS/SALOMEDS_Study_i.cxx index 3dec698bc..5bbc01b31 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.cxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.cxx @@ -147,6 +147,23 @@ namespace SALOMEDS myObservers.push_back(std::make_pair(SALOMEDS::Observer::_duplicate(theObs),modify)); } + //============================================================================ + /*! Function : detach + * Purpose : unregister an Observer + */ + //============================================================================ + + virtual void detach(SALOMEDS::Observer_ptr theObs) + { + for (ObsListIter it (myObservers.begin()); it != myObservers.end(); ++it) + { + if ( it->first->_is_equivalent(theObs) ) { + myObservers.erase( it ); + break; + } + } + } + private: typedef std::list< std::pair< SALOMEDS::Observer_var, bool > > ObsList; typedef ObsList::iterator ObsListIter; @@ -1330,6 +1347,18 @@ void SALOMEDS_Study_i::attach(SALOMEDS::Observer_ptr theObs,CORBA::Boolean modif static_cast(_notifier)->attach(theObs,modify); } + +//============================================================================ +/*! Function : detach + * Purpose : This function detaches an observer from the study + */ +//============================================================================ +void SALOMEDS_Study_i::detach(SALOMEDS::Observer_ptr theObs) +{ + if(_notifier) + static_cast(_notifier)->detach(theObs); +} + //=========================================================================== // PRIVATE FUNCTIONS //===========================================================================