X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fhla%2FHLAFederate.hxx;h=3083903cb80866267d3c90873f3dc3a073bd2ce7;hb=086a30e61aa153008bd403c79cd1bff3ad594179;hp=4c82820cb13c9183a3fe813ea75856c6c4aff6f0;hpb=f665431132c2302cfd2acf7e294b4161da5b1448;p=simgear.git diff --git a/simgear/hla/HLAFederate.hxx b/simgear/hla/HLAFederate.hxx index 4c82820c..3083903c 100644 --- a/simgear/hla/HLAFederate.hxx +++ b/simgear/hla/HLAFederate.hxx @@ -41,21 +41,31 @@ public: RTI1516E }; + /// The rti version backend to connect Version getVersion() const; bool setVersion(HLAFederate::Version version); + /// The rti backends connect arguments, depends on the version const std::list& getConnectArguments() const; bool setConnectArguments(const std::list& connectArguments); + /// If true try to create on join and try to destroy on resign + bool getCreateFederationExecution() const; + bool setCreateFederationExecution(bool createFederationExecution); + + /// The federation execution name to use on create, join and destroy const std::string& getFederationExecutionName() const; bool setFederationExecutionName(const std::string& federationExecutionName); + /// The federation object model name to use on create and possibly join const std::string& getFederationObjectModel() const; bool setFederationObjectModel(const std::string& federationObjectModel); + /// The federate type used on join const std::string& getFederateType() const; bool setFederateType(const std::string& federateType); + /// The federate name possibly used on join const std::string& getFederateName() const; bool setFederateName(const std::string& federateName); @@ -84,11 +94,43 @@ public: /// Time management + /// If set to true, time constrained mode is entered on init + bool getTimeConstrained() const; + bool setTimeConstrained(bool timeConstrained); + + /// If set to true, time advance is constrained by the local system clock + bool getTimeConstrainedByLocalClock() const; + bool setTimeConstrainedByLocalClock(bool timeConstrainedByLocalClock); + + /// If set to true, time regulation mode is entered on init + bool getTimeRegulating() const; + bool setTimeRegulating(bool timeRegulating); + + /// If set to a non zero value, this federate leads the federations + /// locical time advance by this amount of time. + const SGTimeStamp& getLeadTime() const; + bool setLeadTime(const SGTimeStamp& leadTime); + + /// The time increment for use in the default update method. + const SGTimeStamp& getTimeIncrement() const; + bool setTimeIncrement(const SGTimeStamp& timeIncrement); + + /// Actually enable time constrained mode. + /// This method blocks until time constrained mode is enabled. bool enableTimeConstrained(); + /// Actually disable time constrained mode. bool disableTimeConstrained(); + /// Actually enable time constrained by local clock mode. + bool enableTimeConstrainedByLocalClock(); + + /// Actually enable time regulation mode. + /// This method blocks until time regulation mode is enabled. bool enableTimeRegulation(const SGTimeStamp& lookahead); + bool enableTimeRegulation(); + /// Actually disable time regulation mode. bool disableTimeRegulation(); + /// Actually modify the lookahead time. bool modifyLookahead(const SGTimeStamp& lookahead); /// Advance the logical time by the given time increment. @@ -104,7 +146,9 @@ public: /// as far as currently possible. bool timeAdvanceAvailable(); + /// Get the current federates time bool queryFederateTime(SGTimeStamp& timeStamp); + /// Get the current federates lookahead bool queryLookahead(SGTimeStamp& timeStamp); /// Process one messsage @@ -142,12 +186,29 @@ public: bool readObjectModelTemplate(const std::string& objectModel, ObjectModelFactory& objectModelFactory); + /// Get the object class of a given name HLAObjectClass* getObjectClass(const std::string& name); const HLAObjectClass* getObjectClass(const std::string& name) const; + /// Get the interaction class of a given name HLAInteractionClass* getInteractionClass(const std::string& name); const HLAInteractionClass* getInteractionClass(const std::string& name) const; + /// Tells the main exec loop to continue or not. + void setDone(bool done); + bool getDone() const; + + virtual bool readObjectModel(); + + virtual bool subscribe(); + virtual bool publish(); + + virtual bool init(); + virtual bool update(); + virtual bool shutdown(); + + virtual bool exec(); + private: HLAFederate(const HLAFederate&); HLAFederate& operator=(const HLAFederate&); @@ -162,11 +223,30 @@ private: /// Parameters for the federation execution std::string _federationExecutionName; std::string _federationObjectModel; + bool _createFederationExecution; /// Parameters for the federate std::string _federateType; std::string _federateName; + /// Time management related parameters + /// If true, the federate is expected to enter time constrained mode + bool _timeConstrained; + /// If true, the federate is expected to enter time regulating mode + bool _timeRegulating; + /// The amount of time this federate leads the others. + SGTimeStamp _leadTime; + /// The regular time increment we do on calling update() + SGTimeStamp _timeIncrement; + /// The reference system time at initialization time. + /// Is used to implement being time constrained on the + /// local system time. + bool _timeConstrainedByLocalClock; + SGTimeStamp _localClockOffset; + + /// If true the exec method returns. + bool _done; + typedef std::map > ObjectClassMap; ObjectClassMap _objectClassMap;