NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
itkNifTKMacro.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 itkNifTKMacro_h
16 #define itkNifTKMacro_h
17 #include <itkMutexLockHolder.h>
18 #include <itkObjectFactory.h>
19 
24 #define itkThreadSafeGetConstMacro(name,type) \
25  virtual type Get##name () const \
26  { \
27  itkDebugMacro("returning " << #name " of " << this->m_##name ); \
28  itk::MutexLockHolder<itk::FastMutexLock> lock(*this->m_Mutex); \
29  return this->m_##name; \
30  }
31 
36 #define itkThreadSafeSetMacro(name,type) \
37  virtual void Set##name (const type _arg) \
38  { \
39  itkDebugMacro("setting " #name " to " << _arg); \
40  if (this->m_##name != _arg) \
41  { \
42  itk::MutexLockHolder<itk::FastMutexLock> lock(*this->m_Mutex); \
43  this->m_##name = _arg; \
44  this->Modified(); \
45  } \
46  }
47 
48 #endif // itkNifTKMacro_h