Downloader.h
上传用户:lds876
上传日期:2013-05-25
资源大小:567k
文件大小:2k
源码类别:

P2P编程

开发平台:

Visual C++

  1. // Downloader.h: interface for the CDownloader class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_DOWNLOADER_H__73CCECA4_C8FB_4231_AD44_5B45B9238992__INCLUDED_)
  5. #define AFX_DOWNLOADER_H__73CCECA4_C8FB_4231_AD44_5B45B9238992__INCLUDED_
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. class CStorageWrapper;
  10. class CPiecePicker;
  11. class CMeasure;
  12. class CRateMeasure;
  13. // class CSingleDownload;
  14. class CConnection;
  15. class CDownloaderFeedback;
  16. #include "SingleDownload.h"
  17. class CDownloader  
  18. {
  19. public:
  20. CDownloader();
  21. virtual ~CDownloader();
  22. bool Create(CDownloaderFeedback* pDownloaderFeedback, CStorageWrapper* pstrorage, CPiecePicker* pPicker, long lBacklog, 
  23. long lMaxRatePeriod, CMeasure* pDownMeasure, long lNumPieces, long lSnubTime, 
  24. CRateMeasure* pRateMeasure);
  25. bool IsCreate();
  26. void make_endgame();
  27. bool is_endgame();
  28. void cancel_endgame();
  29. CSingleDownload* make_download(CConnection* pConnection);
  30. void OnNeedFilesChanged();
  31. CStorageWrapper* m_pstrorage;
  32. CPiecePicker* m_pPicker;
  33. long m_lBacklog;
  34. long m_lMaxRatePeriod;
  35. CMeasure* m_pDownMeasure;
  36. long m_lNumPieces;
  37. long m_lSnubTime;
  38. CRateMeasure* m_pRateMeasure;
  39. vector<CSingleDownload*> m_vDownloads;
  40. // for endgame.
  41. vector<CRequestsItem> m_vRequests;
  42. bool m_bEndgame;
  43. private:
  44. CDownloaderFeedback* m_pDownloaderFeedback;
  45. bool m_bCreate;
  46. };
  47. #endif // !defined(AFX_DOWNLOADER_H__73CCECA4_C8FB_4231_AD44_5B45B9238992__INCLUDED_)