From: Mathias Froehlich Date: Sun, 11 Mar 2012 08:21:47 +0000 (+0100) Subject: hla: Add convenience function to set version by string. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=32ef925a79c323880fb0cfb4209aca8486467d17;p=simgear.git hla: Add convenience function to set version by string. --- diff --git a/simgear/hla/HLAFederate.cxx b/simgear/hla/HLAFederate.cxx index 94e8b3a2..8cd173ad 100644 --- a/simgear/hla/HLAFederate.cxx +++ b/simgear/hla/HLAFederate.cxx @@ -78,6 +78,22 @@ HLAFederate::setVersion(HLAFederate::Version version) return true; } +bool +HLAFederate::setVersion(const std::string& version) +{ + if (version == "RTI13") + return setVersion(RTI13); + else if (version == "RTI1516") + return setVersion(RTI1516); + else if (version == "RTI1516E") + return setVersion(RTI1516E); + else { + /// at some time think about routing these down to the factory + SG_LOG(SG_NETWORK, SG_ALERT, "HLA: Unknown version string in HLAFederate::setVersion!"); + return false; + } +} + const std::list& HLAFederate::getConnectArguments() const { diff --git a/simgear/hla/HLAFederate.hxx b/simgear/hla/HLAFederate.hxx index eb0c8424..be052130 100644 --- a/simgear/hla/HLAFederate.hxx +++ b/simgear/hla/HLAFederate.hxx @@ -44,6 +44,7 @@ public: /// The rti version backend to connect Version getVersion() const; bool setVersion(HLAFederate::Version version); + bool setVersion(const std::string& version); /// The rti backends connect arguments, depends on the version const std::list& getConnectArguments() const;