VR-Forces 4.0.4 Class Documentation
include/vrvCore/DtSharedSettingsManager.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 ** Copyright (c) 2009 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 ******************************************************************************/
00005 /******************************************************************************
00006 ** $RCSfile: DtSharedSettingsManager.h,v $ $Revision: 1.7 $ $State: Exp $
00007 ******************************************************************************/
00008 
00012 
00013 #ifndef DtSharedSettingsManager_H_
00014 #define DtSharedSettingsManager_H_
00015 
00016 #include <vrvCore/vrvCore.h>
00017 #include <vrvUtil/DtVirtualBaseClass.h>
00018 
00019 //Needed to keep from messing up windows.
00020 #ifndef WIN32_LEAN_AND_MEAN
00021 #define UNDEF_WIN32_LEAN_AND_MEAN
00022 #define WIN32_LEAN_AND_MEAN
00023 #endif
00024 
00025 #include <boost/thread/shared_mutex.hpp>
00026 
00027 #ifdef UNDEF_WIN32_LEAN_AND_MEAN
00028 #undef UNDEF_WIN32_LEAN_AND_MEAN
00029 #undef WIN32_LEAN_AND_MEAN
00030 #endif
00031 
00032 #include <vlutil/vlThread.h>
00033 #include <map>
00034 
00035 namespace makVrv
00036 {
00037    class DtEventQueueInterface;
00038    class DtDe;
00039    class DtSharedSettings;
00040 
00045    class DT_DLL_VRVCORE DtSharedSettingsManager : public DtVirtualBaseClass
00046    {
00047    public:
00048 
00051       template <typename SettingsClass> friend class DtReadSettingsLock;
00052       template <typename SettingsClass> friend class DtWriteSettingsLock;
00053 
00055       static DtSharedSettingsManager& instance(DtDe&);
00056 
00058       virtual ~DtSharedSettingsManager();
00059 
00064       DtEventQueueInterface& thisThreadEventQueue() const;
00065 
00069       DtEventQueueInterface* findThisThreadEventQueue() const;
00070 
00071    protected:
00072 
00075       const DtSharedSettings* findSettings(const std::string& className) const;
00076       
00079       void registerSettings(const std::string& className,DtSharedSettings* setting);
00080 
00081       inline boost::shared_mutex& mutex()
00082       {
00083          return myMutex;
00084       }
00085 
00086    protected:
00087 
00089       DtSharedSettingsManager(DtDe& de);
00090 
00091    private:
00093       DtSharedSettingsManager(const DtSharedSettingsManager&);
00094       DtSharedSettingsManager& operator=(DtSharedSettingsManager&);
00095 
00096    protected:
00097       typedef std::map<std::string, DtSharedSettings*> SettingInstances;
00098 
00099       boost::shared_mutex myMutex;
00100       SettingInstances mySettings;
00101       DtDe& myUnsafeDe;
00102       DtThreadId myDeThreadId;
00103 
00104    };
00105 }
00106 
00107 #endif
00108 

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)