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
42 {
43 if (_callbacks.empty())
44 return;
45
46 std::vector<T> updateCallbacks{ std::move(_callbacks) };
47
48 updateCallbacks.erase(std::remove_if(updateCallbacks.begin(), updateCallbacks.end(), [](T& callback)
49 {
50 return callback.InvokeIfReady();
51 }), updateCallbacks.end());
52
53 _callbacks.insert(_callbacks.end(), std::make_move_iterator(updateCallbacks.begin()), std::make_move_iterator(updateCallbacks.end()));
54 }

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