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
igtl::SimpleMutexLock::GetNameOfClass
virtual const char * GetNameOfClass()
Definition: igtlMutexLock.h:100
igtl::SimpleMutexLock::Self
SimpleMutexLock Self
Definition: igtlMutexLock.h:87
igtl::SimpleMutexLock
Simple mutual exclusion locking class.
Definition: igtlMutexLock.h:83
igtl::MutexLock::Lock
void Lock(void)
Definition: igtlMutexLock.h:166
igtlNewMacro
#define igtlNewMacro(x)
Definition: igtlMacro.h:431
igtl::SimpleMutexLock::m_MutexLock
MutexType m_MutexLock
Definition: igtlMutexLock.h:120
igtl::MutexLock::~MutexLock
~MutexLock()
Definition: igtlMutexLock.h:155
igtl::SimpleMutexLock::Unlock
void Unlock(void)
igtl::MutexLock::Superclass
Object Superclass
Definition: igtlMutexLock.h:137
igtl::Object
Base class for most igtl classes.
Definition: igtlObject.h:60
igtl::MutexLock::m_SimpleMutexLock
SimpleMutexLock m_SimpleMutexLock
Definition: igtlMutexLock.h:157
igtl
The "igtl" namespace contains all OpenIGTLink classes. There are several nested namespaces within the...
Definition: igtlBindMessage.h:25
IGTLCommon_EXPORT
#define IGTLCommon_EXPORT
Definition: igtlWin32Header.h:151
igtl::MutexLock::MutexLock
MutexLock()
Definition: igtlMutexLock.h:154
igtl::MutexLock::Unlock
void Unlock(void)
Definition: igtlMutexLock.h:171
igtl::MutexType
int MutexType
Definition: igtlMutexLock.h:69
igtlWindows.h
igtl::MutexLock
Mutual exclusion locking class.
Definition: igtlMutexLock.h:132
igtl::SimpleMutexLock::GetMutexLock
const MutexType GetMutexLock() const
Definition: igtlMutexLock.h:113
igtl::MutexLock::Pointer
SmartPointer< Self > Pointer
Definition: igtlMutexLock.h:138
igtl::SimpleMutexLock::GetMutexLock
MutexType & GetMutexLock()
Definition: igtlMutexLock.h:109
igtl::MutexLock::Self
MutexLock Self
Definition: igtlMutexLock.h:136
igtl::SmartPointer< Self >
igtlTypeMacro
#define igtlTypeMacro(thisClass, superclass)
Definition: igtlMacro.h:486
igtlObject.h
igtl::LightObject
Light weight base class for most igtl classes.
Definition: igtlLightObject.h:58
igtl::SimpleMutexLock::Lock
void Lock(void)
igtl::MutexLock::ConstPointer
SmartPointer< const Self > ConstPointer
Definition: igtlMutexLock.h:139
igtlObjectFactory.h

Generated for OpenIGTLink by Doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2012