AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
TransactionCallback Class Reference

#include "Transaction.h"

Public Member Functions

 TransactionCallback (TransactionFuture &&future)
 
 TransactionCallback (TransactionCallback &&)=default
 
TransactionCallbackoperator= (TransactionCallback &&)=default
 
void AfterComplete (std::function< void(bool)> callback) &
 
bool InvokeIfReady ()
 

Public Attributes

TransactionFuture m_future
 
std::function< void(bool)> m_callback
 

Detailed Description

Constructor & Destructor Documentation

◆ TransactionCallback() [1/2]

TransactionCallback::TransactionCallback ( TransactionFuture &&  future)
inline
112: m_future(std::move(future)) { }
TransactionFuture m_future
Definition: Transaction.h:124

◆ TransactionCallback() [2/2]

TransactionCallback::TransactionCallback ( TransactionCallback &&  )
default

Member Function Documentation

◆ AfterComplete()

void TransactionCallback::AfterComplete ( std::function< void(bool)>  callback) &
inline
118 {
119 m_callback = std::move(callback);
120 }
std::function< void(bool)> m_callback
Definition: Transaction.h:125

◆ InvokeIfReady()

bool TransactionCallback::InvokeIfReady ( )
183{
184 if (m_future.valid() && m_future.wait_for(0s) == std::future_status::ready)
185 {
186 m_callback(m_future.get());
187 return true;
188 }
189
190 return false;
191}

References m_callback, and m_future.

◆ operator=()

TransactionCallback & TransactionCallback::operator= ( TransactionCallback &&  )
default

Member Data Documentation

◆ m_callback

std::function<void(bool)> TransactionCallback::m_callback

Referenced by InvokeIfReady().

◆ m_future

TransactionFuture TransactionCallback::m_future

Referenced by InvokeIfReady().