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) |
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.
|
explicit |
Creates a new sequencer.
This constructor creates a new sequencer. If no implementation serializable is given, a default implementation serializable is used.
impl | The sequence implementation serializable implementing the sequence strategy. |
unsigned long long matador::sequencer::current | ( | ) | const |
Returns the current sequence number.
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.
impl | The new sequencer implementation. |
unsigned long long matador::sequencer::init | ( | ) |
Initializes the sequencer and return the current number.
unsigned long long matador::sequencer::next | ( | ) |
Returns the next valid sequence number.
unsigned long long matador::sequencer::reset | ( | unsigned long long | id | ) |
Resets the sequencers sequence id to the given value.
id | The new sequence number. |
unsigned long long matador::sequencer::update | ( | unsigned long long | id | ) |
Updates the sequence number to the given value.
id | The value to update. |