]> git.mxchange.org Git - simgear.git/commitdiff
hla: Rename AttributePathPair to StringPathPair.
authorMathias Froehlich <Mathias.Froehlich@web.de>
Sat, 18 Feb 2012 15:49:17 +0000 (16:49 +0100)
committerMathias Froehlich <Mathias.Froehlich@web.de>
Sat, 18 Feb 2012 15:49:17 +0000 (16:49 +0100)
This way of addressing attribute data elements
should also be used for parameters. So, name it a little
more neutral.

simgear/hla/HLADataElement.cxx
simgear/hla/HLADataElement.hxx
simgear/hla/HLAObjectClass.cxx
simgear/hla/HLAObjectClass.hxx

index 8245bddd7b75f2cf4cebc2db25736c44a17f969f..b7da888412e647aaca5eb0d0e5a1051ebd8a3d34 100644 (file)
@@ -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);
 }
 
 }
index e3d529336b779c92ab4cb00d6956993ace1679c1..35613d069b0784982912b84bb29deb0effbd20fd 100644 (file)
@@ -150,15 +150,18 @@ public:
         SGSharedPtr<Data> _data;
     };
     typedef std::list<PathElement> Path;
-    typedef std::pair<std::string, Path> AttributePathPair;
+    typedef std::pair<std::string, Path> StringPathPair;
+    typedef StringPathPair AttributePathPair; // deprecated
     typedef std::pair<unsigned, Path> 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<const TimeStamp> _timeStamp;
index 4b8265621be009bf81be8a7f227ffbfeceea080a..40cef871a0adc1400c48e40835a0b1dbaf8e71c3 100644 (file)
@@ -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
index 3c5ace5f5e9b2ebd974873ed9f839dedae2b7e36..240162230ec603b4ac5b2a7af21e2195c0f3a57d 100644 (file)
@@ -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<unsigned>& indexSet, bool active);