VR-Forces 4.3 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/vrvCore.h
>
17
#include <
vrvCore/DtSharedSettingsManager.h
>
18
19
#include <boost/thread/shared_mutex.hpp>
20
#include <boost/thread/locks.hpp>
21
22
namespace
makVrv
23
{
24
class
DtSharedSettingsManager;
25
51
template
<
typename
SettingsClass>
52
class
DtReadSettingsLock
53
{
54
public
:
55
56
//Acquired an instance of the SettingsClass with a read lock.
57
DtReadSettingsLock
(
DtSharedSettingsManager
& manager);
58
59
//release the lock on the object.
60
~DtReadSettingsLock
();
61
62
//Access the instance using pointer notation.
63
inline
const
SettingsClass*
operator->
() {
return
myObject
; }
64
inline
const
SettingsClass*
operator->
()
const
{
return
myObject
; }
65
66
//Access the instance using deref notation.
67
inline
const
SettingsClass&
operator*
() {
return
*
myObject
; }
68
inline
const
SettingsClass&
operator*
()
const
{
return
*
myObject
; }
69
70
private
:
71
//Not copyable or assignable.
72
DtReadSettingsLock
(
const
DtReadSettingsLock
&);
73
DtReadSettingsLock
&
operator=
(
const
DtReadSettingsLock
&);
74
75
private
:
76
DtSharedSettingsManager
&
myManager
;
77
SettingsClass*
myObject
;
78
79
boost::shared_lock<boost::shared_mutex>
myManagerLock
;
80
boost::shared_lock<boost::shared_mutex>
myObjectLock
;
81
};
82
}
83
84
#define DtReadSettingsLock_INL_
85
#include <vrvCore/DtReadSettingsLock.inl>
86
#undef DtReadSettingsLock_INL_
87
88
#endif
89
Document ID: Generated on Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (
www.mak.com
)