diff --git a/ChangeLog b/ChangeLog index 395e71bb..9b21a117 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-11-14 Tatsuhiro Tsujikawa + + Added .cc file for classes/structs that only provided by header + file. Defined non-POD classes' ctor, dtor in .cc file. Moved + implementation code in header file to .cc file for major + classes/strucsts. + 2010-11-12 Tatsuhiro Tsujikawa Removed SharedHandle::isNull(). Instead we added operator* and diff --git a/src/AbstractCommand.cc b/src/AbstractCommand.cc index aad57e5a..a35d7e25 100644 --- a/src/AbstractCommand.cc +++ b/src/AbstractCommand.cc @@ -49,9 +49,6 @@ #include "CreateRequestCommand.h" #include "InitiateConnectionCommandFactory.h" #include "SleepCommand.h" -#ifdef ENABLE_ASYNC_DNS -#include "AsyncNameResolver.h" -#endif // ENABLE_ASYNC_DNS #include "StreamCheckIntegrityEntry.h" #include "PieceStorage.h" #include "Socket.h" @@ -66,9 +63,11 @@ #include "DownloadContext.h" #include "wallclock.h" #include "NameResolver.h" -#include "ServerStatMan.h" -#include "FileAllocationEntry.h" #include "uri.h" +#include "FileEntry.h" +#ifdef ENABLE_ASYNC_DNS +#include "AsyncNameResolver.h" +#endif // ENABLE_ASYNC_DNS #ifdef ENABLE_MESSAGE_DIGEST # include "ChecksumCheckIntegrityEntry.h" #endif // ENABLE_MESSAGE_DIGEST @@ -861,4 +860,34 @@ size_t AbstractCommand::calculateMinSplitSize() const } } +void AbstractCommand::setRequest(const SharedHandle& request) +{ + req_ = request; +} + +void AbstractCommand::setFileEntry(const SharedHandle& fileEntry) +{ + fileEntry_ = fileEntry; +} + +void AbstractCommand::setSocket(const SharedHandle& s) +{ + socket_ = s; +} + +const SharedHandle& AbstractCommand::getDownloadContext() const +{ + return requestGroup_->getDownloadContext(); +} + +const SharedHandle& AbstractCommand::getSegmentMan() const +{ + return requestGroup_->getSegmentMan(); +} + +const SharedHandle& AbstractCommand::getPieceStorage() const +{ + return requestGroup_->getPieceStorage(); +} + } // namespace aria2 diff --git a/src/AbstractCommand.h b/src/AbstractCommand.h index cd8b2c7c..687738b9 100644 --- a/src/AbstractCommand.h +++ b/src/AbstractCommand.h @@ -36,17 +36,24 @@ #define D_ABSTRACT_COMMAND_H #include "Command.h" + +#include +#include + #include "SharedHandle.h" #include "TimerA2.h" -#include "FileEntry.h" -#include "RequestGroup.h" namespace aria2 { +class FileEntry; +class RequestGroup; +class CheckIntegrityEntry; +class DownloadContext; +class SegmentMan; +class PieceStorage; class Request; class DownloadEngine; class Segment; -class Exception; class SocketCore; class Option; #ifdef ENABLE_ASYNC_DNS @@ -98,20 +105,14 @@ protected: return req_; } - void setRequest(const SharedHandle& request) - { - req_ = request; - } + void setRequest(const SharedHandle& request); const SharedHandle& getFileEntry() const { return fileEntry_; } - void setFileEntry(const SharedHandle& fileEntry) - { - fileEntry_ = fileEntry; - } + void setFileEntry(const SharedHandle& fileEntry); DownloadEngine* getDownloadEngine() const { @@ -123,10 +124,7 @@ protected: return socket_; } - void setSocket(const SharedHandle& s) - { - socket_ = s; - } + void setSocket(const SharedHandle& s); void createSocket(); @@ -213,20 +211,9 @@ protected: const SharedHandle