/* */ #include "FileAllocationMan.h" #include "FileAllocationEntry.h" namespace aria2 { FileAllocationMan::FileAllocationMan() {} FileAllocationMan::~FileAllocationMan() {} bool FileAllocationMan::isFileAllocationBeingExecuted() const { return _currentFileAllocationEntry.get() != 0; } FileAllocationEntryHandle FileAllocationMan::getCurrentFileAllocationEntry() { return _currentFileAllocationEntry; } void FileAllocationMan::markCurrentFileAllocationEntryDone() { _currentFileAllocationEntry.reset(); } bool FileAllocationMan::nextFileAllocationEntryExists() const { return !_fileAllocationEntries.empty(); } FileAllocationEntryHandle FileAllocationMan::popNextFileAllocationEntry() { if(!nextFileAllocationEntryExists()) { return SharedHandle(); } FileAllocationEntryHandle entry = _fileAllocationEntries.front(); _fileAllocationEntries.pop_front(); _currentFileAllocationEntry = entry; return entry; } void FileAllocationMan::pushFileAllocationEntry(const FileAllocationEntryHandle& entry) { _fileAllocationEntries.push_back(entry); } size_t FileAllocationMan::countFileAllocationEntryInQueue() const { return _fileAllocationEntries.size(); } } // namespace aria2