GlobalObjects
Loading...
Searching...
No Matches
glo::CallBackSpy Class Reference

Class to access the CallBack objects of a database in memory. More...

#include <GloCallBackSpy.h>

Public Member Functions

CallBackgetCallBack (EnSeekMode eMode)
 
CallBackgetCallBack (NUM_PTR ipAddress)
 

Static Public Member Functions

static void create (CallBackSpy *&prInstance)
 
static int destroy ()
 

Protected Member Functions

 CallBackSpy ()
 
virtual ~CallBackSpy ()
 
int insertCallBack (const CallBack *pCallBack)
 
int removeCallBack (const CallBack *pCallBack)
 

Static Protected Attributes

static int ms_iReferenceCounter
 
static CallBackSpyms_pInstance
 

Private Member Functions

 CallBackSpy (const CallBackSpy &)
 
CallBackSpyoperator= (const CallBackSpy &)
 

Private Attributes

eut::CriticalSection m_CallBackListCriticalSection
 
std::unordered_map< NUM_PTR, CallBack * > m_List
 
std::unordered_map< NUM_PTR, CallBack * >::iterator m_ListIterator
 

Friends

class CallBack
 

Detailed Description

Class to access the CallBack objects of a database in memory.

All CallBack objects log on automatically here.

There may only be one object of this class (Singleton Class).

Author
Helmut Jakoby

Constructor & Destructor Documentation

◆ CallBackSpy() [1/2]

glo::CallBackSpy::CallBackSpy ( )
protected

The standard constructor is not available. You can get an instance via CallBackSpy::create(CallBackSpy*&) .

◆ ~CallBackSpy()

virtual glo::CallBackSpy::~CallBackSpy ( )
protectedvirtual

The destructor is not available. An DebugClassSpy object may only be removed from memory with CallBackSpy::destroy().

◆ CallBackSpy() [2/2]

glo::CallBackSpy::CallBackSpy ( const CallBackSpy & )
private

The copy constructor is not available.

Member Function Documentation

◆ create()

static void glo::CallBackSpy::create ( CallBackSpy *& prInstance)
static

Instantiation function. Since CallBackSpy is a singleton class, this method instantiates it once and then only returns the pointer to the instance.

Parameters
[in,out]prInstanceThe only instance of this class.
Attention
The delivered instance must be removed from memory with CallBackSpy::destroy().

◆ destroy()

static int glo::CallBackSpy::destroy ( )
static

If the calling instance is the last one with a reference to the only instance of CallBackSpy, this instance is removed from memory.

Returns
Return is the number of still-references to this instance.

◆ getCallBack() [1/2]

CallBack * glo::CallBackSpy::getCallBack ( EnSeekMode eMode)

Returns a CallBack object from the list of CallBack objects related to eMode

Parameters
[in]eModeThe seek mode.

Parameter examples:

Returns
If found, the CallBack object, otherwise nullptr.
Attention
The calling instance must not remove the supplied object from memory.

◆ getCallBack() [2/2]

CallBack * glo::CallBackSpy::getCallBack ( NUM_PTR ipAddress)

Returns a pointer to a CallBack object from the list of CallBack objects, which has the passed address in memory.

Parameters
[in]ipAddressThe memory address.
Returns
The pointer to the CallBack object if found; otherwise nullptr.
Attention
The calling instance must not remove the supplied object from memory.

◆ insertCallBack()

int glo::CallBackSpy::insertCallBack ( const CallBack * pCallBack)
protected

Inserts a CallBack object into the list of CallBack objects.

Parameters
[in]pCallBackThe CallBack object to be inserted.
Returns
A return < 0 indicates an error.

◆ operator=()

CallBackSpy & glo::CallBackSpy::operator= ( const CallBackSpy & )
private

The assignment operator is not available.

◆ removeCallBack()

int glo::CallBackSpy::removeCallBack ( const CallBack * pCallBack)
protected

Removes a CallBack object from the list of CallBack objects.

Parameters
[in]pCallBackThe CallBack object to be removed.
Returns
A return < 0 indicates an error.

Friends And Related Symbol Documentation

◆ CallBack

friend class CallBack
friend

Member Data Documentation

◆ m_CallBackListCriticalSection

eut::CriticalSection glo::CallBackSpy::m_CallBackListCriticalSection
private

To have thread-safe access to the list of CallBack objects, access is synchronized via this local CriticalSection.

◆ m_List

std::unordered_map< NUM_PTR, CallBack * > glo::CallBackSpy::m_List
private

The list of CallBack objects. The index is the address, cast to NUM_PTR, of the individual objects.

◆ m_ListIterator

std::unordered_map<NUM_PTR,CallBack*>::iterator glo::CallBackSpy::m_ListIterator
private

An internal iterator to the CallBack object list.

◆ ms_iReferenceCounter

int glo::CallBackSpy::ms_iReferenceCounter
staticprotected

The reference counter to the only instance of this class.

◆ ms_pInstance

CallBackSpy* glo::CallBackSpy::ms_pInstance
staticprotected

The only instance of this class.


The documentation for this class was generated from the following file: