Mercurial > hg > orthanc-transfers
annotate Plugin/PluginContext.h @ 14:e1b24c9a9bd8
patch Orthanc 1.5.6
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 04 Mar 2019 16:48:25 +0100 |
parents | c9e28e31262e |
children | b06103a50c95 |
rev | line source |
---|---|
0 | 1 /** |
2 * Transfers accelerator plugin for Orthanc | |
9 | 3 * Copyright (C) 2018-2019 Osimis S.A., Belgium |
0 | 4 * |
5 * This program is free software: you can redistribute it and/or | |
6 * modify it under the terms of the GNU Affero General Public License | |
7 * as published by the Free Software Foundation, either version 3 of | |
8 * the License, or (at your option) any later version. | |
9 * | |
10 * This program is distributed in the hope that it will be useful, but | |
11 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 * Affero General Public License for more details. | |
14 * | |
15 * You should have received a copy of the GNU Affero General Public License | |
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 **/ | |
18 | |
19 | |
20 #pragma once | |
21 | |
22 #include "../Framework/OrthancInstancesCache.h" | |
23 #include "../Framework/PushMode/ActivePushTransactions.h" | |
24 | |
25 #include <Core/MultiThreading/Semaphore.h> | |
26 | |
27 #include <map> | |
28 | |
29 namespace OrthancPlugins | |
30 { | |
31 class PluginContext : public boost::noncopyable | |
32 { | |
33 private: | |
34 // Runtime structures | |
35 OrthancInstancesCache cache_; | |
36 ActivePushTransactions pushTransactions_; | |
37 Orthanc::Semaphore semaphore_; | |
38 std::string pluginUuid_; | |
39 | |
40 // Configuration | |
41 size_t threadsCount_; | |
42 size_t targetBucketSize_; | |
10
c9e28e31262e
new option: MaxHttpRetries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
9
diff
changeset
|
43 unsigned int maxHttpRetries_; |
0 | 44 |
8
4c3437217518
fix for compatibility with simplified OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
45 PluginContext(size_t threadsCount, |
0 | 46 size_t targetBucketSize, |
47 size_t maxPushTransactions, | |
10
c9e28e31262e
new option: MaxHttpRetries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
9
diff
changeset
|
48 size_t memoryCacheSize, |
c9e28e31262e
new option: MaxHttpRetries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
9
diff
changeset
|
49 unsigned int maxHttpRetries); |
0 | 50 |
51 static std::auto_ptr<PluginContext>& GetSingleton(); | |
52 | |
53 public: | |
54 OrthancInstancesCache& GetCache() | |
55 { | |
56 return cache_; | |
57 } | |
58 | |
59 ActivePushTransactions& GetActivePushTransactions() | |
60 { | |
61 return pushTransactions_; | |
62 } | |
63 | |
64 Orthanc::Semaphore& GetSemaphore() | |
65 { | |
66 return semaphore_; | |
67 } | |
68 | |
69 const std::string& GetPluginUuid() const | |
70 { | |
71 return pluginUuid_; | |
72 } | |
73 | |
74 size_t GetThreadsCount() const | |
75 { | |
76 return threadsCount_; | |
77 } | |
78 | |
79 size_t GetTargetBucketSize() const | |
80 { | |
81 return targetBucketSize_; | |
82 } | |
83 | |
10
c9e28e31262e
new option: MaxHttpRetries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
9
diff
changeset
|
84 unsigned int GetMaxHttpRetries() const |
c9e28e31262e
new option: MaxHttpRetries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
9
diff
changeset
|
85 { |
c9e28e31262e
new option: MaxHttpRetries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
9
diff
changeset
|
86 return maxHttpRetries_; |
c9e28e31262e
new option: MaxHttpRetries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
9
diff
changeset
|
87 } |
c9e28e31262e
new option: MaxHttpRetries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
9
diff
changeset
|
88 |
8
4c3437217518
fix for compatibility with simplified OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
89 static void Initialize(size_t threadsCount, |
0 | 90 size_t targetBucketSize, |
91 size_t maxPushTransactions, | |
10
c9e28e31262e
new option: MaxHttpRetries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
9
diff
changeset
|
92 size_t memoryCacheSize, |
c9e28e31262e
new option: MaxHttpRetries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
9
diff
changeset
|
93 unsigned int maxHttpRetries); |
0 | 94 |
95 static PluginContext& GetInstance(); | |
96 | |
97 static void Finalize(); | |
98 }; | |
99 } |