From: Mathias Froehlich Date: Sat, 18 Feb 2012 15:49:17 +0000 (+0100) Subject: hla: Rename AttributePathPair to StringPathPair. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c39926dd721e5dee2c086bcabfdf561b12475eff;p=simgear.git hla: Rename AttributePathPair to StringPathPair. This way of addressing attribute data elements should also be used for parameters. So, name it a little more neutral. --- diff --git a/simgear/hla/HLADataElement.cxx b/simgear/hla/HLADataElement.cxx index 8245bddd..b7da8884 100644 --- a/simgear/hla/HLADataElement.cxx +++ b/simgear/hla/HLADataElement.cxx @@ -152,11 +152,11 @@ HLADataElement::toString(const Path& path) return s; } -HLADataElement::AttributePathPair -HLADataElement::toAttributePathPair(const std::string& s) +HLADataElement::StringPathPair +HLADataElement::toStringPathPair(const std::string& s) { Path path; - // Skip the initial attribute name if given + // Skip the initial attribute/parameter name if given std::string::size_type i = s.find_first_of("[."); std::string attribute = s.substr(0, i); while (i < s.size()) { @@ -171,7 +171,7 @@ HLADataElement::toAttributePathPair(const std::string& s) if (10 <= v) { SG_LOG(SG_NETWORK, SG_WARN, "HLADataElement: invalid character in array subscript for \"" << s << "\" at \"" << attribute << toString(path) << "\"!"); - return AttributePathPair(); + return StringPathPair(); } index *= 10; index += v; @@ -186,7 +186,7 @@ HLADataElement::toAttributePathPair(const std::string& s) if (s.size() <= ++i) { SG_LOG(SG_NETWORK, SG_WARN, "HLADataElement: invalid terminating '.' for \"" << s << "\"!"); - return AttributePathPair(); + return StringPathPair(); } std::string::size_type e = s.find_first_of("[.", i); path.push_back(s.substr(i, e - i)); @@ -195,7 +195,7 @@ HLADataElement::toAttributePathPair(const std::string& s) } } - return AttributePathPair(attribute, path); + return StringPathPair(attribute, path); } } diff --git a/simgear/hla/HLADataElement.hxx b/simgear/hla/HLADataElement.hxx index e3d52933..35613d06 100644 --- a/simgear/hla/HLADataElement.hxx +++ b/simgear/hla/HLADataElement.hxx @@ -150,15 +150,18 @@ public: SGSharedPtr _data; }; typedef std::list Path; - typedef std::pair AttributePathPair; + typedef std::pair StringPathPair; + typedef StringPathPair AttributePathPair; // deprecated typedef std::pair IndexPathPair; static std::string toString(const Path& path); - static std::string toString(const AttributePathPair& path) + static std::string toString(const StringPathPair& path) { return path.first + toString(path.second); } - static AttributePathPair toAttributePathPair(const std::string& s); + static StringPathPair toStringPathPair(const std::string& s); + static AttributePathPair toAttributePathPair(const std::string& s) // deprecated + { return toStringPathPair(s); } static Path toPath(const std::string& s) - { return toAttributePathPair(s).second; } + { return toStringPathPair(s).second; } private: // SGSharedPtr _timeStamp; diff --git a/simgear/hla/HLAObjectClass.cxx b/simgear/hla/HLAObjectClass.cxx index 4b826562..40cef871 100644 --- a/simgear/hla/HLAObjectClass.cxx +++ b/simgear/hla/HLAObjectClass.cxx @@ -138,22 +138,22 @@ HLAObjectClass::setAttributeUpdateType(unsigned index, HLAUpdateType updateType) } HLADataElement::IndexPathPair -HLAObjectClass::getIndexPathPair(const HLADataElement::AttributePathPair& attributePathPair) const +HLAObjectClass::getIndexPathPair(const HLADataElement::StringPathPair& stringPathPair) const { - unsigned index = getAttributeIndex(attributePathPair.first); + unsigned index = getAttributeIndex(stringPathPair.first); if (getNumAttributes() <= index) { SG_LOG(SG_NETWORK, SG_ALERT, "HLAObjectClass::getIndexPathPair(\"" - << HLADataElement::toString(attributePathPair) - << "\"): Could not resolve attribute \"" << attributePathPair.first + << HLADataElement::toString(stringPathPair) + << "\"): Could not resolve attribute \"" << stringPathPair.first << "\" for object class \"" << getName() << "\"!"); } - return HLADataElement::IndexPathPair(index, attributePathPair.second); + return HLADataElement::IndexPathPair(index, stringPathPair.second); } HLADataElement::IndexPathPair HLAObjectClass::getIndexPathPair(const std::string& path) const { - return getIndexPathPair(HLADataElement::toAttributePathPair(path)); + return getIndexPathPair(HLADataElement::toStringPathPair(path)); } bool diff --git a/simgear/hla/HLAObjectClass.hxx b/simgear/hla/HLAObjectClass.hxx index 3c5ace5f..24016223 100644 --- a/simgear/hla/HLAObjectClass.hxx +++ b/simgear/hla/HLAObjectClass.hxx @@ -48,7 +48,7 @@ public: HLAUpdateType getAttributeUpdateType(unsigned index) const; void setAttributeUpdateType(unsigned index, HLAUpdateType updateType); - HLADataElement::IndexPathPair getIndexPathPair(const HLADataElement::AttributePathPair&) const; + HLADataElement::IndexPathPair getIndexPathPair(const HLADataElement::StringPathPair&) const; HLADataElement::IndexPathPair getIndexPathPair(const std::string& path) const; bool subscribe(const std::set& indexSet, bool active);