comparison OrthancServer/Sources/ServerJobs/ArchiveJob.cpp @ 4205:d962a2996637

cppcheck
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 17 Sep 2020 17:58:19 +0200
parents 05b8fd21089c
children 977c2759eb0a
comparison
equal deleted inserted replaced
4204:318c16cfccab 4205:d962a2996637
238 } 238 }
239 } 239 }
240 240
241 241
242 public: 242 public:
243 ArchiveIndex(ResourceType level) : 243 explicit ArchiveIndex(ResourceType level) :
244 level_(level) 244 level_(level)
245 { 245 {
246 } 246 }
247 247
248 ~ArchiveIndex() 248 ~ArchiveIndex()
629 629
630 snprintf(instanceFormat_, sizeof(instanceFormat_) - 1, "%%08d.dcm"); 630 snprintf(instanceFormat_, sizeof(instanceFormat_) - 1, "%%08d.dcm");
631 } 631 }
632 632
633 virtual void Open(ResourceType level, 633 virtual void Open(ResourceType level,
634 const std::string& publicId) 634 const std::string& publicId) ORTHANC_OVERRIDE
635 { 635 {
636 std::string path; 636 std::string path;
637 637
638 DicomMap tags; 638 DicomMap tags;
639 if (context_.GetIndex().GetMainDicomTags(tags, publicId, level, level)) 639 if (context_.GetIndex().GetMainDicomTags(tags, publicId, level, level))
686 } 686 }
687 687
688 commands_.AddOpenDirectory(path.c_str()); 688 commands_.AddOpenDirectory(path.c_str());
689 } 689 }
690 690
691 virtual void Close() 691 virtual void Close() ORTHANC_OVERRIDE
692 { 692 {
693 commands_.AddCloseDirectory(); 693 commands_.AddCloseDirectory();
694 } 694 }
695 695
696 virtual void AddInstance(const std::string& instanceId, 696 virtual void AddInstance(const std::string& instanceId,
697 const FileInfo& dicom) 697 const FileInfo& dicom) ORTHANC_OVERRIDE
698 { 698 {
699 char filename[24]; 699 char filename[24];
700 snprintf(filename, sizeof(filename) - 1, instanceFormat_, counter_); 700 snprintf(filename, sizeof(filename) - 1, instanceFormat_, counter_);
701 counter_ ++; 701 counter_ ++;
702 702
720 counter_(0) 720 counter_(0)
721 { 721 {
722 } 722 }
723 723
724 virtual void Open(ResourceType level, 724 virtual void Open(ResourceType level,
725 const std::string& publicId) 725 const std::string& publicId) ORTHANC_OVERRIDE
726 { 726 {
727 } 727 }
728 728
729 virtual void Close() 729 virtual void Close() ORTHANC_OVERRIDE
730 { 730 {
731 } 731 }
732 732
733 virtual void AddInstance(const std::string& instanceId, 733 virtual void AddInstance(const std::string& instanceId,
734 const FileInfo& dicom) 734 const FileInfo& dicom) ORTHANC_OVERRIDE
735 { 735 {
736 // "DICOM restricts the filenames on DICOM media to 8 736 // "DICOM restricts the filenames on DICOM media to 8
737 // characters (some systems wrongly use 8.3, but this does not 737 // characters (some systems wrongly use 8.3, but this does not
738 // conform to the standard)." 738 // conform to the standard)."
739 std::string filename = "IM" + boost::lexical_cast<std::string>(counter_); 739 std::string filename = "IM" + boost::lexical_cast<std::string>(counter_);
974 { 974 {
975 private: 975 private:
976 std::unique_ptr<TemporaryFile> file_; 976 std::unique_ptr<TemporaryFile> file_;
977 977
978 public: 978 public:
979 DynamicTemporaryFile(TemporaryFile* f) : file_(f) 979 explicit DynamicTemporaryFile(TemporaryFile* f) : file_(f)
980 { 980 {
981 if (f == NULL) 981 if (f == NULL)
982 { 982 {
983 throw OrthancException(ErrorCode_NullPointer); 983 throw OrthancException(ErrorCode_NullPointer);
984 } 984 }