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

#include "QueryHolder.h"

Public Member Functions

 SQLQueryHolderCallback (std::shared_ptr< SQLQueryHolderBase > &&holder, QueryResultHolderFuture &&future)
 
 SQLQueryHolderCallback (SQLQueryHolderCallback &&)=default
 
SQLQueryHolderCallbackoperator= (SQLQueryHolderCallback &&)=default
 
void AfterComplete (std::function< void(SQLQueryHolderBase const &)> callback) &
 
bool InvokeIfReady ()
 

Public Attributes

std::shared_ptr< SQLQueryHolderBasem_holder
 
QueryResultHolderFuture m_future
 
std::function< void(SQLQueryHolderBase const &)> m_callback
 

Detailed Description

Constructor & Destructor Documentation

◆ SQLQueryHolderCallback() [1/2]

SQLQueryHolderCallback::SQLQueryHolderCallback ( std::shared_ptr< SQLQueryHolderBase > &&  holder,
QueryResultHolderFuture &&  future 
)
inline
72 : m_holder(std::move(holder)), m_future(std::move(future)) { }
std::shared_ptr< SQLQueryHolderBase > m_holder
Definition: QueryHolder.h:84
QueryResultHolderFuture m_future
Definition: QueryHolder.h:85

◆ SQLQueryHolderCallback() [2/2]

SQLQueryHolderCallback::SQLQueryHolderCallback ( SQLQueryHolderCallback &&  )
default

Member Function Documentation

◆ AfterComplete()

void SQLQueryHolderCallback::AfterComplete ( std::function< void(SQLQueryHolderBase const &)>  callback) &
inline
78 {
79 m_callback = std::move(callback);
80 }
std::function< void(SQLQueryHolderBase const &)> m_callback
Definition: QueryHolder.h:86

Referenced by WorldSession::HandlePlayerLoginOpcode(), WorldSession::InitializeSession(), and Pet::LoadPetFromDB().

◆ InvokeIfReady()

bool SQLQueryHolderCallback::InvokeIfReady ( )
89{
90 if (m_future.valid() && m_future.wait_for(std::chrono::seconds(0)) == std::future_status::ready)
91 {
93 return true;
94 }
95
96 return false;
97}

References m_callback, m_future, and m_holder.

◆ operator=()

SQLQueryHolderCallback & SQLQueryHolderCallback::operator= ( SQLQueryHolderCallback &&  )
default

Member Data Documentation

◆ m_callback

std::function<void(SQLQueryHolderBase const&)> SQLQueryHolderCallback::m_callback

Referenced by InvokeIfReady().

◆ m_future

QueryResultHolderFuture SQLQueryHolderCallback::m_future

Referenced by InvokeIfReady().

◆ m_holder

std::shared_ptr<SQLQueryHolderBase> SQLQueryHolderCallback::m_holder

Referenced by InvokeIfReady().