Mercurial > hg > orthanc-stone
annotate Applications/Platforms/WebAssembly/WebAssemblyLoadersContext.h @ 1666:1e6d3289b1ad
enable catching of exceptions in stone web viewer
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 19 Nov 2020 17:10:08 +0100 |
parents | 4fb8fdf03314 |
children | 6fa05252b085 |
rev | line source |
---|---|
1248
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Stone of Orthanc |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
2a8359503f3b
WebAssemblyLoadersContext
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:
1248
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
1248
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Affero General Public License |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * the License, or (at your option) any later version. |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, but |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * WITHOUT ANY WARRANTY; without even the implied warranty of |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * Affero General Public License for more details. |
1596
4fb8fdf03314
removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
16 * |
1248
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Affero General Public License |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 **/ |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 #pragma once |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 |
1591
5887a4f8594b
moving platform-specific files out of the "OrthancStone" folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
24 #include "../../../OrthancStone/Sources/Loaders/ILoadersContext.h" |
5887a4f8594b
moving platform-specific files out of the "OrthancStone" folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
25 #include "../../../OrthancStone/Sources/Loaders/OracleScheduler.h" |
5887a4f8594b
moving platform-specific files out of the "OrthancStone" folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
26 #include "WebAssemblyOracle.h" |
1248
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 |
1318
cbfdba08e039
removed SDL code in wasm + added undostack CTOR in Wasm viewport + build fix + ORTHANC_OVERRIDE
Benjamin Golinvaux <bgo@osimis.io>
parents:
1271
diff
changeset
|
28 #include <list> |
cbfdba08e039
removed SDL code in wasm + added undostack CTOR in Wasm viewport + build fix + ORTHANC_OVERRIDE
Benjamin Golinvaux <bgo@osimis.io>
parents:
1271
diff
changeset
|
29 |
1248
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 namespace OrthancStone |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 { |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 class WebAssemblyLoadersContext : public ILoadersContext |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 { |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 private: |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 class Locker; |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 WebAssemblyOracle oracle_; |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 boost::shared_ptr<OracleScheduler> scheduler_; |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 std::list< boost::shared_ptr<IObserver> > loaders_; |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 public: |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 WebAssemblyLoadersContext(unsigned int maxHighPriority, |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 unsigned int maxStandardPriority, |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 unsigned int maxLowPriority); |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 void SetLocalOrthanc(const std::string& root) |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 { |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 oracle_.SetLocalOrthanc(root); |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 } |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 void SetRemoteOrthanc(const Orthanc::WebServiceParameters& orthanc) |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 { |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 oracle_.SetRemoteOrthanc(orthanc); |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 } |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 void SetDicomCacheSize(size_t size) |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 { |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 oracle_.SetDicomCacheSize(size); |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 } |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 virtual ILock* Lock() ORTHANC_OVERRIDE; |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 }; |
2a8359503f3b
WebAssemblyLoadersContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 } |