annotate OrthancServer/Plugins/Samples/DelayedDeletion/LargeDeleteJob.h @ 5853:4d932683049d get-scu tip

very first implementation of C-Get SCU
author Alain Mazy <am@orthanc.team>
date Tue, 29 Oct 2024 17:25:49 +0100
parents f7adfb22e20e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5264
99751c5a7cfe added missing copyrights
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5024
diff changeset
1 /**
99751c5a7cfe added missing copyrights
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5024
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
99751c5a7cfe added missing copyrights
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5024
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
99751c5a7cfe added missing copyrights
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5024
diff changeset
4 * Department, University Hospital of Liege, Belgium
5640
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
5485
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5264
diff changeset
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
5264
99751c5a7cfe added missing copyrights
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5024
diff changeset
8 *
99751c5a7cfe added missing copyrights
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5024
diff changeset
9 * This program is free software: you can redistribute it and/or
99751c5a7cfe added missing copyrights
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5024
diff changeset
10 * modify it under the terms of the GNU General Public License as
99751c5a7cfe added missing copyrights
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5024
diff changeset
11 * published by the Free Software Foundation, either version 3 of the
99751c5a7cfe added missing copyrights
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5024
diff changeset
12 * License, or (at your option) any later version.
99751c5a7cfe added missing copyrights
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5024
diff changeset
13 *
99751c5a7cfe added missing copyrights
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5024
diff changeset
14 * This program is distributed in the hope that it will be useful, but
99751c5a7cfe added missing copyrights
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5024
diff changeset
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
99751c5a7cfe added missing copyrights
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5024
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
99751c5a7cfe added missing copyrights
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5024
diff changeset
17 * General Public License for more details.
99751c5a7cfe added missing copyrights
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5024
diff changeset
18 *
99751c5a7cfe added missing copyrights
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5024
diff changeset
19 * You should have received a copy of the GNU General Public License
99751c5a7cfe added missing copyrights
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5024
diff changeset
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
99751c5a7cfe added missing copyrights
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5024
diff changeset
21 **/
99751c5a7cfe added missing copyrights
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5024
diff changeset
22
99751c5a7cfe added missing copyrights
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5024
diff changeset
23
5024
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
24 #pragma once
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
25
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
26 #include "../Common/OrthancPluginCppWrapper.h"
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
27 #include "../../../../OrthancFramework/Sources/Enumerations.h"
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
28 #include "../../../../OrthancFramework/Sources/Compatibility.h"
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
29
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
30
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
31 class LargeDeleteJob : public OrthancPlugins::OrthancJob
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
32 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
33 private:
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
34 std::vector<std::string> resources_;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
35 std::vector<Orthanc::ResourceType> levels_;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
36 std::vector<std::string> instances_;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
37 std::vector<std::string> series_;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
38 size_t posResources_;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
39 size_t posInstances_;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
40 size_t posSeries_;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
41 size_t posDelete_;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
42
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
43 void UpdateDeleteProgress();
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
44
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
45 void ScheduleChildrenResources(std::vector<std::string>& target,
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
46 const std::string& uri);
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
47
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
48 void ScheduleResource(Orthanc::ResourceType level,
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
49 const std::string& id);
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
50
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
51 void DeleteResource(Orthanc::ResourceType level,
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
52 const std::string& id);
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
53
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
54 public:
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
55 LargeDeleteJob(const std::vector<std::string>& resources,
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
56 const std::vector<Orthanc::ResourceType>& levels);
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
57
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
58 virtual OrthancPluginJobStepStatus Step() ORTHANC_OVERRIDE;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
59
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
60 virtual void Stop(OrthancPluginJobStopReason reason) ORTHANC_OVERRIDE
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
61 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
62 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
63
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
64 virtual void Reset() ORTHANC_OVERRIDE;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
65
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
66 static void RestHandler(OrthancPluginRestOutput* output,
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
67 const char* url,
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
68 const OrthancPluginHttpRequest* request);
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
69 };