return _rtiFederate->timeAdvanceRequest(dt);
}
+bool
+HLAFederate::queryFederateTime(SGTimeStamp& timeStamp)
+{
+ return _rtiFederate->queryFederateTime(timeStamp);
+}
+
+bool
+HLAFederate::queryLookahead(SGTimeStamp& timeStamp)
+{
+ return _rtiFederate->queryLookahead(timeStamp);
+}
+
bool
HLAFederate::tick()
{
bool timeAdvanceRequestBy(const SGTimeStamp& dt);
bool timeAdvanceRequest(const SGTimeStamp& dt);
+ bool queryFederateTime(SGTimeStamp& timeStamp);
+ bool queryLookahead(SGTimeStamp& timeStamp);
+
/// Process messages
bool tick();
bool tick(const double& minimum, const double& maximum);
// }
// return false;
// }
- // bool queryFederateTime(double& time)
- // {
- // try {
- // RTIfedTime fedTime;
- // _rtiAmbassador.queryFederateTime(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 queryLookahead(double& time)
- // {
- // try {
- // RTIfedTime fedTime;
- // _rtiAmbassador.queryLookahead(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;
- // }
+ void queryFederateTime(SGTimeStamp& timeStamp)
+ {
+ RTIfedTime fedTime;
+ _rtiAmbassador.queryFederateTime(fedTime);
+ timeStamp = toTimeStamp(fedTime);
+ }
+ void queryLookahead(SGTimeStamp& timeStamp)
+ {
+ RTIfedTime fedTime;
+ _rtiAmbassador.queryLookahead(fedTime);
+ timeStamp = toTimeStamp(fedTime);
+ }
RTI13ObjectClass* createObjectClass(const std::string& name, HLAObjectClass* hlaObjectClass)
{
return true;
}
+bool
+RTI13Federate::queryFederateTime(SGTimeStamp& timeStamp)
+{
+ if (!_ambassador.valid()) {
+ SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query federate time.");
+ return false;
+ }
+
+ try {
+ _ambassador->queryFederateTime(timeStamp);
+ } catch (RTI::FederateNotExecutionMember& e) {
+ SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query federate time: " << e._name << " " << e._reason);
+ return false;
+ } catch (RTI::ConcurrentAccessAttempted& e) {
+ SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query federate time: " << e._name << " " << e._reason);
+ return false;
+ } catch (RTI::SaveInProgress& e) {
+ SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query federate time: " << e._name << " " << e._reason);
+ return false;
+ } catch (RTI::RestoreInProgress& e) {
+ SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query federate time: " << e._name << " " << e._reason);
+ return false;
+ } catch (RTI::RTIinternalError& e) {
+ SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query federate time: " << e._name << " " << e._reason);
+ return false;
+ }
+ return true;
+}
+
+bool
+RTI13Federate::queryLookahead(SGTimeStamp& timeStamp)
+{
+ if (!_ambassador.valid()) {
+ SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query lookahead.");
+ return false;
+ }
+
+ try {
+ _ambassador->queryLookahead(timeStamp);
+ } catch (RTI::FederateNotExecutionMember& e) {
+ SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query lookahead: " << e._name << " " << e._reason);
+ return false;
+ } catch (RTI::ConcurrentAccessAttempted& e) {
+ SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query lookahead: " << e._name << " " << e._reason);
+ return false;
+ } catch (RTI::SaveInProgress& e) {
+ SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query lookahead: " << e._name << " " << e._reason);
+ return false;
+ } catch (RTI::RestoreInProgress& e) {
+ SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query lookahead: " << e._name << " " << e._reason);
+ return false;
+ } catch (RTI::RTIinternalError& e) {
+ SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query lookahead: " << e._name << " " << e._reason);
+ return false;
+ }
+ return true;
+}
+
bool
RTI13Federate::tick()
{
virtual bool timeAdvanceRequestBy(const SGTimeStamp& dt);
virtual bool timeAdvanceRequest(const SGTimeStamp& fedTime);
+ virtual bool queryFederateTime(SGTimeStamp& timeStamp);
+ virtual bool queryLookahead(SGTimeStamp& timeStamp);
+
/// Process messages
virtual bool tick();
virtual bool tick(const double& minimum, const double& maximum);
virtual bool timeAdvanceRequestBy(const SGTimeStamp& dt) = 0;
virtual bool timeAdvanceRequest(const SGTimeStamp& fedTime) = 0;
+ virtual bool queryFederateTime(SGTimeStamp& timeStamp) = 0;
+ virtual bool queryLookahead(SGTimeStamp& timeStamp) = 0;
+
/// Process messages
virtual bool tick() = 0;
virtual bool tick(const double& minimum, const double& maximum) = 0;