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
+5 -5
View File
@@ -867,11 +867,11 @@ class WorldSession
QueryResultFuture m_charEnumCallback; QueryResultFuture m_charEnumCallback;
QueryResultFuture m_addIgnoreCallback; QueryResultFuture m_addIgnoreCallback;
QueryResultFuture m_stablePetCallback; QueryResultFuture m_stablePetCallback;
QueryCallback<std::string> m_charRenameCallback; QueryCallback<QueryResult, std::string> m_charRenameCallback;
QueryCallback<std::string> m_addFriendCallback; QueryCallback<QueryResult, std::string> m_addFriendCallback;
QueryCallback<uint32> m_unstablePetCallback; QueryCallback<QueryResult, uint32> m_unstablePetCallback;
QueryCallback<uint32> m_stableSwapCallback; QueryCallback<QueryResult, uint32> m_stableSwapCallback;
QueryCallback<uint64> m_sendStabledPetCallback; QueryCallback<QueryResult, uint64> m_sendStabledPetCallback;
QueryResultHolderFuture m_charLoginCallback; QueryResultHolderFuture m_charLoginCallback;
private: private:
+1 -1
View File
@@ -829,7 +829,7 @@ class World
private: private:
void ProcessQueryCallbacks(); void ProcessQueryCallbacks();
QueryCallback<uint32> m_realmCharCallback; QueryCallback<QueryResult, uint32> m_realmCharCallback;
}; };
extern uint32 realmID; extern uint32 realmID;
+10 -10
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 issued the request. <ParamType> is variable type of parameter that is used as parameter
for the callback function. for the callback function.
*/ */
template <typename ParamType> template <typename Result, typename ParamType>
class QueryCallback class QueryCallback
{ {
public: public:
QueryCallback() {} QueryCallback() {}
void SetFutureResult(QueryResultFuture value) void SetFutureResult(ACE_Future<Result> value)
{ {
result = value; result = value;
} }
QueryResultFuture GetFutureResult() ACE_Future<Result> GetFutureResult()
{ {
return result; return result;
} }
@@ -50,7 +50,7 @@ class QueryCallback
return result.ready(); return result.ready();
} }
void GetResult(QueryResult& res) void GetResult(Result& res)
{ {
result.get(res); result.get(res);
} }
@@ -71,22 +71,22 @@ class QueryCallback
} }
private: private:
QueryResultFuture result; ACE_Future<Result> result;
ParamType param; ParamType param;
}; };
template <typename ParamType1, typename ParamType2> template <typename Result, typename ParamType1, typename ParamType2>
class QueryCallback_2 class QueryCallback_2
{ {
public: public:
QueryCallback_2() {} QueryCallback_2() {}
void SetFutureResult(QueryResultFuture value) void SetFutureResult(ACE_Future<Result> value)
{ {
result = value; result = value;
} }
QueryResultFuture GetFutureResult() ACE_Future<Result> GetFutureResult()
{ {
return result; return result;
} }
@@ -96,7 +96,7 @@ class QueryCallback_2
return result.ready(); return result.ready();
} }
void GetResult(QueryResult& res) void GetResult(Result& res)
{ {
result.get(res); result.get(res);
} }
@@ -127,7 +127,7 @@ class QueryCallback_2
} }
private: private:
QueryResultFuture result; ACE_Future<Result> result;
ParamType1 param_1; ParamType1 param_1;
ParamType2 param_2; ParamType2 param_2;
}; };