libktorrent  2.2.0
chunkselectorinterface.h
1 /***************************************************************************
2  * Copyright (C) 2008 by Joris Guisson and Ivan Vasic *
3  * joris.guisson@gmail.com *
4  * ivasic@gmail.com *
5  * *
6  * This program is free software; you can redistribute it and/or modify *
7  * it under the terms of the GNU General Public License as published by *
8  * the Free Software Foundation; either version 2 of the License, or *
9  * (at your option) any later version. *
10  * *
11  * This program is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14  * GNU General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU General Public License *
17  * along with this program; if not, write to the *
18  * Free Software Foundation, Inc., *
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
20  ***************************************************************************/
21 #ifndef BTCHUNKSELECTORINTERFACE_H
22 #define BTCHUNKSELECTORINTERFACE_H
23 
24 #include <util/constants.h>
25 #include <ktorrent_export.h>
26 
27 namespace bt
28 {
29  class BitSet;
30  class Downloader;
31  class PeerManager;
32  class ChunkManager;
33  class PieceDownloader;
34 
40  class KTORRENT_EXPORT ChunkSelectorInterface
41  {
42  public:
44  virtual ~ChunkSelectorInterface();
45 
53  virtual void init(ChunkManager* cman,Downloader* downer,PeerManager* pman);
54 
61  virtual bool select(PieceDownloader* pd,Uint32 & chunk) = 0;
62 
70  virtual bool selectRange(Uint32 & from,Uint32 & to,Uint32 max_len);
71 
78  virtual void dataChecked(const BitSet & ok_chunks, Uint32 from, Uint32 to) = 0;
79 
86  virtual void reincluded(Uint32 from, Uint32 to)= 0;
87 
93  virtual void reinsert(Uint32 chunk) = 0;
94 
95  protected:
96  ChunkManager* cman;
97  Downloader* downer;
98  PeerManager* pman;
99  };
100 }
101 
102 #endif
bt::BitSet
Simple implementation of a BitSet.
Definition: bitset.h:37
bt::ChunkSelectorInterface::reinsert
virtual void reinsert(Uint32 chunk)=0
bt::ChunkSelectorInterface
Definition: chunkselectorinterface.h:41
bt::ChunkManager
Definition: chunkmanager.h:61
bt::PieceDownloader
Definition: piecedownloader.h:38
bt::PeerManager
Manages all the Peers.
Definition: peermanager.h:67
bt::Downloader
Manages the downloading.
Definition: downloader.h:68
bt::ChunkSelectorInterface::init
virtual void init(ChunkManager *cman, Downloader *downer, PeerManager *pman)
bt::ChunkSelectorInterface::selectRange
virtual bool selectRange(Uint32 &from, Uint32 &to, Uint32 max_len)
bt::ChunkSelectorInterface::dataChecked
virtual void dataChecked(const BitSet &ok_chunks, Uint32 from, Uint32 to)=0
bt::ChunkSelectorInterface::reincluded
virtual void reincluded(Uint32 from, Uint32 to)=0
bt::ChunkSelectorInterface::select
virtual bool select(PieceDownloader *pd, Uint32 &chunk)=0