Mercurial > hg > orthanc-transfers
annotate Plugin/PluginContext.h @ 62:bb2842b670d1
fix windows resources
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 08 Sep 2023 14:27:17 +0200 |
parents | b09adb6aa199 |
children | 1e396fb509ca |
rev | line source |
---|---|
0 | 1 /** |
2 * Transfers accelerator plugin for Orthanc | |
33
44a0430d7899
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
25
diff
changeset
|
3 * Copyright (C) 2018-2021 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
dfc43678aecb
replacing deprecated std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
20
diff
changeset
|
25 #include <Compatibility.h> // For std::unique_ptr |
20 | 26 #include <MultiThreading/Semaphore.h> |
0 | 27 |
28 #include <map> | |
29 | |
30 namespace OrthancPlugins | |
31 { | |
32 class PluginContext : public boost::noncopyable | |
33 { | |
34 private: | |
35 // Runtime structures | |
36 OrthancInstancesCache cache_; | |
37 ActivePushTransactions pushTransactions_; | |
38 Orthanc::Semaphore semaphore_; | |
39 std::string pluginUuid_; | |
40 | |
41 // Configuration | |
42 size_t threadsCount_; | |
43 size_t targetBucketSize_; | |
10
c9e28e31262e
new option: MaxHttpRetries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
9
diff
changeset
|
44 unsigned int maxHttpRetries_; |
55
b09adb6aa199
new PeerConnectivityTimeout configuration
Alain Mazy <am@osimis.io>
parents:
33
diff
changeset
|
45 unsigned int peerConnectivityTimeout_; |
0 | 46 |
8
4c3437217518
fix for compatibility with simplified OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
47 PluginContext(size_t threadsCount, |
0 | 48 size_t targetBucketSize, |
49 size_t maxPushTransactions, | |
10
c9e28e31262e
new option: MaxHttpRetries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
9
diff
changeset
|
50 size_t memoryCacheSize, |
55
b09adb6aa199
new PeerConnectivityTimeout configuration
Alain Mazy <am@osimis.io>
parents:
33
diff
changeset
|
51 unsigned int maxHttpRetries, |
b09adb6aa199
new PeerConnectivityTimeout configuration
Alain Mazy <am@osimis.io>
parents:
33
diff
changeset
|
52 unsigned int peerConnectivityTimeout); |
0 | 53 |
25
dfc43678aecb
replacing deprecated std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
20
diff
changeset
|
54 static std::unique_ptr<PluginContext>& GetSingleton(); |
0 | 55 |
56 public: | |
57 OrthancInstancesCache& GetCache() | |
58 { | |
59 return cache_; | |
60 } | |
61 | |
62 ActivePushTransactions& GetActivePushTransactions() | |
63 { | |
64 return pushTransactions_; | |
65 } | |
66 | |
67 Orthanc::Semaphore& GetSemaphore() | |
68 { | |
69 return semaphore_; | |
70 } | |
71 | |
72 const std::string& GetPluginUuid() const | |
73 { | |
74 return pluginUuid_; | |
75 } | |
76 | |
77 size_t GetThreadsCount() const | |
78 { | |
79 return threadsCount_; | |
80 } | |
81 | |
82 size_t GetTargetBucketSize() const | |
83 { | |
84 return targetBucketSize_; | |
85 } | |
86 | |
10
c9e28e31262e
new option: MaxHttpRetries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
9
diff
changeset
|
87 unsigned int GetMaxHttpRetries() const |
c9e28e31262e
new option: MaxHttpRetries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
9
diff
changeset
|
88 { |
c9e28e31262e
new option: MaxHttpRetries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
9
diff
changeset
|
89 return maxHttpRetries_; |
c9e28e31262e
new option: MaxHttpRetries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
9
diff
changeset
|
90 } |
c9e28e31262e
new option: MaxHttpRetries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
9
diff
changeset
|
91 |
55
b09adb6aa199
new PeerConnectivityTimeout configuration
Alain Mazy <am@osimis.io>
parents:
33
diff
changeset
|
92 unsigned int GetPeerConnectivityTimeout() const |
b09adb6aa199
new PeerConnectivityTimeout configuration
Alain Mazy <am@osimis.io>
parents:
33
diff
changeset
|
93 { |
b09adb6aa199
new PeerConnectivityTimeout configuration
Alain Mazy <am@osimis.io>
parents:
33
diff
changeset
|
94 return peerConnectivityTimeout_; |
b09adb6aa199
new PeerConnectivityTimeout configuration
Alain Mazy <am@osimis.io>
parents:
33
diff
changeset
|
95 } |
b09adb6aa199
new PeerConnectivityTimeout configuration
Alain Mazy <am@osimis.io>
parents:
33
diff
changeset
|
96 |
8
4c3437217518
fix for compatibility with simplified OrthancPluginCppWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
97 static void Initialize(size_t threadsCount, |
0 | 98 size_t targetBucketSize, |
99 size_t maxPushTransactions, | |
10
c9e28e31262e
new option: MaxHttpRetries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
9
diff
changeset
|
100 size_t memoryCacheSize, |
55
b09adb6aa199
new PeerConnectivityTimeout configuration
Alain Mazy <am@osimis.io>
parents:
33
diff
changeset
|
101 unsigned int maxHttpRetries, |
b09adb6aa199
new PeerConnectivityTimeout configuration
Alain Mazy <am@osimis.io>
parents:
33
diff
changeset
|
102 unsigned int peerConnectivityTimeout); |
0 | 103 |
104 static PluginContext& GetInstance(); | |
105 | |
106 static void Finalize(); | |
107 }; | |
108 } |