_parameterVector[index]._dataType = dataType;
}
-HLADataElement::IndexPathPair
-HLAInteractionClass::getIndexPathPair(const HLADataElement::StringPathPair& stringPathPair) const
+bool
+HLAInteractionClass::getDataElementIndex(HLADataElementIndex& dataElementIndex, const std::string& path) const
{
- unsigned index = getParameterIndex(stringPathPair.first);
+ if (path.empty()) {
+ SG_LOG(SG_NETWORK, SG_ALERT, "HLAObjectClass: failed to parse empty element path!");
+ return false;
+ }
+ std::string::size_type len = std::min(path.find_first_of("[."), path.size());
+ unsigned index = 0;
+ while (index < getNumParameters()) {
+ if (path.compare(0, len, getParameterName(index)) == 0)
+ break;
+ ++index;
+ }
if (getNumParameters() <= index) {
- SG_LOG(SG_NETWORK, SG_ALERT, "HLAInteractionClass::getIndexPathPair(\""
- << HLADataElement::toString(stringPathPair)
- << "\"): Could not resolve attribute \"" << stringPathPair.first
- << "\" for interaction class \"" << getName() << "\"!");
+ SG_LOG(SG_NETWORK, SG_ALERT, "HLAObjectClass: faild to parse data element index \"" << path << "\":\n"
+ << "Parameter \"" << path.substr(0, len) << "\" not found in object class \""
+ << getName() << "\"!");
+ return false;
+ }
+ if (!getParameterDataType(index)) {
+ SG_LOG(SG_NETWORK, SG_ALERT, "HLAObjectClass: faild to parse data element index \"" << path << "\":\n"
+ << "Undefined parameter data type in variant record data type \""
+ << getParameterName(index) << "\"!");
+ return false;
}
- return HLADataElement::IndexPathPair(index, stringPathPair.second);
+ dataElementIndex.push_back(index);
+ return getParameterDataType(index)->getDataElementIndex(dataElementIndex, path, len);
}
-HLADataElement::IndexPathPair
-HLAInteractionClass::getIndexPathPair(const std::string& path) const
+HLADataElementIndex
+HLAInteractionClass::getDataElementIndex(const std::string& path) const
{
- return getIndexPathPair(HLADataElement::toStringPathPair(path));
+ HLADataElementIndex dataElementIndex;
+ getDataElementIndex(dataElementIndex, path);
+ return dataElementIndex;
}
bool