changeset 6847:96731e8733c2 streaming

renamed DicomDataSource::MultipleReader as MultipleDicomReader
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 22 May 2026 11:20:36 +0200
parents 8d118becf246
children 68f6931f02a8
files OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake OrthancFramework/Sources/DataSource/DicomDataSource.cpp OrthancFramework/Sources/DataSource/DicomDataSource.h OrthancFramework/Sources/DataSource/MultipleDicomReader.cpp OrthancFramework/Sources/DataSource/MultipleDicomReader.h OrthancServer/Sources/OrthancGetRequestHandler.h OrthancServer/Sources/ServerContext.cpp OrthancServer/Sources/ServerContext.h
diffstat 8 files changed, 173 insertions(+), 86 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake	Fri May 22 10:57:51 2026 +0200
+++ b/OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake	Fri May 22 11:20:36 2026 +0200
@@ -681,6 +681,7 @@
   if (ENABLE_DCMTK)
     list(APPEND ORTHANC_CORE_SOURCES_INTERNAL
       ${CMAKE_CURRENT_LIST_DIR}/../../Sources/DataSource/DicomDataSource.cpp
+      ${CMAKE_CURRENT_LIST_DIR}/../../Sources/DataSource/MultipleDicomReader.cpp
       ${CMAKE_CURRENT_LIST_DIR}/../../Sources/DataSource/TranscoderDataSource.cpp
       ${CMAKE_CURRENT_LIST_DIR}/../../Sources/DicomParsing/TranscodingCallable.cpp
       )
--- a/OrthancFramework/Sources/DataSource/DicomDataSource.cpp	Fri May 22 10:57:51 2026 +0200
+++ b/OrthancFramework/Sources/DataSource/DicomDataSource.cpp	Fri May 22 11:20:36 2026 +0200
@@ -205,6 +205,12 @@
   }
 
 
+  IDataIdentifier* DicomDataSource::CreateWholeIdentifier(const FileInfo& attachment)
+  {
+    return new WholeIdentifier(attachment);
+  }
+
+
   DicomDataSource::Dicom* DicomDataSource::ReadWhole(DataSourceReader& reader,
                                                      const FileInfo& attachment)
   {
@@ -232,69 +238,4 @@
     boost::shared_ptr<IDynamicObject> value = reader.ReadSingle(id.release());
     return new Dicom(value);
   }
-
-
-  class DicomDataSource::MultipleReader::PImpl : public boost::noncopyable
-  {
-  private:
-    boost::shared_ptr<DataSourceReader>  reader_;
-    std::unique_ptr<DataSourceRequest>   request_;
-    boost::shared_ptr<DataSourceAnswer>  answer_;
-
-  public:
-    PImpl(const boost::shared_ptr<DataSourceReader>& reader) :
-      reader_(reader),
-      request_(new DataSourceRequest)
-    {
-    }
-
-    void Enqueue(const FileInfo& attachment)
-    {
-      if (request_.get() == NULL)
-      {
-        throw OrthancException(ErrorCode_BadSequenceOfCalls);
-      }
-      else
-      {
-        request_->Enqueue(new WholeIdentifier(attachment));
-      }
-    }
-
-    Dicom* Dequeue()
-    {
-      if (answer_.get() == NULL)
-      {
-        assert(request_.get() != NULL);
-        answer_ = reader_->Submit(request_.release());
-      }
-
-      std::unique_ptr<DataSourceAnswer::Item> item(answer_->Dequeue());
-      return new Dicom(item->GetValue());
-    }
-  };
-
-
-  DicomDataSource::MultipleReader::MultipleReader(const boost::shared_ptr<DataSourceReader>& reader) :
-    pimpl_(new PImpl(reader))
-  {
-  }
-
-
-  DicomDataSource::MultipleReader::~MultipleReader()
-  {
-    assert(pimpl_ != NULL);
-    delete pimpl_;
-  }
-
-
-  void DicomDataSource::MultipleReader::Enqueue(const FileInfo& attachment)
-  {
-    pimpl_->Enqueue(attachment);
-  }
-
-
-  DicomDataSource::Dicom* DicomDataSource::MultipleReader::Dequeue()
-  {
-    return pimpl_->Dequeue();
-  }
 }
--- a/OrthancFramework/Sources/DataSource/DicomDataSource.h	Fri May 22 10:57:51 2026 +0200
+++ b/OrthancFramework/Sources/DataSource/DicomDataSource.h	Fri May 22 11:20:36 2026 +0200
@@ -96,27 +96,13 @@
       };
     };
 
+    static IDataIdentifier* CreateWholeIdentifier(const FileInfo& attachment);
+
     static Dicom* ReadWhole(DataSourceReader& reader,
                             const FileInfo& attachment);
 
     static Dicom* ReadUntilPixelData(DataSourceReader& reader,
                                      const FileInfo& attachment,
                                      uint64_t pixelDataOffset);
-
-    class MultipleReader : public boost::noncopyable
-    {
-    private:
-      class PImpl;
-      PImpl* pimpl_;
-
-    public:
-      MultipleReader(const boost::shared_ptr<DataSourceReader>& reader);
-
-      ~MultipleReader();
-
-      void Enqueue(const FileInfo& item);
-
-      Dicom* Dequeue();
-    };
   };
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OrthancFramework/Sources/DataSource/MultipleDicomReader.cpp	Fri May 22 11:20:36 2026 +0200
@@ -0,0 +1,99 @@
+/**
+ * Orthanc - A Lightweight, RESTful DICOM Store
+ * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
+ * Department, University Hospital of Liege, Belgium
+ * Copyright (C) 2017-2023 Osimis S.A., Belgium
+ * Copyright (C) 2024-2026 Orthanc Team SRL, Belgium
+ * Copyright (C) 2021-2026 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/>.
+ **/
+
+
+#include "../PrecompiledHeaders.h"
+#include "MultipleDicomReader.h"
+
+#include "../OrthancException.h"
+#include "DataSourceAnswer.h"
+#include "DataSourceReader.h"
+#include "DataSourceRequest.h"
+
+
+namespace Orthanc
+{
+  class MultipleDicomReader::PImpl : public boost::noncopyable
+  {
+  private:
+    boost::shared_ptr<DataSourceReader>  reader_;
+    std::unique_ptr<DataSourceRequest>   request_;
+    boost::shared_ptr<DataSourceAnswer>  answer_;
+
+  public:
+    PImpl(const boost::shared_ptr<DataSourceReader>& reader) :
+      reader_(reader),
+      request_(new DataSourceRequest)
+    {
+    }
+
+    void Enqueue(const FileInfo& attachment)
+    {
+      if (request_.get() == NULL)
+      {
+        throw OrthancException(ErrorCode_BadSequenceOfCalls);
+      }
+      else
+      {
+        request_->Enqueue(DicomDataSource::CreateWholeIdentifier(attachment));
+      }
+    }
+
+    DicomDataSource::Dicom* Dequeue()
+    {
+      if (answer_.get() == NULL)
+      {
+        assert(request_.get() != NULL);
+        answer_ = reader_->Submit(request_.release());
+      }
+
+      std::unique_ptr<DataSourceAnswer::Item> item(answer_->Dequeue());
+      return new DicomDataSource::Dicom(item->GetValue());
+    }
+  };
+
+
+  MultipleDicomReader::MultipleDicomReader(const boost::shared_ptr<DataSourceReader>& reader) :
+    pimpl_(new PImpl(reader))
+  {
+  }
+
+
+  MultipleDicomReader::~MultipleDicomReader()
+  {
+    assert(pimpl_ != NULL);
+    delete pimpl_;
+  }
+
+
+  void MultipleDicomReader::Enqueue(const FileInfo& attachment)
+  {
+    pimpl_->Enqueue(attachment);
+  }
+
+
+  DicomDataSource::Dicom* MultipleDicomReader::Dequeue()
+  {
+    return pimpl_->Dequeue();
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OrthancFramework/Sources/DataSource/MultipleDicomReader.h	Fri May 22 11:20:36 2026 +0200
@@ -0,0 +1,59 @@
+/**
+ * Orthanc - A Lightweight, RESTful DICOM Store
+ * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
+ * Department, University Hospital of Liege, Belgium
+ * Copyright (C) 2017-2023 Osimis S.A., Belgium
+ * Copyright (C) 2024-2026 Orthanc Team SRL, Belgium
+ * Copyright (C) 2021-2026 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/>.
+ **/
+
+
+#pragma once
+
+#if !defined(ORTHANC_ENABLE_DCMTK)
+#  error The macro ORTHANC_ENABLE_DCMTK must be defined
+#endif
+
+#if ORTHANC_ENABLE_DCMTK != 1
+#  error The macro ORTHANC_ENABLE_DCMTK must be set to 1 to use this file
+#endif
+
+#include "DicomDataSource.h"
+
+#include <boost/shared_ptr.hpp>
+
+
+namespace Orthanc
+{
+  class DataSourceReader;
+
+  class MultipleDicomReader : public boost::noncopyable
+  {
+  private:
+    class PImpl;
+    PImpl* pimpl_;
+
+  public:
+    MultipleDicomReader(const boost::shared_ptr<DataSourceReader>& reader);
+
+    ~MultipleDicomReader();
+
+    void Enqueue(const FileInfo& item);
+
+    DicomDataSource::Dicom* Dequeue();
+  };
+}
--- a/OrthancServer/Sources/OrthancGetRequestHandler.h	Fri May 22 10:57:51 2026 +0200
+++ b/OrthancServer/Sources/OrthancGetRequestHandler.h	Fri May 22 11:20:36 2026 +0200
@@ -23,7 +23,7 @@
 #pragma once
 
 #include "../../OrthancFramework/Sources/Compatibility.h"  // For ORTHANC_OVERRIDE
-#include "../../OrthancFramework/Sources/DataSource/DicomDataSource.h"
+#include "../../OrthancFramework/Sources/DataSource/MultipleDicomReader.h"
 #include "../../OrthancFramework/Sources/DicomNetworking/IGetRequestHandler.h"
 #include "../../OrthancFramework/Sources/DicomNetworking/RemoteModalityParameters.h"
 
@@ -45,7 +45,7 @@
     std::vector<std::string> instancesIds_;
     size_t position_;
     std::string originatorAet_;
-    std::unique_ptr<DicomDataSource::MultipleReader> instancesLoader_;
+    std::unique_ptr<MultipleDicomReader> instancesLoader_;
 
     unsigned int completedCount_;
     unsigned int warningCount_;
--- a/OrthancServer/Sources/ServerContext.cpp	Fri May 22 10:57:51 2026 +0200
+++ b/OrthancServer/Sources/ServerContext.cpp	Fri May 22 11:20:36 2026 +0200
@@ -2144,8 +2144,8 @@
   }
 
 
-  DicomDataSource::MultipleReader* ServerContext::CreateMultipleDicomReader() const
+  MultipleDicomReader* ServerContext::CreateMultipleDicomReader() const
   {
-    return new DicomDataSource::MultipleReader(dicomReader_);
+    return new MultipleDicomReader(dicomReader_);
   }
 }
--- a/OrthancServer/Sources/ServerContext.h	Fri May 22 10:57:51 2026 +0200
+++ b/OrthancServer/Sources/ServerContext.h	Fri May 22 11:20:36 2026 +0200
@@ -30,6 +30,7 @@
 #include "ServerJobs/IStorageCommitmentFactory.h"
 
 #include "../../OrthancFramework/Sources/DataSource/DicomDataSource.h"
+#include "../../OrthancFramework/Sources/DataSource/MultipleDicomReader.h"
 #include "../../OrthancFramework/Sources/DataSource/StorageAreaDataSource.h"
 #include "../../OrthancFramework/Sources/DicomParsing/DicomModification.h"
 #include "../../OrthancFramework/Sources/JobsEngine/JobsEngine.h"
@@ -592,6 +593,6 @@
 
     StorageAreaDataSource::MultipleReader* CreateMultipleStorageAreaReader() const;
 
-    DicomDataSource::MultipleReader* CreateMultipleDicomReader() const;
+    MultipleDicomReader* CreateMultipleDicomReader() const;
   };
 }