Migrate types in mjs structs.
PiperOrigin-RevId: 942546629 Change-Id: I46f2b24b53a43361fdc67dc32f2af1c0ce8b1de8
This commit is contained in:
committed by
Copybara-Service
parent
315bcfbf3a
commit
11f1da0c44
@@ -179,6 +179,17 @@ class mjXUtil {
|
||||
static bool MapValue(tinyxml2::XMLElement* elem, const char* attr, int* data,
|
||||
const mjMap* map, int mapSz, bool required = false);
|
||||
|
||||
template <typename T>
|
||||
static bool MapValue(tinyxml2::XMLElement* elem, const char* attr, T* data,
|
||||
const mjMap* map, int mapSz, bool required = false) {
|
||||
int value;
|
||||
if (MapValue(elem, attr, &value, map, mapSz, required)) {
|
||||
*data = static_cast<T>(value);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// find attribute, translate unique space-separated keys to data, return number of keys found
|
||||
static int MapValues(tinyxml2::XMLElement* elem, const char* attr, int* data,
|
||||
const mjMap* map, int mapSz, bool required = false);
|
||||
|
||||
Reference in New Issue
Block a user