Mercurial > hg > orthanc
annotate OrthancFramework/Sources/IDynamicObject.h @ 5141:023569e7155b
moved DicomModification thread safety into ResourceModificationJob (trying to avoid mutex in OrthancFramework as much as possible)
author | Alain Mazy <am@osimis.io> |
---|---|
date | Fri, 20 Jan 2023 18:10:42 +0100 |
parents | 55469ccfb384 |
children | 0ea402b4d901 |
rev | line source |
---|---|
139
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
4870
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
139
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * |
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * 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:
4044
diff
changeset
|
9 * 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:
4044
diff
changeset
|
10 * 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:
4044
diff
changeset
|
11 * the License, or (at your option) any later version. |
139
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * |
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, but |
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * WITHOUT ANY WARRANTY; without even the implied warranty of |
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * 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:
4044
diff
changeset
|
16 * Lesser General Public License for more details. |
139
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
18 * 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:
4044
diff
changeset
|
19 * 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:
4044
diff
changeset
|
20 * <http://www.gnu.org/licenses/>. |
139
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 **/ |
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 |
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 #pragma once |
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 |
4037
5e26d004838c
adding option "system" to DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
26 #include "OrthancFramework.h" |
5e26d004838c
adding option "system" to DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
27 |
139
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 #include <boost/noncopyable.hpp> |
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 |
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 namespace Orthanc |
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 { |
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 /** |
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 * This class should be the ancestor to any class whose type is |
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 * determined at the runtime, and that can be dynamically allocated. |
140 | 35 * Being a child of IDynamicObject only implies the existence of a |
36 * virtual destructor. | |
139
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 **/ |
4037
5e26d004838c
adding option "system" to DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
38 class ORTHANC_PUBLIC IDynamicObject : public boost::noncopyable |
139
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 { |
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 public: |
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 virtual ~IDynamicObject() |
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 { |
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 } |
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 }; |
2989 | 45 |
2858
39b171502059
added SingleValueObject: a simple implementation of a IDynamicObject that stores a single typed value
am@osimis.io
parents:
2447
diff
changeset
|
46 |
39b171502059
added SingleValueObject: a simple implementation of a IDynamicObject that stores a single typed value
am@osimis.io
parents:
2447
diff
changeset
|
47 /** |
2989 | 48 * This class is a simple implementation of a IDynamicObject that |
49 * stores a single typed value. | |
2858
39b171502059
added SingleValueObject: a simple implementation of a IDynamicObject that stores a single typed value
am@osimis.io
parents:
2447
diff
changeset
|
50 */ |
39b171502059
added SingleValueObject: a simple implementation of a IDynamicObject that stores a single typed value
am@osimis.io
parents:
2447
diff
changeset
|
51 template <typename T> |
2989 | 52 class SingleValueObject : public IDynamicObject |
2858
39b171502059
added SingleValueObject: a simple implementation of a IDynamicObject that stores a single typed value
am@osimis.io
parents:
2447
diff
changeset
|
53 { |
39b171502059
added SingleValueObject: a simple implementation of a IDynamicObject that stores a single typed value
am@osimis.io
parents:
2447
diff
changeset
|
54 private: |
2989 | 55 T value_; |
56 | |
2858
39b171502059
added SingleValueObject: a simple implementation of a IDynamicObject that stores a single typed value
am@osimis.io
parents:
2447
diff
changeset
|
57 public: |
2989 | 58 explicit SingleValueObject(const T& value) : |
2858
39b171502059
added SingleValueObject: a simple implementation of a IDynamicObject that stores a single typed value
am@osimis.io
parents:
2447
diff
changeset
|
59 value_(value) |
39b171502059
added SingleValueObject: a simple implementation of a IDynamicObject that stores a single typed value
am@osimis.io
parents:
2447
diff
changeset
|
60 { |
39b171502059
added SingleValueObject: a simple implementation of a IDynamicObject that stores a single typed value
am@osimis.io
parents:
2447
diff
changeset
|
61 } |
39b171502059
added SingleValueObject: a simple implementation of a IDynamicObject that stores a single typed value
am@osimis.io
parents:
2447
diff
changeset
|
62 |
39b171502059
added SingleValueObject: a simple implementation of a IDynamicObject that stores a single typed value
am@osimis.io
parents:
2447
diff
changeset
|
63 const T& GetValue() const |
39b171502059
added SingleValueObject: a simple implementation of a IDynamicObject that stores a single typed value
am@osimis.io
parents:
2447
diff
changeset
|
64 { |
2989 | 65 return value_; |
2858
39b171502059
added SingleValueObject: a simple implementation of a IDynamicObject that stores a single typed value
am@osimis.io
parents:
2447
diff
changeset
|
66 } |
4871
55469ccfb384
added SingleValueObject::SetValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4870
diff
changeset
|
67 |
55469ccfb384
added SingleValueObject::SetValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4870
diff
changeset
|
68 void SetValue(const T& value) |
55469ccfb384
added SingleValueObject::SetValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4870
diff
changeset
|
69 { |
55469ccfb384
added SingleValueObject::SetValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4870
diff
changeset
|
70 value_ = value; |
55469ccfb384
added SingleValueObject::SetValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4870
diff
changeset
|
71 } |
2858
39b171502059
added SingleValueObject: a simple implementation of a IDynamicObject that stores a single typed value
am@osimis.io
parents:
2447
diff
changeset
|
72 }; |
139
3ad78369fcc4
start threaded messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
73 } |