The support for custom cleanup strategies is based on a template-based implementation of the Strategy design pattern. Cleanup strategies can be specified as an optional template parameter of the class templates for automatic resource management.
The default cleanup strategy is determined by the TResourceCleanupStrategy class template which by default calls a function named Cleanup() function. The DEFINE_CLEANUP_FUNCTION macro defines an inline function named Cleanup() function which is invoked for cleanup of the managed object in place of the default CallCleanupFunction function defined in the header file.
DEFINE_CLEANUP_FUNCTION is provided in order to enable Symbian Developers to easily define the default cleanup member function for a class type, such as an R-class. The macro can be used in the same namespace in which the R-class is defined or in a namespace in which the R-class is used. The DEFINE_CLEANUP_FUNCTION can be used by class designers, but if a class does not have a cleanup function specified, then the class users can use the DEFINE_CLEANUP_FUNCTION in order to define the default cleanup function for that class.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License v1.0.