changeset 6855:c954bd4872dc streaming

added missing file
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 23 May 2026 10:31:32 +0200
parents d421e94b8354
children f71f56755608
files OrthancFramework/Sources/DataSource/BaseDataIdentifier.cpp OrthancFramework/Sources/DataSource/BaseDataIdentifier.h OrthancFramework/Sources/DataSource/DataSourceReader.h
diffstat 3 files changed, 111 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OrthancFramework/Sources/DataSource/BaseDataIdentifier.cpp	Sat May 23 10:31:32 2026 +0200
@@ -0,0 +1,65 @@
+/**
+ * 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 "BaseDataIdentifier.h"
+
+#include "../OrthancException.h"
+
+
+namespace Orthanc
+{
+  void BaseDataIdentifier::SetUserData(IDynamicObject* userData)
+  {
+    std::unique_ptr<IDynamicObject> protection(userData);
+
+    if (userData == NULL)
+    {
+      throw OrthancException(ErrorCode_NullPointer);
+    }
+    else
+    {
+      userData_.reset(protection.release());
+    }
+  }
+
+
+  bool BaseDataIdentifier::HasUserData() const
+  {
+    return userData_.get() != NULL;
+  }
+
+
+  const IDynamicObject& BaseDataIdentifier::GetUserData() const
+  {
+    if (userData_.get() != NULL)
+    {
+      return *userData_;
+    }
+    else
+    {
+      throw OrthancException(ErrorCode_BadSequenceOfCalls);
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OrthancFramework/Sources/DataSource/BaseDataIdentifier.h	Sat May 23 10:31:32 2026 +0200
@@ -0,0 +1,45 @@
+/**
+ * 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
+
+#include "IDataIdentifier.h"
+#include "../Compatibility.h"
+
+
+namespace Orthanc
+{
+  class ORTHANC_PUBLIC BaseDataIdentifier : public IDataIdentifier
+  {
+  private:
+    std::unique_ptr<IDynamicObject> userData_;
+
+  public:
+    void SetUserData(IDynamicObject* userData);
+
+    virtual bool HasUserData() const ORTHANC_OVERRIDE;
+
+    virtual const IDynamicObject& GetUserData() const ORTHANC_OVERRIDE;
+  };
+}
--- a/OrthancFramework/Sources/DataSource/DataSourceReader.h	Sat May 23 10:28:31 2026 +0200
+++ b/OrthancFramework/Sources/DataSource/DataSourceReader.h	Sat May 23 10:31:32 2026 +0200
@@ -41,6 +41,7 @@
     class DataSourceMemoryBudget;
   }
 
+  // TODO-Streaming: Is it useful for DataSourceRequest and DataSourceAnswer to handle multiple requests?
   class ORTHANC_PUBLIC DataSourceReader : public boost::noncopyable
   {
   private: