BazisLib::Network::DownloadManager::DownloadTask Class Reference

Represents a single download task. More...

#include <dlmgr.h>

Collaboration diagram for BazisLib::Network::DownloadManager::DownloadTask:

Collaboration graph
[legend]

List of all members.

Classes

struct  ThreadStats
 Contains statistics for a single thread. More...

Public Member Functions

 DECLARE_REFERENCE (MultiThreaded::MultiThreadDownloaderBase, m_pDownloader)
 DownloadTask (ManagedPointer< MultiThreaded::MultiThreadDownloaderBase > pBase, DownloadManager *pManager, unsigned RateAveragingTime, const MultiThreaded::AdvancedDownloadParams &CachedDownloadParams)
 ~DownloadTask ()
bool IsPending ()
bool IsDownloading ()
unsigned GetActiveThreads ()
unsigned GetAverageRate ()
unsigned GetSlidingRate ()
TimeSpan GetRemainingTime ()
ULONGLONG GetTotalFileSize ()
ULONGLONG GetCompletedSize ()
unsigned GetAdditionalStatusCode ()
ActionStatus GetStatus ()
unsigned GetMaxThreadCount ()
ThreadStats GetThreadStats (unsigned ThreadID)
MultiThreaded::MultiThreadDownloaderBase::DownloadState GetCurrentState ()
bool GetAndResetCompletePendingEvent ()
bool IsCompleted ()
MultiThreaded::FragmentFileFormat GetFormat ()
void * GetUserContext ()
void SetUserContext (void *pContext)
MultiThreaded::AdvancedDownloadParamsGetCachedDownloadParams ()
ActionStatus ApplyDownloadParams (const std::string &URL, const FilePath &path, MultiThreaded::AdvancedDownloadParams *pParams)
ActionStatus ApplyThreadCount (unsigned NewThreadCount)
ActionStatus Resume ()
void Stop ()
void AllowFileAppending (bool FileAppendingAllowed)
ActionStatus NonConditionalResume ()
void SetTimeout (unsigned Timeout)
void SetAveragingTime (unsigned Time)

Public Attributes

RateCalculator m_AverageRateCalc
RateCalculator m_SlidingRateCalc
std::string m_URL
BazisLib::String m_TargetFile
bool m_bTransferStarted
bool m_bCompletedEventPending
bool m_bCompletedEventProcessed
bool m_bStartPending
SingleMallocVector< ThreadStatsm_ThreadStats
DownloadManagerm_pMgr
MultiThreaded::AdvancedDownloadParams m_CachedDownloadParams
void * m_pUserContext

Protected Member Functions

void FlagCompleted ()

Static Protected Member Functions

static bool ProgressProc (NetworkOperationPhase phase, ULONGLONG done, ULONGLONG total, unsigned lastPortionSize, unsigned ThreadID, void *pContext)

Friends

class DownloadManager


Detailed Description

Represents a single download task.

This class represents a single MultiThreadDownloaderBase-based download task. The functionality implemented inside this class is the following:


Constructor & Destructor Documentation

BazisLib::Network::DownloadManager::DownloadTask::DownloadTask ( ManagedPointer< MultiThreaded::MultiThreadDownloaderBase pBase,
DownloadManager pManager,
unsigned  RateAveragingTime,
const MultiThreaded::AdvancedDownloadParams CachedDownloadParams 
) [inline]

Here is the call graph for this function:

BazisLib::Network::DownloadManager::DownloadTask::~DownloadTask (  )  [inline]


Member Function Documentation

void BazisLib::Network::DownloadManager::DownloadTask::AllowFileAppending ( bool  FileAppendingAllowed  )  [inline]

ActionStatus BazisLib::Network::DownloadManager::DownloadTask::ApplyDownloadParams ( const std::string &  URL,
const FilePath path,
MultiThreaded::AdvancedDownloadParams pParams 
) [inline]

Here is the call graph for this function:

ActionStatus BazisLib::Network::DownloadManager::DownloadTask::ApplyThreadCount ( unsigned  NewThreadCount  )  [inline]

Here is the call graph for this function:

