# HG changeset patch # User Sebastien Jodogne # Date 1618332644 -7200 # Node ID 9d00e5e073e828cf46dca7965a693afda12d09d5 # Parent 02cd7254c94967baf7edcbb693d286fa5c45e165 rename FileValue as ResultFileValue diff -r 02cd7254c949 -r 9d00e5e073e8 Framework/Common/BinaryStringValue.cpp --- a/Framework/Common/BinaryStringValue.cpp Tue Apr 13 18:43:21 2021 +0200 +++ b/Framework/Common/BinaryStringValue.cpp Tue Apr 13 18:50:44 2021 +0200 @@ -21,7 +21,6 @@ #include "BinaryStringValue.h" -#include "FileValue.h" #include "NullValue.h" #include diff -r 02cd7254c949 -r 9d00e5e073e8 Framework/Common/DatabasesEnumerations.h --- a/Framework/Common/DatabasesEnumerations.h Tue Apr 13 18:43:21 2021 +0200 +++ b/Framework/Common/DatabasesEnumerations.h Tue Apr 13 18:50:44 2021 +0200 @@ -27,10 +27,10 @@ enum ValueType { ValueType_BinaryString, - ValueType_File, ValueType_InputFile, ValueType_Integer64, ValueType_Null, + ValueType_ResultFile, ValueType_Utf8String }; diff -r 02cd7254c949 -r 9d00e5e073e8 Framework/Common/FileValue.cpp --- a/Framework/Common/FileValue.cpp Tue Apr 13 18:43:21 2021 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/** - * Orthanc - A Lightweight, RESTful DICOM Store - * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics - * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017-2021 Osimis S.A., Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU Affero 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 - * Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - **/ - - -#include "FileValue.h" - -#include "BinaryStringValue.h" -#include "NullValue.h" - -#include - -#include - -namespace OrthancDatabases -{ - IValue* FileValue::Convert(ValueType target) const - { - switch (target) - { - case ValueType_BinaryString: - return new BinaryStringValue(content_); - - case ValueType_Null: - return new NullValue; - - default: - throw Orthanc::OrthancException(Orthanc::ErrorCode_BadParameterType); - } - } -} diff -r 02cd7254c949 -r 9d00e5e073e8 Framework/Common/FileValue.h --- a/Framework/Common/FileValue.h Tue Apr 13 18:43:21 2021 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -/** - * Orthanc - A Lightweight, RESTful DICOM Store - * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics - * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017-2021 Osimis S.A., Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU Affero 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 - * Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - **/ - - -#pragma once - -#include "IValue.h" - -#include - -namespace OrthancDatabases -{ - class FileValue : public IValue - { - private: - std::string content_; - - public: - FileValue() - { - } - - std::string& GetContent() - { - return content_; - } - - const std::string& GetContent() const - { - return content_; - } - - const void* GetBuffer() const - { - return (content_.empty() ? NULL : content_.c_str()); - } - - size_t GetSize() const - { - return content_.size(); - } - - virtual ValueType GetType() const ORTHANC_OVERRIDE - { - return ValueType_File; - } - - virtual IValue* Convert(ValueType target) const ORTHANC_OVERRIDE; - }; -} diff -r 02cd7254c949 -r 9d00e5e073e8 Framework/Common/Integer64Value.cpp --- a/Framework/Common/Integer64Value.cpp Tue Apr 13 18:43:21 2021 +0200 +++ b/Framework/Common/Integer64Value.cpp Tue Apr 13 18:50:44 2021 +0200 @@ -22,7 +22,6 @@ #include "Integer64Value.h" #include "BinaryStringValue.h" -#include "FileValue.h" #include "NullValue.h" #include "Utf8StringValue.h" diff -r 02cd7254c949 -r 9d00e5e073e8 Framework/Common/ResultFileValue.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Framework/Common/ResultFileValue.cpp Tue Apr 13 18:50:44 2021 +0200 @@ -0,0 +1,44 @@ +/** + * Orthanc - A Lightweight, RESTful DICOM Store + * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017-2021 Osimis S.A., Belgium + * + * This program is free software: you can redistribute it and/or + * modify it under the terms of the GNU Affero 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 + * Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + **/ + + +#include "ResultFileValue.h" + +#include "BinaryStringValue.h" +#include "NullValue.h" + +#include + +#include + +namespace OrthancDatabases +{ + IValue* ResultFileValue::Convert(ValueType target) const + { + switch (target) + { + case ValueType_BinaryString: + return new BinaryStringValue(content_); + + default: + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadParameterType); + } + } +} diff -r 02cd7254c949 -r 9d00e5e073e8 Framework/Common/ResultFileValue.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Framework/Common/ResultFileValue.h Tue Apr 13 18:50:44 2021 +0200 @@ -0,0 +1,67 @@ +/** + * Orthanc - A Lightweight, RESTful DICOM Store + * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017-2021 Osimis S.A., Belgium + * + * This program is free software: you can redistribute it and/or + * modify it under the terms of the GNU Affero 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 + * Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + **/ + + +#pragma once + +#include "IValue.h" + +#include + +namespace OrthancDatabases +{ + class ResultFileValue : public IValue + { + private: + std::string content_; + + public: + ResultFileValue() + { + } + + std::string& GetContent() + { + return content_; + } + + const std::string& GetContent() const + { + return content_; + } + + const void* GetBuffer() const + { + return (content_.empty() ? NULL : content_.c_str()); + } + + size_t GetSize() const + { + return content_.size(); + } + + virtual ValueType GetType() const ORTHANC_OVERRIDE + { + return ValueType_ResultFile; + } + + virtual IValue* Convert(ValueType target) const ORTHANC_OVERRIDE; + }; +} diff -r 02cd7254c949 -r 9d00e5e073e8 Framework/Common/Utf8StringValue.cpp --- a/Framework/Common/Utf8StringValue.cpp Tue Apr 13 18:43:21 2021 +0200 +++ b/Framework/Common/Utf8StringValue.cpp Tue Apr 13 18:50:44 2021 +0200 @@ -22,7 +22,6 @@ #include "Utf8StringValue.h" #include "BinaryStringValue.h" -#include "FileValue.h" #include "NullValue.h" #include "Integer64Value.h" diff -r 02cd7254c949 -r 9d00e5e073e8 Framework/Plugins/StorageBackend.cpp --- a/Framework/Plugins/StorageBackend.cpp Tue Apr 13 18:43:21 2021 +0200 +++ b/Framework/Plugins/StorageBackend.cpp Tue Apr 13 18:50:44 2021 +0200 @@ -26,7 +26,7 @@ #endif #include "../../Framework/Common/BinaryStringValue.h" -#include "../../Framework/Common/FileValue.h" +#include "../../Framework/Common/ResultFileValue.h" #include // For std::unique_ptr<> #include @@ -147,8 +147,8 @@ switch (value.GetType()) { - case ValueType_File: - visitor.Assign(dynamic_cast(value).GetContent()); + case ValueType_ResultFile: + visitor.Assign(dynamic_cast(value).GetContent()); break; case ValueType_BinaryString: diff -r 02cd7254c949 -r 9d00e5e073e8 Framework/PostgreSQL/PostgreSQLResult.cpp --- a/Framework/PostgreSQL/PostgreSQLResult.cpp Tue Apr 13 18:43:21 2021 +0200 +++ b/Framework/PostgreSQL/PostgreSQLResult.cpp Tue Apr 13 18:50:44 2021 +0200 @@ -23,7 +23,7 @@ #include "PostgreSQLResult.h" #include "../Common/BinaryStringValue.h" -#include "../Common/FileValue.h" +#include "../Common/ResultFileValue.h" #include "../Common/Integer64Value.h" #include "../Common/NullValue.h" #include "../Common/Utf8StringValue.h" @@ -235,7 +235,7 @@ case OIDOID: { - std::unique_ptr value(new FileValue); + std::unique_ptr value(new ResultFileValue); GetLargeObject(value->GetContent(), column); return value.release(); } diff -r 02cd7254c949 -r 9d00e5e073e8 Framework/SQLite/SQLiteStatement.cpp --- a/Framework/SQLite/SQLiteStatement.cpp Tue Apr 13 18:43:21 2021 +0200 +++ b/Framework/SQLite/SQLiteStatement.cpp Tue Apr 13 18:50:44 2021 +0200 @@ -22,7 +22,7 @@ #include "SQLiteStatement.h" #include "../Common/BinaryStringValue.h" -#include "../Common/FileValue.h" +#include "../Common/InputFileValue.h" #include "../Common/Integer64Value.h" #include "../Common/Query.h" #include "../Common/Utf8StringValue.h" @@ -74,10 +74,10 @@ break; } - case ValueType_File: + case ValueType_InputFile: { - const FileValue& blob = - dynamic_cast(parameters.GetValue(name)); + const InputFileValue& blob = + dynamic_cast(parameters.GetValue(name)); statement_->BindBlob(i, blob.GetBuffer(), blob.GetSize()); break; } diff -r 02cd7254c949 -r 9d00e5e073e8 Resources/CMake/DatabasesFrameworkConfiguration.cmake --- a/Resources/CMake/DatabasesFrameworkConfiguration.cmake Tue Apr 13 18:43:21 2021 +0200 +++ b/Resources/CMake/DatabasesFrameworkConfiguration.cmake Tue Apr 13 18:50:44 2021 +0200 @@ -88,7 +88,6 @@ ${ORTHANC_DATABASES_ROOT}/Framework/Common/BinaryStringValue.cpp ${ORTHANC_DATABASES_ROOT}/Framework/Common/DatabaseManager.cpp ${ORTHANC_DATABASES_ROOT}/Framework/Common/Dictionary.cpp - ${ORTHANC_DATABASES_ROOT}/Framework/Common/FileValue.cpp ${ORTHANC_DATABASES_ROOT}/Framework/Common/GenericFormatter.cpp ${ORTHANC_DATABASES_ROOT}/Framework/Common/ImplicitTransaction.cpp ${ORTHANC_DATABASES_ROOT}/Framework/Common/InputFileValue.cpp @@ -96,6 +95,7 @@ ${ORTHANC_DATABASES_ROOT}/Framework/Common/NullValue.cpp ${ORTHANC_DATABASES_ROOT}/Framework/Common/Query.cpp ${ORTHANC_DATABASES_ROOT}/Framework/Common/ResultBase.cpp + ${ORTHANC_DATABASES_ROOT}/Framework/Common/ResultFileValue.cpp ${ORTHANC_DATABASES_ROOT}/Framework/Common/RetryDatabaseFactory.cpp ${ORTHANC_DATABASES_ROOT}/Framework/Common/RetryDatabaseFactory.cpp ${ORTHANC_DATABASES_ROOT}/Framework/Common/StatementLocation.cpp