1 // Copyright (C) 2009 - 2012 Mathias Froehlich - Mathias.Froehlich@web.de
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Library General Public
5 // License as published by the Free Software Foundation; either
6 // version 2 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Library General Public License for more details.
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 # include <simgear_config.h>
22 #include <simgear/compiler.h>
24 #include "RTI13Federate.hxx"
26 #include "RTI13Ambassador.hxx"
30 static std::string toStdString(const char* n)
34 return std::string(n);
37 /// Just the interface class doing the callbacks into the parent class
38 struct RTI13Federate::FederateAmbassador : public RTI::FederateAmbassador {
39 FederateAmbassador() :
40 _timeRegulationEnabled(false),
41 _timeConstrainedEnabled(false),
42 _timeAdvancePending(false)
45 virtual ~FederateAmbassador()
46 throw (RTI::FederateInternalError)
50 /// Generic callback to execute some notification on objects in a way that they are not prone to
51 /// ConcurrentAccess exceptions.
52 class QueueCallback : public SGReferenced {
54 virtual ~QueueCallback() {}
55 virtual void operator()(FederateAmbassador& self) = 0;
57 class TagQueueCallback : public QueueCallback {
59 TagQueueCallback(const char* tag)
62 _tag.setData(tag, std::strlen(tag) + 1);
66 virtual ~TagQueueCallback()
71 /// RTI federate ambassador callback functions.
72 virtual void synchronizationPointRegistrationSucceeded(const char* label)
73 throw (RTI::FederateInternalError)
77 virtual void synchronizationPointRegistrationFailed(const char* label)
78 throw (RTI::FederateInternalError)
82 virtual void announceSynchronizationPoint(const char* label, const char* tag)
83 throw (RTI::FederateInternalError)
85 _pendingSyncLabels.insert(toStdString(label));
88 virtual void federationSynchronized(const char* label)
89 throw (RTI::FederateInternalError)
91 std::string s = toStdString(label);
92 _pendingSyncLabels.erase(s);
93 _syncronizedSyncLabels.insert(s);
96 virtual void initiateFederateSave(const char* label)
97 throw (RTI::UnableToPerformSave,
98 RTI::FederateInternalError)
102 virtual void federationSaved()
103 throw (RTI::FederateInternalError)
107 virtual void federationNotSaved()
108 throw (RTI::FederateInternalError)
112 virtual void requestFederationRestoreSucceeded(const char* label)
113 throw (RTI::FederateInternalError)
117 virtual void requestFederationRestoreFailed(const char* label, const char* reason)
118 throw (RTI::FederateInternalError)
122 virtual void federationRestoreBegun()
123 throw (RTI::FederateInternalError)
127 virtual void initiateFederateRestore(const char* label, RTI::FederateHandle federateHandle)
128 throw (RTI::SpecifiedSaveLabelDoesNotExist,
129 RTI::CouldNotRestore,
130 RTI::FederateInternalError)
134 virtual void federationRestored()
135 throw (RTI::FederateInternalError)
139 virtual void federationNotRestored()
140 throw (RTI::FederateInternalError)
144 // Declaration Management
145 class StartRegistrationForObjectClassCallback : public QueueCallback {
147 StartRegistrationForObjectClassCallback(RTI::ObjectClassHandle objectClassHandle) :
148 _objectClassHandle(objectClassHandle)
150 virtual void operator()(FederateAmbassador& self)
151 { self.startRegistrationForObjectClassCallback(_objectClassHandle); }
153 RTI::ObjectClassHandle _objectClassHandle;
155 virtual void startRegistrationForObjectClass(RTI::ObjectClassHandle objectClassHandle)
156 throw (RTI::ObjectClassNotPublished,
157 RTI::FederateInternalError)
158 { _queueCallbackList.push_back(new StartRegistrationForObjectClassCallback(objectClassHandle)); }
159 void startRegistrationForObjectClassCallback(RTI::ObjectClassHandle objectClassHandle)
161 ObjectClassMap::iterator i = _objectClassMap.find(objectClassHandle);
162 if (i == _objectClassMap.end())
164 if (!i->second.valid())
166 i->second->startRegistration();
169 class StopRegistrationForObjectClassCallback : public QueueCallback {
171 StopRegistrationForObjectClassCallback(RTI::ObjectClassHandle objectClassHandle) :
172 _objectClassHandle(objectClassHandle)
174 virtual void operator()(FederateAmbassador& self)
175 { self.stopRegistrationForObjectClassCallback(_objectClassHandle); }
177 RTI::ObjectClassHandle _objectClassHandle;
179 virtual void stopRegistrationForObjectClass(RTI::ObjectClassHandle objectClassHandle)
180 throw (RTI::ObjectClassNotPublished,
181 RTI::FederateInternalError)
182 { _queueCallbackList.push_back(new StopRegistrationForObjectClassCallback(objectClassHandle)); }
183 void stopRegistrationForObjectClassCallback(RTI::ObjectClassHandle objectClassHandle)
185 ObjectClassMap::iterator i = _objectClassMap.find(objectClassHandle);
186 if (i == _objectClassMap.end())
188 if (!i->second.valid())
190 i->second->stopRegistration();
193 virtual void turnInteractionsOn(RTI::InteractionClassHandle interactionClassHandle)
194 throw (RTI::InteractionClassNotPublished,
195 RTI::FederateInternalError)
199 virtual void turnInteractionsOff(RTI::InteractionClassHandle interactionClassHandle)
200 throw (RTI::InteractionClassNotPublished,
201 RTI::FederateInternalError)
206 class DiscoverObjectCallback : public TagQueueCallback {
208 DiscoverObjectCallback(RTI::ObjectHandle objectHandle, RTI::ObjectClassHandle objectClassHandle, const char *tag) :
209 TagQueueCallback(tag),
210 _objectHandle(objectHandle),
211 _objectClassHandle(objectClassHandle)
213 virtual void operator()(FederateAmbassador& self)
214 { self.discoverObjectInstanceCallback(_objectHandle, _objectClassHandle, _tag); }
216 RTI::ObjectHandle _objectHandle;
217 RTI::ObjectClassHandle _objectClassHandle;
219 virtual void discoverObjectInstance(RTI::ObjectHandle objectHandle, RTI::ObjectClassHandle objectClassHandle, const char* tag)
220 throw (RTI::CouldNotDiscover,
221 RTI::ObjectClassNotKnown,
222 RTI::FederateInternalError)
223 { _queueCallbackList.push_back(new DiscoverObjectCallback(objectHandle, objectClassHandle, tag)); }
224 void discoverObjectInstanceCallback(RTI::ObjectHandle objectHandle, RTI::ObjectClassHandle objectClassHandle, const RTIData& tag)
226 ObjectClassMap::iterator i = _objectClassMap.find(objectClassHandle);
227 if (i == _objectClassMap.end())
229 if (!i->second.valid())
231 SGSharedPtr<RTI13ObjectInstance> objectInstance = new RTI13ObjectInstance(objectHandle, 0, i->second, _rtiAmbassador.get());
232 _objectInstanceMap[objectHandle] = objectInstance;
233 i->second->discoverInstance(objectInstance.get(), tag);
236 class ReflectAttributeValuesTimestampCallback : public TagQueueCallback {
238 ReflectAttributeValuesTimestampCallback(RTI::ObjectHandle objectHandle,
239 RTI13AttributeHandleDataPairList& attributeHandleDataPairList,
240 const SGTimeStamp& timeStamp, const char *tag) :
241 TagQueueCallback(tag),
242 _objectHandle(objectHandle),
243 _timeStamp(timeStamp)
245 _attributeHandleDataPairList.swap(attributeHandleDataPairList);
247 virtual void operator()(FederateAmbassador& self)
249 self.reflectAttributeValuesCallback(_objectHandle, _attributeHandleDataPairList, _timeStamp, _tag);
250 self.freeAttributeHandleDataPairList(_attributeHandleDataPairList);
253 RTI::ObjectHandle _objectHandle;
254 RTI13AttributeHandleDataPairList _attributeHandleDataPairList;
255 SGTimeStamp _timeStamp;
257 virtual void reflectAttributeValues(RTI::ObjectHandle objectHandle, const RTI::AttributeHandleValuePairSet& attributeValuePairSet,
258 const RTI::FedTime& fedTime, const char* tag, RTI::EventRetractionHandle eventRetractionHandle)
259 throw (RTI::ObjectNotKnown,
260 RTI::AttributeNotKnown,
261 RTI::FederateOwnsAttributes,
262 RTI::InvalidFederationTime,
263 RTI::FederateInternalError)
265 RTI13AttributeHandleDataPairList attributeHandleDataPairList;
267 RTI::ULong numAttribs = attributeValuePairSet.size();
268 for (RTI::ULong i = 0; i < numAttribs; ++i) {
269 appendAttributeHandleDataPair(attributeHandleDataPairList);
270 attributeHandleDataPairList.back().first = attributeValuePairSet.getHandle(i);
271 RTI::ULong length = attributeValuePairSet.getValueLength(i);
272 attributeHandleDataPairList.back().second.resize(length);
273 attributeValuePairSet.getValue(i, attributeHandleDataPairList.back().second.data(), length);
276 _queueCallbackList.push_back(new ReflectAttributeValuesTimestampCallback(objectHandle, attributeHandleDataPairList,
277 RTI13Ambassador::toTimeStamp(fedTime), tag));
279 void reflectAttributeValuesCallback(RTI::ObjectHandle objectHandle, RTI13AttributeHandleDataPairList& attributeHandleDataPairList,
280 const SGTimeStamp& timeStamp, const RTIData& tag)
282 ObjectInstanceMap::iterator i = _objectInstanceMap.find(objectHandle);
283 if (i == _objectInstanceMap.end())
285 if (!i->second.valid())
287 i->second->reflectAttributeValues(attributeHandleDataPairList, timeStamp, tag, _indexPool);
290 class ReflectAttributeValuesCallback : public TagQueueCallback {
292 ReflectAttributeValuesCallback(RTI::ObjectHandle objectHandle, RTI13AttributeHandleDataPairList& attributeHandleDataPairList,
294 TagQueueCallback(tag),
295 _objectHandle(objectHandle)
297 _attributeHandleDataPairList.swap(attributeHandleDataPairList);
299 virtual void operator()(FederateAmbassador& self)
301 self.reflectAttributeValuesCallback(_objectHandle, _attributeHandleDataPairList, _tag);
302 self.freeAttributeHandleDataPairList(_attributeHandleDataPairList);
305 RTI::ObjectHandle _objectHandle;
306 RTI13AttributeHandleDataPairList _attributeHandleDataPairList;
308 virtual void reflectAttributeValues(RTI::ObjectHandle objectHandle, const RTI::AttributeHandleValuePairSet& attributeValuePairSet,
310 throw (RTI::ObjectNotKnown,
311 RTI::AttributeNotKnown,
312 RTI::FederateOwnsAttributes,
313 RTI::FederateInternalError)
315 RTI13AttributeHandleDataPairList attributeHandleDataPairList;
317 RTI::ULong numAttribs = attributeValuePairSet.size();
318 for (RTI::ULong i = 0; i < numAttribs; ++i) {
319 appendAttributeHandleDataPair(attributeHandleDataPairList);
320 attributeHandleDataPairList.back().first = attributeValuePairSet.getHandle(i);
321 RTI::ULong length = attributeValuePairSet.getValueLength(i);
322 attributeHandleDataPairList.back().second.resize(length);
323 attributeValuePairSet.getValue(i, attributeHandleDataPairList.back().second.data(), length);
326 _queueCallbackList.push_back(new ReflectAttributeValuesCallback(objectHandle, attributeHandleDataPairList, tag));
328 void reflectAttributeValuesCallback(RTI::ObjectHandle objectHandle, RTI13AttributeHandleDataPairList& attributeHandleDataPairList,
331 ObjectInstanceMap::iterator i = _objectInstanceMap.find(objectHandle);
332 if (i == _objectInstanceMap.end())
334 if (!i->second.valid())
336 i->second->reflectAttributeValues(attributeHandleDataPairList, tag, _indexPool);
339 virtual void receiveInteraction(RTI::InteractionClassHandle interactionClassHandle, const RTI::ParameterHandleValuePairSet& parameters,
340 const RTI::FedTime& fedTime, const char* tag, RTI::EventRetractionHandle eventRetractionHandle)
341 throw (RTI::InteractionClassNotKnown,
342 RTI::InteractionParameterNotKnown,
343 RTI::InvalidFederationTime,
344 RTI::FederateInternalError)
348 virtual void receiveInteraction(RTI::InteractionClassHandle interactionClassHandle,
349 const RTI::ParameterHandleValuePairSet& parameters, const char* tag)
350 throw (RTI::InteractionClassNotKnown,
351 RTI::InteractionParameterNotKnown,
352 RTI::FederateInternalError)
356 class RemoveObjectTimestampCallback : public TagQueueCallback {
358 RemoveObjectTimestampCallback(RTI::ObjectHandle objectHandle, const SGTimeStamp& timeStamp, const char* tag) :
359 TagQueueCallback(tag),
360 _objectHandle(objectHandle),
361 _timeStamp(timeStamp)
363 virtual void operator()(FederateAmbassador& self)
364 { self.removeObjectInstanceCallback(_objectHandle, _timeStamp, _tag); }
366 RTI::ObjectHandle _objectHandle;
367 SGTimeStamp _timeStamp;
369 virtual void removeObjectInstance(RTI::ObjectHandle objectHandle, const RTI::FedTime& fedTime,
370 const char* tag, RTI::EventRetractionHandle eventRetractionHandle)
371 throw (RTI::ObjectNotKnown,
372 RTI::InvalidFederationTime,
373 RTI::FederateInternalError)
374 { _queueCallbackList.push_back(new RemoveObjectTimestampCallback(objectHandle, RTI13Ambassador::toTimeStamp(fedTime), tag)); }
375 void removeObjectInstanceCallback(RTI::ObjectHandle objectHandle, const SGTimeStamp& timeStamp, const RTIData& tag)
377 ObjectInstanceMap::iterator i = _objectInstanceMap.find(objectHandle);
378 if (i == _objectInstanceMap.end())
380 if (i->second.valid())
381 i->second->removeInstance(tag);
382 _objectInstanceMap.erase(i);
385 class RemoveObjectCallback : public TagQueueCallback {
387 RemoveObjectCallback(RTI::ObjectHandle objectHandle, const char* tag) :
388 TagQueueCallback(tag),
389 _objectHandle(objectHandle)
391 virtual void operator()(FederateAmbassador& self)
392 { self.removeObjectInstanceCallback(_objectHandle, _tag); }
394 RTI::ObjectHandle _objectHandle;
396 virtual void removeObjectInstance(RTI::ObjectHandle objectHandle, const char* tag)
397 throw (RTI::ObjectNotKnown,
398 RTI::FederateInternalError)
399 { _queueCallbackList.push_back(new RemoveObjectCallback(objectHandle, tag)); }
400 void removeObjectInstanceCallback(RTI::ObjectHandle objectHandle, const RTIData& tag)
402 ObjectInstanceMap::iterator i = _objectInstanceMap.find(objectHandle);
403 if (i == _objectInstanceMap.end())
405 if (i->second.valid())
406 i->second->removeInstance(tag);
407 _objectInstanceMap.erase(i);
410 class AttributeHandleSetCallback : public QueueCallback {
412 AttributeHandleSetCallback(RTI::ObjectHandle objectHandle, const RTI::AttributeHandleSet& attributeHandleSet) :
413 _objectHandle(objectHandle)
415 RTI::ULong numAttribs = attributeHandleSet.size();
416 _attributes.reserve(numAttribs);
417 for (RTI::ULong i = 0; i < numAttribs; ++i)
418 _attributes.push_back(attributeHandleSet.getHandle(i));
421 RTI::ObjectHandle _objectHandle;
422 std::vector<RTI::AttributeHandle> _attributes;
424 class AttributesInScopeCallback : public AttributeHandleSetCallback {
426 AttributesInScopeCallback(RTI::ObjectHandle objectHandle, const RTI::AttributeHandleSet& attributes) :
427 AttributeHandleSetCallback(objectHandle, attributes)
429 virtual void operator()(FederateAmbassador& self)
430 { self.attributesInScopeCallback(_objectHandle, _attributes); }
432 virtual void attributesInScope(RTI::ObjectHandle objectHandle, const RTI::AttributeHandleSet& attributes)
433 throw (RTI::ObjectNotKnown,
434 RTI::AttributeNotKnown,
435 RTI::FederateInternalError)
436 { _queueCallbackList.push_back(new AttributesInScopeCallback(objectHandle, attributes)); }
437 void attributesInScopeCallback(RTI::ObjectHandle objectHandle, const std::vector<RTI::AttributeHandle>& attributes)
439 ObjectInstanceMap::iterator i = _objectInstanceMap.find(objectHandle);
440 if (i == _objectInstanceMap.end())
442 if (!i->second.valid())
444 i->second->attributesInScope(attributes);
447 class AttributesOutOfScopeCallback : public AttributeHandleSetCallback {
449 AttributesOutOfScopeCallback(RTI::ObjectHandle objectHandle, const RTI::AttributeHandleSet& attributes) :
450 AttributeHandleSetCallback(objectHandle, attributes)
452 virtual void operator()(FederateAmbassador& self)
453 { self.attributesOutOfScopeCallback(_objectHandle, _attributes); }
455 virtual void attributesOutOfScope(RTI::ObjectHandle objectHandle, const RTI::AttributeHandleSet& attributes)
456 throw (RTI::ObjectNotKnown,
457 RTI::AttributeNotKnown,
458 RTI::FederateInternalError)
459 { _queueCallbackList.push_back(new AttributesOutOfScopeCallback(objectHandle, attributes)); }
460 void attributesOutOfScopeCallback(RTI::ObjectHandle objectHandle, const std::vector<RTI::AttributeHandle>& attributes)
462 ObjectInstanceMap::iterator i = _objectInstanceMap.find(objectHandle);
463 if (i == _objectInstanceMap.end())
465 if (!i->second.valid())
467 i->second->attributesOutOfScope(attributes);
470 class ProvideAttributeValueUpdateCallback : public AttributeHandleSetCallback {
472 ProvideAttributeValueUpdateCallback(RTI::ObjectHandle objectHandle, const RTI::AttributeHandleSet& attributes) :
473 AttributeHandleSetCallback(objectHandle, attributes)
475 virtual void operator()(FederateAmbassador& self)
476 { self.provideAttributeValueUpdateCallback(_objectHandle, _attributes); }
478 virtual void provideAttributeValueUpdate(RTI::ObjectHandle objectHandle, const RTI::AttributeHandleSet& attributes)
479 throw (RTI::ObjectNotKnown,
480 RTI::AttributeNotKnown,
481 RTI::AttributeNotOwned,
482 RTI::FederateInternalError)
483 { _queueCallbackList.push_back(new ProvideAttributeValueUpdateCallback(objectHandle, attributes)); }
484 void provideAttributeValueUpdateCallback(RTI::ObjectHandle objectHandle, const std::vector<RTI::AttributeHandle>& attributes)
486 ObjectInstanceMap::iterator i = _objectInstanceMap.find(objectHandle);
487 if (i == _objectInstanceMap.end())
489 if (!i->second.valid())
491 i->second->provideAttributeValueUpdate(attributes);
494 class TurnUpdatesOnForObjectInstanceCallback : public AttributeHandleSetCallback {
496 TurnUpdatesOnForObjectInstanceCallback(RTI::ObjectHandle objectHandle, const RTI::AttributeHandleSet& attributes) :
497 AttributeHandleSetCallback(objectHandle, attributes)
499 virtual void operator()(FederateAmbassador& self)
500 { self.turnUpdatesOnForObjectInstanceCallback(_objectHandle, _attributes); }
502 virtual void turnUpdatesOnForObjectInstance(RTI::ObjectHandle objectHandle, const RTI::AttributeHandleSet& attributes)
503 throw (RTI::ObjectNotKnown,
504 RTI::AttributeNotOwned,
505 RTI::FederateInternalError)
506 { _queueCallbackList.push_back(new TurnUpdatesOnForObjectInstanceCallback(objectHandle, attributes)); }
507 void turnUpdatesOnForObjectInstanceCallback(RTI::ObjectHandle objectHandle, const std::vector<RTI::AttributeHandle>& attributes)
509 ObjectInstanceMap::iterator i = _objectInstanceMap.find(objectHandle);
510 if (i == _objectInstanceMap.end())
512 if (!i->second.valid())
514 i->second->turnUpdatesOnForObjectInstance(attributes);
517 class TurnUpdatesOffForObjectInstanceCallback : public AttributeHandleSetCallback {
519 TurnUpdatesOffForObjectInstanceCallback(RTI::ObjectHandle objectHandle, const RTI::AttributeHandleSet& attributes) :
520 AttributeHandleSetCallback(objectHandle, attributes)
522 virtual void operator()(FederateAmbassador& self)
523 { self.turnUpdatesOffForObjectInstanceCallback(_objectHandle, _attributes); }
525 virtual void turnUpdatesOffForObjectInstance(RTI::ObjectHandle objectHandle, const RTI::AttributeHandleSet& attributes)
526 throw (RTI::ObjectNotKnown,
527 RTI::AttributeNotOwned,
528 RTI::FederateInternalError)
529 { _queueCallbackList.push_back(new TurnUpdatesOffForObjectInstanceCallback(objectHandle, attributes)); }
530 void turnUpdatesOffForObjectInstanceCallback(RTI::ObjectHandle objectHandle, const std::vector<RTI::AttributeHandle>& attributes)
532 ObjectInstanceMap::iterator i = _objectInstanceMap.find(objectHandle);
533 if (i == _objectInstanceMap.end())
535 if (!i->second.valid())
537 i->second->turnUpdatesOffForObjectInstance(attributes);
540 // Ownership Management
541 class RequestAttributeOwnershipAssumptionCallback : public AttributeHandleSetCallback {
543 RequestAttributeOwnershipAssumptionCallback(RTI::ObjectHandle objectHandle, const RTI::AttributeHandleSet& attributes, const RTIData& tag) :
544 AttributeHandleSetCallback(objectHandle, attributes),
547 virtual void operator()(FederateAmbassador& self)
548 { self.requestAttributeOwnershipAssumptionCallback(_objectHandle, _attributes, _tag); }
552 virtual void requestAttributeOwnershipAssumption(RTI::ObjectHandle objectHandle,
553 const RTI::AttributeHandleSet& attributes, const char* tag)
554 throw (RTI::ObjectNotKnown,
555 RTI::AttributeNotKnown,
556 RTI::AttributeAlreadyOwned,
557 RTI::AttributeNotPublished,
558 RTI::FederateInternalError)
559 { _queueCallbackList.push_back(new RequestAttributeOwnershipAssumptionCallback(objectHandle, attributes, tagToData(tag))); }
560 void requestAttributeOwnershipAssumptionCallback(RTI::ObjectHandle objectHandle, std::vector<RTI::AttributeHandle>& attributes, const RTIData& tag)
562 ObjectInstanceMap::iterator i = _objectInstanceMap.find(objectHandle);
563 if (i == _objectInstanceMap.end())
565 if (!i->second.valid())
567 i->second->requestAttributeOwnershipAssumption(attributes, tag);
570 class AttributeOwnershipDivestitureNotificationCallback : public AttributeHandleSetCallback {
572 AttributeOwnershipDivestitureNotificationCallback(RTI::ObjectHandle objectHandle, const RTI::AttributeHandleSet& attributes) :
573 AttributeHandleSetCallback(objectHandle, attributes)
575 virtual void operator()(FederateAmbassador& self)
576 { self.attributeOwnershipDivestitureNotificationCallback(_objectHandle, _attributes); }
578 virtual void attributeOwnershipDivestitureNotification(RTI::ObjectHandle objectHandle, const RTI::AttributeHandleSet& attributes)
579 throw (RTI::ObjectNotKnown,
580 RTI::AttributeNotKnown,
581 RTI::AttributeNotOwned,
582 RTI::AttributeDivestitureWasNotRequested,
583 RTI::FederateInternalError)
584 { _queueCallbackList.push_back(new AttributeOwnershipDivestitureNotificationCallback(objectHandle, attributes)); }
585 void attributeOwnershipDivestitureNotificationCallback(RTI::ObjectHandle objectHandle, const std::vector<RTI::AttributeHandle>& attributes)
587 ObjectInstanceMap::iterator i = _objectInstanceMap.find(objectHandle);
588 if (i == _objectInstanceMap.end())
590 if (!i->second.valid())
592 i->second->attributeOwnershipDivestitureNotification(attributes);
595 class AttributeOwnershipAcquisitionNotificationCallback : public AttributeHandleSetCallback {
597 AttributeOwnershipAcquisitionNotificationCallback(RTI::ObjectHandle objectHandle, const RTI::AttributeHandleSet& attributes) :
598 AttributeHandleSetCallback(objectHandle, attributes)
600 virtual void operator()(FederateAmbassador& self)
601 { self.attributeOwnershipAcquisitionNotificationCallback(_objectHandle, _attributes); }
603 virtual void attributeOwnershipAcquisitionNotification(RTI::ObjectHandle objectHandle, const RTI::AttributeHandleSet& attributes)
604 throw (RTI::ObjectNotKnown,
605 RTI::AttributeNotKnown,
606 RTI::AttributeAcquisitionWasNotRequested,
607 RTI::AttributeAlreadyOwned,
608 RTI::AttributeNotPublished,
609 RTI::FederateInternalError)
610 { _queueCallbackList.push_back(new AttributeOwnershipAcquisitionNotificationCallback(objectHandle, attributes)); }
611 void attributeOwnershipAcquisitionNotificationCallback(RTI::ObjectHandle objectHandle, const std::vector<RTI::AttributeHandle>& attributes)
613 ObjectInstanceMap::iterator i = _objectInstanceMap.find(objectHandle);
614 if (i == _objectInstanceMap.end())
616 if (!i->second.valid())
618 i->second->attributeOwnershipAcquisitionNotification(attributes);
621 class AttributeOwnershipUnavailableCallback : public AttributeHandleSetCallback {
623 AttributeOwnershipUnavailableCallback(RTI::ObjectHandle objectHandle, const RTI::AttributeHandleSet& attributes) :
624 AttributeHandleSetCallback(objectHandle, attributes)
626 virtual void operator()(FederateAmbassador& self)
627 { self.attributeOwnershipUnavailableCallback(_objectHandle, _attributes); }
629 virtual void attributeOwnershipUnavailable(RTI::ObjectHandle objectHandle, const RTI::AttributeHandleSet& attributes)
630 throw (RTI::ObjectNotKnown,
631 RTI::AttributeNotKnown,
632 RTI::AttributeAlreadyOwned,
633 RTI::AttributeAcquisitionWasNotRequested,
634 RTI::FederateInternalError)
635 { _queueCallbackList.push_back(new AttributeOwnershipUnavailableCallback(objectHandle, attributes)); }
636 void attributeOwnershipUnavailableCallback(RTI::ObjectHandle objectHandle, const std::vector<RTI::AttributeHandle>& attributes)
638 ObjectInstanceMap::iterator i = _objectInstanceMap.find(objectHandle);
639 if (i == _objectInstanceMap.end())
641 if (!i->second.valid())
643 i->second->attributeOwnershipUnavailable(attributes);
646 class RequestAttributeOwnershipReleaseCallback : public AttributeHandleSetCallback {
648 RequestAttributeOwnershipReleaseCallback(RTI::ObjectHandle objectHandle, const RTI::AttributeHandleSet& attributes, const RTIData& tag) :
649 AttributeHandleSetCallback(objectHandle, attributes),
652 virtual void operator()(FederateAmbassador& self)
653 { self.requestAttributeOwnershipReleaseCallback(_objectHandle, _attributes, _tag); }
657 virtual void requestAttributeOwnershipRelease(RTI::ObjectHandle objectHandle,
658 const RTI::AttributeHandleSet& attributes, const char* tag)
659 throw (RTI::ObjectNotKnown,
660 RTI::AttributeNotKnown,
661 RTI::AttributeNotOwned,
662 RTI::FederateInternalError)
663 { _queueCallbackList.push_back(new RequestAttributeOwnershipReleaseCallback(objectHandle, attributes, tagToData(tag))); }
664 void requestAttributeOwnershipReleaseCallback(RTI::ObjectHandle objectHandle, std::vector<RTI::AttributeHandle>& attributes, const RTIData& tag)
666 ObjectInstanceMap::iterator i = _objectInstanceMap.find(objectHandle);
667 if (i == _objectInstanceMap.end())
669 if (!i->second.valid())
671 i->second->requestAttributeOwnershipRelease(attributes, tag);
674 class ConfirmAttributeOwnershipAcquisitionCancellationCallback : public AttributeHandleSetCallback {
676 ConfirmAttributeOwnershipAcquisitionCancellationCallback(RTI::ObjectHandle objectHandle, const RTI::AttributeHandleSet& attributes) :
677 AttributeHandleSetCallback(objectHandle, attributes)
679 virtual void operator()(FederateAmbassador& self)
680 { self.confirmAttributeOwnershipAcquisitionCancellationCallback(_objectHandle, _attributes); }
682 virtual void confirmAttributeOwnershipAcquisitionCancellation(RTI::ObjectHandle objectHandle, const RTI::AttributeHandleSet& attributes)
683 throw (RTI::ObjectNotKnown,
684 RTI::AttributeNotKnown,
685 RTI::AttributeAlreadyOwned,
686 RTI::AttributeAcquisitionWasNotCanceled,
687 RTI::FederateInternalError)
688 { _queueCallbackList.push_back(new ConfirmAttributeOwnershipAcquisitionCancellationCallback(objectHandle, attributes)); }
689 void confirmAttributeOwnershipAcquisitionCancellationCallback(RTI::ObjectHandle objectHandle, const std::vector<RTI::AttributeHandle>& attributes)
691 ObjectInstanceMap::iterator i = _objectInstanceMap.find(objectHandle);
692 if (i == _objectInstanceMap.end())
694 if (!i->second.valid())
696 i->second->confirmAttributeOwnershipAcquisitionCancellation(attributes);
699 class InformAttributeOwnershipCallback : public QueueCallback {
701 InformAttributeOwnershipCallback(RTI::ObjectHandle objectHandle, RTI::AttributeHandle attributeHandle, RTI::FederateHandle federateHandle) :
702 _objectHandle(objectHandle),
703 _attributeHandle(attributeHandle),
704 _federateHandle(federateHandle)
706 virtual void operator()(FederateAmbassador& self)
707 { self.informAttributeOwnershipCallback(_objectHandle, _attributeHandle, _federateHandle); }
709 RTI::ObjectHandle _objectHandle;
710 RTI::AttributeHandle _attributeHandle;
711 RTI::FederateHandle _federateHandle;
713 virtual void informAttributeOwnership(RTI::ObjectHandle objectHandle, RTI::AttributeHandle attributeHandle,
714 RTI::FederateHandle federateHandle)
715 throw (RTI::ObjectNotKnown,
716 RTI::AttributeNotKnown,
717 RTI::FederateInternalError)
718 { _queueCallbackList.push_back(new InformAttributeOwnershipCallback(objectHandle, attributeHandle, federateHandle)); }
719 void informAttributeOwnershipCallback(RTI::ObjectHandle objectHandle, RTI::AttributeHandle attributeHandle, RTI::FederateHandle federateHandle)
721 ObjectInstanceMap::iterator i = _objectInstanceMap.find(objectHandle);
722 if (i == _objectInstanceMap.end())
724 if (!i->second.valid())
726 i->second->informAttributeOwnership(attributeHandle, federateHandle);
729 class AttributeIsNotOwnedCallback : public QueueCallback {
731 AttributeIsNotOwnedCallback(RTI::ObjectHandle objectHandle, RTI::AttributeHandle attributeHandle) :
732 _objectHandle(objectHandle),
733 _attributeHandle(attributeHandle)
735 virtual void operator()(FederateAmbassador& self)
736 { self.attributeIsNotOwnedCallback(_objectHandle, _attributeHandle); }
738 RTI::ObjectHandle _objectHandle;
739 RTI::AttributeHandle _attributeHandle;
741 virtual void attributeIsNotOwned(RTI::ObjectHandle objectHandle, RTI::AttributeHandle attributeHandle)
742 throw (RTI::ObjectNotKnown,
743 RTI::AttributeNotKnown,
744 RTI::FederateInternalError)
745 { _queueCallbackList.push_back(new AttributeIsNotOwnedCallback(objectHandle, attributeHandle)); }
746 void attributeIsNotOwnedCallback(RTI::ObjectHandle objectHandle, RTI::AttributeHandle attributeHandle)
748 ObjectInstanceMap::iterator i = _objectInstanceMap.find(objectHandle);
749 if (i == _objectInstanceMap.end())
751 if (!i->second.valid())
753 i->second->attributeIsNotOwned(attributeHandle);
756 class AttributeOwnedByRTICallback : public QueueCallback {
758 AttributeOwnedByRTICallback(RTI::ObjectHandle objectHandle, RTI::AttributeHandle attributeHandle) :
759 _objectHandle(objectHandle),
760 _attributeHandle(attributeHandle)
762 virtual void operator()(FederateAmbassador& self)
763 { self.attributeOwnedByRTICallback(_objectHandle, _attributeHandle); }
765 RTI::ObjectHandle _objectHandle;
766 RTI::AttributeHandle _attributeHandle;
768 virtual void attributeOwnedByRTI(RTI::ObjectHandle objectHandle, RTI::AttributeHandle attributeHandle)
769 throw (RTI::ObjectNotKnown,
770 RTI::AttributeNotKnown,
771 RTI::FederateInternalError)
772 { _queueCallbackList.push_back(new AttributeOwnedByRTICallback(objectHandle, attributeHandle)); }
773 void attributeOwnedByRTICallback(RTI::ObjectHandle objectHandle, RTI::AttributeHandle attributeHandle)
775 ObjectInstanceMap::iterator i = _objectInstanceMap.find(objectHandle);
776 if (i == _objectInstanceMap.end())
778 if (!i->second.valid())
780 i->second->attributeOwnedByRTI(attributeHandle);
784 virtual void timeRegulationEnabled(const RTI::FedTime& fedTime)
785 throw (RTI::InvalidFederationTime,
786 RTI::EnableTimeRegulationWasNotPending,
787 RTI::FederateInternalError)
789 _timeRegulationEnabled = true;
790 SG_LOG(SG_NETWORK, SG_INFO, "RTI: timeRegulationEnabled: " << RTI13Ambassador::toTimeStamp(fedTime));
793 virtual void timeConstrainedEnabled(const RTI::FedTime& fedTime)
794 throw (RTI::InvalidFederationTime,
795 RTI::EnableTimeConstrainedWasNotPending,
796 RTI::FederateInternalError)
798 _timeConstrainedEnabled = true;
799 SG_LOG(SG_NETWORK, SG_INFO, "RTI: timeConstrainedEnabled: " << RTI13Ambassador::toTimeStamp(fedTime));
802 virtual void timeAdvanceGrant(const RTI::FedTime& fedTime)
803 throw (RTI::InvalidFederationTime,
804 RTI::TimeAdvanceWasNotInProgress,
805 RTI::FederateInternalError)
807 _timeAdvancePending = false;
808 // SG_LOG(SG_NETWORK, SG_INFO, "RTI: timeAdvanceGrant: " << RTI13Ambassador::toTimeStamp(fedTime));
811 virtual void requestRetraction(RTI::EventRetractionHandle eventRetractionHandle)
812 throw (RTI::EventNotKnown,
813 RTI::FederateInternalError)
815 // No retraction concept yet
818 // processes the queues that filled up during the past
821 while (!_queueCallbackList.empty()) {
822 (*_queueCallbackList.front())(*this);
823 // _queueCallbackListPool.splice();
824 _queueCallbackList.pop_front();
828 bool getFederationSynchronizationPointAnnounced(const std::string& label)
829 { return _pendingSyncLabels.find(label) != _pendingSyncLabels.end(); }
830 bool getFederationSynchronized(const std::string& label)
832 std::set<std::string>::iterator i = _syncronizedSyncLabels.find(label);
833 if (i == _syncronizedSyncLabels.end())
835 _syncronizedSyncLabels.erase(i);
839 // The rtiambassador to issue requests
840 SGSharedPtr<RTI13Ambassador> _rtiAmbassador;
842 // All the sync labels we got an announcement for
843 std::set<std::string> _pendingSyncLabels;
844 std::set<std::string> _syncronizedSyncLabels;
846 // All that calls back into user code is just queued.
847 // That is to make sure we do not call recursively into the RTI
848 typedef std::list<SGSharedPtr<QueueCallback> > QueueCallbackList;
849 QueueCallbackList _queueCallbackList;
850 // QueueCallbackList _queueCallbackListPool;
852 RTI13AttributeHandleDataPairList _attributeHandleDataPairPool;
853 void appendAttributeHandleDataPair(RTI13AttributeHandleDataPairList& attributeHandleDataPairList)
855 if (_attributeHandleDataPairPool.empty())
856 attributeHandleDataPairList.push_back(RTI13AttributeHandleDataPair());
858 attributeHandleDataPairList.splice(attributeHandleDataPairList.end(),
859 _attributeHandleDataPairPool, _attributeHandleDataPairPool.begin());
861 void freeAttributeHandleDataPairList(RTI13AttributeHandleDataPairList& attributeHandleDataPairList)
862 { _attributeHandleDataPairPool.splice(_attributeHandleDataPairPool.end(), attributeHandleDataPairList); }
864 // For attribute reflection, pool or indices
865 HLAIndexList _indexPool;
867 // Top level information for dispatching federate object attribute updates
868 typedef std::map<RTI::ObjectHandle, SGSharedPtr<RTI13ObjectInstance> > ObjectInstanceMap;
869 // Map of all available objects
870 ObjectInstanceMap _objectInstanceMap;
872 // Top level information for dispatching creation of federate objects
873 typedef std::map<RTI::ObjectClassHandle, SGSharedPtr<RTI13ObjectClass> > ObjectClassMap;
874 ObjectClassMap _objectClassMap;
876 // Top level information for dispatching creation of federate objects
877 typedef std::map<RTI::InteractionClassHandle, SGSharedPtr<RTI13InteractionClass> > InteractionClassMap;
878 InteractionClassMap _interactionClassMap;
880 bool _timeRegulationEnabled;
881 bool _timeConstrainedEnabled;
882 bool _timeAdvancePending;
885 const RTIData& tagToData(const char* tag)
888 _cachedTag.setData(tag, std::strlen(tag) + 1);
890 _cachedTag.setData("", 1);
896 RTI13Federate::RTI13Federate(const std::list<std::string>& stringList) :
898 _ambassador(new RTI13Ambassador),
899 _federateAmbassador(new FederateAmbassador)
901 _ambassador->_federate = this;
902 _federateAmbassador->_rtiAmbassador = _ambassador;
903 if (stringList.empty()) {
904 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Ignoring non empty connect arguments while connecting to an RTI13 federation!");
908 RTI13Federate::~RTI13Federate()
911 _ambassador->resignFederationExecution();
912 delete _federateAmbassador;
915 RTI13Federate::FederationManagementResult
916 RTI13Federate::createFederationExecution(const std::string& federationName, const std::string& objectModel)
919 _ambassador->createFederationExecution(federationName, objectModel);
920 return FederationManagementSuccess;
921 } catch (RTI::FederationExecutionAlreadyExists& e) {
922 return FederationManagementFail;
923 } catch (RTI::CouldNotOpenFED& e) {
924 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not create federation execution: " << e._name << " " << e._reason);
925 return FederationManagementFatal;
926 } catch (RTI::ErrorReadingFED& e) {
927 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not create federation execution: " << e._name << " " << e._reason);
928 return FederationManagementFatal;
929 } catch (RTI::ConcurrentAccessAttempted& e) {
930 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not create federation execution: " << e._name << " " << e._reason);
931 return FederationManagementFatal;
932 } catch (RTI::RTIinternalError& e) {
933 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not create federation execution: " << e._name << " " << e._reason);
934 return FederationManagementFatal;
938 RTI13Federate::FederationManagementResult
939 RTI13Federate::destroyFederationExecution(const std::string& federation)
942 _ambassador->destroyFederationExecution(federation);
943 return FederationManagementSuccess;
944 } catch (RTI::FederatesCurrentlyJoined& e) {
945 return FederationManagementFail;
946 } catch (RTI::FederationExecutionDoesNotExist& e) {
947 return FederationManagementFail;
948 } catch (RTI::ConcurrentAccessAttempted& e) {
949 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not destroy federation execution: " << e._name << " " << e._reason);
950 return FederationManagementFatal;
951 } catch (RTI::RTIinternalError& e) {
952 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not destroy federation execution: " << e._name << " " << e._reason);
953 return FederationManagementFatal;
957 RTI13Federate::FederationManagementResult
958 RTI13Federate::join(const std::string& federateType, const std::string& federationName)
961 _federateHandle = _ambassador->joinFederationExecution(federateType, federationName, _federateAmbassador);
962 SG_LOG(SG_NETWORK, SG_INFO, "RTI: Joined federation \""
963 << federationName << "\" as \"" << federateType << "\"");
965 return FederationManagementSuccess;
966 } catch (RTI::FederateAlreadyExecutionMember& e) {
967 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not join federation execution: " << e._name << " " << e._reason);
968 return FederationManagementFatal;
969 } catch (RTI::FederationExecutionDoesNotExist& e) {
970 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not join federation execution: " << e._name << " " << e._reason);
971 return FederationManagementFail;
972 } catch (RTI::CouldNotOpenFED& e) {
973 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not join federation execution: " << e._name << " " << e._reason);
974 return FederationManagementFatal;
975 } catch (RTI::ErrorReadingFED& e) {
976 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not join federation execution: " << e._name << " " << e._reason);
977 return FederationManagementFatal;
978 } catch (RTI::ConcurrentAccessAttempted& e) {
979 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not join federation execution: " << e._name << " " << e._reason);
980 return FederationManagementFatal;
981 } catch (RTI::SaveInProgress& e) {
982 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not join federation execution: " << e._name << " " << e._reason);
983 return FederationManagementFatal;
984 } catch (RTI::RestoreInProgress& e) {
985 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not join federation execution: " << e._name << " " << e._reason);
986 return FederationManagementFatal;
987 } catch (RTI::RTIinternalError& e) {
988 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not join federation execution: " << e._name << " " << e._reason);
989 return FederationManagementFatal;
994 RTI13Federate::resign()
997 _ambassador->resignFederationExecution();
998 SG_LOG(SG_NETWORK, SG_INFO, "RTI: Resigned from federation.");
1000 _federateHandle = -1;
1002 } catch (RTI::FederateOwnsAttributes& e) {
1003 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
1005 } catch (RTI::FederateNotExecutionMember& e) {
1006 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
1008 } catch (RTI::InvalidResignAction& e) {
1009 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
1011 } catch (RTI::ConcurrentAccessAttempted& e) {
1012 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
1014 } catch (RTI::RTIinternalError& e) {
1015 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
1021 RTI13Federate::getJoined() const
1027 RTI13Federate::registerFederationSynchronizationPoint(const std::string& label, const RTIData& tag)
1030 _ambassador->registerFederationSynchronizationPoint(label, tag);
1031 SG_LOG(SG_NETWORK, SG_INFO, "RTI: registerFederationSynchronizationPoint(" << label << ", tag )");
1033 } catch (RTI::FederateNotExecutionMember& e) {
1034 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not register federation synchronization point: " << e._name << " " << e._reason);
1036 } catch (RTI::ConcurrentAccessAttempted& e) {
1037 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not register federation synchronization point: " << e._name << " " << e._reason);
1039 } catch (RTI::SaveInProgress& e) {
1040 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not register federation synchronization point: " << e._name << " " << e._reason);
1042 } catch (RTI::RestoreInProgress& e) {
1043 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not register federation synchronization point: " << e._name << " " << e._reason);
1045 } catch (RTI::RTIinternalError& e) {
1046 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not register federation synchronization point: " << e._name << " " << e._reason);
1052 RTI13Federate::getFederationSynchronizationPointAnnounced(const std::string& label)
1054 return _federateAmbassador->getFederationSynchronizationPointAnnounced(label);
1058 RTI13Federate::synchronizationPointAchieved(const std::string& label)
1061 _ambassador->synchronizationPointAchieved(label);
1062 SG_LOG(SG_NETWORK, SG_INFO, "RTI: synchronizationPointAchieved(" << label << ")");
1064 } catch (RTI::SynchronizationPointLabelWasNotAnnounced& e) {
1065 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not signal synchronization point: " << e._name << " " << e._reason);
1067 } catch (RTI::FederateNotExecutionMember& e) {
1068 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not signal synchronization point: " << e._name << " " << e._reason);
1070 } catch (RTI::ConcurrentAccessAttempted& e) {
1071 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not signal synchronization point: " << e._name << " " << e._reason);
1073 } catch (RTI::SaveInProgress& e) {
1074 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not signal synchronization point: " << e._name << " " << e._reason);
1076 } catch (RTI::RestoreInProgress& e) {
1077 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not signal synchronization point: " << e._name << " " << e._reason);
1079 } catch (RTI::RTIinternalError& e) {
1080 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not signal synchronization point: " << e._name << " " << e._reason);
1086 RTI13Federate::getFederationSynchronized(const std::string& label)
1088 return _federateAmbassador->getFederationSynchronized(label);
1092 RTI13Federate::enableTimeConstrained()
1094 if (!_ambassador.valid()) {
1095 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not enable time constrained at unconnected federate.");
1099 if (_federateAmbassador->_timeConstrainedEnabled) {
1100 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Time constrained is already enabled.");
1105 _ambassador->enableTimeConstrained();
1106 } catch (RTI::TimeConstrainedAlreadyEnabled& e) {
1107 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not enable time constrained: " << e._name << " " << e._reason);
1109 } catch (RTI::EnableTimeConstrainedPending& e) {
1110 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not enable time constrained: " << e._name << " " << e._reason);
1112 } catch (RTI::TimeAdvanceAlreadyInProgress& e) {
1113 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not enable time constrained: " << e._name << " " << e._reason);
1115 } catch (RTI::ConcurrentAccessAttempted& e) {
1116 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not enable time constrained: " << e._name << " " << e._reason);
1118 } catch (RTI::FederateNotExecutionMember& e) {
1119 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not enable time constrained: " << e._name << " " << e._reason);
1121 } catch (RTI::SaveInProgress& e) {
1122 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not enable time constrained: " << e._name << " " << e._reason);
1124 } catch (RTI::RestoreInProgress& e) {
1125 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not enable time constrained: " << e._name << " " << e._reason);
1127 } catch (RTI::RTIinternalError& e) {
1128 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not enable time constrained: " << e._name << " " << e._reason);
1136 RTI13Federate::disableTimeConstrained()
1138 if (!_ambassador.valid()) {
1139 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not disable time constrained at unconnected federate.");
1143 if (!_federateAmbassador->_timeConstrainedEnabled) {
1144 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Time constrained is not enabled.");
1149 _ambassador->disableTimeConstrained();
1150 _federateAmbassador->_timeConstrainedEnabled = false;
1151 } catch (RTI::TimeConstrainedWasNotEnabled& e) {
1152 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not disable time constrained: " << e._name << " " << e._reason);
1154 } catch (RTI::FederateNotExecutionMember& e) {
1155 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not disable time constrained: " << e._name << " " << e._reason);
1157 } catch (RTI::ConcurrentAccessAttempted& e) {
1158 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not disable time constrained: " << e._name << " " << e._reason);
1160 } catch (RTI::SaveInProgress& e) {
1161 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not disable time constrained: " << e._name << " " << e._reason);
1163 } catch (RTI::RestoreInProgress& e) {
1164 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not disable time constrained: " << e._name << " " << e._reason);
1166 } catch (RTI::RTIinternalError& e) {
1167 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not disable time constrained: " << e._name << " " << e._reason);
1175 RTI13Federate::getTimeConstrainedEnabled()
1177 return _federateAmbassador->_timeConstrainedEnabled;
1181 RTI13Federate::enableTimeRegulation(const SGTimeStamp& lookahead)
1183 if (!_ambassador.valid()) {
1184 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not enable time regulation at unconnected federate.");
1188 if (_federateAmbassador->_timeRegulationEnabled) {
1189 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Time regulation already enabled.");
1194 _ambassador->enableTimeRegulation(lookahead);
1195 } catch (RTI::TimeRegulationAlreadyEnabled& e) {
1196 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not enable time regulation: " << e._name << " " << e._reason);
1198 } catch (RTI::EnableTimeRegulationPending& e) {
1199 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not enable time regulation: " << e._name << " " << e._reason);
1201 } catch (RTI::TimeAdvanceAlreadyInProgress& e) {
1202 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not enable time regulation: " << e._name << " " << e._reason);
1204 } catch (RTI::InvalidFederationTime& e) {
1205 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not enable time regulation: " << e._name << " " << e._reason);
1207 } catch (RTI::InvalidLookahead& e) {
1208 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not enable time regulation: " << e._name << " " << e._reason);
1210 } catch (RTI::ConcurrentAccessAttempted& e) {
1211 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not enable time regulation: " << e._name << " " << e._reason);
1213 } catch (RTI::FederateNotExecutionMember& e) {
1214 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not enable time regulation: " << e._name << " " << e._reason);
1216 } catch (RTI::SaveInProgress& e) {
1217 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not enable time regulation: " << e._name << " " << e._reason);
1219 } catch (RTI::RestoreInProgress& e) {
1220 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not enable time regulation: " << e._name << " " << e._reason);
1222 } catch (RTI::RTIinternalError& e) {
1223 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not enable time regulation: " << e._name << " " << e._reason);
1231 RTI13Federate::disableTimeRegulation()
1233 if (!_ambassador.valid()) {
1234 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not disable time regulation at unconnected federate.");
1238 if (!_federateAmbassador->_timeRegulationEnabled) {
1239 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Time regulation is not enabled.");
1244 _ambassador->disableTimeRegulation();
1245 _federateAmbassador->_timeRegulationEnabled = false;
1246 } catch (RTI::TimeRegulationWasNotEnabled& e) {
1247 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not disable time regulation: " << e._name << " " << e._reason);
1249 } catch (RTI::ConcurrentAccessAttempted& e) {
1250 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not disable time regulation: " << e._name << " " << e._reason);
1252 } catch (RTI::FederateNotExecutionMember& e) {
1253 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not disable time regulation: " << e._name << " " << e._reason);
1255 } catch (RTI::SaveInProgress& e) {
1256 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not disable time regulation: " << e._name << " " << e._reason);
1258 } catch (RTI::RestoreInProgress& e) {
1259 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not disable time regulation: " << e._name << " " << e._reason);
1261 } catch (RTI::RTIinternalError& e) {
1262 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not disable time regulation: " << e._name << " " << e._reason);
1270 RTI13Federate::modifyLookahead(const SGTimeStamp& timeStamp)
1272 if (!_ambassador.valid()) {
1273 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not modify lookahead.");
1277 _ambassador->modifyLookahead(timeStamp);
1278 } catch (RTI::InvalidLookahead& e) {
1279 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not modify lookahead: " << e._name << " " << e._reason);
1281 } catch (RTI::FederateNotExecutionMember& e) {
1282 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not modify lookahead: " << e._name << " " << e._reason);
1284 } catch (RTI::ConcurrentAccessAttempted& e) {
1285 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not modify lookahead: " << e._name << " " << e._reason);
1287 } catch (RTI::SaveInProgress& e) {
1288 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not modify lookahead: " << e._name << " " << e._reason);
1290 } catch (RTI::RestoreInProgress& e) {
1291 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not modify lookahead: " << e._name << " " << e._reason);
1293 } catch (RTI::RTIinternalError& e) {
1294 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not modify lookahead: " << e._name << " " << e._reason);
1301 RTI13Federate::getTimeRegulationEnabled()
1303 return _federateAmbassador->_timeRegulationEnabled;
1307 RTI13Federate::timeAdvanceRequest(const SGTimeStamp& timeStamp)
1309 if (!_ambassador.valid()) {
1310 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not advance time at unconnected federate.");
1315 _ambassador->timeAdvanceRequest(timeStamp);
1316 _federateAmbassador->_timeAdvancePending = true;
1317 } catch (RTI::InvalidFederationTime& e) {
1318 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not advance time: " << e._name << " " << e._reason);
1320 } catch (RTI::FederationTimeAlreadyPassed& e) {
1321 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not advance time: " << e._name << " " << e._reason);
1323 } catch (RTI::TimeAdvanceAlreadyInProgress& e) {
1324 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not advance time: " << e._name << " " << e._reason);
1326 } catch (RTI::EnableTimeRegulationPending& e) {
1327 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not advance time: " << e._name << " " << e._reason);
1329 } catch (RTI::EnableTimeConstrainedPending& e) {
1330 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not advance time: " << e._name << " " << e._reason);
1332 } catch (RTI::FederateNotExecutionMember& e) {
1333 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not advance time: " << e._name << " " << e._reason);
1335 } catch (RTI::ConcurrentAccessAttempted& e) {
1336 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not advance time: " << e._name << " " << e._reason);
1338 } catch (RTI::SaveInProgress& e) {
1339 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not advance time: " << e._name << " " << e._reason);
1341 } catch (RTI::RestoreInProgress& e) {
1342 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not advance time: " << e._name << " " << e._reason);
1344 } catch (RTI::RTIinternalError& e) {
1345 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not advance time: " << e._name << " " << e._reason);
1353 RTI13Federate::timeAdvanceRequestAvailable(const SGTimeStamp& timeStamp)
1355 if (!_ambassador.valid()) {
1356 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not advance time at unconnected federate.");
1361 _ambassador->timeAdvanceRequestAvailable(timeStamp);
1362 _federateAmbassador->_timeAdvancePending = true;
1363 } catch (RTI::InvalidFederationTime& e) {
1364 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not advance time: " << e._name << " " << e._reason);
1366 } catch (RTI::FederationTimeAlreadyPassed& e) {
1367 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not advance time: " << e._name << " " << e._reason);
1369 } catch (RTI::TimeAdvanceAlreadyInProgress& e) {
1370 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not advance time: " << e._name << " " << e._reason);
1372 } catch (RTI::EnableTimeRegulationPending& e) {
1373 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not advance time: " << e._name << " " << e._reason);
1375 } catch (RTI::EnableTimeConstrainedPending& e) {
1376 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not advance time: " << e._name << " " << e._reason);
1378 } catch (RTI::FederateNotExecutionMember& e) {
1379 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not advance time: " << e._name << " " << e._reason);
1381 } catch (RTI::ConcurrentAccessAttempted& e) {
1382 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not advance time: " << e._name << " " << e._reason);
1384 } catch (RTI::SaveInProgress& e) {
1385 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not advance time: " << e._name << " " << e._reason);
1387 } catch (RTI::RestoreInProgress& e) {
1388 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not advance time: " << e._name << " " << e._reason);
1390 } catch (RTI::RTIinternalError& e) {
1391 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not advance time: " << e._name << " " << e._reason);
1399 RTI13Federate::flushQueueRequest(const SGTimeStamp& timeStamp)
1401 if (!_ambassador.valid()) {
1402 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not flush queue at unconnected federate.");
1407 _ambassador->flushQueueRequest(timeStamp);
1408 _federateAmbassador->_timeAdvancePending = true;
1409 } catch (RTI::InvalidFederationTime& e) {
1410 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not flush queue: " << e._name << " " << e._reason);
1412 } catch (RTI::FederationTimeAlreadyPassed& e) {
1413 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not flush queue: " << e._name << " " << e._reason);
1415 } catch (RTI::TimeAdvanceAlreadyInProgress& e) {
1416 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not flush queue: " << e._name << " " << e._reason);
1418 } catch (RTI::EnableTimeRegulationPending& e) {
1419 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not flush queue: " << e._name << " " << e._reason);
1421 } catch (RTI::EnableTimeConstrainedPending& e) {
1422 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not flush queue: " << e._name << " " << e._reason);
1424 } catch (RTI::FederateNotExecutionMember& e) {
1425 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not flush queue: " << e._name << " " << e._reason);
1427 } catch (RTI::ConcurrentAccessAttempted& e) {
1428 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not flush queue: " << e._name << " " << e._reason);
1430 } catch (RTI::SaveInProgress& e) {
1431 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not flush queue: " << e._name << " " << e._reason);
1433 } catch (RTI::RestoreInProgress& e) {
1434 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not flush queue: " << e._name << " " << e._reason);
1436 } catch (RTI::RTIinternalError& e) {
1437 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not flush queue: " << e._name << " " << e._reason);
1445 RTI13Federate::getTimeAdvancePending()
1447 return _federateAmbassador->_timeAdvancePending;
1451 RTI13Federate::queryFederateTime(SGTimeStamp& timeStamp)
1453 if (!_ambassador.valid()) {
1454 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query federate time.");
1459 _ambassador->queryFederateTime(timeStamp);
1460 } catch (RTI::FederateNotExecutionMember& e) {
1461 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query federate time: " << e._name << " " << e._reason);
1463 } catch (RTI::ConcurrentAccessAttempted& e) {
1464 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query federate time: " << e._name << " " << e._reason);
1466 } catch (RTI::SaveInProgress& e) {
1467 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query federate time: " << e._name << " " << e._reason);
1469 } catch (RTI::RestoreInProgress& e) {
1470 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query federate time: " << e._name << " " << e._reason);
1472 } catch (RTI::RTIinternalError& e) {
1473 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query federate time: " << e._name << " " << e._reason);
1480 RTI13Federate::queryLookahead(SGTimeStamp& timeStamp)
1482 if (!_ambassador.valid()) {
1483 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query lookahead.");
1488 _ambassador->queryLookahead(timeStamp);
1489 } catch (RTI::FederateNotExecutionMember& e) {
1490 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query lookahead: " << e._name << " " << e._reason);
1492 } catch (RTI::ConcurrentAccessAttempted& e) {
1493 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query lookahead: " << e._name << " " << e._reason);
1495 } catch (RTI::SaveInProgress& e) {
1496 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query lookahead: " << e._name << " " << e._reason);
1498 } catch (RTI::RestoreInProgress& e) {
1499 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query lookahead: " << e._name << " " << e._reason);
1501 } catch (RTI::RTIinternalError& e) {
1502 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query lookahead: " << e._name << " " << e._reason);
1509 RTI13Federate::queryGALT(SGTimeStamp& timeStamp)
1511 if (!_ambassador.valid()) {
1512 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query GALT.");
1517 return _ambassador->queryGALT(timeStamp);
1518 } catch (RTI::FederateNotExecutionMember& e) {
1519 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query GALT: " << e._name << " " << e._reason);
1521 } catch (RTI::ConcurrentAccessAttempted& e) {
1522 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query GALT: " << e._name << " " << e._reason);
1524 } catch (RTI::SaveInProgress& e) {
1525 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query GALT: " << e._name << " " << e._reason);
1527 } catch (RTI::RestoreInProgress& e) {
1528 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query GALT: " << e._name << " " << e._reason);
1530 } catch (RTI::RTIinternalError& e) {
1531 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query GALT: " << e._name << " " << e._reason);
1538 RTI13Federate::queryLITS(SGTimeStamp& timeStamp)
1540 if (!_ambassador.valid()) {
1541 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query LITS.");
1546 return _ambassador->queryLITS(timeStamp);
1547 } catch (RTI::FederateNotExecutionMember& e) {
1548 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query LITS: " << e._name << " " << e._reason);
1550 } catch (RTI::ConcurrentAccessAttempted& e) {
1551 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query LITS: " << e._name << " " << e._reason);
1553 } catch (RTI::SaveInProgress& e) {
1554 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query LITS: " << e._name << " " << e._reason);
1556 } catch (RTI::RestoreInProgress& e) {
1557 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query LITS: " << e._name << " " << e._reason);
1559 } catch (RTI::RTIinternalError& e) {
1560 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query LITS: " << e._name << " " << e._reason);
1567 RTI13Federate::processMessage()
1569 bool result = _ambassador->tick();
1570 _federateAmbassador->processQueues();
1575 RTI13Federate::processMessages(const double& minimum, const double& maximum)
1577 bool result = _ambassador->tick(minimum, 0);
1578 _federateAmbassador->processQueues();
1581 SGTimeStamp timeStamp = SGTimeStamp::now() + SGTimeStamp::fromSec(maximum);
1583 result = _ambassador->tick(0, 0);
1584 _federateAmbassador->processQueues();
1585 } while (result && SGTimeStamp::now() <= timeStamp);
1590 RTI13Federate::createObjectClass(const std::string& objectClassName, HLAObjectClass* hlaObjectClass)
1593 RTI::ObjectClassHandle objectClassHandle;
1594 objectClassHandle = _ambassador->getObjectClassHandle(objectClassName);
1595 if (_federateAmbassador->_objectClassMap.find(objectClassHandle) != _federateAmbassador->_objectClassMap.end()) {
1596 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not create object class, object class already exists!");
1599 RTI13ObjectClass* rtiObjectClass;
1600 rtiObjectClass = new RTI13ObjectClass(hlaObjectClass, objectClassHandle, _ambassador.get());
1601 _federateAmbassador->_objectClassMap[objectClassHandle] = rtiObjectClass;
1602 return rtiObjectClass;
1603 } catch (RTI::NameNotFound& e) {
1604 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not get object class: " << e._name << " " << e._reason);
1606 } catch (RTI::FederateNotExecutionMember& e) {
1607 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not get object class: " << e._name << " " << e._reason);
1609 } catch (RTI::ConcurrentAccessAttempted& e) {
1610 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not get object class: " << e._name << " " << e._reason);
1612 } catch (RTI::RTIinternalError& e) {
1613 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not get object class: " << e._name << " " << e._reason);
1618 RTI13InteractionClass*
1619 RTI13Federate::createInteractionClass(const std::string& interactionClassName, HLAInteractionClass* interactionClass)
1622 RTI::InteractionClassHandle interactionClassHandle;
1623 interactionClassHandle = _ambassador->getInteractionClassHandle(interactionClassName);
1624 if (_federateAmbassador->_interactionClassMap.find(interactionClassHandle) != _federateAmbassador->_interactionClassMap.end()) {
1625 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not create interaction class, interaction class already exists!");
1628 RTI13InteractionClass* rtiInteractionClass;
1629 rtiInteractionClass = new RTI13InteractionClass(interactionClass, interactionClassHandle, _ambassador.get());
1630 _federateAmbassador->_interactionClassMap[interactionClassHandle] = rtiInteractionClass;
1631 return rtiInteractionClass;
1632 } catch (RTI::NameNotFound& e) {
1633 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not get interaction class: " << e._name << " " << e._reason);
1635 } catch (RTI::FederateNotExecutionMember& e) {
1636 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not get interaction class: " << e._name << " " << e._reason);
1638 } catch (RTI::ConcurrentAccessAttempted& e) {
1639 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not get interaction class: " << e._name << " " << e._reason);
1641 } catch (RTI::RTIinternalError& e) {
1642 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not get interaction class: " << e._name << " " << e._reason);
1647 RTI13ObjectInstance*
1648 RTI13Federate::getObjectInstance(const std::string& objectInstanceName)
1651 RTI::ObjectHandle objectHandle;
1652 objectHandle = _ambassador->getObjectInstanceHandle(objectInstanceName);
1653 FederateAmbassador::ObjectInstanceMap::iterator i = _federateAmbassador->_objectInstanceMap.find(objectHandle);
1654 if (i == _federateAmbassador->_objectInstanceMap.end()) {
1655 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not get object instance: ObjectInstance not found.");
1659 } catch (RTI::ObjectNotKnown& e) {
1660 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not get object instance: " << e._name << " " << e._reason);
1662 } catch (RTI::FederateNotExecutionMember& e) {
1663 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not get object instance: " << e._name << " " << e._reason);
1665 } catch (RTI::ConcurrentAccessAttempted& e) {
1666 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not get object instance: " << e._name << " " << e._reason);
1668 } catch (RTI::RTIinternalError& e) {
1669 SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not get object instance: " << e._name << " " << e._reason);
1675 RTI13Federate::insertObjectInstance(RTI13ObjectInstance* objectInstance)
1677 _federateAmbassador->_objectInstanceMap[objectInstance->getHandle()] = objectInstance;