VR-Forces 4.1 Class Documentation
Home
Modules
Namespaces
Classes
Files
Examples
Behavior Models
File List
File Members
include
vrvCore
DtWriteSettingsLock.h
Go to the documentation of this file.
1
/******************************************************************************
2
** Copyright (c) 2009 MAK Technologies, Inc.
3
** All rights reserved.
4
******************************************************************************/
5
/******************************************************************************
6
** $RCSfile: DtWriteSettingsLock.h,v $ $Revision: 1.6 $ $State: Exp $
7
******************************************************************************/
8
12
13
#ifndef DtWriteSettingsLock_H_
14
#define DtWriteSettingsLock_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
DtWriteSettingsLock
53
{
54
public
:
55
56
//Acquired an instance of the SettingsClass with a read lock.
57
DtWriteSettingsLock
(
DtSharedSettingsManager
& manager);
58
59
//release the lock on the object.
60
~DtWriteSettingsLock
();
61
62
//Access the instance using pointer notation.
63
inline
SettingsClass*
operator->
() {
return
myObject
; }
64
65
//Access the instance using deref notation.
66
inline
SettingsClass&
operator*
() {
return
*
myObject
; }
67
68
private
:
69
//Not copyable or assignable.
70
DtWriteSettingsLock
(
const
DtWriteSettingsLock
&);
71
DtWriteSettingsLock
&
operator=
(
const
DtWriteSettingsLock
&);
72
73
private
:
74
DtSharedSettingsManager
&
myManager
;
75
SettingsClass*
myObject
;
76
77
boost::shared_lock<boost::shared_mutex>
myManagerLock
;
78
boost::unique_lock<boost::shared_mutex>
myObjectLock
;
79
80
};
81
}
82
83
#define DtWriteSettingsLock_INL_
84
#include <vrvCore/DtWriteSettingsLock.inl>
85
#undef DtWriteSettingsLock_INL_
86
87
#endif
88
Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (
www.mak.com
)