Migrate types in mjs structs.

PiperOrigin-RevId: 942546629
Change-Id: I46f2b24b53a43361fdc67dc32f2af1c0ce8b1de8
This commit is contained in:
Yuval Tassa
2026-07-04 11:27:00 -07:00
committed by Copybara-Service
parent 315bcfbf3a
commit 11f1da0c44
15 changed files with 339 additions and 311 deletions
+11
View File
@@ -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);