[IGSTK-Users] Remove from observed object

Andinet Enquobahrie andinet.enqu at kitware.com
Thu Jan 28 14:30:01 EST 2010


Charles-

When an object you are observing is deleted,  a delete event
(igstk::DeleteEvent ) is thrown.

Callback functions ( ObservedObjectDeleteProcessing ) are setup to
listen to this delete event.  In this call back function, the object
gets removed from the list of the objects we are observing.

-Andinet

void Object::ObservedObjectDeleteProcessing(
  const ::itk::Object* caller, const EventType& event )
{
  ::itk::DeleteEvent deleteEvent;
  if ( deleteEvent.CheckEvent( &event ) == true )
    {
    // Setup a predicate that is true if the object in the pair == caller.
    ObservedObjectTagPairObjectMatchPredicate objectIsCaller( caller );

    // Remove the object that is being deleted from the list
    // containing the objects we observe. We use this list
    // when we're deleted to remove observers we've put in place.
    m_ObservedObjectPairContainer.remove_if( objectIsCaller );
    }


On Thu, Jan 28, 2010 at 8:41 AM,  <charles.garraud at irisa.fr> wrote:
> Hi everybody,
>
> I am currently exploring igstkObject.cxx to analyze the event workflow.
>
> In the Object::RemoveFromObservedObjects() method, the list
> m_ObservedObjectPairContainer is not cleared.
>
> Is it normal behaviour ?
>
> Thanks for the answer.
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/cgi-bin/mailman/listinfo/igstk-users
>



-- 
Andinet Enquobahrie, Ph.D.
Kitware, Inc. - North Carolina Office
http://www.kitware.com
(919) 969-6990 x311



More information about the IGSTK-Users mailing list