![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 00002 #pragma once 00003 00004 #include <vrvVrl/DtVrlinkDriver.h> 00005 #include <vrfVrlSharedSource/DtVrfDriver.h> 00006 #include <vrvVrl/DtVrlinkConnection.h> 00007 #include <vl/exerciseConn.h> 00008 00009 //This class manages passing calls and data from the main (display engine) thread 00010 //to the driver thread, which is what is ticking the DtExerciseConnection. 00011 class DtExConnInterface 00012 { 00013 public: 00014 //Construction is done by the driver thread. 00015 DtExConnInterface(makVrv::DtVrlinkDriver* driver) 00016 : myDriver(driver) 00017 , myExConn(0) 00018 { 00019 makVrv::DT_PROTOCOL_NAMESPACE::DtVrlinkConnection* connection = 00020 dynamic_cast<makVrv::DT_PROTOCOL_NAMESPACE::DtVrlinkConnection*>(driver->connection()); 00021 if (connection) 00022 { 00023 myExConn = connection->exerciseConn(); 00024 } 00025 } 00026 00027 //These functions may be called from a thread other than the driver thread. 00028 void sendCommentInteraction(const DtString& data) 00029 { 00030 //Queue the execute function to be run by the driver thread. 00031 //This bind function puts the arguments into the queue as well, which 00032 //will then be processed by the execute function in the other thread. 00033 myDriver->queueSimulationFunction( 00034 boost::bind(&DtExConnInterface::executeSendCommentInteraction, this, data)); 00035 } 00036 00037 static DtExConnInterface* theExConnInterface; 00038 protected: 00039 00040 //This is the function will get called in the driver thread, and can 00041 //make the normal calls on the exercise connection. 00042 void executeSendCommentInteraction(DtString commentString); 00043 00044 makVrv::DtVrlinkDriver* myDriver; 00045 DtExerciseConn* myExConn; 00046 }; 00047