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.
This commit is contained in:
parent
4683e7e9c9
commit
c39926dd72
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user