]> git.mxchange.org Git - simgear.git/blob - simgear/hla/RTIFederate.hxx
Add modifyLookahead to the rti abstraction.
[simgear.git] / simgear / hla / RTIFederate.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 RTIFederate_hxx
19 #define RTIFederate_hxx
20
21 #include <string>
22 #include "simgear/structure/SGWeakReferenced.hxx"
23 #include "RTIObjectClass.hxx"
24 #include "RTIObjectInstance.hxx"
25
26 class SGTimeStamp;
27
28 namespace simgear {
29
30 class RTIFederate : public SGWeakReferenced {
31 public:
32     RTIFederate();
33     virtual ~RTIFederate();
34
35     /// Get the name of the joined federate/federation
36     const std::string& getFederateType() const
37     { return _federateType; }
38     const std::string& getFederationName() const
39     { return _federationName; }
40
41     /// Create a federation execution
42     /// Semantically this methods should be static,
43     /// but the nonstatic case could reuse the connection to the server
44     /// FIXME: cannot determine from the return value if we created the execution
45     virtual bool createFederationExecution(const std::string& federation, const std::string& objectModel) = 0;
46     virtual bool destroyFederationExecution(const std::string& federation) = 0;
47
48     /// Join with federateName the federation execution federation
49     virtual bool join(const std::string& federateType, const std::string& federation) = 0;
50     virtual bool resign() = 0;
51
52     /// Synchronization Point handling
53     virtual bool registerFederationSynchronizationPoint(const std::string& label, const RTIData& tag) = 0;
54     virtual bool waitForFederationSynchronizationPointAnnounced(const std::string& label) = 0;
55     virtual bool synchronizationPointAchieved(const std::string& label) = 0;
56     virtual bool waitForFederationSynchronized(const std::string& label) = 0;
57
58     /// Time management
59     virtual bool enableTimeConstrained() = 0;
60     virtual bool disableTimeConstrained() = 0;
61
62     virtual bool enableTimeRegulation(const SGTimeStamp& lookahead) = 0;
63     virtual bool disableTimeRegulation() = 0;
64
65     virtual bool timeAdvanceRequestBy(const SGTimeStamp& dt) = 0;
66     virtual bool timeAdvanceRequest(const SGTimeStamp& fedTime) = 0;
67
68     virtual bool queryFederateTime(SGTimeStamp& timeStamp) = 0;
69     virtual bool modifyLookahead(const SGTimeStamp& timeStamp) = 0;
70     virtual bool queryLookahead(SGTimeStamp& timeStamp) = 0;
71
72     /// Process messages
73     virtual bool tick() = 0;
74     virtual bool tick(const double& minimum, const double& maximum) = 0;
75
76     virtual RTIObjectClass* createObjectClass(const std::string& name, HLAObjectClass* hlaObjectClass) = 0;
77     // virtual RTIInteractionClass* createInteractionClass(const std::string& name) = 0;
78
79     virtual RTIObjectInstance* getObjectInstance(const std::string& name) = 0;
80
81 protected:
82     void setFederateType(const std::string& federateType)
83     { _federateType = federateType; }
84     void setFederationName(const std::string& federationName)
85     { _federationName = federationName; }
86
87 private:
88     RTIFederate(const RTIFederate&);
89     RTIFederate& operator=(const RTIFederate&);
90
91     /// The federates name
92     std::string _federateType;
93
94     /// The federation execution name
95     std::string _federationName;
96 };
97
98 }
99
100 #endif