CppUnit project page FAQ

SynchronizedObject.h
Go to the documentation of this file.
1 #ifndef CPPUNIT_SYNCHRONIZEDOBJECT_H
2 #define CPPUNIT_SYNCHRONIZEDOBJECT_H
3 
4 #include <cppunit/Portability.h>
5 
6 
8 
9 
23 {
24 public:
28  {
29  public:
32 
33  virtual void lock() {}
34  virtual void unlock() {}
35  };
36 
39  SynchronizedObject( SynchronizationObject *syncObject =0 );
40 
42  virtual ~SynchronizedObject();
43 
44 protected:
48  {
50 
51  public:
53  : m_syncObject( syncObject )
54  {
55  m_syncObject->lock();
56  }
57 
59  {
60  m_syncObject->unlock ();
61  }
62  private:
65 
68  };
69 
70  virtual void setSynchronizationObject( SynchronizationObject *syncObject );
71 
72 protected:
74 
75 private:
78 
80  void operator =( const SynchronizedObject &copy );
81 };
82 
83 
85 
86 #endif // CPPUNIT_SYNCHRONIZEDOBJECT_H
#define CPPUNIT_API
Definition: CppUnitApi.h:27
#define CPPUNIT_NS_END
Definition: Portability.h:106
#define CPPUNIT_NS_BEGIN
Definition: Portability.h:105
Locks a synchronization object in the current scope.
Definition: SynchronizedObject.h:48
ExclusiveZone(const ExclusiveZone &)
Prevents the use of the copy constructor.
~ExclusiveZone()
Definition: SynchronizedObject.h:58
SynchronizationObject * m_syncObject
Definition: SynchronizedObject.h:49
ExclusiveZone & operator=(const ExclusiveZone &)
Prevents the use of the copy operator.
ExclusiveZone(SynchronizationObject *syncObject)
Definition: SynchronizedObject.h:52
Abstract synchronization object (mutex)
Definition: SynchronizedObject.h:28
virtual void unlock()
Definition: SynchronizedObject.h:34
virtual void lock()
Definition: SynchronizedObject.h:33
SynchronizationObject()
Definition: SynchronizedObject.h:30
virtual ~SynchronizationObject()
Definition: SynchronizedObject.h:31
Base class for synchronized object.
Definition: SynchronizedObject.h:23
SynchronizationObject * m_syncObject
Definition: SynchronizedObject.h:73
SynchronizedObject(const SynchronizedObject &copy)
Prevents the use of the copy constructor.

Send comments to:
CppUnit Developers