kget
bt::Chunk Class Reference
#include <chunk.h>
List of all members.
Detailed Description
- Author:
- Joris Guisson
Keep track of a piece of the file
Keeps track of a piece of the file. The Chunk has 3 possible states :
- MMAPPED : It is memory mapped
- BUFFERED : It is in a buffer in dynamically allocated memory (because the chunk is located in 2 or more separate files, so we cannot just set a pointer to a region of mmapped memory)
- ON_DISK : On disk
- NOT_DOWNLOADED : It hasn't been dowloaded yet, and there is no buffer allocated
Definition at line 44 of file chunk.h.
Member Enumeration Documentation
- Enumerator:
-
| MMAPPED |
|
| BUFFERED |
|
| ON_DISK |
|
| NOT_DOWNLOADED |
|
Definition at line 50 of file chunk.h.
Constructor & Destructor Documentation
| bt::Chunk::Chunk |
( |
unsigned int |
index, |
|
|
Uint32 |
size | |
|
) |
| | |
Member Function Documentation
| void bt::Chunk::allocate |
( |
|
) |
|
allocate data if not already done, sets the status to buffered
Definition at line 46 of file chunk.cpp.
| bool bt::Chunk::checkHash |
( |
const SHA1Hash & |
h |
) |
const |
Check wehter the chunk matches it's hash.
- Parameters:
-
- Returns:
- true if the data matches the hash
Definition at line 68 of file chunk.cpp.
| void bt::Chunk::clear |
( |
|
) |
|
Clear the chunk (delete data depending on the mode).
Definition at line 53 of file chunk.cpp.
| Uint8 * bt::Chunk::getData |
( |
|
) |
[inline] |
Get the data.
Definition at line 142 of file chunk.h.
| const Uint8 * bt::Chunk::getData |
( |
|
) |
const [inline] |
Get the data.
Definition at line 141 of file chunk.h.
| Uint32 bt::Chunk::getIndex |
( |
|
) |
const [inline] |
Get the chunk's index.
Definition at line 144 of file chunk.h.
| Priority bt::Chunk::getPriority |
( |
|
) |
const [inline] |
get chunk priority
Definition at line 151 of file chunk.h.
| Uint32 bt::Chunk::getSize |
( |
|
) |
const [inline] |
Get the chunk's size.
Definition at line 145 of file chunk.h.
Get the chunks status.
Definition at line 131 of file chunk.h.
| bool bt::Chunk::isExcluded |
( |
|
) |
const [inline] |
Is chunk excluded.
Definition at line 153 of file chunk.h.
| bool bt::Chunk::isExcludedForDownloading |
( |
|
) |
const [inline] |
Is this a seed only chunk.
Definition at line 158 of file chunk.h.
| void bt::Chunk::ref |
( |
|
) |
[inline] |
Add one to the reference counter.
Definition at line 147 of file chunk.h.
Set the data and the new status.
Definition at line 39 of file chunk.cpp.
| void bt::Chunk::setExclude |
( |
bool |
yes |
) |
[inline] |
In/Exclude chunk.
Definition at line 163 of file chunk.h.
| void bt::Chunk::setPriority |
( |
Priority |
newpriority = NORMAL_PRIORITY |
) |
[inline] |
set chunk priority
Definition at line 152 of file chunk.h.
Set the chunks status.
- Parameters:
-
Definition at line 136 of file chunk.h.
| bool bt::Chunk::taken |
( |
|
) |
const [inline] |
reference coun > 0
Definition at line 149 of file chunk.h.
| void bt::Chunk::unref |
( |
|
) |
[inline] |
--reference counter
Definition at line 148 of file chunk.h.
The documentation for this class was generated from the following files: