Tulip  4.6.0
Better Visualization Through Research
tlp::ObserverHolder Class Reference

#include <Observable.h>

List of all members.


Detailed Description

The ObserverHolder class is a convenience class to automatically hold and unhold observers. It performs a call to Observable::holdObserver() at its creation and a call to Observable::unholdObserver() at its destruction. You can use it if you have to hold observers in a function with multiple return points to avoid to call Observable::unholdObserver() for each of them.

 void myFunc(){
  ObserverHolder holder;//Automatically call Observable::holdObserver()

  if(someTest()){
      someOperation1();
      return;//No need to call Observable::unholdObserver() it will be called with the destruction of the locker object
  }

 }

Definition at line 518 of file Observable.h.

 All Classes Files Functions Variables Enumerations Enumerator Properties