annotate OrthancStone/Sources/Oracle/GenericOracleRunner.h @ 1574:fb5e620430ae

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 21 Sep 2020 18:29:53 +0200
parents 244ad1e4e76a
children 4fb8fdf03314
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1077
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
1271
0ca50d275b9a upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1150
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
1077
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * Affero General Public License for more details.
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #pragma once
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
1509
b7210c688ca7 linking SDL samples against system-wide orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
24 #include <OrthancFramework.h> // To have the macros properly defined
b7210c688ca7 linking SDL samples against system-wide orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1455
diff changeset
25
1124
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1104
diff changeset
26 #if !defined(ORTHANC_ENABLE_DCMTK)
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1104
diff changeset
27 # error The macro ORTHANC_ENABLE_DCMTK must be defined
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1104
diff changeset
28 #endif
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1104
diff changeset
29
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1104
diff changeset
30 #if ORTHANC_ENABLE_DCMTK == 1
1150
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1135
diff changeset
31 # include "../Toolbox/ParsedDicomCache.h"
1124
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1104
diff changeset
32 #endif
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1104
diff changeset
33
1129
c3d4adf8bc70 removing IOracleRunner abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1127
diff changeset
34 #include "IOracleCommand.h"
1134
87fbeb823375 allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1129
diff changeset
35 #include "../Messages/IMessageEmitter.h"
1124
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1104
diff changeset
36
1455
30deba7bc8e2 simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1271
diff changeset
37 #include <Enumerations.h> // For ORTHANC_OVERRIDE
30deba7bc8e2 simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1271
diff changeset
38 #include <WebServiceParameters.h>
1077
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 namespace OrthancStone
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 {
1129
c3d4adf8bc70 removing IOracleRunner abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1127
diff changeset
42 class GenericOracleRunner : public boost::noncopyable
1077
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 {
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 private:
1104
98cdfe5768a4 ReadFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1098
diff changeset
45 Orthanc::WebServiceParameters orthanc_;
98cdfe5768a4 ReadFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1098
diff changeset
46 std::string rootDirectory_;
1077
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47
1124
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1104
diff changeset
48 #if ORTHANC_ENABLE_DCMTK == 1
1150
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1135
diff changeset
49 boost::shared_ptr<ParsedDicomCache> dicomCache_;
1124
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1104
diff changeset
50 #endif
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1104
diff changeset
51
1077
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 public:
1127
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1124
diff changeset
53 GenericOracleRunner() :
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1124
diff changeset
54 rootDirectory_(".")
1104
98cdfe5768a4 ReadFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1098
diff changeset
55 {
98cdfe5768a4 ReadFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1098
diff changeset
56 }
98cdfe5768a4 ReadFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1098
diff changeset
57
98cdfe5768a4 ReadFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1098
diff changeset
58 void SetOrthanc(const Orthanc::WebServiceParameters& orthanc)
98cdfe5768a4 ReadFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1098
diff changeset
59 {
98cdfe5768a4 ReadFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1098
diff changeset
60 orthanc_ = orthanc;
98cdfe5768a4 ReadFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1098
diff changeset
61 }
98cdfe5768a4 ReadFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1098
diff changeset
62
98cdfe5768a4 ReadFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1098
diff changeset
63 const Orthanc::WebServiceParameters& GetOrthanc() const
1077
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 {
1104
98cdfe5768a4 ReadFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1098
diff changeset
65 return orthanc_;
98cdfe5768a4 ReadFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1098
diff changeset
66 }
98cdfe5768a4 ReadFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1098
diff changeset
67
98cdfe5768a4 ReadFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1098
diff changeset
68 void SetRootDirectory(const std::string& rootDirectory)
98cdfe5768a4 ReadFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1098
diff changeset
69 {
98cdfe5768a4 ReadFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1098
diff changeset
70 rootDirectory_ = rootDirectory;
98cdfe5768a4 ReadFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1098
diff changeset
71 }
98cdfe5768a4 ReadFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1098
diff changeset
72
98cdfe5768a4 ReadFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1098
diff changeset
73 const std::string GetRootDirectory() const
98cdfe5768a4 ReadFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1098
diff changeset
74 {
98cdfe5768a4 ReadFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1098
diff changeset
75 return rootDirectory_;
1077
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 }
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77
1124
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1104
diff changeset
78 #if ORTHANC_ENABLE_DCMTK == 1
1150
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1135
diff changeset
79 void SetDicomCache(boost::shared_ptr<ParsedDicomCache> cache)
1124
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1104
diff changeset
80 {
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1104
diff changeset
81 dicomCache_ = cache;
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1104
diff changeset
82 }
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1104
diff changeset
83 #endif
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1104
diff changeset
84
1134
87fbeb823375 allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1129
diff changeset
85 void Run(boost::weak_ptr<IObserver> receiver,
87fbeb823375 allocating messages from oracle commands on the stack
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1129
diff changeset
86 IMessageEmitter& emitter,
1135
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
87 const IOracleCommand& command);
1077
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 };
d7a18a3cd6f9 IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 }