VR-Forces 5.0.1 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtSharedSettingsManager.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2009 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #ifndef DtSharedSettingsManager_H_
11 #define DtSharedSettingsManager_H_
12 
13 #include <vrvCore/vrvCore.h>
15 
16 //Needed to keep from messing up windows.
17 #ifndef WIN32_LEAN_AND_MEAN
18 #define UNDEF_WIN32_LEAN_AND_MEAN
19 #define WIN32_LEAN_AND_MEAN
20 #endif
21 
22 #include <boost/thread/shared_mutex.hpp>
23 
24 #ifdef UNDEF_WIN32_LEAN_AND_MEAN
25 #undef UNDEF_WIN32_LEAN_AND_MEAN
26 #undef WIN32_LEAN_AND_MEAN
27 #endif
28 
29 #include <vlutil/vlThread.h>
30 #include <boost/unordered_map.hpp>
31 
32 namespace makVrv
33 {
34  class DtEventQueueInterface;
35  class DtDe;
36  class DtSharedSettings;
37 
43  {
44  public:
45 
48  template <typename SettingsClass> friend class DtReadSettingsLock;
49  template <typename SettingsClass> friend class DtWriteSettingsLock;
50 
52  static DtSharedSettingsManager& instance(DtDe&);
53 
55  virtual ~DtSharedSettingsManager();
56 
61  DtEventQueueInterface& thisThreadEventQueue() const;
62 
66  DtEventQueueInterface* findThisThreadEventQueue() const;
67 
68  protected:
69 
72  const DtSharedSettings* findSettings(const std::string& className) const;
73 
76  void registerSettings(const std::string& className,DtSharedSettings* setting);
77 
78  inline boost::shared_mutex& mutex()
79  {
80  return myMutex;
81  }
82 
83  protected:
84 
87 
88  private:
92 
93  protected:
94  typedef boost::unordered_map<std::string, DtSharedSettings*> SettingInstances;
95 
96  boost::shared_mutex myMutex;
99  DtThreadId myDeThreadId;
100 
101  };
102 }
103 
104 #endif
105 
a read settings lock on a setting object. The object can only get read access aka const functions...
Definition: DtReadSettingsLock.h:48
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
boost::shared_mutex myMutex
Definition: DtSharedSettingsManager.h:96
DtThreadId myDeThreadId
Definition: DtSharedSettingsManager.h:99
The shared settings manager, is the global object responsible for managing any shared settings object...
Definition: DtSharedSettingsManager.h:42
The base class for all shared settings. Actual settings class should have the following members/decla...
Definition: DtSharedSettings.h:45
The event queue interface is a cross thread event queue used to emit event_signal across thread bound...
Definition: DtEventQueueInterface.h:26
boost::unordered_map< std::string, DtSharedSettings * > SettingInstances
Definition: DtSharedSettingsManager.h:94
Contains makVrv::DtVirtualBaseClass class.
SettingInstances mySettings
Definition: DtSharedSettingsManager.h:97
#define DT_DLL_VRVCORE
Definition: vrvCore.h:20
DtDe & myUnsafeDe
Definition: DtSharedSettingsManager.h:98
a write settings lock on a setting object. The object can be read and modified, but no other threads ...
Definition: DtWriteSettingsLock.h:47
boost::shared_mutex & mutex()
Definition: DtSharedSettingsManager.h:78
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:70
Contains DLL export macros.

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)