/// Time Management
- void enableTimeRegulation(const SGTimeStamp& federateTime, const SGTimeStamp& lookahead)
- { _rtiAmbassador.enableTimeRegulation(toFedTime(federateTime), toFedTime(lookahead)); }
+ void enableTimeRegulation(const SGTimeStamp& lookahead)
+ {
+ RTIfedTime federateTime;
+ federateTime.setZero();
+ _rtiAmbassador.enableTimeRegulation(federateTime, toFedTime(lookahead));
+ }
void disableTimeRegulation()
{ _rtiAmbassador.disableTimeRegulation();}
void timeAdvanceRequestAvailable(const SGTimeStamp& time)
{ _rtiAmbassador.timeAdvanceRequestAvailable(toFedTime(time)); }
- // bool queryLBTS(double& time)
- // {
- // try {
- // RTIfedTime fedTime;
- // _rtiAmbassador.queryLBTS(fedTime);
- // time = fedTime.getTime();
- // return true;
- // } catch (RTI::FederateNotExecutionMember& e) {
- // } catch (RTI::ConcurrentAccessAttempted& e) {
- // } catch (RTI::SaveInProgress& e) {
- // } catch (RTI::RestoreInProgress& e) {
- // } catch (RTI::RTIinternalError& e) {
- // }
- // return false;
- // }
+ bool queryGALT(SGTimeStamp& timeStamp)
+ {
+ RTIfedTime fedTime;
+ fedTime.setPositiveInfinity();
+ _rtiAmbassador.queryLBTS(fedTime);
+ if (fedTime.isPositiveInfinity())
+ return false;
+ timeStamp = toTimeStamp(fedTime);
+ return true;
+ }
+ bool queryLITS(SGTimeStamp& timeStamp)
+ {
+ RTIfedTime fedTime;
+ fedTime.setPositiveInfinity();
+ _rtiAmbassador.queryMinNextEventTime(fedTime);
+ if (fedTime.isPositiveInfinity())
+ return false;
+ timeStamp = toTimeStamp(fedTime);
+ return true;
+ }
void queryFederateTime(SGTimeStamp& timeStamp)
{
RTIfedTime fedTime;
}
try {
- _ambassador->enableTimeRegulation(SGTimeStamp(), lookahead);
+ _ambassador->enableTimeRegulation(lookahead);
} catch (RTI::TimeRegulationAlreadyEnabled& e) {
SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
return false;
return true;
}
+bool
+RTI13Federate::queryGALT(SGTimeStamp& timeStamp)
+{
+ if (!_ambassador.valid()) {
+ SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query GALT.");
+ return false;
+ }
+
+ try {
+ return _ambassador->queryGALT(timeStamp);
+ } catch (RTI::FederateNotExecutionMember& e) {
+ SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query GALT: " << e._name << " " << e._reason);
+ return false;
+ } catch (RTI::ConcurrentAccessAttempted& e) {
+ SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query GALT: " << e._name << " " << e._reason);
+ return false;
+ } catch (RTI::SaveInProgress& e) {
+ SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query GALT: " << e._name << " " << e._reason);
+ return false;
+ } catch (RTI::RestoreInProgress& e) {
+ SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query GALT: " << e._name << " " << e._reason);
+ return false;
+ } catch (RTI::RTIinternalError& e) {
+ SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query GALT: " << e._name << " " << e._reason);
+ return false;
+ }
+ return true;
+}
+
+bool
+RTI13Federate::queryLITS(SGTimeStamp& timeStamp)
+{
+ if (!_ambassador.valid()) {
+ SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query LITS.");
+ return false;
+ }
+
+ try {
+ return _ambassador->queryLITS(timeStamp);
+ } catch (RTI::FederateNotExecutionMember& e) {
+ SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query LITS: " << e._name << " " << e._reason);
+ return false;
+ } catch (RTI::ConcurrentAccessAttempted& e) {
+ SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query LITS: " << e._name << " " << e._reason);
+ return false;
+ } catch (RTI::SaveInProgress& e) {
+ SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query LITS: " << e._name << " " << e._reason);
+ return false;
+ } catch (RTI::RestoreInProgress& e) {
+ SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query LITS: " << e._name << " " << e._reason);
+ return false;
+ } catch (RTI::RTIinternalError& e) {
+ SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query LITS: " << e._name << " " << e._reason);
+ return false;
+ }
+ return true;
+}
+
bool
RTI13Federate::tick()
{