oILAB
Loading...
Searching...
No Matches
gbLAB::StaticID< Derived > Class Template Reference

A class template that implements a counter of the number of instances of Derived type that are created at runtime. It also provides a unique increasing static identifier (sID) for each instance. More...

#include <StaticID.h>

Public Member Functions

 StaticID ()
 
 StaticID (const StaticID &)
 

Static Public Member Functions

static size_t nextID ()
 
static size_t & get_count ()
 
static void set_count (const size_t &newCount)
 
static void set_increment (const size_t &newIncrement)
 

Data Fields

const size_t sID
 The static ID of this.
 

Static Private Attributes

static size_t increment = 1
 
static size_t count = 0
 
static bool count_used = false
 

Detailed Description

template<typename Derived>
class gbLAB::StaticID< Derived >

A class template that implements a counter of the number of instances of Derived type that are created at runtime. It also provides a unique increasing static identifier (sID) for each instance.

Example:

Output:

Definition at line 26 of file StaticID.h.

Constructor & Destructor Documentation

◆ StaticID() [1/2]

template<typename Derived >
gbLAB::StaticID< Derived >::StaticID ( )
inline

Definition at line 42 of file StaticID.h.

◆ StaticID() [2/2]

template<typename Derived >
gbLAB::StaticID< Derived >::StaticID ( const StaticID< Derived > &  )
inline

Definition at line 49 of file StaticID.h.

Member Function Documentation

◆ get_count()

template<typename Derived >
static size_t & gbLAB::StaticID< Derived >::get_count ( )
inlinestatic

Definition at line 61 of file StaticID.h.

◆ nextID()

template<typename Derived >
static size_t gbLAB::StaticID< Derived >::nextID ( )
inlinestatic

Definition at line 56 of file StaticID.h.

◆ set_count()

template<typename Derived >
static void gbLAB::StaticID< Derived >::set_count ( const size_t &  newCount)
inlinestatic

Definition at line 67 of file StaticID.h.

◆ set_increment()

template<typename Derived >
static void gbLAB::StaticID< Derived >::set_increment ( const size_t &  newIncrement)
inlinestatic

Definition at line 78 of file StaticID.h.

Field Documentation

◆ count

template<typename Derived >
size_t gbLAB::StaticID< Derived >::count = 0
staticprivate

Definition at line 33 of file StaticID.h.

◆ count_used

template<typename Derived >
bool gbLAB::StaticID< Derived >::count_used = false
staticprivate

Definition at line 34 of file StaticID.h.

◆ increment

template<typename Derived >
size_t gbLAB::StaticID< Derived >::increment = 1
staticprivate

Definition at line 30 of file StaticID.h.

◆ sID

template<typename Derived >
const size_t gbLAB::StaticID< Derived >::sID

The static ID of this.

Definition at line 39 of file StaticID.h.


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