From 959791ffde7bed820a319fbe228dcafddf7cb645 Mon Sep 17 00:00:00 2001 From: Mathias Froehlich Date: Tue, 30 Aug 2011 07:28:13 +0200 Subject: [PATCH] Add modifyLookahead to the rti abstraction. --- simgear/hla/HLAFederate.cxx | 6 ++++++ simgear/hla/HLAFederate.hxx | 1 + simgear/hla/RTI13Ambassador.hxx | 2 ++ simgear/hla/RTI13Federate.cxx | 31 +++++++++++++++++++++++++++++++ simgear/hla/RTI13Federate.hxx | 1 + simgear/hla/RTIFederate.hxx | 1 + 6 files changed, 42 insertions(+) diff --git a/simgear/hla/HLAFederate.cxx b/simgear/hla/HLAFederate.cxx index 96e31fc3..d16494c9 100644 --- a/simgear/hla/HLAFederate.cxx +++ b/simgear/hla/HLAFederate.cxx @@ -113,6 +113,12 @@ HLAFederate::queryFederateTime(SGTimeStamp& timeStamp) return _rtiFederate->queryFederateTime(timeStamp); } +bool +HLAFederate::modifyLookahead(const SGTimeStamp& timeStamp) +{ + return _rtiFederate->modifyLookahead(timeStamp); +} + bool HLAFederate::queryLookahead(SGTimeStamp& timeStamp) { diff --git a/simgear/hla/HLAFederate.hxx b/simgear/hla/HLAFederate.hxx index 241f6093..7376540e 100644 --- a/simgear/hla/HLAFederate.hxx +++ b/simgear/hla/HLAFederate.hxx @@ -59,6 +59,7 @@ public: bool timeAdvanceRequest(const SGTimeStamp& dt); bool queryFederateTime(SGTimeStamp& timeStamp); + bool modifyLookahead(const SGTimeStamp& timeStamp); bool queryLookahead(SGTimeStamp& timeStamp); /// Process messages diff --git a/simgear/hla/RTI13Ambassador.hxx b/simgear/hla/RTI13Ambassador.hxx index 502a39f7..5446f858 100644 --- a/simgear/hla/RTI13Ambassador.hxx +++ b/simgear/hla/RTI13Ambassador.hxx @@ -387,6 +387,8 @@ public: _rtiAmbassador.queryFederateTime(fedTime); timeStamp = toTimeStamp(fedTime); } + void modifyLookahead(const SGTimeStamp& timeStamp) + { _rtiAmbassador.modifyLookahead(toFedTime(timeStamp)); } void queryLookahead(SGTimeStamp& timeStamp) { RTIfedTime fedTime; diff --git a/simgear/hla/RTI13Federate.cxx b/simgear/hla/RTI13Federate.cxx index d3f9eebc..649a9f58 100644 --- a/simgear/hla/RTI13Federate.cxx +++ b/simgear/hla/RTI13Federate.cxx @@ -480,6 +480,37 @@ RTI13Federate::queryFederateTime(SGTimeStamp& timeStamp) return true; } +bool +RTI13Federate::modifyLookahead(const SGTimeStamp& timeStamp) +{ + if (!_ambassador.valid()) { + SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not modify lookahead."); + return false; + } + try { + _ambassador->modifyLookahead(timeStamp); + } catch (RTI::InvalidLookahead& e) { + SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not modify lookahead: " << e._name << " " << e._reason); + return false; + } catch (RTI::FederateNotExecutionMember& e) { + SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not modify lookahead: " << e._name << " " << e._reason); + return false; + } catch (RTI::ConcurrentAccessAttempted& e) { + SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not modify lookahead: " << e._name << " " << e._reason); + return false; + } catch (RTI::SaveInProgress& e) { + SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not modify lookahead: " << e._name << " " << e._reason); + return false; + } catch (RTI::RestoreInProgress& e) { + SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not modify lookahead: " << e._name << " " << e._reason); + return false; + } catch (RTI::RTIinternalError& e) { + SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not modify lookahead: " << e._name << " " << e._reason); + return false; + } + return true; +} + bool RTI13Federate::queryLookahead(SGTimeStamp& timeStamp) { diff --git a/simgear/hla/RTI13Federate.hxx b/simgear/hla/RTI13Federate.hxx index acad0fce..8ace9e58 100644 --- a/simgear/hla/RTI13Federate.hxx +++ b/simgear/hla/RTI13Federate.hxx @@ -61,6 +61,7 @@ public: virtual bool timeAdvanceRequest(const SGTimeStamp& fedTime); virtual bool queryFederateTime(SGTimeStamp& timeStamp); + virtual bool modifyLookahead(const SGTimeStamp& timeStamp); virtual bool queryLookahead(SGTimeStamp& timeStamp); /// Process messages diff --git a/simgear/hla/RTIFederate.hxx b/simgear/hla/RTIFederate.hxx index bdb68faa..c997704f 100644 --- a/simgear/hla/RTIFederate.hxx +++ b/simgear/hla/RTIFederate.hxx @@ -66,6 +66,7 @@ public: virtual bool timeAdvanceRequest(const SGTimeStamp& fedTime) = 0; virtual bool queryFederateTime(SGTimeStamp& timeStamp) = 0; + virtual bool modifyLookahead(const SGTimeStamp& timeStamp) = 0; virtual bool queryLookahead(SGTimeStamp& timeStamp) = 0; /// Process messages -- 2.39.5