TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
QueryCallback_2< Result, ParamType1, ParamType2, chain > Class Template Reference

#include <Callback.h>

Public Member Functions

 QueryCallback_2 ()
 
void SetFutureResult (std::future< Result > value)
 The parameter of this function should be a resultset returned from either .AsyncQuery or .AsyncPQuery. More...
 
std::future< Result > & GetFutureResult ()
 
bool IsReady ()
 
void GetResult (Result &res)
 
void FreeResult ()
 
void SetFirstParam (ParamType1 value)
 
void SetSecondParam (ParamType2 value)
 
ParamType1 GetFirstParam ()
 
ParamType2 GetSecondParam ()
 
void ResetStage ()
 Resets the stage of the callback chain. More...
 
void NextStage ()
 Advances the callback chain to the next stage, so upper level code can act on its results accordingly. More...
 
uint8 GetStage ()
 Returns the callback stage (or CALLBACK_STAGE_INVALID if invalid) More...
 
void Reset ()
 Resets all underlying variables (param, result and stage) More...
 

Private Member Functions

 QueryCallback_2 (QueryCallback_2 const &right)=delete
 
QueryCallback_2operator= (QueryCallback_2 const &right)=delete
 

Private Attributes

std::future< Result > _result
 
ParamType1 _param_1
 
ParamType2 _param_2
 
uint8 _stage
 

Constructor & Destructor Documentation

template<typename Result , typename ParamType1 , typename ParamType2 , bool chain = false>
QueryCallback_2< Result, ParamType1, ParamType2, chain >::QueryCallback_2 ( )
inline
118 : _stage(chain ? 0 : CALLBACK_STAGE_INVALID) { }
uint8 _stage
Definition: Callback.h:203
#define CALLBACK_STAGE_INVALID
Definition: Callback.h:29
template<typename Result , typename ParamType1 , typename ParamType2 , bool chain = false>
QueryCallback_2< Result, ParamType1, ParamType2, chain >::QueryCallback_2 ( QueryCallback_2< Result, ParamType1, ParamType2, chain > const right)
privatedelete

Member Function Documentation

template<typename Result , typename ParamType1 , typename ParamType2 , bool chain = false>
void QueryCallback_2< Result, ParamType1, ParamType2, chain >::FreeResult ( )
inline
142  {
143  // Nothing to do here, the constructor of std::future will take care of the cleanup
144  }

+ Here is the caller graph for this function:

template<typename Result , typename ParamType1 , typename ParamType2 , bool chain = false>
ParamType1 QueryCallback_2< Result, ParamType1, ParamType2, chain >::GetFirstParam ( )
inline
157  {
158  return _param_1;
159  }
ParamType1 _param_1
Definition: Callback.h:201
template<typename Result , typename ParamType1 , typename ParamType2 , bool chain = false>
std::future<Result>& QueryCallback_2< Result, ParamType1, ParamType2, chain >::GetFutureResult ( )
inline
127  {
128  return _result;
129  }
std::future< Result > _result
Definition: Callback.h:200
template<typename Result , typename ParamType1 , typename ParamType2 , bool chain = false>
void QueryCallback_2< Result, ParamType1, ParamType2, chain >::GetResult ( Result &  res)
inline
137  {
138  res = _result.get();
139  }
std::future< Result > _result
Definition: Callback.h:200
template<typename Result , typename ParamType1 , typename ParamType2 , bool chain = false>
ParamType2 QueryCallback_2< Result, ParamType1, ParamType2, chain >::GetSecondParam ( )
inline
162  {
163  return _param_2;
164  }
ParamType2 _param_2
Definition: Callback.h:202
template<typename Result , typename ParamType1 , typename ParamType2 , bool chain = false>
uint8 QueryCallback_2< Result, ParamType1, ParamType2, chain >::GetStage ( )
inline

Returns the callback stage (or CALLBACK_STAGE_INVALID if invalid)

