![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2010 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 /****************************************************************************** 00006 ** $RCSfile: DtMessageDispatcher.h,v $ $Revision: 1.29 $ $State: Exp $ 00007 ******************************************************************************/ 00008 00011 00012 #ifndef DtMessageDispatcher_H_ 00013 #define DtMessageDispatcher_H_ 00014 00015 #include <map> 00016 #include <list> 00017 #include <string> 00018 #include <vector> 00019 #include <vrvUtil/DtMessage.h> 00020 00021 #include <vrvCore/vrvCore.h> 00022 00023 namespace makVrv 00024 { 00025 00026 class DtDe; 00027 class DtProctor; 00028 class DtProxy; 00029 class DtMessage; 00030 class DtMessageClient; 00031 00034 class DT_DLL_VRVCORE DtMessageDispatcher 00035 { 00036 public: 00037 00038 enum 00039 { 00040 theInternalControlId = 1 00041 }; 00042 00043 enum 00044 { 00045 id_AddInterfaceMap = 1 00046 }; 00047 00049 DtMessageDispatcher(bool isMaster); 00050 00053 typedef unsigned short IGIInterfaceID; 00054 00056 virtual ~DtMessageDispatcher(); 00057 00062 void registerProctor(int classId, DtProctor* handler); 00063 00065 DtProctor* findProctor(int classId); 00066 00068 void deliverFromClients(); 00069 00071 void deliverToClients(); 00072 00075 void queueForDelivery(DtMessage* msg, bool toClients = true,bool toLocalInterface = false); 00076 00078 void addClient(DtMessageClient* client); 00079 00081 void removeClient(DtMessageClient* client); 00082 00084 bool hasClients() const; 00085 00087 bool isMaster() const; 00088 00090 void setIsMaster(bool isMaster); 00091 00092 protected: 00093 00095 void sendInterfaceMapToClients(IGIInterfaceID id, const std::string& name); 00096 00099 bool myIsMasterFlag; 00100 00102 IGIInterfaceID myFreeInterfaceId; 00103 00104 typedef std::list<DtMessageClient*> ClientList; 00106 ClientList myClients; 00107 00108 typedef std::map<std::string,IGIInterfaceID> NameIdMap; 00109 NameIdMap myIdLookUp; 00110 00111 typedef std::map<IGIInterfaceID,DtProxy*> IdInterfaceMap; 00112 IdInterfaceMap myInstanceLookUp; 00113 00114 typedef std::list<DtProxy*> InterfaceList; 00115 InterfaceList myUnknownInterfaceList; 00116 00117 typedef std::map<int, DtProctor*> ProctorTable; 00118 ProctorTable myProctors; 00119 00120 typedef std::vector<DtMessage*> MessageList; 00121 MessageList myMessageQueue; 00122 }; 00123 00124 } 00125 #endif