libtorrent::piece_picker Class Reference

#include <piece_picker.hpp>

List of all members.

Public Types

enum  { max_blocks_per_piece = 256 }

Public Member Functions

 piece_picker (int blocks_per_piece, int total_num_blocks)
void set_sequenced_download_threshold (int sequenced_download_threshold)
void files_checked (const std::vector< bool > &pieces, const std::vector< downloading_piece > &unfinished)
void inc_refcount (int index)
void dec_refcount (int index)
void we_have (int index)
void mark_as_unfiltered (int index)
void mark_as_filtered (int index)
bool is_filtered (int index) const
void filtered_pieces (std::vector< bool > &mask) const
void pick_pieces (const std::vector< bool > &pieces, std::vector< piece_block > &interesting_blocks, int num_pieces, bool prefer_whole_pieces, tcp::endpoint peer) const
bool is_downloading (piece_block block) const
bool is_finished (piece_block block) const
void mark_as_downloading (piece_block block, tcp::endpoint const &peer)
void mark_as_finished (piece_block block, tcp::endpoint const &peer)
void restore_piece (int index)
void abort_download (piece_block block)
bool is_piece_finished (int index) const
int blocks_in_piece (int index) const
int unverified_blocks () const
void get_downloaders (std::vector< tcp::endpoint > &d, int index) const
std::vector< downloading_piece >
const & 
get_download_queue () const
boost::optional< tcp::endpointget_downloader (piece_block block) const
int num_filtered () const
int num_have_filtered () const
void check_invariant (const torrent *t=0) const
int blocks_in_last_piece () const
float distributed_copies () const

Private Member Functions

void add (int index)
void move (bool downloading, bool filtered, int vec_index, int elem_index)
void remove (bool downloading, bool filtered, int vec_index, int elem_index)
std::vector< std::vector< int > > & pick_piece_info_vector (bool downloading, bool filtered)
std::vector< std::vector< int >
> const & 
pick_piece_info_vector (bool downloading, bool filtered) const
int add_interesting_blocks_free (const std::vector< int > &piece_list, const std::vector< bool > &pieces, std::vector< piece_block > &interesting_blocks, int num_blocks, bool prefer_whole_pieces) const
int add_interesting_blocks_partial (const std::vector< int > &piece_list, const std::vector< bool > &pieces, std::vector< piece_block > &interesting_blocks, std::vector< piece_block > &backup_blocks, int num_blocks, bool prefer_whole_pieces, tcp::endpoint peer) const

Private Attributes

std::vector< std::vector< int > > m_piece_info
std::vector< std::vector< int > > m_downloading_piece_info
std::vector< piece_posm_piece_map
std::vector< downloading_piecem_downloads
int m_blocks_per_piece
int m_blocks_in_last_piece
int m_num_filtered
int m_num_have_filtered
int m_sequenced_download_threshold
bool m_files_checked_called

Classes

struct  block_info
struct  downloading_piece
struct  has_index
struct  piece_pos


Detailed Description

Definition at line 85 of file piece_picker.hpp.


Member Enumeration Documentation

anonymous enum

Enumerator:
max_blocks_per_piece 

Definition at line 89 of file piece_picker.hpp.


Constructor & Destructor Documentation

libtorrent::piece_picker::piece_picker ( int  blocks_per_piece,
int  total_num_blocks 
)


Member Function Documentation

void libtorrent::piece_picker::set_sequenced_download_threshold ( int  sequenced_download_threshold  ) 

void libtorrent::piece_picker::files_checked ( const std::vector< bool > &  pieces,
const std::vector< downloading_piece > &  unfinished 
)

void libtorrent::piece_picker::inc_refcount ( int  index  ) 

void libtorrent::piece_picker::dec_refcount ( int  index  ) 

void libtorrent::piece_picker::we_have ( int  index  ) 

void libtorrent::piece_picker::mark_as_unfiltered ( int  index  ) 

void libtorrent::piece_picker::mark_as_filtered ( int  index  ) 

bool libtorrent::piece_picker::is_filtered ( int  index  )  const

Definition at line 694 of file piece_picker.cpp.

References m_piece_map.

Referenced by test_main().

void libtorrent::piece_picker::filtered_pieces ( std::vector< bool > &  mask  )  const

Definition at line 702 of file piece_picker.cpp.

References asio::placeholders::iterator, and m_piece_map.

Referenced by test_main().

