# HG changeset patch # User Sebastien Jodogne # Date 1779525092 -7200 # Node ID c954bd4872dc7ed3161cf257b9b07d51facc05c0 # Parent d421e94b835490753d34a380e8b1b84415b18695 added missing file diff -r d421e94b8354 -r c954bd4872dc OrthancFramework/Sources/DataSource/BaseDataIdentifier.cpp --- /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 + * . + **/ + + +#include "../PrecompiledHeaders.h" +#include "BaseDataIdentifier.h" + +#include "../OrthancException.h" + + +namespace Orthanc +{ + void BaseDataIdentifier::SetUserData(IDynamicObject* userData) + { + std::unique_ptr 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); + } + } +} diff -r d421e94b8354 -r c954bd4872dc OrthancFramework/Sources/DataSource/BaseDataIdentifier.h --- /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 + * . + **/ + + +#pragma once + +#include "IDataIdentifier.h" +#include "../Compatibility.h" + + +namespace Orthanc +{ + class ORTHANC_PUBLIC BaseDataIdentifier : public IDataIdentifier + { + private: + std::unique_ptr userData_; + + public: + void SetUserData(IDynamicObject* userData); + + virtual bool HasUserData() const ORTHANC_OVERRIDE; + + virtual const IDynamicObject& GetUserData() const ORTHANC_OVERRIDE; + }; +} diff -r d421e94b8354 -r c954bd4872dc OrthancFramework/Sources/DataSource/DataSourceReader.h --- 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: