changeset 245:9d00e5e073e8

rename FileValue as ResultFileValue
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 13 Apr 2021 18:50:44 +0200
parents 02cd7254c949
children 483af3f35a4b
files Framework/Common/BinaryStringValue.cpp Framework/Common/DatabasesEnumerations.h Framework/Common/FileValue.cpp Framework/Common/FileValue.h Framework/Common/Integer64Value.cpp Framework/Common/ResultFileValue.cpp Framework/Common/ResultFileValue.h Framework/Common/Utf8StringValue.cpp Framework/Plugins/StorageBackend.cpp Framework/PostgreSQL/PostgreSQLResult.cpp Framework/SQLite/SQLiteStatement.cpp Resources/CMake/DatabasesFrameworkConfiguration.cmake
diffstat 12 files changed, 122 insertions(+), 128 deletions(-) [+]
line wrap: on
line diff
--- 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 <OrthancException.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
   };
 
--- 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 <http://www.gnu.org/licenses/>.
- **/
-
-
-#include "FileValue.h"
-
-#include "BinaryStringValue.h"
-#include "NullValue.h"
-
-#include <OrthancException.h>
-
-#include <boost/lexical_cast.hpp>
-
-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);
-    }
-  }
-}
--- 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 <http://www.gnu.org/licenses/>.
- **/
-
-
-#pragma once
-
-#include "IValue.h"
-
-#include <Compatibility.h>
-
-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;
-  };
-}
--- 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"
 
--- /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 <http://www.gnu.org/licenses/>.
+ **/
+
+
+#include "ResultFileValue.h"
+
+#include "BinaryStringValue.h"
+#include "NullValue.h"
+
+#include <OrthancException.h>
+
+#include <boost/lexical_cast.hpp>
+
+namespace OrthancDatabases
+{
+  IValue* ResultFileValue::Convert(ValueType target) const
+  {
+    switch (target)
+    {
+      case ValueType_BinaryString:
+        return new BinaryStringValue(content_);
+
+      default:
+        throw Orthanc::OrthancException(Orthanc::ErrorCode_BadParameterType);
+    }
+  }
+}
--- /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 <http://www.gnu.org/licenses/>.
+ **/
+
+
+#pragma once
+
+#include "IValue.h"
+
+#include <Compatibility.h>
+
+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;
+  };
+}
--- 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"
 
--- 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 <Compatibility.h>  // For std::unique_ptr<>
 #include <OrthancException.h>
@@ -147,8 +147,8 @@
       
         switch (value.GetType())
         {
-          case ValueType_File:
-            visitor.Assign(dynamic_cast<const FileValue&>(value).GetContent());
+          case ValueType_ResultFile:
+            visitor.Assign(dynamic_cast<const ResultFileValue&>(value).GetContent());
             break;
 
           case ValueType_BinaryString:
--- 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<FileValue> value(new FileValue);
+        std::unique_ptr<ResultFileValue> value(new ResultFileValue);
         GetLargeObject(value->GetContent(), column);
         return value.release();
       }
--- 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<const FileValue&>(parameters.GetValue(name));
+          const InputFileValue& blob =
+            dynamic_cast<const InputFileValue&>(parameters.GetValue(name));
           statement_->BindBlob(i, blob.GetBuffer(), blob.GetSize());
           break;
         }
--- 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