Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#80: vt-tv cannot handle shared_block_id object QOI #94

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/vt-tv/api/info.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,9 @@ struct Info {
return convertQOIVariantTypeToDouble_(getObjectRankID(obj));
};
} else {
// Look in attributes (will throw an error if QOI doesn't exist)
// Look in attributes and user_defined (will throw an error if QOI doesn't exist)
qoi_getter = [&](ObjectWork obj) {
return convertQOIVariantTypeToDouble_(getObjectAttribute(obj, object_qoi));
return convertQOIVariantTypeToDouble_(getObjectAttributeOrUserDefined(obj, object_qoi));
};
}
return qoi_getter;
Expand Down Expand Up @@ -716,19 +716,23 @@ struct Info {
}

/**
* \brief Get the specified attribute of an object at a given phase
* \brief Get the specified attribute or user_defined QOI of an object at a given phase
*
* \param[in] object the current object
*
* \return the requested attribute
* \return the requested attribute or user_defined QOI
*/
QOIVariantTypes getObjectAttribute(ObjectWork object, std::string object_qoi) const {
QOIVariantTypes getObjectAttributeOrUserDefined(ObjectWork object, std::string object_qoi) const {
auto obj_attributes = object.getAttributes();
if (obj_attributes.count(object_qoi) > 0) {
return obj_attributes.at(object_qoi);
} else {
throw std::runtime_error("Invalid Object QOI: " + object_qoi);
auto obj_user_defined = object.getUserDefined();
if (obj_user_defined.count(object_qoi) > 0) {
return obj_user_defined.at(object_qoi);
}
}
throw std::runtime_error("Invalid Object QOI: " + object_qoi);
}

/* ---------------------------------------------------------- */
Expand Down
Loading