• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdenetwork API Reference
  • KDE Home
  • Contact Us
 

kget

  • sources
  • kde-4.12
  • kdenetwork
  • kget
  • transfer-plugins
  • bittorrent
btchunkselector.h
Go to the documentation of this file.
1 /* This file is part of the KDE project
2 
3  Copyright (C) 2008 Lukas Appelhans <l.appelhans@gmx.de>
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 */
10 
11 #ifndef KGETBTCHUNKSELECTOR_H
12 #define KGETBTCHUNKSELECTOR_H
13 
14 #include <list>
15 #include <util/timer.h>
16 #include <util/constants.h>
17 #include <interfaces/chunkselectorinterface.h>
18 #include <QObject>
19 
20 namespace bt
21 {
22  class BitSet;
23  class ChunkManager;
24  class Downloader;
25  class PeerManager;
26  class PieceDownloader;
27 }
28 
29 class BTChunkSelector : public bt::ChunkSelectorInterface
30 {
31  public:
32  BTChunkSelector(bt::ChunkManager & cman,bt::Downloader & downer,bt::PeerManager & pman);
33  ~BTChunkSelector();
34 
35  virtual bool select(bt::PieceDownloader* pd,bt::Uint32 & chunk);
36  virtual void dataChecked(const bt::BitSet & ok_chunks);
37  virtual void reincluded(bt::Uint32 from, bt::Uint32 to);
38  virtual void reinsert(bt::Uint32 chunk);
39  virtual void excludeAll();
40  virtual void exclude(bt::Uint32 chunk);
41 
42  private:
43  bt::Uint32 leastPeers(const std::list<bt::Uint32> & lp);
44 
45  std::list<bt::Uint32> chunks;
46  bt::Timer sort_timer;
47 };
48 
49 class BTChunkSelectorFactory : public QObject, public bt::ChunkSelectorFactoryInterface
50 {
51  Q_OBJECT
52  public:
53  BTChunkSelectorFactory();
54  ~BTChunkSelectorFactory();
55 
56  bt::ChunkSelectorInterface* createChunkSelector(bt::ChunkManager & cman, bt::Downloader & downer, bt::PeerManager & pman);
57 
58  signals:
59  void selectorAdded(BTChunkSelector *selector);
60 };
61 
62 #endif
BTChunkSelectorFactory::BTChunkSelectorFactory
BTChunkSelectorFactory()
Definition: btchunkselector.cpp:286
BTChunkSelector
Definition: btchunkselector.h:29
BTChunkSelector::~BTChunkSelector
~BTChunkSelector()
Definition: btchunkselector.cpp:80
BTChunkSelector::exclude
virtual void exclude(bt::Uint32 chunk)
Definition: btchunkselector.cpp:279
QObject
BTChunkSelector::reinsert
virtual void reinsert(bt::Uint32 chunk)
Definition: btchunkselector.cpp:267
BTChunkSelector::reincluded
virtual void reincluded(bt::Uint32 from, bt::Uint32 to)
Definition: btchunkselector.cpp:247
BTChunkSelectorFactory::~BTChunkSelectorFactory
~BTChunkSelectorFactory()
Definition: btchunkselector.cpp:290
BTChunkSelector::excludeAll
virtual void excludeAll()
Definition: btchunkselector.cpp:274
BitSet
Simple implementation of a BitSet.
Definition: bitset.h:32
BTChunkSelectorFactory::selectorAdded
void selectorAdded(BTChunkSelector *selector)
BTChunkSelector::dataChecked
virtual void dataChecked(const bt::BitSet &ok_chunks)
Definition: btchunkselector.cpp:229
BTChunkSelector::select
virtual bool select(bt::PieceDownloader *pd, bt::Uint32 &chunk)
Definition: btchunkselector.cpp:101
BTChunkSelectorFactory
Definition: btchunkselector.h:49
BTChunkSelectorFactory::createChunkSelector
bt::ChunkSelectorInterface * createChunkSelector(bt::ChunkManager &cman, bt::Downloader &downer, bt::PeerManager &pman)
Definition: btchunkselector.cpp:294
BTChunkSelector::BTChunkSelector
BTChunkSelector(bt::ChunkManager &cman, bt::Downloader &downer, bt::PeerManager &pman)
Definition: btchunkselector.cpp:61
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:53:17 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kget

Skip menu "kget"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal