Core/DBLayer: add template parameter to QueryCallback classes to make it work with both QueryResult and PreparedQueryResult (will be used later).

This commit is contained in:
Azazel
2011-04-08 09:41:52 +06:00
parent 0ae5aca55e
commit 74b84a603d
3 changed files with 16 additions and 16 deletions

View File

@@ -867,11 +867,11 @@ class WorldSession
QueryResultFuture m_charEnumCallback;
QueryResultFuture m_addIgnoreCallback;
QueryResultFuture m_stablePetCallback;
QueryCallback<std::string> m_charRenameCallback;
QueryCallback<std::string> m_addFriendCallback;
QueryCallback<uint32> m_unstablePetCallback;
QueryCallback<uint32> m_stableSwapCallback;
QueryCallback<uint64> m_sendStabledPetCallback;
QueryCallback<QueryResult, std::string> m_charRenameCallback;
QueryCallback<QueryResult, std::string> m_addFriendCallback;
QueryCallback<QueryResult, uint32> m_unstablePetCallback;
QueryCallback<QueryResult, uint32> m_stableSwapCallback;
QueryCallback<QueryResult, uint64> m_sendStabledPetCallback;
QueryResultHolderFuture m_charLoginCallback;
private:

View File

@@ -829,7 +829,7 @@ class World
private:
void ProcessQueryCallbacks();
QueryCallback<uint32> m_realmCharCallback;
QueryCallback<QueryResult, uint32> m_realmCharCallback;
};
extern uint32 realmID;

View File

@@ -29,18 +29,18 @@ typedef ACE_Future<PreparedQueryResult> PreparedQueryResultFuture;
issued the request. <ParamType> is variable type of parameter that is used as parameter
for the callback function.
*/
template <typename ParamType>
template <typename Result, typename ParamType>
class QueryCallback
{
public:
QueryCallback() {}
void SetFutureResult(QueryResultFuture value)
void SetFutureResult(ACE_Future<Result> value)
{
result = value;
}
QueryResultFuture GetFutureResult()
ACE_Future<Result> GetFutureResult()
{
return result;
}
@@ -50,7 +50,7 @@ class QueryCallback
return result.ready();
}
void GetResult(QueryResult& res)
void GetResult(Result& res)
{
result.get(res);
}
@@ -71,22 +71,22 @@ class QueryCallback
}
private:
QueryResultFuture result;
ACE_Future<Result> result;
ParamType param;
};
template <typename ParamType1, typename ParamType2>
template <typename Result, typename ParamType1, typename ParamType2>
class QueryCallback_2
{
public:
QueryCallback_2() {}
void SetFutureResult(QueryResultFuture value)
void SetFutureResult(ACE_Future<Result> value)
{
result = value;
}
QueryResultFuture GetFutureResult()
ACE_Future<Result> GetFutureResult()
{
return result;
}
@@ -96,7 +96,7 @@ class QueryCallback_2
return result.ready();
}
void GetResult(QueryResult& res)
void GetResult(Result& res)
{
result.get(res);
}
@@ -127,7 +127,7 @@ class QueryCallback_2
}
private:
QueryResultFuture result;
ACE_Future<Result> result;
ParamType1 param_1;
ParamType2 param_2;
};