Template Class poisson_queue

Nested Relationships

Nested Types

Class Documentation

template<typename T>
class poisson_queue

A wrapper around std::queue to make it more amenable to queueing theoretic analysis by tracking queue state.

Public Functions

poisson_queue(const poisson_queue&) = delete
inline poisson_queue(double lambda, double mu, math::rng *rng)
Parameters:
  • lambda – The enqueue rate for the queue.

  • mu – The dequeue rate for the queue.

inline bool contains(const T &key) const

Determine if key is currently contained in the queue.

inline boost::optional<T> dequeue(const types::timestep &t, bool fake)

Remove an item from the queue after an event has been triggered. This is a separate function from checking for the event for symmetry with the enqueue operation.

Parameters:
  • fake – Allow for a fake dequeue in which nothing is returned but the metadata for dequeueing is still updated as if there was something in the queue. Useful for simulating queues of infinite size/queues where the objects to dequeue cannot be put into the queue a priori.

  • t – The current timestep.

inline bool dequeue_check(const types::timestep &t)

Check if the conditions are ready for dequeue at time t from the queue as part of a poisson process. Does not perform the dequeue operation.

Returns:

TRUE if an event has been triggered for dequeueing, FALSE otherwise.

inline op_metadata dequeue_data(void) const

Get the current dequeue data.

inline void enqueue(const T &item, const types::timestep &t)

Add an item to the queue after an event has been triggered at time t. This is a separate function from checking for the event because it may be that generating the items to enqueue is a non-trivial and/or non-reversible task, and we only want to force the caller to do that when necessary.

inline bool enqueue_check(const types::timestep &t)

Check if the conditions are ready for enqueueing into the queue as part of a poisson process. Does not perform the enqueue operation.

Returns:

TRUE if an event has been triggered for enqueueing, FALSE otherwise.

inline op_metadata enqueue_data(void) const

Get the current enqueue data.

template<typename ...Args>
inline auto Func(Args&&... args) -> decltype(std::declval<decltype(Member)>().Func(args...))
template<typename ...Args>
inline auto Func(Args&&... args) const -> decltype(std::declval<decltype(Member)>().Func(args...))
inline double lambda(void) const
inline double mu(void) const
const poisson_queue &operator=(const poisson_queue&) = delete
inline void reset_metrics(void)
struct op_metadata

Metadata for tracking enqueue_queue/dequeue operations.

Public Members

size_t count = {0}

The # of operations since the last reset.

types::timestep interval_accum = {0}

The accumulated time between operations since the last reset.

size_t total_count = {0}

The # of operations since the beginning of time.

types::timestep total_interval_accum = {0}

The accumulated time between operations since the beginning of time.