LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
LC::Util::IDPool< T > Class Template Referencefinal

A simple pool of identificators of the given type. More...

#include "idpool.h"

Public Member Functions

 IDPool (const T &id=T())
 Creates a pool with the given initial value. More...
 
GetID ()
 Returns next ID. More...
 
void SetID (T id)
 Forcefully sets the current ID. More...
 
void FreeID (T id)
 Frees the id. More...
 
QByteArray SaveState () const
 Saves the state of this pool. More...
 
void LoadState (const QByteArray &state)
 Recovers the state of this pool. More...
 

Detailed Description

template<typename T>
class LC::Util::IDPool< T >

A simple pool of identificators of the given type.

This class holds a pool of identificators of the given type T. It is very simple and produces consecutive IDs, this T should support operator++().

Definition at line 32 of file idpool.h.

Constructor & Destructor Documentation

◆ IDPool()

template<typename T >
LC::Util::IDPool< T >::IDPool ( const T &  id = T ())
inlineexplicit

Creates a pool with the given initial value.

Parameters
[in]idThe initial value of the pool.

Definition at line 46 of file idpool.h.

Member Function Documentation

◆ FreeID()

template<typename T >
void LC::Util::IDPool< T >::FreeID ( id)
inline

Frees the id.

Parameters
[in]idThe ID to free.

Definition at line 73 of file idpool.h.

◆ GetID()

template<typename T >
T LC::Util::IDPool< T >::GetID ( )
inline

Returns next ID.

Returns
Next ID in the pool.

Definition at line 55 of file idpool.h.

◆ LoadState()

template<typename T >
void LC::Util::IDPool< T >::LoadState ( const QByteArray &  state)
inline

Recovers the state of this pool.

Parameters
[in]stateThe state of this pool obtained from SaveState().

Definition at line 99 of file idpool.h.

◆ SaveState()

template<typename T >
QByteArray LC::Util::IDPool< T >::SaveState ( ) const
inline

Saves the state of this pool.

Returns
The serialized state of this pool.

Definition at line 82 of file idpool.h.

◆ SetID()

template<typename T >
void LC::Util::IDPool< T >::SetID ( id)
inline

Forcefully sets the current ID.

Parameters
[in]idThe new current ID.

Definition at line 64 of file idpool.h.


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