eolib-cpp 0.1.0-beta.7
Core C++ library for writing Endless Online applications
Loading...
Searching...
No Matches
eolib::packet::PacketSequencer Class Reference

A class for generating packet sequences. More...

#include <eolib/packet/packet_sequencer.hpp>

Public Member Functions

 PacketSequencer (const SequenceStart &start) noexcept
 Creates a sequencer with the specified sequence start.
int NextSequence () noexcept
 Returns the next sequence value, updating the sequence counter in the process.
void SetSequenceStart (const SequenceStart &start) noexcept
 Sets the sequence start, also known as the "starting counter ID".
PacketSequencer WithSequenceStart (const SequenceStart &start) const noexcept
 Creates a new sequencer with the specified sequence start, preserving this sequencer's counter.

Detailed Description

A class for generating packet sequences.

Constructor & Destructor Documentation

◆ PacketSequencer()

eolib::packet::PacketSequencer::PacketSequencer ( const SequenceStart & start)
explicitnoexcept

Creates a sequencer with the specified sequence start.

Parameters
startthe sequence start.

Member Function Documentation

◆ NextSequence()

int eolib::packet::PacketSequencer::NextSequence ( )
noexcept

Returns the next sequence value, updating the sequence counter in the process.

This is not a pure function; it should only be called once per packet.

Returns
the sequence value for the next packet.

◆ SetSequenceStart()

void eolib::packet::PacketSequencer::SetSequenceStart ( const SequenceStart & start)
noexcept

Sets the sequence start, also known as the "starting counter ID".

The sequence counter is preserved.

Parameters
startthe new sequence start.

◆ WithSequenceStart()

PacketSequencer eolib::packet::PacketSequencer::WithSequenceStart ( const SequenceStart & start) const
noexcept

Creates a new sequencer with the specified sequence start, preserving this sequencer's counter.

Parameters
startthe sequence start for the new sequencer.
Returns
the new sequencer.