DiaDes  0.1
DIAgnosis of Discrete-Event System
Public Types | Public Member Functions | Private Attributes | List of all members
Diades::Utils::PrefixedCounterIdGenerator Class Reference

#include <IdGenerators.hh>

Public Types

using BasicString = std::string
 
using IdGen = IdGenerator< BasicString >
 

Public Member Functions

 PrefixedCounterIdGenerator ()=default
 
 PrefixedCounterIdGenerator (PrefixedCounterIdGenerator const &other)=default
 
PrefixedCounterIdGeneratoroperator= (PrefixedCounterIdGenerator const &other)=default
 
 PrefixedCounterIdGenerator (PrefixedCounterIdGenerator &&other)=default
 
PrefixedCounterIdGeneratoroperator= (PrefixedCounterIdGenerator &&other)=default
 
virtual ~PrefixedCounterIdGenerator ()=default
 
 PrefixedCounterIdGenerator (const std::string &prefix)
 
 PrefixedCounterIdGenerator (const std::string &prefix, size_t counter)
 
virtual void init ()
 
virtual std::string another ()
 

Private Attributes

BasicString _prefix
 
size_t _initial
 
size_t _counter
 

Detailed Description

note that it is specialised for std::string because of std::to_string

Definition at line 46 of file IdGenerators.hh.

Member Typedef Documentation

◆ BasicString

Definition at line 49 of file IdGenerators.hh.

◆ IdGen

Definition at line 50 of file IdGenerators.hh.

Constructor & Destructor Documentation

◆ PrefixedCounterIdGenerator() [1/5]

Diades::Utils::PrefixedCounterIdGenerator::PrefixedCounterIdGenerator ( )
default

Default constructor

◆ PrefixedCounterIdGenerator() [2/5]

Diades::Utils::PrefixedCounterIdGenerator::PrefixedCounterIdGenerator ( PrefixedCounterIdGenerator const &  other)
default

Copy constructor (default)

Parameters
other

◆ PrefixedCounterIdGenerator() [3/5]

Diades::Utils::PrefixedCounterIdGenerator::PrefixedCounterIdGenerator ( PrefixedCounterIdGenerator &&  other)
default

Move constructor (default)

Parameters
other

◆ ~PrefixedCounterIdGenerator()

virtual Diades::Utils::PrefixedCounterIdGenerator::~PrefixedCounterIdGenerator ( )
virtualdefault

Destructor

◆ PrefixedCounterIdGenerator() [4/5]

Diades::Utils::PrefixedCounterIdGenerator::PrefixedCounterIdGenerator ( const std::string &  prefix)
inline

Parametrised constructor

Parameters
prefixthe Prefix of every generated identifier By using init() the first generated identifier will be "prefix0"

Definition at line 98 of file IdGenerators.hh.

◆ PrefixedCounterIdGenerator() [5/5]

Diades::Utils::PrefixedCounterIdGenerator::PrefixedCounterIdGenerator ( const std::string &  prefix,
size_t  counter 
)
inline

Parametrised constructor

Parameters
prefixthe Prefix of every generated identifier
counterthe initial counter By using init() the first generated identifier will be "prefixN" with counter = N

Definition at line 108 of file IdGenerators.hh.

Member Function Documentation

◆ another()

virtual std::string Diades::Utils::PrefixedCounterIdGenerator::another ( )
inlinevirtual
Returns
another generated identifier If the previous identifier was "prefixN" then it generates "prefixN+1"

Implements Diades::Utils::IdGenerator< std::string >.

Definition at line 128 of file IdGenerators.hh.

◆ init()

virtual void Diades::Utils::PrefixedCounterIdGenerator::init ( )
inlinevirtual

Reinitialise the generator

Implements Diades::Utils::IdGenerator< std::string >.

Definition at line 116 of file IdGenerators.hh.

◆ operator=() [1/2]

PrefixedCounterIdGenerator& Diades::Utils::PrefixedCounterIdGenerator::operator= ( PrefixedCounterIdGenerator const &  other)
default

Assignement (default)

Parameters
other
Returns
the current PrefixedCounterIdGenerator

◆ operator=() [2/2]

PrefixedCounterIdGenerator& Diades::Utils::PrefixedCounterIdGenerator::operator= ( PrefixedCounterIdGenerator &&  other)
default

Move assignement (default)

Parameters
other
Returns
the current PrefixedCounterIdGenerator

Member Data Documentation

◆ _counter

size_t Diades::Utils::PrefixedCounterIdGenerator::_counter
private

Definition at line 55 of file IdGenerators.hh.

◆ _initial

size_t Diades::Utils::PrefixedCounterIdGenerator::_initial
private

Definition at line 54 of file IdGenerators.hh.

◆ _prefix

BasicString Diades::Utils::PrefixedCounterIdGenerator::_prefix
private

Definition at line 53 of file IdGenerators.hh.


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