hla: Add convenience function to set version by string.

This commit is contained in:
Mathias Froehlich 2012-03-11 09:21:47 +01:00
parent c62c778c88
commit 32ef925a79
2 changed files with 17 additions and 0 deletions

View File

@ -78,6 +78,22 @@ HLAFederate::setVersion(HLAFederate::Version version)
return true; 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<std::string>& const std::list<std::string>&
HLAFederate::getConnectArguments() const HLAFederate::getConnectArguments() const
{ {

View File

@ -44,6 +44,7 @@ public:
/// The rti version backend to connect /// The rti version backend to connect
Version getVersion() const; Version getVersion() const;
bool setVersion(HLAFederate::Version version); bool setVersion(HLAFederate::Version version);
bool setVersion(const std::string& version);
/// The rti backends connect arguments, depends on the version /// The rti backends connect arguments, depends on the version
const std::list<std::string>& getConnectArguments() const; const std::list<std::string>& getConnectArguments() const;