changeset 4561:02510325d869 db-changes

removed function wrappers for transactions in ServerIndex
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 04 Mar 2021 18:45:48 +0100
parents 929409e40008
children e19f11e08226
files OrthancServer/Sources/ServerIndex.cpp OrthancServer/Sources/ServerIndex.h
diffstat 2 files changed, 2 insertions(+), 62 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Sources/ServerIndex.cpp	Thu Mar 04 18:42:25 2021 +0100
+++ b/OrthancServer/Sources/ServerIndex.cpp	Thu Mar 04 18:45:48 2021 +0100
@@ -2325,44 +2325,6 @@
   }
   
 
-  class ServerIndex::ReadOnlyWrapper : public IReadOnlyOperations
-  {
-  private:
-    ReadOnlyFunction  func_;
-
-  public:
-    explicit ReadOnlyWrapper(ReadOnlyFunction  func) :
-      func_(func)
-    {
-      assert(func_ != NULL);
-    }
-
-    virtual void Apply(ReadOnlyTransaction& transaction) ORTHANC_OVERRIDE
-    {
-      func_(transaction);
-    }
-  };
-
-  
-  class ServerIndex::ReadWriteWrapper : public IReadWriteOperations
-  {
-  private:
-    ReadWriteFunction  func_;
-
-  public:
-    explicit ReadWriteWrapper(ReadWriteFunction  func) :
-      func_(func)
-    {
-      assert(func_ != NULL);
-    }
-
-    virtual void Apply(ReadWriteTransaction& transaction) ORTHANC_OVERRIDE
-    {
-      func_(transaction);
-    }
-  };
-
-
   void ServerIndex::ApplyInternal(IReadOnlyOperations* readOperations,
                                   IReadWriteOperations* writeOperations)
   {
@@ -2431,29 +2393,19 @@
       }
     }
   }
+
   
   void ServerIndex::Apply(IReadOnlyOperations& operations)
   {
     ApplyInternal(&operations, NULL);
   }
   
+
   void ServerIndex::Apply(IReadWriteOperations& operations)
   {
     ApplyInternal(NULL, &operations);
   }
   
-  void ServerIndex::Apply(ReadOnlyFunction func)
-  {
-    ReadOnlyWrapper wrapper(func);
-    Apply(wrapper);
-  }
-  
-  void ServerIndex::Apply(ReadWriteFunction func)
-  {
-    ReadWriteWrapper wrapper(func);
-    Apply(wrapper);
-  }
-
 
   bool ServerIndex::ExpandResource(Json::Value& target,
                                    const std::string& publicId,
--- a/OrthancServer/Sources/ServerIndex.h	Thu Mar 04 18:42:25 2021 +0100
+++ b/OrthancServer/Sources/ServerIndex.h	Thu Mar 04 18:45:48 2021 +0100
@@ -449,16 +449,8 @@
 
       virtual void Apply(ReadWriteTransaction& transaction) = 0;
     };
-
-
-    typedef void (*ReadOnlyFunction) (ReadOnlyTransaction& transaction);  // TODO - Is this useful?
-    typedef void (*ReadWriteFunction) (ReadWriteTransaction& transaction);  // TODO - Is this useful?
-
     
   private:
-    class ReadOnlyWrapper;  // TODO - Is this useful?
-    class ReadWriteWrapper;  // TODO - Is this useful?
-
     void ApplyInternal(IReadOnlyOperations* readOperations,
                        IReadWriteOperations* writeOperations);
     
@@ -469,10 +461,6 @@
   
     void Apply(IReadWriteOperations& operations);
 
-    void Apply(ReadOnlyFunction func);
-
-    void Apply(ReadWriteFunction func);
-
     bool ExpandResource(Json::Value& target,
                         const std::string& publicId,
                         ResourceType level);