IMP Reference Guide
2.6.2
The Integrative Modeling Platform
|
Temporarily change something; undo the change when this object is destroyed. More...
#include <IMP/RAII.h>
Temporarily change something; undo the change when this object is destroyed.
An RAII class (Resource Acquisition Is Initialization) provides a way of temporarily changing something and undoing the change when the RAII object is destroyed. Examples include reference counting and changing the log level where you want to do something (increase the amount of logging), but ensure that when your function exits, things are put back to how they were before.
In Python, all RAII objects also support the context manager protocol (the 'with' statement), and its use is strongly encouraged.