actor-framework
Classes | Public Types | Public Member Functions | List of all members
caf::action Class Reference

A functional interface similar to std::function<void()> with dispose semantics. More...

#include <action.hpp>

Classes

class  impl
 Internal interface of action. More...
 

Public Types

enum  state { scheduled, state::running, state::deferred_dispose, state::disposed }
 Describes the current state of an action. More...
 
using impl_ptr = intrusive_ptr< impl >
 

Public Member Functions

 action (impl_ptr ptr) noexcept
 
 action (action &&) noexcept=default
 
 action (const action &) noexcept=default
 
actionoperator= (action &&) noexcept=default
 
actionoperator= (const action &) noexcept=default
 
actionoperator= (std::nullptr_t) noexcept
 
bool disposed () const
 
bool scheduled () const
 
void run ()
 Triggers the action.
 
void dispose ()
 Cancel the action if it has not been invoked yet.
 
disposable as_disposable () &&noexcept
 Returns a smart pointer to the implementation.
 
disposable as_disposable () const &noexcept
 Returns a smart pointer to the implementation.
 
implptr () const noexcept
 Returns a pointer to the implementation.
 
impl_ptr && as_intrusive_ptr () &&noexcept
 Returns a smart pointer to the implementation.
 
impl_ptr as_intrusive_ptr () const &noexcept
 Returns a smart pointer to the implementation.
 
 operator bool () const noexcept
 
bool operator! () const noexcept
 

Detailed Description

A functional interface similar to std::function<void()> with dispose semantics.

Member Enumeration Documentation

◆ state

enum caf::action::state
strong

Describes the current state of an action.

Enumerator
running 

The action is scheduled for execution.

deferred_dispose 

The action is currently running in another thread.

disposed 

The action is currently running, and will be disposed.


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