NCBI C++ ToolKit
|
Search Toolkit Book for CSafeStatic_Callbacks
Initialization and cleanup of a safe-static object. More...
#include <corelib/ncbi_safe_static.hpp>
Public Types | |
typedef T *(* | FCreate) (void) |
The default implementation allows to use callback functions rather than a new class. More... | |
typedef void(* | FCleanup) (T &value) |
typedef CSafeStatic_Allocator< T > | TAllocator |
Public Member Functions | |
CSafeStatic_Callbacks (FCreate create=0, FCleanup cleanup=0) | |
The constructor allows to use CSafeStatic_Callbacks as a simple wrapper for static functions. More... | |
T * | Create (void) |
Create new object. More... | |
void | Cleanup (T &value) |
Perform cleanup before destruction. More... | |
Private Attributes | |
FCreate | m_Create |
FCleanup | m_Cleanup |
Initialization and cleanup of a safe-static object.
Must implement at least Create() and Cleanup() methods. Create() must create a new object and return the initialized pointer. Cleanup() can be a no-op. The default implementation allows to use it as a wrapper for static callback functions.
Definition at line 383 of file ncbi_safe_static.hpp.
typedef void(* CSafeStatic_Callbacks< T >::FCleanup) (T &value) |
Definition at line 389 of file ncbi_safe_static.hpp.
typedef T*(* CSafeStatic_Callbacks< T >::FCreate) (void) |
The default implementation allows to use callback functions rather than a new class.
Definition at line 388 of file ncbi_safe_static.hpp.
typedef CSafeStatic_Allocator<T> CSafeStatic_Callbacks< T >::TAllocator |
Definition at line 390 of file ncbi_safe_static.hpp.
|
inline |
The constructor allows to use CSafeStatic_Callbacks as a simple wrapper for static functions.
create | Initialization function which must create a new object. If null, no special initialization is performed. |
cleanup | Cleanup function. If null, no special cleanup is performed. |
Definition at line 399 of file ncbi_safe_static.hpp.
|
inline |
Perform cleanup before destruction.
ptr | Object to be destroyed using the selected allocator. The cleanup method should not destroy the object itself, just perform any additional actions (e.g. setting some external pointers to null). |
Definition at line 414 of file ncbi_safe_static.hpp.
|
inline |
Create new object.
Definition at line 405 of file ncbi_safe_static.hpp.
|
private |
Definition at line 422 of file ncbi_safe_static.hpp.
Referenced by CSafeStatic_Callbacks< list< UpdaterInterface * > >::Cleanup().
|
private |
Definition at line 421 of file ncbi_safe_static.hpp.
Referenced by CSafeStatic_Callbacks< list< UpdaterInterface * > >::Create().