fw4spl
ObjectReadLock.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2016.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #ifndef __FWDATA_MT_OBJECTREADLOCK_HPP__
8 #define __FWDATA_MT_OBJECTREADLOCK_HPP__
9 
10 #include "fwData/Object.hpp"
11 #include "fwData/config.hpp"
12 
13 #include <fwCore/mt/types.hpp>
14 
15 namespace fwData
16 {
17 namespace mt
18 {
19 
23 class FWDATA_CLASS_API ObjectReadLock
24 {
25 
26 public:
27 
32  FWDATA_API ObjectReadLock( ::fwData::Object::csptr obj, bool lock = true );
33 
35  FWDATA_API ~ObjectReadLock();
36 
38  FWDATA_API void lock();
39 
41  FWDATA_API void unlock();
42 
43 private:
44 
47 };
48 
49 } // mt
50 } // fwData
51 
52 #endif // __FWDATA_MT_OBJECTREADLOCK_HPP__
A helper to lock object on read mode.
::boost::shared_lock< ReadWriteMutex > ReadLock
Defines a lock of read type for read/write mutex.
Contains the representation of the data objects used in the framework.