changeset 6252:e76ad6e4f968

Toolbox::MergeJson
author Alain Mazy <am@orthanc.team>
date Tue, 22 Jul 2025 12:31:54 +0200
parents 390a09b5b6bf
children f1398abc4e83
files OrthancFramework/Sources/Toolbox.cpp OrthancFramework/Sources/Toolbox.h TODO
diffstat 3 files changed, 30 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/Toolbox.cpp	Thu Jul 17 12:37:42 2025 +0200
+++ b/OrthancFramework/Sources/Toolbox.cpp	Tue Jul 22 12:31:54 2025 +0200
@@ -2700,6 +2700,30 @@
 #endif
   }
 
+  void Toolbox::MergeJson(Json::Value &a, const Json::Value &b)
+  {
+    if (!a.isObject() || !b.isObject())
+    {
+      return;
+    }
+
+    Json::Value::Members members = b.getMemberNames();
+
+    for (size_t i = 0; i < members.size(); i++)
+    {
+      std::string key = members[i];
+      
+      if (!a[key].isNull() && a[key].type() == Json::objectValue && b[key].type() == Json::objectValue)
+      {
+        MergeJson(a[key], b[key]);
+      } 
+      else
+      {
+        a[key] = b[key];
+      }
+    }
+  }
+
 
   void Toolbox::RemoveSurroundingQuotes(std::string& value)
   {
--- a/OrthancFramework/Sources/Toolbox.h	Thu Jul 17 12:37:42 2025 +0200
+++ b/OrthancFramework/Sources/Toolbox.h	Tue Jul 22 12:31:54 2025 +0200
@@ -403,6 +403,8 @@
     static void WriteStyledJson(std::string& target,
                                 const Json::Value& source);
 
+    static void MergeJson(Json::Value &a, const Json::Value &b);
+
     static void RemoveSurroundingQuotes(std::string& value);
 
     class ORTHANC_PUBLIC ElapsedTimer : public boost::noncopyable
--- a/TODO	Thu Jul 17 12:37:42 2025 +0200
+++ b/TODO	Tue Jul 22 12:31:54 2025 +0200
@@ -71,7 +71,9 @@
     "admin": {
       "Password": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8", 
       "Hashing": "sha1"} }
-  
+* Reuse the ThreadedInstanceLoader from the ArchiveJob in C-Store, peer/store ... to optimize loading
+  time when working with an object storage.
+
 
 ============================
 Documentation (Orthanc Book)
@@ -172,6 +174,7 @@
 * Implement a 'commit' route to force the Stable status earlier.
   https://discourse.orthanc-server.org/t/expediting-stability-of-a-dicom-study-new-api-endpoint/1684
 
+
 ---------
 Long-term
 ---------