Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  
igtlMutexLock.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: The OpenIGTLink Library
4  Language: C++
5  Web page: http://openigtlink.org/
6 
7  Copyright (c) Insight Software Consortium. All rights reserved.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notices for more information.
12 
13 =========================================================================*/
14 /*=========================================================================
15 
16  Program: Insight Segmentation & Registration Toolkit
17  Module: $RCSfile: itkMutexLock.h,v $
18  Language: C++
19  Date: $Date: 2008-12-22 19:05:42 -0500 (Mon, 22 Dec 2008) $
20  Version: $Revision: 3460 $
21 
22  Copyright (c) Insight Software Consortium. All rights reserved.
23  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
24 
25  Portions of this code are covered under the VTK copyright.
26  See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details.
27 
28  This software is distributed WITHOUT ANY WARRANTY; without even
29  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
30  PURPOSE. See the above copyright notices for more information.
31 
32 =========================================================================*/
33 #ifndef __igtlMutexLock_h
34 #define __igtlMutexLock_h
35 
36 #include "igtlObject.h"
37 #include "igtlObjectFactory.h"
38 
39 #ifdef OpenIGTLink_USE_SPROC
40 #include <abi_mutex.h>
41 #endif
42 
43 #ifdef OpenIGTLink_USE_PTHREADS
44 #include <pthread.h>
45 #endif
46 
47 #ifdef OpenIGTLink_USE_WIN32_THREADS
48 #include "igtlWindows.h"
49 #endif
50 
51 namespace igtl
52 {
53 
54 #ifdef OpenIGTLink_USE_SPROC
55 typedef abilock_t MutexType;
56 #endif
57 
58 #ifdef OpenIGTLink_USE_PTHREADS
59 typedef pthread_mutex_t MutexType;
60 #endif
61 
62 #ifdef OpenIGTLink_USE_WIN32_THREADS
63 typedef HANDLE MutexType;
64 #endif
65 
66 #ifndef OpenIGTLink_USE_SPROC
67 #ifndef OpenIGTLink_USE_PTHREADS
68 #ifndef OpenIGTLink_USE_WIN32_THREADS
69 typedef int MutexType;
70 #endif
71 #endif
72 #endif
73 
84 {
85 public:
88 
91  virtual ~SimpleMutexLock();
93 
95  static SimpleMutexLock *New();
96  //void Delete() {delete this;}
98 
100  virtual const char *GetNameOfClass() {return "igtlSimpleMutexLock";};
101 
103  void Lock( void );
104 
106  void Unlock( void );
107 
110  {
111  return m_MutexLock;
112  }
113  const MutexType GetMutexLock() const
114  {
115  return m_MutexLock;
116  }
118 
119 protected:
121 };
122 
133 {
134 public:
136  typedef MutexLock Self;
140 
143 
146 
148  void Lock( void );
149 
151  void Unlock( void );
152 
153 protected:
156 
158  void PrintSelf(std::ostream& os) const;
159 
160 private:
161  MutexLock(const Self&); //purposely not implemented
162  void operator=(const Self&); //purposely not implemented
163 };
164 
165 
166 inline void MutexLock::Lock( void )
167 {
169 }
170 
171 inline void MutexLock::Unlock( void )
172 {
174 }
175 
176 
177 }//end igtl namespace
178 #endif
int MutexType
Definition: igtlMutexLock.h:69
MutexType & GetMutexLock()
SmartPointer< Self > Pointer
const MutexType GetMutexLock() const
#define igtlTypeMacro(thisClass, superclass)
Definition: igtlMacro.h:486
Mutual exclusion locking class.
virtual const char * GetNameOfClass()
#define IGTLCommon_EXPORT
SimpleMutexLock Self
Definition: igtlMutexLock.h:87
void Unlock(void)
SimpleMutexLock m_SimpleMutexLock
SmartPointer< const Self > ConstPointer
Light weight base class for most igtl classes.
void Lock(void)
#define igtlNewMacro(x)
Definition: igtlMacro.h:431
Base class for most igtl classes.
Definition: igtlObject.h:60
Simple mutual exclusion locking class.
Definition: igtlMutexLock.h:83

Generated at Mon Nov 11 2013 05:19:48 for OpenIGTLink by doxygen 1.8.5 written by Dimitri van Heesch, © 1997-2012