186  {
187  return _stage;
188  }
uint8 _stage
Definition: Callback.h:203
template<typename Result , typename ParamType1 , typename ParamType2 , bool chain = false>
bool QueryCallback_2< Result, ParamType1, ParamType2, chain >::IsReady ( )
inline
132  {
133  return _result.valid() && _result.wait_for(std::chrono::seconds(0)) == std::future_status::ready;
134  }
std::future< Result > _result
Definition: Callback.h:200
float seconds()
Definition: units.h:97

+ Here is the call graph for this function:

template<typename Result , typename ParamType1 , typename ParamType2 , bool chain = false>
void QueryCallback_2< Result, ParamType1, ParamType2, chain >::NextStage ( )
inline

Advances the callback chain to the next stage, so upper level code can act on its results accordingly.

177  {
178  if (!chain)
179  return;
180 
181  ++_stage;
182  }
uint8 _stage
Definition: Callback.h:203
template<typename Result , typename ParamType1 , typename ParamType2 , bool chain = false>
QueryCallback_2& QueryCallback_2< Result, ParamType1, ParamType2, chain >::operator= ( QueryCallback_2< Result, ParamType1, ParamType2, chain > const right)
privatedelete
template<typename Result , typename ParamType1 , typename ParamType2 , bool chain = false>
void QueryCallback_2< Result, ParamType1, ParamType2, chain >::Reset ( )
inline

Resets all underlying variables (param, result and stage)

192  {
195  FreeResult();
196  ResetStage();
197  }
void SetFirstParam(ParamType1 value)
Definition: Callback.h:146
void FreeResult()
Definition: Callback.h:141
arena_t NULL
Definition: jemalloc_internal.h:624
void ResetStage()
Resets the stage of the callback chain.
Definition: Callback.h:167
void SetSecondParam(ParamType2 value)
Definition: Callback.h:151

+ Here is the call graph for this function:

template<typename Result , typename ParamType1 , typename ParamType2 , bool chain = false>
void QueryCallback_2< Result, ParamType1, ParamType2, chain >::ResetStage ( )
inline

Resets the stage of the callback chain.

168  {
169  if (!chain)
170  return;
171 
172  _stage = 0;
173  }
uint8 _stage
Definition: Callback.h:203

+ Here is the caller graph for this function:

template<typename Result , typename ParamType1 , typename ParamType2 , bool chain = false>
void QueryCallback_2< Result, ParamType1, ParamType2, chain >::SetFirstParam ( ParamType1  value)
inline
147  {
148  _param_1 = value;
149  }
ParamType1 _param_1
Definition: Callback.h:201
const FieldDescriptor value
Definition: descriptor.h:1522

+ Here is the caller graph for this function:

template<typename Result , typename ParamType1 , typename ParamType2 , bool chain = false>
void QueryCallback_2< Result, ParamType1, ParamType2, chain >::SetFutureResult ( std::future< Result >  value)
inline

The parameter of this function should be a resultset returned from either .AsyncQuery or .AsyncPQuery.

122  {
123  _result = std::move(value);
124  }
std::future< Result > _result
Definition: Callback.h:200
const FieldDescriptor value
Definition: descriptor.h:1522
template<typename Result , typename ParamType1 , typename ParamType2 , bool chain = false>
void QueryCallback_2< Result, ParamType1, ParamType2, chain >::SetSecondParam ( ParamType2  value)
inline
152  {
153  _param_2 = value;
154  }
ParamType2 _param_2
Definition: Callback.h:202
const FieldDescriptor value
Definition: descriptor.h:1522

+ Here is the caller graph for this function:

Member Data Documentation

template<typename Result , typename ParamType1 , typename ParamType2 , bool chain = false>
ParamType1 QueryCallback_2< Result, ParamType1, ParamType2, chain >::_param_1
private
template<typename Result , typename ParamType1 , typename ParamType2 , bool chain = false>
ParamType2 QueryCallback_2< Result, ParamType1, ParamType2, chain >::_param_2
private
template<typename Result , typename ParamType1 , typename ParamType2 , bool chain = false>
std::future<Result> QueryCallback_2< Result, ParamType1, ParamType2, chain >::_result
private
template<typename Result , typename ParamType1 , typename ParamType2 , bool chain = false>
uint8 QueryCallback_2< Result, ParamType1, ParamType2, chain >::_stage
private

The documentation for this class was generated from the following file: