![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2007 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 /****************************************************************************** 00006 ** $RCSfile: DtCigiDriver.h,v $ $Revision: 1.18 $ $State: Exp $ 00007 ******************************************************************************/ 00008 00012 00013 #ifndef DtCigiDriver_H_ 00014 #define DtCigiDriver_H_ 00015 00016 #include <vrvCigi/vrvCigi.h> 00017 00018 #include <vrvCigi/DtCigiViewController.h> 00019 00020 #include <vrvCore/DtDriver.h> 00021 #include <vrvCore/DtSharedSettingsManager.h> 00022 #include <vrvCore/DtUniqueID.h> 00023 #include <vrvCore/DtViewStateProcessor.h> 00024 00025 #include <vrvUtil/DtLockedBufferedQueue.h> 00026 #include <vrvUtil/DtSignalConnectionManager.h> 00027 00028 #include <matrix/vlVector.h> 00029 #include <vlutil/vlRunnable.h> 00030 00031 class DtThread; 00032 00033 namespace makVrv 00034 { 00035 class DtAsynchronousAgentManager; 00036 class DtAsynchronousEventQueue; 00037 class DtCigiConnection; 00038 class DtCigiConnectionInitializer; 00039 class DtCigiIntersectionHandler; 00040 class DtIgSettingsController; 00041 class DtLosResponder; 00042 00047 class DT_DLL_VRVCIGI DtCigiDriver : public DtDriver, 00048 protected DtRunnable 00049 { 00050 public: 00051 00053 DtCigiDriver(DtAgentManager& agentManager, 00054 const std::string& uniqueName); 00055 00057 virtual ~DtCigiDriver(); 00058 00060 virtual const std::string& className() const; 00061 00063 const DtCigiConnectionInitializer& connectionSettings() const; 00064 00066 virtual void setConnectionSettings(const DtCigiConnectionInitializer& settings); 00067 00069 virtual DtConfiguration createConfiguration() const; 00070 00072 virtual void realizeConfiguration(const DtConfiguration& config); 00073 00077 virtual void run(); 00078 00081 virtual DtAgentManagerInterface& sceneInterface(); 00082 00085 virtual bool useThreadFlag() const; 00086 00088 virtual void addDriverFunction(boost::function<void ()> func); 00089 00099 virtual void generateLosResponse(int losId, DtUniqueID entityId, 00100 bool visible, double range, int responseCount, int hostFrame); 00101 00110 virtual void generateHatHotResponse(double height, unsigned int hotId, bool hat, 00111 unsigned int lastFrame, bool valid); 00112 00114 boost::signal<void (DtCigiConnection*)> signal_sessionCreated; 00115 00117 boost::signal<void (DtCigiConnection*)> signal_sessionAboutToBeDestroyed; 00118 00119 00120 protected: 00121 static std::string theCigiDriverClassName; 00122 00123 protected: 00125 virtual bool onStart(); 00126 00128 virtual bool onStop(); 00129 00132 virtual bool onTick(); 00133 00135 virtual void startThread(); 00136 00138 virtual void stopThread(); 00139 00141 virtual void setConnectionState(bool connected); 00142 00144 virtual void slot_onLoadDatabase(const std::string& filename); 00145 00147 virtual void performLoadDatabase(const std::string& filename); 00148 00151 virtual void slot_onCoordinateSystemChanged( 00152 const std::string& name, 00153 const std::string& params); 00154 00156 typedef DtLockedBufferedQueue<boost::function<void ()> > FunctionCallQueue; 00157 typedef std::vector<boost::function<void ()> > FunctionCallList; 00158 00160 virtual void runFunctionQueue(FunctionCallQueue& queue); 00161 00162 protected: 00165 bool myUseThreadFlag; 00166 00168 DtThread* myThread; 00169 00173 DtCigiConnection* myConnection; 00174 00176 DtLosResponder* myLosResponder; 00177 00179 bool myConnectedFlag; 00180 00181 DtCigiConnectionInitializer *myInitializer; 00182 00183 DtAsynchronousEventQueue* myAsynchronousEventQueue; 00184 DtAsynchronousAgentManager* myAsynchronousInterface; 00185 DtDe& myDe; 00186 00187 FunctionCallQueue myDriverThreadFunctions; 00188 FunctionCallQueue mySimulationThreadFunctions; 00189 00190 DtSignalConnectionManager myDynamicSignals; 00191 00193 DtCigiViewController* myViewController; 00194 00197 DtIgSettingsController* myComponentController; 00198 00200 DtCigiIntersectionHandler* myIntersectionHandler; 00201 00203 double myNextFrameTime; 00204 }; 00205 00206 inline const DtCigiConnectionInitializer& DtCigiDriver::connectionSettings() const 00207 { 00208 return (*myInitializer); 00209 } 00210 00213 class DT_DLL_VRVCIGI DtCigiDriverCreator : public DtDriverCreator 00214 { 00215 public: 00216 00218 DtCigiDriverCreator(); 00219 00221 virtual ~DtCigiDriverCreator(); 00222 00225 virtual const std::string& extension() const; 00226 00228 virtual DtDriver* create(DtAgentManager& agentManager, 00229 const std::string& instanceName) const; 00230 00231 protected: 00232 std::string myFileExtension; 00233 00234 }; 00235 } 00236 00237 #endif 00238