![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2010 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 /****************************************************************************** 00006 ** $RCSfile: DtChannelKeywordObjectManager.h,v $ $Revision: 1.23 $ $State: Exp $ 00007 ******************************************************************************/ 00008 00012 00013 #pragma once 00014 00015 #include <vrvCore/vrvCore.h> 00016 00017 #include <vrvUtil/DtSignalConnectionManager.h> 00018 #include <vrvUtil/DtVirtualBaseClass.h> 00019 00020 #include <boost/unordered_map.hpp> 00021 #include <string> 00022 #include <vector> 00023 00024 namespace makVrv 00025 { 00026 class DtAgentManagerInterface; 00027 class DtChannel; 00028 class DtChannelKeywordObject; 00029 class DtChannelConfiguration; 00030 class DtWindowConfiguration; 00031 class DtChannelManager; 00032 class DtDe; 00033 class DtWindowConfiguration; 00034 00035 00038 class DT_DLL_VRVCORE DtChannelKeywordObjectManager : public DtVirtualBaseClass 00039 { 00040 00041 public: 00042 // This is a map of channel keyword objects indexed by keyword name. each channel may 00043 // have such a map 00044 typedef boost::unordered_map<std::string, DtChannelKeywordObject*> ObjectMap; 00045 00046 // This is a map of ObjectMaps, indexed by DisplayName :: WindowName :: ChannelName 00047 typedef boost::unordered_map<std::string, ObjectMap> ChannelMap; 00048 00049 00050 public: 00052 friend class DtChannelKeywordObjectManagerCreator; 00053 00055 virtual ~DtChannelKeywordObjectManager(); 00056 00059 static DtChannelKeywordObjectManager& instance( DtDe& de ); 00060 00062 const ChannelMap& channelMap() const; 00063 00064 protected: 00065 00066 // Signal Slots 00067 virtual void slot_channelCreated( DtChannelManager*, DtChannel* ); 00068 00069 virtual void slot_channelToBeDestroyed( const std::string& deName, 00070 const std::string& winName, const std::string& channelName ); 00071 00072 virtual void slot_channelConfigurationAdded( const std::string& deName, 00073 const std::string& winName, const DtChannelConfiguration& config); 00074 00075 virtual void slot_displayConfigurationRealized( const std::string& igName, 00076 const std::string& displayName ); 00077 00078 virtual void slot_displayToBeDestroyed( const std::string& displayName ); 00079 00080 virtual void slot_channelConfigurationModified( const std::string& deName, 00081 const std::string& winName, const std::string& oldChannelName, 00082 const DtChannelConfiguration& config); 00083 00084 virtual void slot_windowConfigurationModified( const std::string& deName, 00085 const std::string& oldWindowName, const DtWindowConfiguration& config); 00086 00087 // Helper methods 00088 // we may get deName, windowName, and configuration in different ways, but once 00089 // we have them, call this 00090 virtual void processChannelConfiguration(const std::string& deName, 00091 const std::string& winName, const DtChannelConfiguration& config ); 00092 00093 virtual std::string makeChannelKey( const std::string& deName, 00094 const std::string& winName, const std::string& channelName ); 00095 00096 virtual std::string makeWindowKey( const std::string& deName, 00097 const std::string& winName ); 00098 00099 virtual void addChannelKeywordObject( const std::string& channelKey, 00100 const std::string& keyword, DtChannelKeywordObject* keywordObject ); 00101 00102 virtual void removeChannelKeywordObject( const std::string& channelKey, 00103 const std::string& keyword ); 00104 00105 // Special case; can't use removeChannelKeywordObjects() because we're iterating over the 00106 // object map, so this one method removes them all 00107 virtual void removeAllChannelKeywordObjectsFromChannel( const std::string& channelKey ); 00108 00109 void addToWindowMap( const std::string& windowKey, const std::string& channelKey ); 00110 00111 void removeFromWindowMap( const std::string& windowKey, const std::string& channelKey ); 00112 00113 static std::string getChannelNameFromChannelKey( const std::string& channelKey ); 00114 00115 protected: 00117 DtChannelKeywordObjectManager( DtDe& de ); 00118 protected: 00119 00120 // This is a map of channel key lists indexed by window key 00121 // Given a deName/windowName, we can get all the channel keys for channels in that 00122 // window that have compasses 00123 00124 typedef std::vector<std::string> ChannelKeyList; 00125 typedef boost::unordered_map<std::string, ChannelKeyList > WindowMap; 00126 00127 DtDe& myDe; 00128 DtSignalConnectionManager myConnections; 00129 00130 // This map provides a pointer to CompassMap given 00131 // a DisplayName :: WindowName :: ChannelName string. The CompassMap 00132 // can then provide a pointer to a compass based on keyword 00133 ChannelMap myChannelMap; 00134 00135 WindowMap myWindowMap; 00136 00137 }; 00138 00141 class DT_DLL_VRVCORE DtChannelKeywordObjectManagerCreator : public DtVirtualBaseClass 00142 { 00143 00144 public: 00146 static DtChannelKeywordObjectManagerCreator& instance( DtDe& ); 00147 00149 static void registerInstance( DtDe& theIG, DtChannelKeywordObjectManagerCreator* anInstance ); 00150 00152 virtual DtChannelKeywordObjectManager* create( DtDe& ); 00153 }; 00154 } 00155