Mercurial > hg > orthanc
annotate OrthancServer/Sources/ServerJobs/OrthancPeerStoreJob.h @ 4571:9224e107d613 db-changes
simplifying IDatabaseListener::SignalChange() as IDatabaseListener::SignalResourceDeleted()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 08 Mar 2021 16:49:34 +0100 |
parents | d9473bd5ed43 |
children | f0038043fb97 7053502fbf97 |
rev | line source |
---|---|
2602 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
4437
d9473bd5ed43
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4205
diff
changeset
|
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium |
2602 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU General Public License as | |
9 * published by the Free Software Foundation, either version 3 of the | |
10 * License, or (at your option) any later version. | |
11 * | |
12 * In addition, as a special exception, the copyright holders of this | |
13 * program give permission to link the code of its release with the | |
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
15 * that use the same license as the "OpenSSL" library), and distribute | |
16 * the linked executables. You must obey the GNU General Public License | |
17 * in all respects for all of the code used other than "OpenSSL". If you | |
18 * modify file(s) with this exception, you may extend this exception to | |
19 * your version of the file(s), but you are not obligated to do so. If | |
20 * you do not wish to do so, delete this exception statement from your | |
21 * version. If you delete this exception statement from all source files | |
22 * in the program, then also delete it here. | |
23 * | |
24 * This program is distributed in the hope that it will be useful, but | |
25 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
27 * General Public License for more details. | |
28 * | |
29 * You should have received a copy of the GNU General Public License | |
30 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
31 **/ | |
32 | |
33 | |
34 #pragma once | |
35 | |
4045 | 36 #include "../../../OrthancFramework/Sources/Compatibility.h" |
37 #include "../../../OrthancFramework/Sources/JobsEngine/SetOfInstancesJob.h" | |
38 #include "../../../OrthancFramework/Sources/HttpClient.h" | |
2602 | 39 |
4156 | 40 #include <stdint.h> |
41 | |
2602 | 42 |
43 namespace Orthanc | |
44 { | |
3095
beeeb6096f27
removing dependencies upon ServerContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
45 class ServerContext; |
beeeb6096f27
removing dependencies upon ServerContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
46 |
2602 | 47 class OrthancPeerStoreJob : public SetOfInstancesJob |
48 { | |
49 private: | |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
50 ServerContext& context_; |
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
51 WebServiceParameters peer_; |
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
52 std::unique_ptr<HttpClient> client_; |
3949
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
53 bool transcode_; |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
54 DicomTransferSyntax transferSyntax_; |
4153
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
55 bool compress_; |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
56 uint64_t size_; |
2602 | 57 |
58 protected: | |
4205 | 59 virtual bool HandleInstance(const std::string& instance) ORTHANC_OVERRIDE; |
2602 | 60 |
4205 | 61 virtual bool HandleTrailingStep() ORTHANC_OVERRIDE; |
2842
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2812
diff
changeset
|
62 |
2602 | 63 public: |
4205 | 64 explicit OrthancPeerStoreJob(ServerContext& context) : |
3949
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
65 context_(context), |
4153
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
66 transcode_(false), |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
67 transferSyntax_(DicomTransferSyntax_LittleEndianExplicit), // Dummy value |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
68 compress_(false), |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
69 size_(0) |
2602 | 70 { |
71 } | |
72 | |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
73 OrthancPeerStoreJob(ServerContext& context, |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
74 const Json::Value& serialize); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
75 |
2603 | 76 void SetPeer(const WebServiceParameters& peer); |
2602 | 77 |
78 const WebServiceParameters& GetPeer() const | |
79 { | |
80 return peer_; | |
81 } | |
82 | |
3949
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
83 bool IsTranscode() const |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
84 { |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
85 return transcode_; |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
86 } |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
87 |
4153
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
88 bool IsCompress() const |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
89 { |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
90 return compress_; |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
91 } |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
92 |
3949
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
93 DicomTransferSyntax GetTransferSyntax() const; |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
94 |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
95 void SetTranscode(DicomTransferSyntax syntax); |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
96 |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
97 void SetTranscode(const std::string& transferSyntaxUid); |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
98 |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
99 void ClearTranscode(); |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
100 |
4153
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
101 void SetCompress(bool compress); |
a4664f169cd7
"/peers/{id}/store": New option "Compress" to compress DICOM data using gzip
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
102 |
4205 | 103 virtual void Stop(JobStopReason reason) ORTHANC_OVERRIDE; // For pausing jobs |
2602 | 104 |
4205 | 105 virtual void GetJobType(std::string& target) ORTHANC_OVERRIDE |
2602 | 106 { |
107 target = "OrthancPeerStore"; | |
108 } | |
109 | |
4205 | 110 virtual void GetPublicContent(Json::Value& value) ORTHANC_OVERRIDE; |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
111 |
4205 | 112 virtual bool Serialize(Json::Value& target) ORTHANC_OVERRIDE; |
2602 | 113 }; |
114 } |