void libtorrent::piece_picker::pick_pieces ( const std::vector< bool > &  pieces,
std::vector< piece_block > &  interesting_blocks,
int  num_pieces,
bool  prefer_whole_pieces,
tcp::endpoint  peer 
) const

bool libtorrent::piece_picker::is_downloading ( piece_block  block  )  const

bool libtorrent::piece_picker::is_finished ( piece_block  block  )  const

void libtorrent::piece_picker::mark_as_downloading ( piece_block  block,
tcp::endpoint const &  peer 
)

void libtorrent::piece_picker::mark_as_finished ( piece_block  block,
tcp::endpoint const &  peer 
)

void libtorrent::piece_picker::restore_piece ( int  index  ) 

void libtorrent::piece_picker::abort_download ( piece_block  block  ) 

bool libtorrent::piece_picker::is_piece_finished ( int  index  )  const

int libtorrent::piece_picker::blocks_in_piece ( int  index  )  const [inline]

int libtorrent::piece_picker::unverified_blocks (  )  const

Definition at line 1130 of file piece_picker.cpp.

References m_downloads.

void libtorrent::piece_picker::get_downloaders ( std::vector< tcp::endpoint > &  d,
int  index 
) const

Definition at line 1050 of file piece_picker.cpp.

References blocks_in_piece(), m_downloads, and m_piece_map.

std::vector<downloading_piece> const& libtorrent::piece_picker::get_download_queue (  )  const [inline]

boost::optional< tcp::endpoint > libtorrent::piece_picker::get_downloader ( piece_block  block  )  const

int libtorrent::piece_picker::num_filtered (  )  const [inline]

int libtorrent::piece_picker::num_have_filtered (  )  const [inline]

Definition at line 211 of file piece_picker.hpp.

Referenced by check_invariant(), and test_main().

void libtorrent::piece_picker::check_invariant ( const torrent t = 0  )  const

int libtorrent::piece_picker::blocks_in_last_piece (  )  const [inline]

Definition at line 226 of file piece_picker.hpp.

float libtorrent::piece_picker::distributed_copies (  )  const

Definition at line 282 of file piece_picker.cpp.

References m_piece_info, and m_piece_map.

void libtorrent::piece_picker::add ( int  index  )  [private]

void libtorrent::piece_picker::move ( bool  downloading,
bool  filtered,
int  vec_index,
int  elem_index 
) [private]

void libtorrent::piece_picker::remove ( bool  downloading,
bool  filtered,
int  vec_index,
int  elem_index 
) [private]

std::vector< std::vector< int > > & libtorrent::piece_picker::pick_piece_info_vector ( bool  downloading,
bool  filtered 
) [private]

Definition at line 300 of file piece_picker.cpp.

References m_downloading_piece_info, and m_piece_info.

Referenced by add(), check_invariant(), move(), and remove().

std::vector< std::vector< int > > const & libtorrent::piece_picker::pick_piece_info_vector ( bool  downloading,
bool  filtered 
) const [private]

Definition at line 307 of file piece_picker.cpp.

References m_downloading_piece_info, and m_piece_info.

int libtorrent::piece_picker::add_interesting_blocks_free ( const std::vector< int > &  piece_list,
const std::vector< bool > &  pieces,
std::vector< piece_block > &  interesting_blocks,
int  num_blocks,
bool  prefer_whole_pieces 
) const [private]

Definition at line 817 of file piece_picker.cpp.

References blocks_in_piece(), and m_piece_map.

Referenced by pick_pieces().

int libtorrent::piece_picker::add_interesting_blocks_partial ( const std::vector< int > &  piece_list,
const std::vector< bool > &  pieces,
std::vector< piece_block > &  interesting_blocks,
std::vector< piece_block > &  backup_blocks,
int  num_blocks,
bool  prefer_whole_pieces,
tcp::endpoint  peer 
) const [private]


Member Data Documentation

std::vector<std::vector<int> > libtorrent::piece_picker::m_piece_info [private]

std::vector<std::vector<int> > libtorrent::piece_picker::m_downloading_piece_info [private]

Definition at line 309 of file piece_picker.hpp.

Referenced by check_invariant(), pick_piece_info_vector(), and pick_pieces().

Definition at line 325 of file piece_picker.hpp.

Referenced by blocks_in_piece(), files_checked(), is_piece_finished(), and piece_picker().

Definition at line 326 of file piece_picker.hpp.

Referenced by blocks_in_piece(), and piece_picker().


The documentation for this class was generated from the following files:

Generated on Sun May 25 00:21:42 2008 by  doxygen 1.5.6