diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2015-12-27 18:39:47 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2015-12-27 18:40:08 +0900 |
| commit | b1132d6b10cd3791b9529d7031d723fd0e2d8215 (patch) | |
| tree | 9ce465b42bf09372118335c7c619bb2b41869eaf /src/RequestGroup.h | |
| parent | 4abad2f64c9ff80144a61c5a9c2bea144852b883 (diff) | |
make clang-format using clang-format-3.6
Diffstat (limited to 'src/RequestGroup.h')
| -rw-r--r-- | src/RequestGroup.h | 183 |
1 files changed, 50 insertions, 133 deletions
diff --git a/src/RequestGroup.h b/src/RequestGroup.h index 5b659312..38dbb1fd 100644 --- a/src/RequestGroup.h +++ b/src/RequestGroup.h @@ -77,11 +77,7 @@ class PeerStorage; class RequestGroup { public: - enum HaltReason { - NONE, - SHUTDOWN_SIGNAL, - USER_REQUEST - }; + enum HaltReason { NONE, SHUTDOWN_SIGNAL, USER_REQUEST }; enum State { // Waiting in the reserved queue STATE_WAITING, @@ -200,8 +196,8 @@ private: // returns error_code::UNKNOWN_ERROR. std::pair<error_code::Value, std::string> downloadResult() const; - void removeDefunctControlFile - (const std::shared_ptr<BtProgressInfoFile>& progressInfoFile); + void removeDefunctControlFile( + const std::shared_ptr<BtProgressInfoFile>& progressInfoFile); public: RequestGroup(const std::shared_ptr<GroupId>& gid, @@ -262,25 +258,13 @@ public: void validateTotalLength(int64_t actualTotalLength) const; - void setNumConcurrentCommand(int num) - { - numConcurrentCommand_ = num; - } + void setNumConcurrentCommand(int num) { numConcurrentCommand_ = num; } - int getNumConcurrentCommand() const - { - return numConcurrentCommand_; - } + int getNumConcurrentCommand() const { return numConcurrentCommand_; } - a2_gid_t getGID() const - { - return gid_->getNumericId(); - } + a2_gid_t getGID() const { return gid_->getNumericId(); } - const std::shared_ptr<GroupId>& getGroupId() const - { - return gid_; - } + const std::shared_ptr<GroupId>& getGroupId() const { return gid_; } TransferStat calculateStat() const; @@ -291,7 +275,8 @@ public: // This function also calls // downloadContext->setOwnerRequestGroup(this). - void setDownloadContext(const std::shared_ptr<DownloadContext>& downloadContext); + void + setDownloadContext(const std::shared_ptr<DownloadContext>& downloadContext); const std::shared_ptr<PieceStorage>& getPieceStorage() const { @@ -300,8 +285,8 @@ public: void setPieceStorage(const std::shared_ptr<PieceStorage>& pieceStorage); - void setProgressInfoFile - (const std::shared_ptr<BtProgressInfoFile>& progressInfoFile); + void setProgressInfoFile( + const std::shared_ptr<BtProgressInfoFile>& progressInfoFile); void increaseStreamCommand(); @@ -317,28 +302,21 @@ public: void decreaseNumCommand(); - int getNumCommand() const - { - return numCommand_; - } + int getNumCommand() const { return numCommand_; } - // TODO is it better to move the following 2 methods to SingleFileDownloadContext? - void setDiskWriterFactory(const std::shared_ptr<DiskWriterFactory>& diskWriterFactory); + // TODO is it better to move the following 2 methods to + // SingleFileDownloadContext? + void setDiskWriterFactory( + const std::shared_ptr<DiskWriterFactory>& diskWriterFactory); const std::shared_ptr<DiskWriterFactory>& getDiskWriterFactory() const { return diskWriterFactory_; } - void setFileAllocationEnabled(bool f) - { - fileAllocationEnabled_ = f; - } + void setFileAllocationEnabled(bool f) { fileAllocationEnabled_ = f; } - bool isFileAllocationEnabled() const - { - return fileAllocationEnabled_; - } + bool isFileAllocationEnabled() const { return fileAllocationEnabled_; } bool needsFileAllocation() const; @@ -347,36 +325,21 @@ public: * if a file is already exists and control file exists etc. * Always open file with DiskAdaptor::initAndOpenFile() */ - void setPreLocalFileCheckEnabled(bool f) - { - preLocalFileCheckEnabled_ = f; - } + void setPreLocalFileCheckEnabled(bool f) { preLocalFileCheckEnabled_ = f; } - bool isPreLocalFileCheckEnabled() const - { - return preLocalFileCheckEnabled_; - } + bool isPreLocalFileCheckEnabled() const { return preLocalFileCheckEnabled_; } void setHaltRequested(bool f, HaltReason = SHUTDOWN_SIGNAL); void setForceHaltRequested(bool f, HaltReason = SHUTDOWN_SIGNAL); - bool isHaltRequested() const - { - return haltRequested_; - } + bool isHaltRequested() const { return haltRequested_; } - bool isForceHaltRequested() const - { - return forceHaltRequested_; - } + bool isForceHaltRequested() const { return forceHaltRequested_; } void setPauseRequested(bool f); - bool isPauseRequested() const - { - return pauseRequested_; - } + bool isPauseRequested() const { return pauseRequested_; } void dependsOn(const std::shared_ptr<Dependency>& dep); @@ -384,7 +347,8 @@ public: void releaseRuntimeResource(DownloadEngine* e); - void postDownloadProcessing(std::vector<std::shared_ptr<RequestGroup> >& groups); + void + postDownloadProcessing(std::vector<std::shared_ptr<RequestGroup>>& groups); void addPostDownloadHandler(const PostDownloadHandler* handler); @@ -396,10 +360,10 @@ public: void clearPreDownloadHandler(); - void processCheckIntegrityEntry - (std::vector<std::unique_ptr<Command>>& commands, - std::unique_ptr<CheckIntegrityEntry> entry, - DownloadEngine* e); + void + processCheckIntegrityEntry(std::vector<std::unique_ptr<Command>>& commands, + std::unique_ptr<CheckIntegrityEntry> entry, + DownloadEngine* e); // Initializes pieceStorage_ and segmentMan_. We guarantee that // either both of pieceStorage_ and segmentMan_ are initialized or @@ -410,7 +374,8 @@ public: bool downloadFinishedByFileLength(); - void loadAndOpenFile(const std::shared_ptr<BtProgressInfoFile>& progressInfoFile); + void + loadAndOpenFile(const std::shared_ptr<BtProgressInfoFile>& progressInfoFile); void shouldCancelDownloadForSafety(); @@ -418,10 +383,7 @@ public: std::shared_ptr<DownloadResult> createDownloadResult() const; - const std::shared_ptr<Option>& getOption() const - { - return option_; - } + const std::shared_ptr<Option>& getOption() const { return option_; } void reportDownloadFinished(); @@ -442,10 +404,7 @@ public: void markInMemoryDownload(); // Returns inMemoryDownload flag. - bool inMemoryDownload() const - { - return inMemoryDownload_; - } + bool inMemoryDownload() const { return inMemoryDownload_; } void setTimeout(std::chrono::seconds timeout); @@ -461,36 +420,21 @@ public: // maxUploadSpeedLimit_ == 0. Otherwise returns false. bool doesUploadSpeedExceed(); - int getMaxDownloadSpeedLimit() const - { - return maxDownloadSpeedLimit_; - } + int getMaxDownloadSpeedLimit() const { return maxDownloadSpeedLimit_; } - void setMaxDownloadSpeedLimit(int speed) - { - maxDownloadSpeedLimit_ = speed; - } + void setMaxDownloadSpeedLimit(int speed) { maxDownloadSpeedLimit_ = speed; } - int getMaxUploadSpeedLimit() const - { - return maxUploadSpeedLimit_; - } + int getMaxUploadSpeedLimit() const { return maxUploadSpeedLimit_; } - void setMaxUploadSpeedLimit(int speed) - { - maxUploadSpeedLimit_ = speed; - } + void setMaxUploadSpeedLimit(int speed) { maxUploadSpeedLimit_ = speed; } - void setLastErrorCode(error_code::Value code, const char *message = "") + void setLastErrorCode(error_code::Value code, const char* message = "") { lastErrorCode_ = code; lastErrorMessage_ = message; } - error_code::Value getLastErrorCode() const - { - return lastErrorCode_; - } + error_code::Value getLastErrorCode() const { return lastErrorCode_; } void saveControlFile() const; @@ -500,49 +444,31 @@ public: void disableSaveControlFile() { saveControlFile_ = false; } - template<typename InputIterator> + template <typename InputIterator> void followedBy(InputIterator groupFirst, InputIterator groupLast) { followedByGIDs_.clear(); - for(; groupFirst != groupLast; ++groupFirst) { + for (; groupFirst != groupLast; ++groupFirst) { followedByGIDs_.push_back((*groupFirst)->getGID()); } } - const std::vector<a2_gid_t>& followedBy() const - { - return followedByGIDs_; - } + const std::vector<a2_gid_t>& followedBy() const { return followedByGIDs_; } - void belongsTo(a2_gid_t gid) - { - belongsToGID_ = gid; - } + void belongsTo(a2_gid_t gid) { belongsToGID_ = gid; } - a2_gid_t belongsTo() const - { - return belongsToGID_; - } + a2_gid_t belongsTo() const { return belongsToGID_; } void setRequestGroupMan(RequestGroupMan* requestGroupMan) { requestGroupMan_ = requestGroupMan; } - RequestGroupMan* getRequestGroupMan() - { - return requestGroupMan_; - } + RequestGroupMan* getRequestGroupMan() { return requestGroupMan_; } - int getResumeFailureCount() const - { - return resumeFailureCount_; - } + int getResumeFailureCount() const { return resumeFailureCount_; } - void increaseResumeFailureCount() - { - ++resumeFailureCount_; - } + void increaseResumeFailureCount() { ++resumeFailureCount_; } bool p2pInvolved() const; @@ -556,20 +482,11 @@ public: return metadataInfo_; } - int getState() const - { - return state_; - } + int getState() const { return state_; } - void setState(int state) - { - state_ = state; - } + void setState(int state) { state_ = state; } - bool isSeedOnlyEnabled() - { - return seedOnly_; - } + bool isSeedOnlyEnabled() { return seedOnly_; } void enableSeedOnly(); }; |
