comparison OrthancServer/ServerJobs/ArchiveJob.cpp @ 2966:10c610e80b15

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 05 Dec 2018 15:27:01 +0100
parents 9c0b0a6d8b54
children cb5d75143da0
comparison
equal deleted inserted replaced
2965:9c0b0a6d8b54 2966:10c610e80b15
776 return commands_.GetUncompressedSize(); 776 return commands_.GetUncompressedSize();
777 } 777 }
778 }; 778 };
779 779
780 780
781 ArchiveJob::ArchiveJob(boost::shared_ptr<TemporaryFile>& synchronousTarget, 781 ArchiveJob::ArchiveJob(ServerContext& context,
782 ServerContext& context,
783 bool isMedia, 782 bool isMedia,
784 bool enableExtendedSopClass) : 783 bool enableExtendedSopClass) :
785 synchronousTarget_(synchronousTarget),
786 context_(context), 784 context_(context),
787 archive_(new ArchiveIndex(ResourceType_Patient)), // root 785 archive_(new ArchiveIndex(ResourceType_Patient)), // root
788 isMedia_(isMedia), 786 isMedia_(isMedia),
789 enableExtendedSopClass_(enableExtendedSopClass), 787 enableExtendedSopClass_(enableExtendedSopClass),
790 currentStep_(0), 788 currentStep_(0),
791 instancesCount_(0), 789 instancesCount_(0),
792 uncompressedSize_(0) 790 uncompressedSize_(0)
793 { 791 {
794 if (synchronousTarget.get() == NULL) 792 }
793
794
795 void ArchiveJob::SetSynchronousTarget(boost::shared_ptr<TemporaryFile>& target)
796 {
797 if (target.get() == NULL)
795 { 798 {
796 throw OrthancException(ErrorCode_NullPointer); 799 throw OrthancException(ErrorCode_NullPointer);
800 }
801 else if (synchronousTarget_.get() != NULL)
802 {
803 throw OrthancException(ErrorCode_BadSequenceOfCalls);
804 }
805 else
806 {
807 synchronousTarget_ = target;
797 } 808 }
798 } 809 }
799 810
800 811
801 void ArchiveJob::AddResource(const std::string& publicId) 812 void ArchiveJob::AddResource(const std::string& publicId)
817 } 828 }
818 829
819 830
820 void ArchiveJob::Start() 831 void ArchiveJob::Start()
821 { 832 {
833 if (synchronousTarget_.get() == NULL)
834 {
835 throw OrthancException(ErrorCode_BadSequenceOfCalls);
836 }
837
822 if (writer_.get() != NULL) 838 if (writer_.get() != NULL)
823 { 839 {
824 throw OrthancException(ErrorCode_BadSequenceOfCalls); 840 throw OrthancException(ErrorCode_BadSequenceOfCalls);
825 } 841 }
826 842