rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
Public Member Functions | List of all members
rexlib::command_token Class Reference

Identifies a command submitted to a command_queue. More...

#include <rexlib/core/hardware/command_token.hpp>

Public Member Functions

 command_token () noexcept
 Construct an empty token.
 
 command_token (std::shared_ptr< const command_timeline > timeline, std::size_t id) noexcept
 Construct a token from its components.
 
 command_token (const command_token &other) noexcept
 
 command_token (command_token &&other) noexcept
 
command_token & operator= (const command_token &other) noexcept
 
command_token & operator= (command_token &&other) noexcept
 
const std::shared_ptr< const command_timeline > & get_timeline () const noexcept
 Get the timeline that gave the id.
 
std::size_t get_id () const noexcept
 Get the id of the command in its timeline.
 
bool is_empty () const noexcept
 Check whether this is empty.
 
bool is_complete () const
 Check whether the command has finished.
 
void wait () const
 Block the calling thread until the command has finished.
 

Detailed Description

Identifies a command submitted to a command_queue.

A token pairs a command_timeline with the id that timeline gave to a command. It is a value: it can be copied freely, and every copy identifies the same command.

Empty state
A token without a timeline is empty: it identifies no command. An empty token is always complete, and waiting for it returns at once.

Constructor & Destructor Documentation

◆ command_token()

rexlib::command_token::command_token ( std::shared_ptr< const command_timeline >  timeline,
std::size_t  id 
)
noexcept

Construct a token from its components.

Parameters
timelineThe timeline that gave the id. A null timeline makes the token empty.
idThe id of the command in timeline.

Member Function Documentation

◆ get_id()

std::size_t rexlib::command_token::get_id ( ) const
noexcept

Get the id of the command in its timeline.

Returns
The id. It has no meaning if this is empty.

◆ get_timeline()

const std::shared_ptr< const command_timeline > & rexlib::command_token::get_timeline ( ) const
noexcept

Get the timeline that gave the id.

Returns
The timeline, or null if this is empty.

◆ is_complete()

bool rexlib::command_token::is_complete ( ) const

Check whether the command has finished.

Does not block the calling thread.

Returns
true The command has finished, or this is empty.
false The command has not finished yet.

◆ is_empty()

bool rexlib::command_token::is_empty ( ) const
noexcept

Check whether this is empty.

Returns
true This identifies no command.
false This identifies a command.

◆ wait()

void rexlib::command_token::wait ( ) const

Block the calling thread until the command has finished.

Returns immediately if this is empty.


The documentation for this class was generated from the following file: