VR-Forces 4.3 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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>
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>
53  {
54  public:
55 
56  //Acquired an instance of the SettingsClass with a read lock.
58 
59  //release the lock on the object.
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.
72 
73  private:
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 Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)