Cleanup GxsTokenQueue header

This commit is contained in:
Gioacchino Mazzurco 2017-02-20 07:36:59 +01:00
parent 55ff9067cf
commit e246876513

View file

@ -29,41 +29,37 @@
#include "util/rsthreads.h" #include "util/rsthreads.h"
/* struct GxsTokenQueueItem
*
* A little helper class, to manage callbacks from requests
*
*/
class GxsTokenQueueItem
{ {
public:
GxsTokenQueueItem(const uint32_t token, const uint32_t req_type)
:mToken(token),mReqType(req_type) { return; }
GxsTokenQueueItem(): mToken(0), mReqType(0) { return; } GxsTokenQueueItem(const uint32_t token, const uint32_t req_type) :
mToken(token), mReqType(req_type) {}
GxsTokenQueueItem(): mToken(0), mReqType(0) {}
uint32_t mToken; uint32_t mToken;
uint32_t mReqType; uint32_t mReqType;
}; };
/**
* A little helper class, to manage callbacks from requests
*/
class GxsTokenQueue class GxsTokenQueue
{ {
public: public:
GxsTokenQueue(RsGenExchange *gxs) :
mGenExchange(gxs), mQueueMtx("GxsTokenQueueMtx") {}
GxsTokenQueue(RsGenExchange *gxs) bool queueRequest(uint32_t token, uint32_t req_type);
:mGenExchange(gxs), mQueueMtx("GxsTokenQueueMtx") { return; } void checkRequests(); /// must be called by
bool queueRequest(uint32_t token, uint32_t req_type);
void checkRequests(); // must be called by protected:
protected: /// This must be overloaded to complete the functionality.
virtual void handleResponse(uint32_t token, uint32_t req_type);
// This must be overloaded to complete the functionality. private:
virtual void handleResponse(uint32_t token, uint32_t req_type);
private:
RsGenExchange *mGenExchange; RsGenExchange *mGenExchange;
RsMutex mQueueMtx; RsMutex mQueueMtx;
std::list<GxsTokenQueueItem> mQueue; std::list<GxsTokenQueueItem> mQueue;