NCBI C++ ToolKit
Classes | Macros | Typedefs | Functions | Variables
ncbiobj.cpp File Reference
#include <ncbi_pch.hpp>
#include <corelib/ncbiobj.hpp>
#include <corelib/ncbimtx.hpp>
#include <corelib/ncbi_param.hpp>
#include <corelib/ncbimempool.hpp>
#include <corelib/ncbithr.hpp>
#include <vector>
#include <corelib/error_codes.hpp>
+ Include dependency graph for ncbiobj.cpp:

Go to the source code of this file.

Go to the SVN repository for this file.

Classes

struct  SEraseLastNewPtrMultiple
 
class  CLocksMonitor
 
struct  CLocksMonitor::SLocks
 

Macros

#define USE_HEAPOBJ_LIST   0
 
#define USE_TLS_PTR   1
 
#define NCBI_USE_ERRCODE_X   Corelib_Object
 
#define ALLOC_FILL_MODE_INIT   CObject::eAllocFillPattern
 
#define ALLOC_FILL_MODE_DEFAULT   CObject::eAllocFillPattern
 
#define ALLOC_FILL_BYTE_PATTERN   0xaa
 
#define ObjFatal   Fatal
 

Typedefs

typedef pair< void *, CAtomicCounter::TValueTLastNewPtrMultipleInfo
 
typedef vector< TLastNewPtrMultipleInfoTLastNewPtrMultiple
 

Functions

static DECLARE_TLS_VAR (void *, s_LastNewPtr)
 
static DECLARE_TLS_VAR (CAtomicCounter::TValue, s_LastNewType)
 
static TTlsKey sx_GetLastNewPtrMultipleCurrentKey (void)
 
static TTlsKey sx_GetLastNewPtrMultipleKey (void)
 
static TLastNewPtrMultiplesx_GetLastNewPtrMultiple (void)
 
static void sx_PushLastNewPtrMultiple (void *ptr, CAtomicCounter::TValue type)
 
static CAtomicCounter::TValue sx_PopLastNewPtrMultiple (void *ptr)
 
static void sx_PushLastNewPtr (void *ptr, CAtomicCounter::TValue type)
 
static CAtomicCounter::TValue sx_PopLastNewPtr (void *ptr)
 
static CObject::EAllocFillMode sx_InitFillNewMemoryMode (void)
 
static void sx_FillNewMemory (void *ptr, size_t size)
 
 NCBI_PARAM_DECL (bool, NCBI, ABORT_ON_COBJECT_THROW)
 
 NCBI_PARAM_DEF_EX (bool, NCBI, ABORT_ON_COBJECT_THROW, false, eParam_NoThread, NCBI_ABORT_ON_COBJECT_THROW)
 
 NCBI_PARAM_DECL (bool, NCBI, ABORT_ON_NULL)
 
 NCBI_PARAM_DEF_EX (bool, NCBI, ABORT_ON_NULL, false, eParam_NoThread, NCBI_ABORT_ON_NULL)
 
typedef NCBI_PARAM_TYPE (NCBI, ABORT_ON_NULL) TAbortOnNull
 
bool MonitoredType (const CObject *object)
 
 DEFINE_STATIC_FAST_MUTEX (s_WeakRefMutex)
 

Variables

static const CObject::TCount eInitCounterNotInHeap
 Initial counter value for non-heap objects. More...
 
static const CObject::TCount eInitCounterInPool
 Initial counter value for objects allocated in memory pool. More...
 
static const CObject::TCount eInitCounterInHeap
 Initial counter value for in-heap objects. More...
 
static const CObject::TCount eMagicCounterDeleted
 All magic counter values should have all their state bits off. More...
 
static const CObject::TCount eMagicCounterNew
 Magic counter value for object allocated in heap. More...
 
static const CObject::TCount eMagicCounterPoolDeleted
 Magic counter value for deleted object allocated in memory pool. More...
 
static const CObject::TCount eMagicCounterPoolNew
 Magic counter value for objects allocated in memory pool. More...
 
static const CAtomicCounter::TValue kLastNewTypeMultiple = 1
 
static atomic< TTlsKeys_LastNewPtrMultiple_key
 
static CObject::EAllocFillMode sm_AllocFillMode
 
static bool sm_AllocFillMode_IsSet
 
static const type_info * sx_MonitorType = 0
 
static CSafeStatic< CLocksMonitorsx_LocksMonitor
 

Macro Definition Documentation

◆ ALLOC_FILL_BYTE_PATTERN

#define ALLOC_FILL_BYTE_PATTERN   0xaa

