Template Class command_queue_base

Inheritance Relationships

Derived Type

Class Documentation

template<template<typename...> typename queueT>
class command_queue_base

The command queue base functionality is provided separate from the more convenient interface, so we can provide easier adaptation to different queue clases, e.g. std::list or liberate’s own concurrent_queue.

The base implementation implements an STL-like container with push_back() and pop_front() as deque would provide.

Subclassed by liberate::concurrency::command::parametrized_command_queue< queueT >

Public Types

using command_ptr = std::unique_ptr<command_context_base>

Alias for a unique_ptr of command_context_base, the main item managed in the queue.

Public Functions

virtual ~command_queue_base() = default

Virtual destructor

inline void enqueue_command(command_ptr &&command)

Enqueue a command. This takes ownership of the command parameter.

Parameters

command[inout] A command such as created with e.g. create_context.

inline command_ptr dequeue_command()

Dequeue a command.

Returns

A command_ptr, which may be nullptr if there is no command in the queue.

inline void put_results(command_ptr &&results)

Push results into the response queue. This also accepts a command_ptr, and also takes ownership, just like enqueue_command - but it is used for when command processing completed.

Parameters

results[inout] A completed command (with results).

inline command_ptr get_completed()

Retrieve a completed command (with results), or nullptr if none is in the queue.

Returns

The command_ptr with results (or nullptr).