_attributeVector[index]._publicationType = publicationType;
}
-HLADataElement::IndexPathPair
-HLAObjectClass::getIndexPathPair(const HLADataElement::StringPathPair& stringPathPair) const
-{
- unsigned index = getAttributeIndex(stringPathPair.first);
- if (getNumAttributes() <= index) {
- SG_LOG(SG_NETWORK, SG_ALERT, "HLAObjectClass::getIndexPathPair(\""
- << HLADataElement::toString(stringPathPair)
- << "\"): Could not resolve attribute \"" << stringPathPair.first
- << "\" for object class \"" << getName() << "\"!");
- }
- return HLADataElement::IndexPathPair(index, stringPathPair.second);
-}
-
-HLADataElement::IndexPathPair
-HLAObjectClass::getIndexPathPair(const std::string& path) const
-{
- return getIndexPathPair(HLADataElement::toStringPathPair(path));
-}
-
bool
-HLAObjectClass::getAttributeIndex(HLADataElementIndex& dataElementIndex, const std::string& path) const
+HLAObjectClass::getDataElementIndex(HLADataElementIndex& dataElementIndex, const std::string& path) const
{
if (path.empty()) {
SG_LOG(SG_NETWORK, SG_ALERT, "HLAObjectClass: failed to parse empty element path!");
return false;
}
- size_t len = path.find_first_of("[.");
+ std::string::size_type len = std::min(path.find_first_of("[."), path.size());
unsigned index = 0;
while (index < getNumAttributes()) {
if (path.compare(0, len, getAttributeName(index)) == 0)
return getAttributeDataType(index)->getDataElementIndex(dataElementIndex, path, len);
}
+HLADataElementIndex
+HLAObjectClass::getDataElementIndex(const std::string& path) const
+{
+ HLADataElementIndex dataElementIndex;
+ getDataElementIndex(dataElementIndex, path);
+ return dataElementIndex;
+}
+
bool
HLAObjectClass::subscribe()
{