matador::sequencer Class Reference

Interface to create and get unique sequence numbers. More...

#include <sequencer.hpp>

Public Member Functions

 sequencer (sequencer_impl_ptr impl=sequencer_impl_ptr(new default_sequencer))
 Creates a new sequencer.
 
sequencer_impl_ptr exchange_sequencer (const sequencer_impl_ptr &impl)
 
unsigned long long init ()
 
unsigned long long reset (unsigned long long id)
 
unsigned long long next ()
 
unsigned long long current () const
 
unsigned long long update (unsigned long long id)
 

Detailed Description

Interface to create and get unique sequence numbers.

This class provides an interface to create, get and manage unique sequence numbers. Because it is just an interface the underlying sequencer implementation is used to do the real work implementing the sequencers strategy.

Constructor & Destructor Documentation

◆ sequencer()

matador::sequencer::sequencer ( sequencer_impl_ptr  impl = sequencer_impl_ptr(new default_sequencer))
explicit

Creates a new sequencer.

This constructor creates a new sequencer. If no implementation serializable is given, a default implementation serializable is used.

Parameters
implThe sequence implementation serializable implementing the sequence strategy.

Member Function Documentation

◆ current()

unsigned long long matador::sequencer::current ( ) const

Returns the current sequence number.

Returns
The current sequence number.

◆ exchange_sequencer()

sequencer_impl_ptr matador::sequencer::exchange_sequencer ( const sequencer_impl_ptr impl)

Replace the current sequencer implementation with the new one and return the old implementation.

Parameters
implThe new sequencer implementation.
Returns
The old sequencer implementation.

◆ init()

unsigned long long matador::sequencer::init ( )

Initializes the sequencer and return the current number.

Returns
The current sequence number.

◆ next()

unsigned long long matador::sequencer::next ( )

Returns the next valid sequence number.

Returns
The next sequence number.

◆ reset()

unsigned long long matador::sequencer::reset ( unsigned long long  id)

Resets the sequencers sequence id to the given value.

Parameters
idThe new sequence number.
Returns
The current sequence number.

◆ update()

unsigned long long matador::sequencer::update ( unsigned long long  id)

Updates the sequence number to the given value.

Parameters
idThe value to update.
Returns
The new current sequence value.

The documentation for this class was generated from the following file:
  • matador/utils/sequencer.hpp