VR-Forces 4.7 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
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>
52  {
53  public:
54 
55  //Acquired an instance of the SettingsClass with a read lock.
57 
58  //release the lock on the object.
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.
73 
74  private:
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 Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (www.mak.com)