NCBI C++ ToolKit
Classes | Macros | Variables
ncbi_safe_static.hpp File Reference

Static variables safety - create on demand, destroy on application termination. More...

#include <corelib/ncbiobj.hpp>
#include <corelib/ncbimtx.hpp>
#include <corelib/ncbi_limits.h>
#include <array>
+ Include dependency graph for ncbi_safe_static.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Go to the SVN repository for this file.

Classes

class  CSafeStaticLifeSpan
 CSafeStaticLifeSpan:: More...
 
class  CSafeStaticPtr_Base
 CSafeStaticPtr_Base:: More...
 
class  CSafeStatic_Less
 Comparison for safe static ptrs. More...
 
class  CSafeStaticGuard
 CSafeStaticGuard:: More...
 
class  CSafeStatic_Allocator< T >
 Helper class for object allocation/deallocation. More...
 
class  CSafeStatic_Callbacks< T >
 Initialization and cleanup of a safe-static object. More...
 
class  CSafeStatic< T, Callbacks >
 CSafeStatic<>:: More...
 
class  CSafeStaticInit_Callbacks< T, V, value >
 Safe static callbacks version allowing initial value of type V. More...
 
class  CSafeStaticPtr< T >
 CSafeStaticPtr<>:: More...
 
class  CSafeStaticRef< T >
 CSafeStaticRef<>:: More...
 

Macros

#define SAFE_CONST_STATIC(type, init_value)    SAFE_CONST_STATIC_EX(type, type, init_value)
 Declare CSafeStatic<const type>, initialize it with 'init_value' of the same type. More...
 
#define SAFE_CONST_STATIC_EX(type, init_value_type, init_value)
 Declare CSafeStatic<const type>, initialize it with 'init_value' of type 'init_value_type'. More...
 
#define SAFE_CONST_STATIC_STRING(var, value)
 Declare CSafeStatic<const string>, initialize it with 'const char* value'. More...
 

Variables

static CSafeStaticGuard s_CleanupGuard
 This static variable must be present in all modules using on-demand static variables. More...
 

Detailed Description

Static variables safety - create on demand, destroy on application termination.

Definition in file ncbi_safe_static.hpp.

Macro Definition Documentation

◆ SAFE_CONST_STATIC

#define SAFE_CONST_STATIC (   type,
  init_value 
)     SAFE_CONST_STATIC_EX(type, type, init_value)

Declare CSafeStatic<const type>, initialize it with 'init_value' of the same type.

Definition at line 574 of file ncbi_safe_static.hpp.

◆ SAFE_CONST_STATIC_EX

#define SAFE_CONST_STATIC_EX (   type,
  init_value_type,
  init_value 
)
Value:
CSafeStatic< const type, \
CSafeStaticInit_Callbacks<const type, init_value_type, init_value> >
CSafeStatic<>::
static int type
Definition: getdata.c:31

Declare CSafeStatic<const type>, initialize it with 'init_value' of type 'init_value_type'.

Definition at line 579 of file ncbi_safe_static.hpp.

◆ SAFE_CONST_STATIC_STRING

#define SAFE_CONST_STATIC_STRING (   var,
  value 
)
Value:
char SAFE_CONST_STATIC_STRING_##var[] = value; \
SAFE_CONST_STATIC_EX(std::string, const char*, \
SAFE_CONST_STATIC_STRING_##var) var
string
Definition: cgiapp.hpp:687
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227

Declare CSafeStatic<const string>, initialize it with 'const char* value'.

Definition at line 584 of file ncbi_safe_static.hpp.

Variable Documentation

◆ s_CleanupGuard

CSafeStaticGuard s_CleanupGuard
static

This static variable must be present in all modules using on-demand static variables.

The guard must be created first regardless of the modules initialization order.

Definition at line 768 of file ncbi_safe_static.hpp.

Modified on Wed Apr 17 13:10:25 2024 by modify_doxy.py rev. 669887