]> git.mxchange.org Git - simgear.git/blob - simgear/hla/RTI13Ambassador.hxx
Merge branch 'next' of git://gitorious.org/fg/simgear into next
[simgear.git] / simgear / hla / RTI13Ambassador.hxx
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 #ifndef RTI13Ambassador_hxx
19 #define RTI13Ambassador_hxx
20
21 #include <cstdlib>
22 #include <list>
23 #include <memory>
24 #include <vector>
25 #include <map>
26 #include <set>
27
28 #ifndef RTI_USES_STD_FSTREAM
29 #define RTI_USES_STD_FSTREAM
30 #endif
31
32 #include <RTI.hh>
33 #include <fedtime.hh>
34
35 #include <simgear/debug/logstream.hxx>
36 #include <simgear/structure/SGWeakReferenced.hxx>
37 #include <simgear/structure/SGSharedPtr.hxx>
38 #include <simgear/structure/SGWeakPtr.hxx>
39 #include <simgear/timing/timestamp.hxx>
40
41 #include "RTIObjectClass.hxx"
42 #include "RTIData.hxx"
43 #include "RTI13Federate.hxx"
44 #include "RTI13ObjectInstance.hxx"
45
46 namespace simgear {
47
48 class RTI13Federate;
49
50 class RTI13Ambassador : public SGReferenced {
51 public:
52     ~RTI13Ambassador()
53     { }
54
55     void createFederationExecution(const std::string& name, const std::string& objectModel)
56     { _rtiAmbassador.createFederationExecution(name.c_str(), objectModel.c_str()); }
57     void destroyFederationExecution(const std::string& name)
58     { _rtiAmbassador.destroyFederationExecution(name.c_str()); }
59
60     RTI::FederateHandle joinFederationExecution(const std::string& federate, const std::string& federation, RTI::FederateAmbassador* federateAmbassador)
61     { return _rtiAmbassador.joinFederationExecution(federate.c_str(), federation.c_str(), federateAmbassador); }
62     void resignFederationExecution()
63     { _rtiAmbassador.resignFederationExecution(RTI::DELETE_OBJECTS_AND_RELEASE_ATTRIBUTES); }
64
65     void registerFederationSynchronizationPoint(const std::string& label, const RTIData& tag)
66     { _rtiAmbassador.registerFederationSynchronizationPoint(label.c_str(), tag.data()); }
67     void synchronizationPointAchieved(const std::string& label)
68     { _rtiAmbassador.synchronizationPointAchieved(label.c_str()); }
69
70     void publishObjectClass(const RTI::ObjectClassHandle& handle, const RTI::AttributeHandleSet& attributeHandleSet)
71     { _rtiAmbassador.publishObjectClass(handle, attributeHandleSet); }
72     void unpublishObjectClass(const RTI::ObjectClassHandle& handle)
73     { _rtiAmbassador.unpublishObjectClass(handle); }
74     void subscribeObjectClassAttributes(const RTI::ObjectClassHandle& handle, const RTI::AttributeHandleSet& attributeHandleSet, bool active)
75     { _rtiAmbassador.subscribeObjectClassAttributes(handle, attributeHandleSet, active ? RTI::RTI_TRUE : RTI::RTI_FALSE); }
76     void unsubscribeObjectClass(const RTI::ObjectClassHandle& handle)
77     { _rtiAmbassador.unsubscribeObjectClass(handle); }
78
79     RTI::ObjectHandle registerObjectInstance(const RTI::ObjectClassHandle& handle)
80     { return _rtiAmbassador.registerObjectInstance(handle); }
81     void updateAttributeValues(const RTI::ObjectHandle& objectHandle, const RTI::AttributeHandleValuePairSet& attributeValues,
82                                const SGTimeStamp& timeStamp, const RTIData& tag)
83     { _rtiAmbassador.updateAttributeValues(objectHandle, attributeValues, toFedTime(timeStamp), tag.data()); }
84     void updateAttributeValues(const RTI::ObjectHandle& objectHandle, const RTI::AttributeHandleValuePairSet& attributeValues, const RTIData& tag)
85     { _rtiAmbassador.updateAttributeValues(objectHandle, attributeValues, tag.data()); }
86
87     // RTI::EventRetractionHandle sendInteraction(RTI::InteractionClassHandle interactionClassHandle, const RTI::ParameterHandleValuePairSet& parameters, const RTI::FedTime& fedTime, const RTIData& tag)
88     // { return _rtiAmbassador.sendInteraction(interactionClassHandle, parameters, fedTime, tag.data()); }
89     // void sendInteraction(RTI::InteractionClassHandle interactionClassHandle, const RTI::ParameterHandleValuePairSet& parameters, const RTIData& tag)
90     // { _rtiAmbassador.sendInteraction(interactionClassHandle, parameters, tag.data()); }
91
92     void deleteObjectInstance(const RTI::ObjectHandle& objectHandle, const SGTimeStamp& timeStamp, const RTIData& tag)
93     { RTI::EventRetractionHandle h = _rtiAmbassador.deleteObjectInstance(objectHandle, toFedTime(timeStamp), tag.data()); }
94     void deleteObjectInstance(const RTI::ObjectHandle& objectHandle, const RTIData& tag)
95     { _rtiAmbassador.deleteObjectInstance(objectHandle, tag.data()); }
96     void localDeleteObjectInstance(const RTI::ObjectHandle& objectHandle)
97     { _rtiAmbassador.localDeleteObjectInstance(objectHandle); }
98
99     void requestObjectAttributeValueUpdate(const RTI::ObjectHandle& handle, const RTI::AttributeHandleSet& attributeHandleSet)
100     { _rtiAmbassador.requestObjectAttributeValueUpdate(handle, attributeHandleSet); }
101     void requestClassAttributeValueUpdate(const RTI::ObjectClassHandle& handle, const RTI::AttributeHandleSet& attributeHandleSet)
102     { _rtiAmbassador.requestClassAttributeValueUpdate(handle, attributeHandleSet); }
103
104     // Ownership Management -------------------
105
106     // bool unconditionalAttributeOwnershipDivestiture(const RTIHandle& objectHandle, const RTIHandleSet& attributeHandles)
107     // {
108     //     try {
109     //         std::auto_ptr<RTI::AttributeHandleSet> attributeHandleSet(RTI::AttributeHandleSetFactory::create(attributeHandles.size()));
110     //         for (RTIHandleSet::const_iterator i = attributeHandles.begin(); i != attributeHandles.end(); ++i)
111     //             attributeHandleSet->add(*i);
112     //         _rtiAmbassador.unconditionalAttributeOwnershipDivestiture(objectHandle, *attributeHandleSet);
113     //         return true;
114     //     } catch (RTI::ObjectNotKnown& e) {
115     //     } catch (RTI::AttributeNotDefined& e) {
116     //     } catch (RTI::AttributeNotOwned& e) {
117     //     } catch (RTI::FederateNotExecutionMember& e) {
118     //     } catch (RTI::ConcurrentAccessAttempted& e) {
119     //     } catch (RTI::SaveInProgress& e) {
120     //     } catch (RTI::RestoreInProgress& e) {
121     //     } catch (RTI::RTIinternalError& e) {
122     //     }
123     //     return false;
124     // }
125     // bool negotiatedAttributeOwnershipDivestiture(const RTIHandle& objectHandle, const RTIHandleSet& attributeHandles, const RTIData& tag)
126     // {
127     //     try {
128     //         std::auto_ptr<RTI::AttributeHandleSet> attributeHandleSet(RTI::AttributeHandleSetFactory::create(attributeHandles.size()));
129     //         for (RTIHandleSet::const_iterator i = attributeHandles.begin(); i != attributeHandles.end(); ++i)
130     //             attributeHandleSet->add(*i);
131     //         _rtiAmbassador.negotiatedAttributeOwnershipDivestiture(objectHandle, *attributeHandleSet, tag.data());
132     //         return true;
133     //     } catch (RTI::ObjectNotKnown& e) {
134     //     } catch (RTI::AttributeNotDefined& e) {
135     //     } catch (RTI::AttributeNotOwned& e) {
136     //     } catch (RTI::AttributeAlreadyBeingDivested& e) {
137     //     } catch (RTI::FederateNotExecutionMember& e) {
138     //     } catch (RTI::ConcurrentAccessAttempted& e) {
139     //     } catch (RTI::SaveInProgress& e) {
140     //     } catch (RTI::RestoreInProgress& e) {
141     //     } catch (RTI::RTIinternalError& e) {
142     //     }
143     //     return false;
144     // }
145     // bool attributeOwnershipAcquisition(const RTIHandle& objectHandle, const RTIHandleSet& attributeHandles, const RTIData& tag)
146     // {
147     //     try {
148     //         std::auto_ptr<RTI::AttributeHandleSet> attributeHandleSet(RTI::AttributeHandleSetFactory::create(attributeHandles.size()));
149     //         for (RTIHandleSet::const_iterator i = attributeHandles.begin(); i != attributeHandles.end(); ++i)
150     //             attributeHandleSet->add(*i);
151     //         _rtiAmbassador.attributeOwnershipAcquisition(objectHandle, *attributeHandleSet, tag.data());
152     //         return true;
153     //     } catch (RTI::ObjectNotKnown& e) {
154     //     } catch (RTI::ObjectClassNotPublished& e) {
155     //     } catch (RTI::AttributeNotDefined& e) {
156     //     } catch (RTI::AttributeNotPublished& e) {
157     //     } catch (RTI::FederateOwnsAttributes& e) {
158     //     } catch (RTI::FederateNotExecutionMember& e) {
159     //     } catch (RTI::ConcurrentAccessAttempted& e) {
160     //     } catch (RTI::SaveInProgress& e) {
161     //     } catch (RTI::RestoreInProgress& e) {
162     //     } catch (RTI::RTIinternalError& e) {
163     //     }
164     //     return false;
165     // }
166     // bool attributeOwnershipAcquisitionIfAvailable(const RTIHandle& objectHandle, const RTIHandleSet& attributeHandles)
167     // {
168     //     try {
169     //         std::auto_ptr<RTI::AttributeHandleSet> attributeHandleSet(RTI::AttributeHandleSetFactory::create(attributeHandles.size()));
170     //         for (RTIHandleSet::const_iterator i = attributeHandles.begin(); i != attributeHandles.end(); ++i)
171     //             attributeHandleSet->add(*i);
172     //         _rtiAmbassador.attributeOwnershipAcquisitionIfAvailable(objectHandle, *attributeHandleSet);
173     //         return true;
174     //     } catch (RTI::ObjectNotKnown& e) {
175     //     } catch (RTI::ObjectClassNotPublished& e) {
176     //     } catch (RTI::AttributeNotDefined& e) {
177     //     } catch (RTI::AttributeNotPublished& e) {
178     //     } catch (RTI::FederateOwnsAttributes& e) {
179     //     } catch (RTI::AttributeAlreadyBeingAcquired& e) {
180     //     } catch (RTI::FederateNotExecutionMember& e) {
181     //     } catch (RTI::ConcurrentAccessAttempted& e) {
182     //     } catch (RTI::SaveInProgress& e) {
183     //     } catch (RTI::RestoreInProgress& e) {
184     //     } catch (RTI::RTIinternalError& e) {
185     //     }
186     //     return false;
187     // }
188     // RTIHandleSet attributeOwnershipReleaseResponse(const RTIHandle& objectHandle, const RTIHandleSet& attributeHandles)
189     // {
190     //     try {
191     //         std::auto_ptr<RTI::AttributeHandleSet> attributeHandleSet(RTI::AttributeHandleSetFactory::create(attributeHandles.size()));
192     //         for (RTIHandleSet::const_iterator i = attributeHandles.begin(); i != attributeHandles.end(); ++i)
193     //             attributeHandleSet->add(*i);
194     //         attributeHandleSet.reset(_rtiAmbassador.attributeOwnershipReleaseResponse(objectHandle, *attributeHandleSet));
195     //         RTIHandleSet handleSet;
196     //         RTI::ULong numAttribs = attributeHandleSet->size();
197     //         for (RTI::ULong i = 0; i < numAttribs; ++i)
198     //             handleSet.insert(attributeHandleSet->getHandle(i));
199     //         return handleSet;
200     //     } catch (RTI::ObjectNotKnown& e) {
201     //     } catch (RTI::AttributeNotDefined& e) {
202     //     } catch (RTI::AttributeNotOwned& e) {
203     //     } catch (RTI::FederateWasNotAskedToReleaseAttribute& e) {
204     //     } catch (RTI::FederateNotExecutionMember& e) {
205     //     } catch (RTI::ConcurrentAccessAttempted& e) {
206     //     } catch (RTI::SaveInProgress& e) {
207     //     } catch (RTI::RestoreInProgress& e) {
208     //     } catch (RTI::RTIinternalError& e) {
209     //     }
210     //     return RTIHandleSet();
211     // }
212     // bool cancelNegotiatedAttributeOwnershipDivestiture(const RTIHandle& objectHandle, const RTIHandleSet& attributeHandles)
213     // {
214     //     try {
215     //         std::auto_ptr<RTI::AttributeHandleSet> attributeHandleSet(RTI::AttributeHandleSetFactory::create(attributeHandles.size()));
216     //         for (RTIHandleSet::const_iterator i = attributeHandles.begin(); i != attributeHandles.end(); ++i)
217     //             attributeHandleSet->add(*i);
218     //         _rtiAmbassador.cancelNegotiatedAttributeOwnershipDivestiture(objectHandle, *attributeHandleSet);
219     //         return true;
220     //     } catch (RTI::ObjectNotKnown& e) {
221     //     } catch (RTI::AttributeNotDefined& e) {
222     //     } catch (RTI::AttributeNotOwned& e) {
223     //     } catch (RTI::AttributeDivestitureWasNotRequested& e) {
224     //     } catch (RTI::FederateNotExecutionMember& e) {
225     //     } catch (RTI::ConcurrentAccessAttempted& e) {
226     //     } catch (RTI::SaveInProgress& e) {
227     //     } catch (RTI::RestoreInProgress& e) {
228     //     } catch (RTI::RTIinternalError& e) {
229     //     }
230     //     return false;
231     // }
232     // bool cancelAttributeOwnershipAcquisition(const RTIHandle& objectHandle, const RTIHandleSet& attributeHandles)
233     // {
234     //     try {
235     //         std::auto_ptr<RTI::AttributeHandleSet> attributeHandleSet(RTI::AttributeHandleSetFactory::create(attributeHandles.size()));
236     //         for (RTIHandleSet::const_iterator i = attributeHandles.begin(); i != attributeHandles.end(); ++i)
237     //             attributeHandleSet->add(*i);
238     //         _rtiAmbassador.cancelAttributeOwnershipAcquisition(objectHandle, *attributeHandleSet);
239     //         return true;
240     //     } catch (RTI::ObjectNotKnown& e) {
241     //     } catch (RTI::AttributeNotDefined& e) {
242     //     } catch (RTI::AttributeAlreadyOwned& e) {
243     //     } catch (RTI::AttributeAcquisitionWasNotRequested& e) {
244     //     } catch (RTI::FederateNotExecutionMember& e) {
245     //     } catch (RTI::ConcurrentAccessAttempted& e) {
246     //     } catch (RTI::SaveInProgress& e) {
247     //     } catch (RTI::RestoreInProgress& e) {
248     //     } catch (RTI::RTIinternalError& e) {
249     //     }
250     //     return false;
251     // }
252     // bool queryAttributeOwnership(const RTIHandle& objectHandle, const RTIHandle& attributeHandle)
253     // {
254     //     try {
255     //         _rtiAmbassador.queryAttributeOwnership(objectHandle, attributeHandle);
256     //         return true;
257     //     } catch (RTI::ObjectNotKnown& e) {
258     //     } catch (RTI::AttributeNotDefined& e) {
259     //     } catch (RTI::FederateNotExecutionMember& e) {
260     //     } catch (RTI::ConcurrentAccessAttempted& e) {
261     //     } catch (RTI::SaveInProgress& e) {
262     //     } catch (RTI::RestoreInProgress& e) {
263     //     } catch (RTI::RTIinternalError& e) {
264     //     }
265     //     return false;
266     // }
267     // bool isAttributeOwnedByFederate(const RTIHandle& objectHandle, const RTIHandle& attributeHandle)
268     // {
269     //     try {
270     //         return _rtiAmbassador.isAttributeOwnedByFederate(objectHandle, attributeHandle);
271     //     } catch (RTI::ObjectNotKnown& e) {
272     //     } catch (RTI::AttributeNotDefined& e) {
273     //     } catch (RTI::FederateNotExecutionMember& e) {
274     //     } catch (RTI::ConcurrentAccessAttempted& e) {
275     //     } catch (RTI::SaveInProgress& e) {
276     //     } catch (RTI::RestoreInProgress& e) {
277     //     } catch (RTI::RTIinternalError& e) {
278     //     }
279     //     return false;
280     // }
281
282     /// Time Management
283
284     void enableTimeRegulation(const SGTimeStamp& lookahead)
285     {
286         RTIfedTime federateTime;
287         federateTime.setZero();
288         _rtiAmbassador.enableTimeRegulation(federateTime, toFedTime(lookahead));
289     }
290     void disableTimeRegulation()
291     { _rtiAmbassador.disableTimeRegulation();}
292
293     void enableTimeConstrained()
294     { _rtiAmbassador.enableTimeConstrained(); }
295     void disableTimeConstrained()
296     { _rtiAmbassador.disableTimeConstrained(); }
297
298     void timeAdvanceRequest(const SGTimeStamp& time)
299     { _rtiAmbassador.timeAdvanceRequest(toFedTime(time)); }
300     void timeAdvanceRequestAvailable(const SGTimeStamp& time)
301     { _rtiAmbassador.timeAdvanceRequestAvailable(toFedTime(time)); }
302     void flushQueueRequest(const SGTimeStamp& time)
303     { _rtiAmbassador.flushQueueRequest(toFedTime(time)); }
304
305     bool queryGALT(SGTimeStamp& timeStamp)
306     {
307         RTIfedTime fedTime;
308         fedTime.setPositiveInfinity();
309         _rtiAmbassador.queryLBTS(fedTime);
310         if (fedTime.isPositiveInfinity())
311             return false;
312         timeStamp = toTimeStamp(fedTime);
313         return true;
314     }
315     bool queryLITS(SGTimeStamp& timeStamp)
316     {
317         RTIfedTime fedTime;
318         fedTime.setPositiveInfinity();
319         _rtiAmbassador.queryMinNextEventTime(fedTime);
320         if (fedTime.isPositiveInfinity())
321             return false;
322         timeStamp = toTimeStamp(fedTime);
323         return true;
324     }
325     void queryFederateTime(SGTimeStamp& timeStamp)
326     {
327         RTIfedTime fedTime;
328         _rtiAmbassador.queryFederateTime(fedTime);
329         timeStamp = toTimeStamp(fedTime);
330     }
331     void modifyLookahead(const SGTimeStamp& timeStamp)
332     { _rtiAmbassador.modifyLookahead(toFedTime(timeStamp)); }
333     void queryLookahead(SGTimeStamp& timeStamp)
334     {
335         RTIfedTime fedTime;
336         _rtiAmbassador.queryLookahead(fedTime);
337         timeStamp = toTimeStamp(fedTime);
338     }
339
340     RTI::ObjectClassHandle getObjectClassHandle(const std::string& name)
341     { return _rtiAmbassador.getObjectClassHandle(name.c_str()); }
342     std::string getObjectClassName(const RTI::ObjectClassHandle& handle)
343     { return rtiToStdString(_rtiAmbassador.getObjectClassName(handle)); }
344
345     RTI::AttributeHandle getAttributeHandle(const std::string& attributeName, const RTI::ObjectClassHandle& objectClassHandle)
346     { return _rtiAmbassador.getAttributeHandle(attributeName.c_str(), objectClassHandle); }
347     std::string getAttributeName(const RTI::AttributeHandle& attributeHandle, const RTI::ObjectClassHandle& objectClassHandle)
348     { return rtiToStdString(_rtiAmbassador.getAttributeName(attributeHandle, objectClassHandle)); }
349
350     // RTIHandle getInteractionClassHandle(const std::string& name)
351     // {
352     //     try {
353     //         return _rtiAmbassador.getInteractionClassHandle(name.c_str());
354     //     } catch (RTI::NameNotFound& e) {
355     //     } catch (RTI::FederateNotExecutionMember& e) {
356     //     } catch (RTI::ConcurrentAccessAttempted& e) {
357     //     } catch (RTI::RTIinternalError& e) {
358     //     }
359     //     return RTIHandle(-1);
360     // }
361     // std::string getInteractionClassName(const RTIHandle& handle)
362     // {
363     //     std::string name;
364     //     try {
365     //         rtiToStdString(name, _rtiAmbassador.getInteractionClassName(handle));
366     //     } catch (RTI::InteractionClassNotDefined& e) {
367     //     } catch (RTI::FederateNotExecutionMember& e) {
368     //     } catch (RTI::ConcurrentAccessAttempted& e) {
369     //     } catch (RTI::RTIinternalError& e) {
370     //     }
371     //     return name;
372     // }
373
374     // RTIHandle getParameterHandle(const std::string& parameterName, const RTIHandle& interactionClassHandle)
375     // {
376     //     try {
377     //         return _rtiAmbassador.getParameterHandle(parameterName.c_str(), interactionClassHandle);
378     //     } catch (RTI::InteractionClassNotDefined& e) {
379     //     } catch (RTI::NameNotFound& e) {
380     //     } catch (RTI::FederateNotExecutionMember& e) {
381     //     } catch (RTI::ConcurrentAccessAttempted& e) {
382     //     } catch (RTI::RTIinternalError& e) {
383     //     }
384     //     return RTIHandle(-1);
385     // }
386     // std::string getParameterName(const RTIHandle& parameterHandle, const RTIHandle& interactionClassHandle)
387     // {
388     //     std::string parameterName;
389     //     try {
390     //         rtiToStdString(parameterName, _rtiAmbassador.getParameterName(parameterHandle, interactionClassHandle));
391     //     } catch (RTI::InteractionClassNotDefined& e) {
392     //     } catch (RTI::InteractionParameterNotDefined& e) {
393     //     } catch (RTI::FederateNotExecutionMember& e) {
394     //     } catch (RTI::ConcurrentAccessAttempted& e) {
395     //     } catch (RTI::RTIinternalError& e) {
396     //     }
397     //     return parameterName;
398     // }
399
400     RTI::ObjectHandle getObjectInstanceHandle(const std::string& name)
401     { return _rtiAmbassador.getObjectInstanceHandle(name.c_str()); }
402     std::string getObjectInstanceName(const RTI::ObjectHandle& objectHandle)
403     { return rtiToStdString(_rtiAmbassador.getObjectInstanceName(objectHandle)); }
404
405     // RTIHandle getRoutingSpaceHandle(const std::string& routingSpaceName)
406     // {
407     //     try {
408     //         return _rtiAmbassador.getRoutingSpaceHandle(routingSpaceName.c_str());
409     //     } catch (RTI::NameNotFound& e) {
410     //     } catch (RTI::FederateNotExecutionMember& e) {
411     //     } catch (RTI::ConcurrentAccessAttempted& e) {
412     //     } catch (RTI::RTIinternalError& e) {
413     //     }
414     //     return RTIHandle(-1);
415     // }
416     // std::string getRoutingSpaceName(const RTIHandle& routingSpaceHandle)
417     // {
418     //     std::string routingSpaceName;
419     //     try {
420     //         rtiToStdString(routingSpaceName, _rtiAmbassador.wgetRoutingSpaceName(routingSpaceHandle));
421     //     } catch (RTI::SpaceNotDefined& e) {
422     //     } catch (RTI::FederateNotExecutionMember& e) {
423     //     } catch (RTI::ConcurrentAccessAttempted& e) {
424     //     } catch (RTI::RTIinternalError& e) {
425     //     }
426     //     return routingSpaceName;
427     // }
428
429     void enableClassRelevanceAdvisorySwitch()
430     { _rtiAmbassador.enableClassRelevanceAdvisorySwitch(); }
431     void disableClassRelevanceAdvisorySwitch()
432     { _rtiAmbassador.disableClassRelevanceAdvisorySwitch(); }
433
434     void enableAttributeRelevanceAdvisorySwitch()
435     { _rtiAmbassador.enableAttributeRelevanceAdvisorySwitch(); }
436     void disableAttributeRelevanceAdvisorySwitch()
437     { _rtiAmbassador.disableAttributeRelevanceAdvisorySwitch(); }
438
439     void enableAttributeScopeAdvisorySwitch()
440     { _rtiAmbassador.enableAttributeScopeAdvisorySwitch(); }
441     void disableAttributeScopeAdvisorySwitch()
442     { _rtiAmbassador.disableAttributeScopeAdvisorySwitch(); }
443
444     void enableInteractionRelevanceAdvisorySwitch()
445     { _rtiAmbassador.enableInteractionRelevanceAdvisorySwitch(); }
446     void disableInteractionRelevanceAdvisorySwitch()
447     { _rtiAmbassador.disableInteractionRelevanceAdvisorySwitch(); }
448
449
450     bool tick()
451     { return _rtiAmbassador.tick(); }
452     bool tick(double minimum, double maximum)
453     { return _rtiAmbassador.tick(minimum, maximum); }
454
455
456     static SGTimeStamp toTimeStamp(const RTI::FedTime& fedTime)
457     {
458         RTIfedTime referenceTime(fedTime);
459         return SGTimeStamp::fromSec(referenceTime.getTime() + 0.5e-9);
460     }
461
462     static RTIfedTime toFedTime(const SGTimeStamp& timeStamp)
463     {
464         RTIfedTime referenceTime;
465         referenceTime.setZero();
466         referenceTime += timeStamp.toSecs();
467         return referenceTime;
468     }
469
470     static std::string rtiToStdString(char* n)
471     {
472         if (!n)
473             return std::string();
474         std::string s;
475         s.assign(n);
476         delete[] n;
477         return s;
478     }
479
480     // The connection class
481     RTI::RTIambassador _rtiAmbassador;
482     SGWeakPtr<RTI13Federate> _federate;
483 };
484
485 } // namespace simgear
486
487 #endif