]> git.mxchange.org Git - simgear.git/blob - simgear/hla/RTI13Federate.cxx
d3f9eebc8694ddc0a14ef12a957ef34eb56f683d
[simgear.git] / simgear / hla / RTI13Federate.cxx
1 // Copyright (C) 2009 - 2010  Mathias Froehlich - Mathias.Froehlich@web.de
2 //
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.
7 //
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.
12 //
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.
16 //
17
18 #include "RTI13Federate.hxx"
19
20 #include "RTI13Ambassador.hxx"
21
22 namespace simgear {
23
24 RTI13Federate::RTI13Federate() :
25     _tickTimeout(10),
26     _ambassador(new RTI13Ambassador)
27 {
28 }
29
30 RTI13Federate::~RTI13Federate()
31 {
32 }
33
34 bool
35 RTI13Federate::createFederationExecution(const std::string& federationName, const std::string& objectModel)
36 {
37     try {
38         _ambassador->createFederationExecution(federationName, objectModel);
39         return true;
40     } catch (RTI::FederationExecutionAlreadyExists& e) {
41         return true;
42     } catch (RTI::CouldNotOpenFED& e) {
43         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not create federation execution: " << e._name << " " << e._reason);
44         return false;
45     } catch (RTI::ErrorReadingFED& e) {
46         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not create federation execution: " << e._name << " " << e._reason);
47         return false;
48     } catch (RTI::ConcurrentAccessAttempted& e) {
49         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not create federation execution: " << e._name << " " << e._reason);
50         return false;
51     } catch (RTI::RTIinternalError& e) {
52         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not create federation execution: " << e._name << " " << e._reason);
53         return false;
54     }
55 }
56
57 bool
58 RTI13Federate::destroyFederationExecution(const std::string& federation)
59 {
60     try {
61         _ambassador->destroyFederationExecution(federation);
62         return true;
63     } catch (RTI::FederatesCurrentlyJoined& e) {
64         return true;
65     } catch (RTI::FederationExecutionDoesNotExist& e) {
66         return true;
67     } catch (RTI::ConcurrentAccessAttempted& e) {
68         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not destroy federation execution: " << e._name << " " << e._reason);
69         return false;
70     } catch (RTI::RTIinternalError& e) {
71         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not destroy federation execution: " << e._name << " " << e._reason);
72         return false;
73     }
74 }
75
76 bool
77 RTI13Federate::join(const std::string& federateType, const std::string& federationName)
78 {
79     try {
80         _federateHandle = _ambassador->joinFederationExecution(federateType, federationName);
81         SG_LOG(SG_NETWORK, SG_INFO, "RTI: Joined federation \""
82                << federationName << "\" as \"" << federateType << "\"");
83         setFederateType(federateType);
84         setFederationName(federationName);
85         return true;
86     } catch (RTI::FederateAlreadyExecutionMember& e) {
87         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not join federation execution: " << e._name << " " << e._reason);
88         return false;
89     } catch (RTI::FederationExecutionDoesNotExist& e) {
90         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not join federation execution: " << e._name << " " << e._reason);
91         return false;
92     } catch (RTI::CouldNotOpenFED& e) {
93         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not join federation execution: " << e._name << " " << e._reason);
94         return false;
95     } catch (RTI::ErrorReadingFED& e) {
96         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not join federation execution: " << e._name << " " << e._reason);
97         return false;
98     } catch (RTI::ConcurrentAccessAttempted& e) {
99         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not join federation execution: " << e._name << " " << e._reason);
100         return false;
101     } catch (RTI::SaveInProgress& e) {
102         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not join federation execution: " << e._name << " " << e._reason);
103         return false;
104     } catch (RTI::RestoreInProgress& e) {
105         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not join federation execution: " << e._name << " " << e._reason);
106         return false;
107     } catch (RTI::RTIinternalError& e) {
108         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not join federation execution: " << e._name << " " << e._reason);
109         return false;
110     }
111 }
112
113 bool
114 RTI13Federate::resign()
115 {
116     try {
117         _ambassador->resignFederationExecution();
118         SG_LOG(SG_NETWORK, SG_INFO, "RTI: Resigned from federation.");
119         _federateHandle = -1;
120         return true;
121     } catch (RTI::FederateOwnsAttributes& e) {
122         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
123         return false;
124     } catch (RTI::FederateNotExecutionMember& e) {
125         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
126         return false;
127     } catch (RTI::InvalidResignAction& e) {
128         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
129         return false;
130     } catch (RTI::ConcurrentAccessAttempted& e) {
131         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
132         return false;
133     } catch (RTI::RTIinternalError& e) {
134         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
135         return false;
136     }
137 }
138
139 bool
140 RTI13Federate::registerFederationSynchronizationPoint(const std::string& label, const RTIData& tag)
141 {
142     try {
143         _ambassador->registerFederationSynchronizationPoint(label, tag);
144         SG_LOG(SG_NETWORK, SG_INFO, "RTI: registerFederationSynchronizationPoint(" << label << ", tag )");
145         return true;
146     } catch (RTI::FederateNotExecutionMember& e) {
147         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not register federation synchronization point: " << e._name << " " << e._reason);
148         return false;
149     } catch (RTI::ConcurrentAccessAttempted& e) {
150         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not register federation synchronization point: " << e._name << " " << e._reason);
151         return false;
152     } catch (RTI::SaveInProgress& e) {
153         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not register federation synchronization point: " << e._name << " " << e._reason);
154         return false;
155     } catch (RTI::RestoreInProgress& e) {
156         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not register federation synchronization point: " << e._name << " " << e._reason);
157         return false;
158     } catch (RTI::RTIinternalError& e) {
159         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not register federation synchronization point: " << e._name << " " << e._reason);
160         return false;
161     }
162 }
163
164 bool
165 RTI13Federate::waitForFederationSynchronizationPointAnnounced(const std::string& label)
166 {
167     while (!_ambassador->getFederationSynchronizationPointAnnounced(label)) {
168         _ambassador->tick(_tickTimeout, 0);
169         _ambassador->processQueues();
170     }
171     return true;
172 }
173
174 bool
175 RTI13Federate::synchronizationPointAchieved(const std::string& label)
176 {
177     try {
178         _ambassador->synchronizationPointAchieved(label);
179         SG_LOG(SG_NETWORK, SG_INFO, "RTI: synchronizationPointAchieved(" << label << ")");
180         return true;
181     } catch (RTI::SynchronizationPointLabelWasNotAnnounced& e) {
182         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not signal synchronization point: " << e._name << " " << e._reason);
183         return false;
184     } catch (RTI::FederateNotExecutionMember& e) {
185         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not signal synchronization point: " << e._name << " " << e._reason);
186         return false;
187     } catch (RTI::ConcurrentAccessAttempted& e) {
188         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not signal synchronization point: " << e._name << " " << e._reason);
189         return false;
190     } catch (RTI::SaveInProgress& e) {
191         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not signal synchronization point: " << e._name << " " << e._reason);
192         return false;
193     } catch (RTI::RestoreInProgress& e) {
194         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not signal synchronization point: " << e._name << " " << e._reason);
195         return false;
196     } catch (RTI::RTIinternalError& e) {
197         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not signal synchronization point: " << e._name << " " << e._reason);
198         return false;
199     }
200 }
201
202 bool
203 RTI13Federate::waitForFederationSynchronized(const std::string& label)
204 {
205     while (!_ambassador->getFederationSynchronized(label)) {
206         _ambassador->tick(_tickTimeout, 0);
207         _ambassador->processQueues();
208     }
209     return true;
210 }
211
212 bool
213 RTI13Federate::enableTimeConstrained()
214 {
215     if (!_ambassador.valid()) {
216         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not enable time constrained at unconnected federate.");
217         return false;
218     }
219
220     if (_ambassador->getTimeConstrainedEnabled()) {
221         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Time constrained is already enabled.");
222         return false;
223     }
224
225     try {
226         _ambassador->enableTimeConstrained();
227     } catch (RTI::TimeConstrainedAlreadyEnabled& e) {
228         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
229         return false;
230     } catch (RTI::EnableTimeConstrainedPending& e) {
231         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
232         return false;
233     } catch (RTI::TimeAdvanceAlreadyInProgress& e) {
234         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
235         return false;
236     } catch (RTI::ConcurrentAccessAttempted& e) {
237         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
238         return false;
239     } catch (RTI::FederateNotExecutionMember& e) {
240         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
241         return false;
242     } catch (RTI::SaveInProgress& e) {
243         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
244         return false;
245     } catch (RTI::RestoreInProgress& e) {
246         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
247         return false;
248     } catch (RTI::RTIinternalError& e) {
249         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
250         return false;
251     }
252
253     while (!_ambassador->getTimeConstrainedEnabled()) {
254         _ambassador->tick(_tickTimeout, 0);
255         _ambassador->processQueues();
256     }
257
258     return true;
259 }
260
261 bool
262 RTI13Federate::disableTimeConstrained()
263 {
264     if (!_ambassador.valid()) {
265         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not disable time constrained at unconnected federate.");
266         return false;
267     }
268
269     if (!_ambassador->getTimeConstrainedEnabled()) {
270         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Time constrained is not enabled.");
271         return false;
272     }
273
274     try {
275         _ambassador->disableTimeConstrained();
276     } catch (RTI::TimeConstrainedWasNotEnabled& e) {
277         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
278         return false;
279     } catch (RTI::FederateNotExecutionMember& e) {
280         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
281         return false;
282     } catch (RTI::ConcurrentAccessAttempted& e) {
283         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
284         return false;
285     } catch (RTI::SaveInProgress& e) {
286         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
287         return false;
288     } catch (RTI::RestoreInProgress& e) {
289         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
290         return false;
291     } catch (RTI::RTIinternalError& e) {
292         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
293         return false;
294     }
295
296     return true;
297 }
298
299 bool
300 RTI13Federate::enableTimeRegulation(const SGTimeStamp& lookahead)
301 {
302     if (!_ambassador.valid()) {
303         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not enable time regulation at unconnected federate.");
304         return false;
305     }
306
307     if (_ambassador->getTimeRegulationEnabled()) {
308         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Time regulation already enabled.");
309         return false;
310     }
311
312     try {
313         _ambassador->enableTimeRegulation(SGTimeStamp(), lookahead);
314     } catch (RTI::TimeRegulationAlreadyEnabled& e) {
315         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
316         return false;
317     } catch (RTI::EnableTimeRegulationPending& e) {
318         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
319         return false;
320     } catch (RTI::TimeAdvanceAlreadyInProgress& e) {
321         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
322         return false;
323     } catch (RTI::InvalidFederationTime& e) {
324         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
325         return false;
326     } catch (RTI::InvalidLookahead& e) {
327         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
328         return false;
329     } catch (RTI::ConcurrentAccessAttempted& e) {
330         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
331         return false;
332     } catch (RTI::FederateNotExecutionMember& e) {
333         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
334         return false;
335     } catch (RTI::SaveInProgress& e) {
336         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
337         return false;
338     } catch (RTI::RestoreInProgress& e) {
339         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
340         return false;
341     } catch (RTI::RTIinternalError& e) {
342         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
343         return false;
344     }
345
346     while (!_ambassador->getTimeRegulationEnabled()) {
347         _ambassador->tick(_tickTimeout, 0);
348         _ambassador->processQueues();
349     }
350
351     return true;
352 }
353
354 bool
355 RTI13Federate::disableTimeRegulation()
356 {
357     if (!_ambassador.valid()) {
358         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not disable time regulation at unconnected federate.");
359         return false;
360     }
361
362     if (!_ambassador->getTimeRegulationEnabled()) {
363         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Time regulation is not enabled.");
364         return false;
365     }
366
367     try {
368         _ambassador->disableTimeRegulation();
369     } catch (RTI::TimeRegulationWasNotEnabled& e) {
370         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
371         return false;
372     } catch (RTI::ConcurrentAccessAttempted& e) {
373         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
374         return false;
375     } catch (RTI::FederateNotExecutionMember& e) {
376         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
377         return false;
378     } catch (RTI::SaveInProgress& e) {
379         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
380         return false;
381     } catch (RTI::RestoreInProgress& e) {
382         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
383         return false;
384     } catch (RTI::RTIinternalError& e) {
385         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
386         return false;
387     }
388
389     return true;
390 }
391
392 bool
393 RTI13Federate::timeAdvanceRequestBy(const SGTimeStamp& dt)
394 {
395     if (!_ambassador.valid()) {
396         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not disable time regulation at unconnected federate.");
397         return false;
398     }
399
400     SGTimeStamp fedTime = _ambassador->getCurrentLogicalTime() + dt;
401     return timeAdvanceRequest(fedTime);
402 }
403
404 bool
405 RTI13Federate::timeAdvanceRequest(const SGTimeStamp& fedTime)
406 {
407     if (!_ambassador.valid()) {
408         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not disable time regulation at unconnected federate.");
409         return false;
410     }
411
412     try {
413         _ambassador->timeAdvanceRequest(fedTime);
414     } catch (RTI::InvalidFederationTime& e) {
415         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
416         return false;
417     } catch (RTI::FederationTimeAlreadyPassed& e) {
418         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
419         return false;
420     } catch (RTI::TimeAdvanceAlreadyInProgress& e) {
421         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
422         return false;
423     } catch (RTI::EnableTimeRegulationPending& e) {
424         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
425         return false;
426     } catch (RTI::EnableTimeConstrainedPending& e) {
427         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
428         return false;
429     } catch (RTI::FederateNotExecutionMember& e) {
430         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
431         return false;
432     } catch (RTI::ConcurrentAccessAttempted& e) {
433         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
434         return false;
435     } catch (RTI::SaveInProgress& e) {
436         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
437         return false;
438     } catch (RTI::RestoreInProgress& e) {
439         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
440         return false;
441     } catch (RTI::RTIinternalError& e) {
442         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not resign federation execution: " << e._name << " " << e._reason);
443         return false;
444     }
445
446     while (_ambassador->getTimeAdvancePending()) {
447         _ambassador->tick(_tickTimeout, 0);
448         _ambassador->processQueues();
449     }
450
451     return true;
452 }
453
454 bool
455 RTI13Federate::queryFederateTime(SGTimeStamp& timeStamp)
456 {
457     if (!_ambassador.valid()) {
458         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query federate time.");
459         return false;
460     }
461
462     try {
463         _ambassador->queryFederateTime(timeStamp);
464     } catch (RTI::FederateNotExecutionMember& e) {
465         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query federate time: " << e._name << " " << e._reason);
466         return false;
467     } catch (RTI::ConcurrentAccessAttempted& e) {
468         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query federate time: " << e._name << " " << e._reason);
469         return false;
470     } catch (RTI::SaveInProgress& e) {
471         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query federate time: " << e._name << " " << e._reason);
472         return false;
473     } catch (RTI::RestoreInProgress& e) {
474         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query federate time: " << e._name << " " << e._reason);
475         return false;
476     } catch (RTI::RTIinternalError& e) {
477         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query federate time: " << e._name << " " << e._reason);
478         return false;
479     }
480     return true;
481 }
482
483 bool
484 RTI13Federate::queryLookahead(SGTimeStamp& timeStamp)
485 {
486     if (!_ambassador.valid()) {
487         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query lookahead.");
488         return false;
489     }
490
491     try {
492         _ambassador->queryLookahead(timeStamp);
493     } catch (RTI::FederateNotExecutionMember& e) {
494         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query lookahead: " << e._name << " " << e._reason);
495         return false;
496     } catch (RTI::ConcurrentAccessAttempted& e) {
497         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query lookahead: " << e._name << " " << e._reason);
498         return false;
499     } catch (RTI::SaveInProgress& e) {
500         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query lookahead: " << e._name << " " << e._reason);
501         return false;
502     } catch (RTI::RestoreInProgress& e) {
503         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query lookahead: " << e._name << " " << e._reason);
504         return false;
505     } catch (RTI::RTIinternalError& e) {
506         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not query lookahead: " << e._name << " " << e._reason);
507         return false;
508     }
509     return true;
510 }
511
512 bool
513 RTI13Federate::tick()
514 {
515     bool result = _ambassador->tick();
516     _ambassador->processQueues();
517     return result;
518 }
519
520 bool
521 RTI13Federate::tick(const double& minimum, const double& maximum)
522 {
523     bool result = _ambassador->tick(minimum, maximum);
524     _ambassador->processQueues();
525     return result;
526 }
527
528 RTI13ObjectClass*
529 RTI13Federate::createObjectClass(const std::string& objectClassName, HLAObjectClass* hlaObjectClass)
530 {
531     try {
532         return _ambassador->createObjectClass(objectClassName, hlaObjectClass);
533     } catch (RTI::NameNotFound& e) {
534         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not get object class: " << e._name << " " << e._reason);
535         return 0;
536     } catch (RTI::FederateNotExecutionMember& e) {
537         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not get object class: " << e._name << " " << e._reason);
538         return 0;
539     } catch (RTI::ConcurrentAccessAttempted& e) {
540         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not get object class: " << e._name << " " << e._reason);
541         return 0;
542     } catch (RTI::RTIinternalError& e) {
543         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not get object class: " << e._name << " " << e._reason);
544         return 0;
545     }
546 }
547
548 RTI13ObjectInstance*
549 RTI13Federate::getObjectInstance(const std::string& objectInstanceName)
550 {
551     try {
552         return _ambassador->getObjectInstance(objectInstanceName);
553     } catch (RTI::ObjectNotKnown& e) {
554         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not get object class: " << e._name << " " << e._reason);
555         return 0;
556     } catch (RTI::FederateNotExecutionMember& e) {
557         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not get object class: " << e._name << " " << e._reason);
558         return 0;
559     } catch (RTI::ConcurrentAccessAttempted& e) {
560         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not get object class: " << e._name << " " << e._reason);
561         return 0;
562     } catch (RTI::RTIinternalError& e) {
563         SG_LOG(SG_NETWORK, SG_WARN, "RTI: Could not get object class: " << e._name << " " << e._reason);
564         return 0;
565     }
566 }
567
568 }