/* */ #ifndef _D_REQUEST_GROUP_ENTRY_H_ #define _D_REQUEST_GROUP_ENTRY_H_ #include "ProgressAwareEntry.h" #include "Request.h" #include "RequestGroup.h" class DownloadCommand; class RequestGroupEntry : public ProgressAwareEntry { protected: int _cuid; RequestHandle _currentRequest; RequestGroup* _requestGroup; DownloadCommand* _nextDownloadCommand; bool _shouldAddNumConnection; public: RequestGroupEntry(int cuid, const RequestHandle& currentRequest, RequestGroup* requestGroup, DownloadCommand* nextDownloadCommand = 0): _cuid(cuid), _currentRequest(currentRequest), _requestGroup(requestGroup), _nextDownloadCommand(nextDownloadCommand) { if(nextDownloadCommand) { _shouldAddNumConnection = false; } else { _shouldAddNumConnection = true; ++_requestGroup->numConnection; } } virtual ~RequestGroupEntry(); virtual int64_t getTotalLength() const { return _requestGroup->getTotalLength(); } int getCUID() const { return _cuid; } RequestHandle getCurrentRequest() const { return _currentRequest; } RequestGroup* getRequestGroup() const { return _requestGroup; } /* void setNextDownloadCommand(DownloadCommand* command) { _nextDownloadCommand = command; } */ DownloadCommand* getNextDownloadCommand() const { return _nextDownloadCommand; } DownloadCommand* popNextDownloadCommand() { DownloadCommand* temp = _nextDownloadCommand; _nextDownloadCommand = 0; return temp; } bool operator==(const RequestGroupEntry& entry) const { return this == &entry; } }; typedef SharedHandle RequestGroupEntryHandle; #endif // _D_REQUEST_GROUP_ENTRY_H_