VR-Forces Development_Version Class Documentation
Home
Modules
Namespaces
Classes
Files
Examples
Behavior Models
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
include
vrvCore
DtReadSettingsLock.h
Go to the documentation of this file.
1
/******************************************************************************
2
** Copyright (c) 2009 MAK Technologies, Inc.
3
** All rights reserved.
4
******************************************************************************/
5
/******************************************************************************
6
** $RCSfile: DtReadSettingsLock.h,v $ $Revision: 1.6 $ $State: Exp $
7
******************************************************************************/
8
12
13
#ifndef DtReadSettingsLock_H_
14
#define DtReadSettingsLock_H_
15
16
#include <
vrvCore/DtSharedSettingsManager.h
>
17
18
#include <boost/thread/shared_mutex.hpp>
19
#include <boost/thread/locks.hpp>
20
21
namespace
makVrv
22
{
23
class
DtSharedSettingsManager;
24
50
template
<
typename
SettingsClass>
51
class
DtReadSettingsLock
52
{
53
public
:
54
55
//Acquired an instance of the SettingsClass with a read lock.
56
DtReadSettingsLock
(
DtSharedSettingsManager
& manager);
57
58
//release the lock on the object.
59
~DtReadSettingsLock
();
60
61
//Access the instance using pointer notation.
62
inline
const
SettingsClass*
operator->
() {
return
myObject
; }
63
inline
const
SettingsClass*
operator->
()
const
{
return
myObject
; }
64
65
//Access the instance using deref notation.
66
inline
const
SettingsClass&
operator*
() {
return
*
myObject
; }
67
inline
const
SettingsClass&
operator*
()
const
{
return
*
myObject
; }
68
69
private
:
70
//Not copyable or assignable.
71
DtReadSettingsLock
(
const
DtReadSettingsLock
&);
72
DtReadSettingsLock
&
operator=
(
const
DtReadSettingsLock
&);
73
74
private
:
75
DtSharedSettingsManager
&
myManager
;
76
SettingsClass*
myObject
;
77
78
boost::shared_lock<boost::shared_mutex>
myManagerLock
;
79
boost::shared_lock<boost::shared_mutex>
myObjectLock
;
80
};
81
}
82
83
#define DtReadSettingsLock_INL_
84
#include <vrvCore/DtReadSettingsLock.inl>
85
#undef DtReadSettingsLock_INL_
86
87
#endif
88
Document ID: Generated on Tue Mar 8 22:13:38 EST 2016 from SVN revision 162938
Copyright © 2005-2015 VT MÄK. All Rights Reserved (
www.mak.com
)