BazisLib::Network::DownloadManager::DownloadTask::DECLARE_REFERENCE ( MultiThreaded::MultiThreadDownloaderBase  ,
m_pDownloader   
)

void BazisLib::Network::DownloadManager::DownloadTask::FlagCompleted (  )  [inline, protected]

unsigned BazisLib::Network::DownloadManager::DownloadTask::GetActiveThreads (  )  [inline]

unsigned BazisLib::Network::DownloadManager::DownloadTask::GetAdditionalStatusCode (  )  [inline]

bool BazisLib::Network::DownloadManager::DownloadTask::GetAndResetCompletePendingEvent (  )  [inline]

unsigned BazisLib::Network::DownloadManager::DownloadTask::GetAverageRate (  )  [inline]

Here is the call graph for this function:

MultiThreaded::AdvancedDownloadParams* BazisLib::Network::DownloadManager::DownloadTask::GetCachedDownloadParams (  )  [inline]

ULONGLONG BazisLib::Network::DownloadManager::DownloadTask::GetCompletedSize (  )  [inline]

MultiThreaded::MultiThreadDownloaderBase::DownloadState BazisLib::Network::DownloadManager::DownloadTask::GetCurrentState (  )  [inline]

MultiThreaded::FragmentFileFormat BazisLib::Network::DownloadManager::DownloadTask::GetFormat (  )  [inline]

unsigned BazisLib::Network::DownloadManager::DownloadTask::GetMaxThreadCount (  )  [inline]

TimeSpan BazisLib::Network::DownloadManager::DownloadTask::GetRemainingTime (  )  [inline]

Here is the call graph for this function:

unsigned BazisLib::Network::DownloadManager::DownloadTask::GetSlidingRate (  )  [inline]

Here is the call graph for this function:

ActionStatus BazisLib::Network::DownloadManager::DownloadTask::GetStatus (  )  [inline]

ThreadStats BazisLib::Network::DownloadManager::DownloadTask::GetThreadStats ( unsigned  ThreadID  )  [inline]

ULONGLONG BazisLib::Network::DownloadManager::DownloadTask::GetTotalFileSize (  )  [inline]

void* BazisLib::Network::DownloadManager::DownloadTask::GetUserContext (  )  [inline]

bool BazisLib::Network::DownloadManager::DownloadTask::IsCompleted (  )  [inline]

bool BazisLib::Network::DownloadManager::DownloadTask::IsDownloading (  )  [inline]

bool BazisLib::Network::DownloadManager::DownloadTask::IsPending (  )  [inline]

ActionStatus BazisLib::Network::DownloadManager::DownloadTask::NonConditionalResume (  )  [inline]

Here is the call graph for this function:

static bool BazisLib::Network::DownloadManager::DownloadTask::ProgressProc ( NetworkOperationPhase  phase,
ULONGLONG  done,
ULONGLONG  total,
unsigned  lastPortionSize,
unsigned  ThreadID,
void *  pContext 
) [static, protected]

ActionStatus BazisLib::Network::DownloadManager::DownloadTask::Resume (  ) 

void BazisLib::Network::DownloadManager::DownloadTask::SetAveragingTime ( unsigned  Time  )  [inline]

Here is the call graph for this function:

void BazisLib::Network::DownloadManager::DownloadTask::SetTimeout ( unsigned  Timeout  )  [inline]

void BazisLib::Network::DownloadManager::DownloadTask::SetUserContext ( void *  pContext  )  [inline]

void BazisLib::Network::DownloadManager::DownloadTask::Stop (  ) 


Friends And Related Function Documentation

friend class DownloadManager [friend]


Member Data Documentation

The flag_pending-start-complete scheme works in the following way: 1) When the active download limit is reached, the Resume() method just sets the m_bStartPending flag instead of actually starting the download. 2) When a download is completed, the download count is checked once again, and in case a new download can be started, the first 'pending' download is actually started by calling NonConditionalResume(). 3) A Stop() call on a 'pending' download just clears the 'pending' flag 4) When the maximum download count is altered, the CheckAndStartPendingDownloads() method is invoked.


The documentation for this class was generated from the following file:
SourceForge.net Logo