Automatic Resource Management Tutorial

The class templates for automatic resource management rely on guaranteed execution of their destructor to trigger cleanup. Due to potential issues with cleanup order when used in conjunction with the Symbian cleanup stack, different variants are required for managing local and member variables as described below.

Before beginning you must know the following:

  • LcleanedupX Classes: The LCleanedupX class provide a means of automatically cleaning up local variables on scope exit.

  • LmanagedX Classes: The LManagedX classes provide a means of automatically cleaning up member variables when the containing object is destroyed

The collection of C++ class templates that provide automatic resource management provided by EuserHl library is based on the C++ RAII idiom. The Symbian C++ class templates for automatic resource management are based on the C++ RAII idiom, in order to provide exception-safe automatic cleanup on normal or exceptional exit from a scope.

Automatic Resource Management Class templates

The Symbian C++ class templates for automatic resource management are relatively easier to use. They provide automatic exception-safe cleanup upon normal or exceptional exit from a scope. In which case they do not require writing any code for invoking the cleanup of resources. The resources are automatically cleaned up by the destructors of the template classes in that case.

The following are the class templates for automatic resource management:

  • LcleanedupX Classes

  • LmanagedX Classes

Note: Due to potential issues with cleanup order when used in conjunction with the Symbian cleanup stack, different variants are required for managing local and member variables. Click here for more information on Automatic Resource Management Class templates.