Mercurial > hg > orthanc
annotate OrthancFramework/Sources/JobsEngine/SetOfCommandsJob.h @ 4130:4899c3135479
fix travis
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 08 Jul 2020 09:18:03 +0200 |
parents | bf7b9edf6b81 |
children | 2007ab69ac16 |
rev | line source |
---|---|
2860 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
3640
94f4a18a79cc
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
2860 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4063
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public License |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4063
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4063
diff
changeset
|
10 * the License, or (at your option) any later version. |
2860 | 11 * |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4063
diff
changeset
|
15 * Lesser General Public License for more details. |
2860 | 16 * |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4063
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4063
diff
changeset
|
18 * License along with this program. If not, see |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4063
diff
changeset
|
19 * <http://www.gnu.org/licenses/>. |
2860 | 20 **/ |
21 | |
22 | |
23 #pragma once | |
24 | |
25 #include "IJob.h" | |
26 | |
27 #include <set> | |
28 | |
29 namespace Orthanc | |
30 { | |
4063
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
31 class ORTHANC_PUBLIC SetOfCommandsJob : public IJob |
2860 | 32 { |
33 public: | |
34 class ICommand : public boost::noncopyable | |
35 { | |
36 public: | |
37 virtual ~ICommand() | |
38 { | |
39 } | |
40 | |
3658
2d90dd30858c
providing job ID to the IJob::Step() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
41 virtual bool Execute(const std::string& jobId) = 0; |
2860 | 42 |
43 virtual void Serialize(Json::Value& target) const = 0; | |
44 }; | |
45 | |
46 class ICommandUnserializer : public boost::noncopyable | |
47 { | |
48 public: | |
49 virtual ~ICommandUnserializer() | |
50 { | |
51 } | |
52 | |
53 virtual ICommand* Unserialize(const Json::Value& source) const = 0; | |
54 }; | |
55 | |
56 private: | |
57 bool started_; | |
58 std::vector<ICommand*> commands_; | |
59 bool permissive_; | |
60 size_t position_; | |
61 std::string description_; | |
62 | |
63 public: | |
64 SetOfCommandsJob(); | |
65 | |
66 SetOfCommandsJob(ICommandUnserializer* unserializer /* takes ownership */, | |
67 const Json::Value& source); | |
68 | |
69 virtual ~SetOfCommandsJob(); | |
70 | |
71 size_t GetPosition() const | |
72 { | |
73 return position_; | |
74 } | |
75 | |
76 void SetDescription(const std::string& description) | |
77 { | |
78 description_ = description; | |
79 } | |
80 | |
81 const std::string& GetDescription() const | |
82 { | |
83 return description_; | |
84 } | |
85 | |
86 void Reserve(size_t size); | |
87 | |
88 size_t GetCommandsCount() const | |
89 { | |
90 return commands_.size(); | |
91 } | |
92 | |
93 void AddCommand(ICommand* command); // Takes ownership | |
94 | |
95 bool IsPermissive() const | |
96 { | |
97 return permissive_; | |
98 } | |
99 | |
100 void SetPermissive(bool permissive); | |
101 | |
3674
9201a7858cce
fix warnings with recent wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3658
diff
changeset
|
102 virtual void Reset() ORTHANC_OVERRIDE; |
2860 | 103 |
3674
9201a7858cce
fix warnings with recent wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3658
diff
changeset
|
104 virtual void Start() ORTHANC_OVERRIDE |
2860 | 105 { |
106 started_ = true; | |
107 } | |
108 | |
3674
9201a7858cce
fix warnings with recent wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3658
diff
changeset
|
109 virtual float GetProgress() ORTHANC_OVERRIDE; |
2860 | 110 |
111 bool IsStarted() const | |
112 { | |
113 return started_; | |
114 } | |
115 | |
116 const ICommand& GetCommand(size_t index) const; | |
117 | |
3658
2d90dd30858c
providing job ID to the IJob::Step() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
118 virtual JobStepResult Step(const std::string& jobId) ORTHANC_OVERRIDE; |
2860 | 119 |
3674
9201a7858cce
fix warnings with recent wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3658
diff
changeset
|
120 virtual void GetPublicContent(Json::Value& value) ORTHANC_OVERRIDE; |
2860 | 121 |
3674
9201a7858cce
fix warnings with recent wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3658
diff
changeset
|
122 virtual bool Serialize(Json::Value& target) ORTHANC_OVERRIDE; |
2976
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2860
diff
changeset
|
123 |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2860
diff
changeset
|
124 virtual bool GetOutput(std::string& output, |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2860
diff
changeset
|
125 MimeType& mime, |
3674
9201a7858cce
fix warnings with recent wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3658
diff
changeset
|
126 const std::string& key) ORTHANC_OVERRIDE |
2976
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2860
diff
changeset
|
127 { |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2860
diff
changeset
|
128 return false; |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2860
diff
changeset
|
129 } |
2860 | 130 }; |
131 } |