diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2007-10-11 16:58:24 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2007-10-11 16:58:24 +0000 |
| commit | 048a2cf59737f761876e81a77e8d064c45c752d7 (patch) | |
| tree | 65c9d5498aafe6a8c8e640ddfcc43c7013504d0d /src/FileAllocationMan.h | |
| parent | e26bbbb9eee140ba24402fe872a752b42f0077de (diff) | |
2007-10-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Implemented BitTorrent/http/ftp integrated download.
I've rewritten lots of files and now some headers have forward
class declarations to reduce compile time.
The implementation is extremely alpha stage, I recommend to use this
for testing purpose only.
Diffstat (limited to 'src/FileAllocationMan.h')
| -rw-r--r-- | src/FileAllocationMan.h | 52 |
1 files changed, 14 insertions, 38 deletions
diff --git a/src/FileAllocationMan.h b/src/FileAllocationMan.h index a4b2413e..17557d9b 100644 --- a/src/FileAllocationMan.h +++ b/src/FileAllocationMan.h @@ -36,57 +36,33 @@ #define _D_FILE_ALLOCATION_MAN_H_ #include "common.h" -#include "Request.h" -#include "RequestGroup.h" -#include "FileAllocationEntry.h" + +class FileAllocationEntry; +extern typedef SharedHandle<FileAllocationEntry> FileAllocationEntryHandle; +extern typedef deque<FileAllocationEntryHandle> FileAllocationEntries; class FileAllocationMan { private: FileAllocationEntries _fileAllocationEntries; FileAllocationEntryHandle _currentFileAllocationEntry; public: - FileAllocationMan():_currentFileAllocationEntry(0) {} + FileAllocationMan(); + + ~FileAllocationMan(); - bool isFileAllocationBeingExecuted() const - { - return _currentFileAllocationEntry.get() != 0; - } + bool isFileAllocationBeingExecuted() const; - FileAllocationEntryHandle getCurrentFileAllocationEntry() - { - return _currentFileAllocationEntry; - } + FileAllocationEntryHandle getCurrentFileAllocationEntry(); - void markCurrentFileAllocationEntryDone() - { - _currentFileAllocationEntry = 0; - } + void markCurrentFileAllocationEntryDone(); - bool nextFileAllocationEntryExists() const - { - return !_fileAllocationEntries.empty(); - } + bool nextFileAllocationEntryExists() const; - FileAllocationEntryHandle popNextFileAllocationEntry() - { - if(!nextFileAllocationEntryExists()) { - return 0; - } - FileAllocationEntryHandle entry = _fileAllocationEntries.front(); - _fileAllocationEntries.pop_front(); - _currentFileAllocationEntry = entry; - return entry; - } + FileAllocationEntryHandle popNextFileAllocationEntry(); - void pushFileAllocationEntry(const FileAllocationEntryHandle& entry) - { - _fileAllocationEntries.push_back(entry); - } + void pushFileAllocationEntry(const FileAllocationEntryHandle& entry); - int32_t countFileAllocationEntryInQueue() const - { - return _fileAllocationEntries.size(); - } + int32_t countFileAllocationEntryInQueue() const; }; typedef SharedHandle<FileAllocationMan> FileAllocationManHandle; |
