cutelyst 4.3.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
Cutelyst::ASync Class Reference

Helper class for asynchronous processing. More...

#include <Cutelyst/async.h>

Public Member Functions

 ASync () noexcept
 
 ASync (ASync &&other) noexcept
 
 ASync (const ASync &other)
 
 ASync (Context *c)
 
 ASync (Context *c, std::function< void(Context *c)> cb)
 
 ~ASync ()
 
ASyncoperator= (ASync &&other) noexcept
 
ASyncoperator= (const ASync &copy)
 

Detailed Description

ASync helps with asynchronous processing. It automatically calls Context::detachAsync() on the given context on construction and will call Context::attachAsync() on it’s own destruction if the context pointer given in the constructor is still valid.

Definition at line 15 of file async.h.

Constructor & Destructor Documentation

◆ ASync() [1/5]

ASync::ASync ( )
defaultnoexcept

Constructs a new default ASync object containing a nullptr.

◆ ASync() [2/5]

ASync::ASync ( Context c)

ASync class should be used in a scoped manner.

This constructor will call c->detachAsync() on context c and once it goes out of scope it will call c->attachAsync() if Context pointer is still valid.

Make sure it is captured by lambdas to avoid it leaving scope.

Definition at line 75 of file async.cpp.

◆ ASync() [3/5]

Cutelyst::ASync::ASync ( Context c,
std::function< void(Context *c)>  cb 
)

ASync class should be used in a scoped manner.

This constructor will call c->detachAsync() on context c and once it goes out of scope if Context pointer is still valid it will call the callback function cb and then c->attachAsync().

Make sure it is captured by lambdas to avoid it leaving scope.

◆ ASync() [4/5]

ASync::ASync ( const ASync other)

Constructs a copy of other.

Definition at line 88 of file async.cpp.

◆ ASync() [5/5]

ASync::ASync ( ASync &&  other)
noexcept

Move-constructs an ASync from other.

Definition at line 96 of file async.cpp.

◆ ~ASync()

ASync::~ASync ( )
default

Destroys the ASync object.

Member Function Documentation

◆ operator=() [1/2]

ASync & Cutelyst::ASync::operator= ( ASync &&  other)
inlinenoexcept

Definition at line 37 of file async.h.

◆ operator=() [2/2]

ASync & ASync::operator= ( const ASync copy)

Assigns other to this object.

Definition at line 109 of file async.cpp.