AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
AsyncCallbackProcessor< T > Class Template Reference

#include "AsyncCallbackProcessor.h"

Public Member Functions

 AsyncCallbackProcessor ()=default
 
 ~AsyncCallbackProcessor ()=default
 
T & AddCallback (T &&query)
 
void ProcessReadyCallbacks ()
 

Private Member Functions

 AsyncCallbackProcessor (AsyncCallbackProcessor const &)=delete
 
AsyncCallbackProcessoroperator= (AsyncCallbackProcessor const &)=delete
 

Private Attributes

std::vector< T > _callbacks
 

Detailed Description

template<typename T>
class AsyncCallbackProcessor< T >

Constructor & Destructor Documentation

◆ AsyncCallbackProcessor() [1/2]

template<typename T >
AsyncCallbackProcessor< T >::AsyncCallbackProcessor ( )
default

◆ ~AsyncCallbackProcessor()

template<typename T >
AsyncCallbackProcessor< T >::~AsyncCallbackProcessor ( )
default

◆ AsyncCallbackProcessor() [2/2]

template<typename T >
AsyncCallbackProcessor< T >::AsyncCallbackProcessor ( AsyncCallbackProcessor< T > const &  )
privatedelete

Member Function Documentation

◆ AddCallback()

◆ operator=()

template<typename T >
AsyncCallbackProcessor & AsyncCallbackProcessor< T >::operator= ( AsyncCallbackProcessor< T > const &  )
privatedelete

◆ ProcessReadyCallbacks()

template<typename T >
void AsyncCallbackProcessor< T >::ProcessReadyCallbacks ( )
inline
41 {
42 if (_callbacks.empty())
43 return;
44
45 std::vector<T> updateCallbacks{ std::move(_callbacks) };
46
47 updateCallbacks.erase(std::remove_if(updateCallbacks.begin(), updateCallbacks.end(), [](T& callback)
48 {
49 return callback.InvokeIfReady();
50 }), updateCallbacks.end());
51
52 _callbacks.insert(_callbacks.end(), std::make_move_iterator(updateCallbacks.begin()), std::make_move_iterator(updateCallbacks.end()));
53 }

References AsyncCallbackProcessor< T >::_callbacks.

Referenced by WorldSession::ProcessQueryCallbacks(), World::ProcessQueryCallbacks(), AuthSession::Update(), and WorldSocket::Update().

Member Data Documentation

◆ _callbacks

template<typename T >
std::vector<T> AsyncCallbackProcessor< T >::_callbacks
private