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

Class to access the opened databases. More...

#include <GloOpenedDatabases.h>

Public Member Functions

BasegetDataBase (unsigned long ulDatabaseID)
 

Static Public Member Functions

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

Protected Member Functions

 OpenedDatabases ()
 
virtual ~OpenedDatabases ()
 
int insertDataBase (const Base *pDatabase)
 
int removeDataBase (unsigned long ulDatabaseID)
 

Static Protected Attributes

static int ms_iReferenceCounter
 
static OpenedDatabasesms_pInstance
 

Private Member Functions

 OpenedDatabases (const OpenedDatabases &)
 
OpenedDatabasesoperator= (const OpenedDatabases &)
 

Private Attributes

std::unordered_map< unsigned long, Base * > m_BaseContainer
 
eut::CriticalSection m_CallBackListCriticalSection
 

Friends

class Base
 

Detailed Description

Class to access the opened databases.

Here all databases log in when opened and log out again automatically when closed.

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

Author
Helmut Jakoby

Constructor & Destructor Documentation

◆ OpenedDatabases() [1/2]

glo::OpenedDatabases::OpenedDatabases ( )
protected

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

◆ ~OpenedDatabases()

virtual glo::OpenedDatabases::~OpenedDatabases ( )
protectedvirtual

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

◆ OpenedDatabases() [2/2]

glo::OpenedDatabases::OpenedDatabases ( const OpenedDatabases & )
private

The copy constructor is not available.

Member Function Documentation

◆ create()

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

Instantiation function. Since OpenedDatabases 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 OpenedDatabases::destroy().

◆ destroy()

static int glo::OpenedDatabases::destroy ( )
static

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

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

◆ getDataBase()

Base * glo::OpenedDatabases::getDataBase ( unsigned long ulDatabaseID)

Returns a database object from the list of database objects with respect to the database ID.

Returns
The database object if found; otherwise nullptr.
Attention
The calling instance must not remove the returned object from memory. It only exists as long as it is not removed from memory by the creating instance.

◆ insertDataBase()

int glo::OpenedDatabases::insertDataBase ( const Base * pDatabase)
protected

Inserts a database object into the list of database objects.

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

◆ operator=()

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

The assignment operator is not available.

◆ removeDataBase()

int glo::OpenedDatabases::removeDataBase ( unsigned long ulDatabaseID)
protected

Removes a database object from the list of database objects.

Parameters
[in]ulDatabaseIDThe database ID of the database object to be removed.
Returns
A return < 0 indicates an error.

Friends And Related Symbol Documentation

◆ Base

friend class Base
friend

Member Data Documentation

◆ m_BaseContainer

std::unordered_map< unsigned long, Base * > glo::OpenedDatabases::m_BaseContainer
private

The container of database objects. The index is the Base-ID.

◆ m_CallBackListCriticalSection

eut::CriticalSection glo::OpenedDatabases::m_CallBackListCriticalSection
private

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

◆ ms_iReferenceCounter

int glo::OpenedDatabases::ms_iReferenceCounter
staticprotected

The reference counter to the only instance of this class.

◆ ms_pInstance

OpenedDatabases* glo::OpenedDatabases::ms_pInstance
staticprotected

The only instance of this class.


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