Definition at line 406 of file ncbiobj.cpp.

◆ ALLOC_FILL_MODE_DEFAULT

#define ALLOC_FILL_MODE_DEFAULT   CObject::eAllocFillPattern

Definition at line 398 of file ncbiobj.cpp.

◆ ALLOC_FILL_MODE_INIT

#define ALLOC_FILL_MODE_INIT   CObject::eAllocFillPattern

Definition at line 397 of file ncbiobj.cpp.

◆ NCBI_USE_ERRCODE_X

#define NCBI_USE_ERRCODE_X   Corelib_Object

Definition at line 99 of file ncbiobj.cpp.

◆ ObjFatal

#define ObjFatal   Fatal

Definition at line 639 of file ncbiobj.cpp.

◆ USE_HEAPOBJ_LIST

#define USE_HEAPOBJ_LIST   0

Definition at line 78 of file ncbiobj.cpp.

◆ USE_TLS_PTR

#define USE_TLS_PTR   1

Definition at line 79 of file ncbiobj.cpp.

Typedef Documentation

◆ TLastNewPtrMultiple

Definition at line 183 of file ncbiobj.cpp.

◆ TLastNewPtrMultipleInfo

Definition at line 182 of file ncbiobj.cpp.

Function Documentation

◆ DECLARE_TLS_VAR() [1/2]

static DECLARE_TLS_VAR ( CAtomicCounter::TValue  ,
s_LastNewType   
)
static

◆ DECLARE_TLS_VAR() [2/2]

static DECLARE_TLS_VAR ( void *  ,
s_LastNewPtr   
)
static

◆ DEFINE_STATIC_FAST_MUTEX()

DEFINE_STATIC_FAST_MUTEX ( s_WeakRefMutex  )

◆ MonitoredType()

bool MonitoredType ( const CObject object)
inline

◆ NCBI_PARAM_DECL() [1/2]

NCBI_PARAM_DECL ( bool  ,
NCBI  ,
ABORT_ON_COBJECT_THROW   
)

◆ NCBI_PARAM_DECL() [2/2]

NCBI_PARAM_DECL ( bool  ,
NCBI  ,
ABORT_ON_NULL   
)

◆ NCBI_PARAM_DEF_EX() [1/2]

NCBI_PARAM_DEF_EX ( bool  ,
NCBI  ,
ABORT_ON_COBJECT_THROW  ,
false  ,
eParam_NoThread  ,
NCBI_ABORT_ON_COBJECT_THROW   
)

◆ NCBI_PARAM_DEF_EX() [2/2]

NCBI_PARAM_DEF_EX ( bool  ,
NCBI  ,
ABORT_ON_NULL  ,
false  ,
eParam_NoThread  ,
NCBI_ABORT_ON_NULL   
)

◆ NCBI_PARAM_TYPE()

typedef NCBI_PARAM_TYPE ( NCBI  ,
ABORT_ON_NULL   
)

◆ sx_FillNewMemory()

static void sx_FillNewMemory ( void *  ptr,
size_t  size 
)
inlinestatic

◆ sx_GetLastNewPtrMultiple()

static TLastNewPtrMultiple& sx_GetLastNewPtrMultiple ( void  )
static

◆ sx_GetLastNewPtrMultipleCurrentKey()

static TTlsKey sx_GetLastNewPtrMultipleCurrentKey ( void  )
inlinestatic

◆ sx_GetLastNewPtrMultipleKey()

static TTlsKey sx_GetLastNewPtrMultipleKey ( void  )
inlinestatic

◆ sx_InitFillNewMemoryMode()

static CObject::EAllocFillMode sx_InitFillNewMemoryMode ( void  )
static

◆ sx_PopLastNewPtr()

static CAtomicCounter::TValue sx_PopLastNewPtr ( void *  ptr)
inlinestatic

Definition at line 322 of file ncbiobj.cpp.

References kLastNewTypeMultiple, and sx_PopLastNewPtrMultiple().

Referenced by CObject::InitCounter(), and CObject::operator delete().

◆ sx_PopLastNewPtrMultiple()

static CAtomicCounter::TValue sx_PopLastNewPtrMultiple ( void *  ptr)
static

◆ sx_PushLastNewPtr()

static void sx_PushLastNewPtr ( void *  ptr,
CAtomicCounter::TValue  type 
)
inlinestatic

Definition at line 309 of file ncbiobj.cpp.

References sx_PushLastNewPtrMultiple(), and type.

Referenced by CObject::operator new().

◆ sx_PushLastNewPtrMultiple()

static void sx_PushLastNewPtrMultiple ( void *  ptr,
CAtomicCounter::TValue  type 
)
static

Definition at line 276 of file ncbiobj.cpp.

References _ASSERT, kLastNewTypeMultiple, and sx_GetLastNewPtrMultiple().

Referenced by sx_PushLastNewPtr().

Variable Documentation

◆ eInitCounterInHeap

const CObject::TCount eInitCounterInHeap
static
Initial value:
=
static const TCount eCounterBitsCanBeDeleted
Define possible object states.
Definition: ncbiobj.hpp:335
static const TCount eCounterValid
Minimal value for valid objects (reference counter is zero) Must be a single bit value.
Definition: ncbiobj.hpp:352
static const TCount eCounterBitsInPlainHeap
Heap signature was found.
Definition: ncbiobj.hpp:337

Initial counter value for in-heap objects.

Definition at line 113 of file ncbiobj.cpp.

Referenced by CObject::DeleteThis(), and CObject::InitCounter().

◆ eInitCounterInPool

const CObject::TCount eInitCounterInPool
static
Initial value:

Initial counter value for objects allocated in memory pool.

Definition at line 110 of file ncbiobj.cpp.

Referenced by CObject::DeleteThis(), and CObject::InitCounter().

◆ eInitCounterNotInHeap

const CObject::TCount eInitCounterNotInHeap
static
Initial value:

Initial counter value for non-heap objects.

Definition at line 107 of file ncbiobj.cpp.

Referenced by CObject::InitCounter().

◆ eMagicCounterDeleted

const CObject::TCount eMagicCounterDeleted
static
Initial value:
=
0x5b4d9f34 & ~CObject::eCounterStateMask
CObject –.
Definition: ncbiobj.hpp:180

All magic counter values should have all their state bits off.

Magic counter value for deleted objects

Definition at line 142 of file ncbiobj.cpp.

Referenced by CObject::CheckReferenceOverflow(), CObject::DoDeleteThisObject(), CObject::DoNotDeleteThisObject(), CObject::operator delete(), CObject::ReleaseReference(), CObject::RemoveLastReference(), and CObject::~CObject().

◆ eMagicCounterNew

const CObject::TCount eMagicCounterNew
static
Initial value:
=
0x3423cb13 & ~CObject::eCounterStateMask

Magic counter value for object allocated in heap.

Definition at line 145 of file ncbiobj.cpp.

Referenced by CObject::InitCounter(), CObject::operator delete(), and CObject::operator new().

◆ eMagicCounterPoolDeleted

const CObject::TCount eMagicCounterPoolDeleted
static
Initial value:
=
0x4229775b & ~CObject::eCounterStateMask

Magic counter value for deleted object allocated in memory pool.

Definition at line 148 of file ncbiobj.cpp.

Referenced by CObject::CheckReferenceOverflow(), CObject::DoDeleteThisObject(), CObject::DoNotDeleteThisObject(), CObject::operator delete(), CObject::ReleaseReference(), CObject::RemoveLastReference(), and CObject::~CObject().

◆ eMagicCounterPoolNew

const CObject::TCount eMagicCounterPoolNew
static
Initial value:
=
0x54917ec2 & ~CObject::eCounterStateMask

Magic counter value for objects allocated in memory pool.

Definition at line 151 of file ncbiobj.cpp.

Referenced by CObject::InitCounter(), CObject::operator delete(), and CObject::operator new().

◆ kLastNewTypeMultiple

const CAtomicCounter::TValue kLastNewTypeMultiple = 1
static

Definition at line 179 of file ncbiobj.cpp.

Referenced by sx_PopLastNewPtr(), and sx_PushLastNewPtrMultiple().

◆ s_LastNewPtrMultiple_key

atomic<TTlsKey> s_LastNewPtrMultiple_key
static

Definition at line 187 of file ncbiobj.cpp.

Referenced by sx_GetLastNewPtrMultipleCurrentKey(), and sx_GetLastNewPtrMultipleKey().

◆ sm_AllocFillMode

CObject::EAllocFillMode sm_AllocFillMode
static

◆ sm_AllocFillMode_IsSet

bool sm_AllocFillMode_IsSet
static

Definition at line 395 of file ncbiobj.cpp.

Referenced by CObject::SetAllocFillMode(), and sx_InitFillNewMemoryMode().

◆ sx_LocksMonitor

CSafeStatic<CLocksMonitor> sx_LocksMonitor
static

◆ sx_MonitorType

const type_info* sx_MonitorType = 0
static
Modified on Fri Sep 20 14:58:02 2024 by modify_doxy.py rev. 669887