Platform fixups: typedef for priority_queue, more specific comparator functor.

master
Monty Brandenberg 2012-06-01 18:18:53 -04:00
parent 7b9da4eeda
commit 640798bb99
3 changed files with 20 additions and 18 deletions

View File

@ -159,19 +159,6 @@ public:
}; // end class HttpOpNull
/// HttpOpCompare isn't an operation but a uniform comparison
/// functor for STL containers that order by priority. Mainly
/// used for the ready queue container but defined here.
class HttpOpCompare
{
public:
bool operator()(const HttpOperation * lhs, const HttpOperation * rhs)
{
return lhs->mReqPriority > rhs->mReqPriority;
}
}; // end class HttpOpCompare
} // end namespace LLCore
#endif // _LLCORE_HTTP_OPERATION_H_

View File

@ -131,6 +131,19 @@ public:
}; // end class HttpOpRequest
/// HttpOpRequestCompare isn't an operation but a uniform comparison
/// functor for STL containers that order by priority. Mainly
/// used for the ready queue container but defined here.
class HttpOpRequestCompare
{
public:
bool operator()(const HttpOpRequest * lhs, const HttpOpRequest * rhs)
{
return lhs->mReqPriority > rhs->mReqPriority;
}
}; // end class HttpOpRequestCompare
} // end namespace LLCore
#endif // _LLCORE_HTTP_OPREQUEST_H_

View File

@ -30,7 +30,7 @@
#include <queue>
#include "_httpoperation.h"
#include "_httpoprequest.h"
namespace LLCore
@ -49,13 +49,15 @@ class HttpOpRequest;
/// Threading: not thread-safe. Expected to be used entirely by
/// a single thread, typically a worker thread of some sort.
class HttpReadyQueue : public std::priority_queue<HttpOpRequest *,
std::deque<HttpOpRequest *>,
LLCore::HttpOpCompare>
typedef std::priority_queue<HttpOpRequest *,
std::deque<HttpOpRequest *>,
LLCore::HttpOpRequestCompare> HttpReadyQueueBase;
class HttpReadyQueue : public HttpReadyQueueBase
{
public:
HttpReadyQueue()
: priority_queue()
: HttpReadyQueueBase()
{}
~HttpReadyQueue()