NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
niftkInteractionEventObserverMutex.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 #ifndef InteractionEventObserverMutex_h
16 #define InteractionEventObserverMutex_h
17 
18 #include "niftkCoreExports.h"
19 
20 #include <unordered_map>
21 
22 namespace mitk
23 {
24 class InteractionEventObserver;
25 }
26 
27 namespace niftk
28 {
29 
48 
49 class NIFTKCORE_EXPORT InteractionEventObserverMutex
50 {
51 public:
52 
54  static InteractionEventObserverMutex* GetInstance();
55 
63  void Lock(mitk::InteractionEventObserver* guardedObserver);
64 
72  void Unlock(mitk::InteractionEventObserver* guardedObserver);
73 
74 private:
75 
77 
79 
100  void DeactivateOtherInteractionEventObservers();
101 
111  void ReactivateOtherInteractionEventObservers();
112 
113  mitk::InteractionEventObserver* m_GuardedObserver;
114 
117  std::unordered_map<mitk::InteractionEventObserver*, bool> m_StateOfOtherInteractionEventObservers;
118 
119 };
120 
121 }
122 
123 #endif
Definition: ReceptorMemberCommandTest.cxx:25
Helper class to prevent unwanted simultaneous interactions.
Definition: niftkInteractionEventObserverMutex.h:49
Definition: niftkExceptionObject.h:21