Mercurial > hg > orthanc-stone
comparison Framework/Volumes/SlicedVolumeBase.cpp @ 88:90bf4116a23c wasm
ISlicedVolume
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 26 May 2017 16:11:52 +0200 |
parents | |
children | 64e60018943f |
comparison
equal
deleted
inserted
replaced
87:4a541cd4fa83 | 88:90bf4116a23c |
---|---|
1 /** | |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017 Osimis, Belgium | |
6 * | |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 | |
22 #include "SlicedVolumeBase.h" | |
23 | |
24 namespace OrthancStone | |
25 { | |
26 namespace | |
27 { | |
28 struct GeometryReadyFunctor | |
29 { | |
30 void operator() (ISlicedVolume::IObserver& observer, | |
31 const ISlicedVolume& source) | |
32 { | |
33 observer.NotifyGeometryReady(source); | |
34 } | |
35 }; | |
36 | |
37 struct GeometryErrorFunctor | |
38 { | |
39 void operator() (ISlicedVolume::IObserver& observer, | |
40 const ISlicedVolume& source) | |
41 { | |
42 observer.NotifyGeometryError(source); | |
43 } | |
44 }; | |
45 | |
46 struct ContentChangeFunctor | |
47 { | |
48 void operator() (ISlicedVolume::IObserver& observer, | |
49 const ISlicedVolume& source) | |
50 { | |
51 observer.NotifyContentChange(source); | |
52 } | |
53 }; | |
54 | |
55 struct SliceChangeFunctor | |
56 { | |
57 size_t sliceIndex_; | |
58 const Slice& slice_; | |
59 | |
60 SliceChangeFunctor(size_t sliceIndex, | |
61 const Slice& slice) : | |
62 sliceIndex_(sliceIndex), | |
63 slice_(slice) | |
64 { | |
65 } | |
66 | |
67 void operator() (ISlicedVolume::IObserver& observer, | |
68 const ISlicedVolume& source) | |
69 { | |
70 observer.NotifySliceChange(source, sliceIndex_, slice_); | |
71 } | |
72 }; | |
73 } | |
74 | |
75 void SlicedVolumeBase::NotifyGeometryReady() | |
76 { | |
77 GeometryReadyFunctor functor; | |
78 observers_.Notify(this, functor); | |
79 } | |
80 | |
81 void SlicedVolumeBase::NotifyGeometryError() | |
82 { | |
83 GeometryErrorFunctor functor; | |
84 observers_.Notify(this, functor); | |
85 } | |
86 | |
87 void SlicedVolumeBase::NotifyContentChange() | |
88 { | |
89 ContentChangeFunctor functor; | |
90 observers_.Notify(this, functor); | |
91 } | |
92 | |
93 void SlicedVolumeBase::NotifySliceChange(size_t sliceIndex, | |
94 const Slice& slice) | |
95 { | |
96 SliceChangeFunctor functor(sliceIndex, slice); | |
97 observers_.Notify(this, functor); | |
98 } | |
99 } |