# HG changeset patch # User Sebastien Jodogne # Date 1614879948 -3600 # Node ID 02510325d8690eef5b5dcfef291918f185030758 # Parent 929409e40008372ead72c852bec3bab728d24232 removed function wrappers for transactions in ServerIndex diff -r 929409e40008 -r 02510325d869 OrthancServer/Sources/ServerIndex.cpp --- 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, diff -r 929409e40008 -r 02510325d869 OrthancServer/Sources/ServerIndex.h --- 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);