]> git.mxchange.org Git - simgear.git/blob - simgear/hla/RTI13Federate.hxx
83878ad0559baeaaa11e7d2a221825764345c4bd
[simgear.git] / simgear / hla / RTI13Federate.hxx
1 // Copyright (C) 2009 - 2011  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 RTI13Federate_hxx
19 #define RTI13Federate_hxx
20
21 #ifndef RTI_USES_STD_FSTREAM
22 #define RTI_USES_STD_FSTREAM
23 #endif
24
25 #include <RTI.hh>
26
27 #include "RTIFederate.hxx"
28 #include "RTI13InteractionClass.hxx"
29 #include "RTI13ObjectClass.hxx"
30 #include "RTI13ObjectInstance.hxx"
31
32 namespace simgear {
33
34 class RTI13Ambassador;
35
36 class RTI13Federate : public RTIFederate {
37 public:
38     RTI13Federate(const std::list<std::string>& stringList);
39     virtual ~RTI13Federate();
40
41     /// Create a federation execution
42     /// Semantically this methods should be static,
43     virtual FederationManagementResult createFederationExecution(const std::string& federation, const std::string& objectModel);
44     virtual FederationManagementResult destroyFederationExecution(const std::string& federation);
45
46     /// Join with federateName the federation execution federation
47     virtual FederationManagementResult join(const std::string& federateType, const std::string& federation);
48     virtual bool resign();
49     virtual bool getJoined() const;
50
51     /// Synchronization Point handling
52     virtual bool registerFederationSynchronizationPoint(const std::string& label, const RTIData& tag);
53     virtual bool getFederationSynchronizationPointAnnounced(const std::string& label);
54     virtual bool synchronizationPointAchieved(const std::string& label);
55     virtual bool getFederationSynchronized(const std::string& label);
56
57     /// Time management
58     virtual bool enableTimeConstrained();
59     virtual bool disableTimeConstrained();
60     virtual bool getTimeConstrainedEnabled();
61
62     virtual bool enableTimeRegulation(const SGTimeStamp& lookahead);
63     virtual bool disableTimeRegulation();
64     virtual bool modifyLookahead(const SGTimeStamp& timeStamp);
65     virtual bool getTimeRegulationEnabled();
66
67     virtual bool timeAdvanceRequest(const SGTimeStamp& timeStamp);
68     virtual bool timeAdvanceRequestAvailable(const SGTimeStamp& timeStamp);
69     virtual bool flushQueueRequest(const SGTimeStamp& timeStamp);
70     virtual bool getTimeAdvancePending();
71
72     virtual bool queryFederateTime(SGTimeStamp& timeStamp);
73     virtual bool queryLookahead(SGTimeStamp& timeStamp);
74     virtual bool queryGALT(SGTimeStamp& timeStamp);
75     virtual bool queryLITS(SGTimeStamp& timeStamp);
76
77     /// Process messages
78     virtual bool processMessage();
79     virtual bool processMessages(const double& minimum, const double& maximum);
80
81     virtual RTI13ObjectClass* createObjectClass(const std::string& name, HLAObjectClass* hlaObjectClass);
82     virtual RTI13InteractionClass* createInteractionClass(const std::string& name, HLAInteractionClass* interactionClass);
83
84     virtual RTI13ObjectInstance* getObjectInstance(const std::string& name);
85     void insertObjectInstance(RTI13ObjectInstance* objectInstance);
86
87 private:
88     RTI13Federate(const RTI13Federate&);
89     RTI13Federate& operator=(const RTI13Federate&);
90
91     /// The federate handle
92     RTI::FederateHandle _federateHandle;
93     bool _joined;
94
95     /// RTI connection
96     SGSharedPtr<RTI13Ambassador> _ambassador;
97
98     /// Callbacks from the rti are handled here.
99     struct FederateAmbassador;
100     FederateAmbassador* _federateAmbassador;
101 };
102
103 }
104
105 #endif