Tulip 5.7.1
Large graphs analysis and drawing
Loading...
Searching...
No Matches
tlp::ObserverHolder Class Reference

#include <Observable.h>

Detailed Description

The ObserverHolder class is a convenience class to automatically hold and unhold observers. It performs a call to Observable::holdObservers() at its creation and a call to Observable::unholdObservers() 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::unholdObservers() for each of them.

void myFunc(){
ObserverHolder holder;//Automatically call Observable::holdObservers()
if(someTest()){
someOperation1();
return;//No need to call Observable::unholdObservers() it will be called with the
destruction of the locker object
}
}
The ObserverHolder class is a convenience class to automatically hold and unhold observers....
Definition: Observable.h:548

Definition at line 548 of file Observable.h.

Constructor & Destructor Documentation

◆ ObserverHolder()

tlp::ObserverHolder::ObserverHolder ( )
inline

Definition at line 550 of file Observable.h.

◆ ~ObserverHolder()

tlp::ObserverHolder::~ObserverHolder ( )
inline

Definition at line 553 of file Observable.h.