Use explicit template instantiation for mjXUtil::ReadAttr.
PiperOrigin-RevId: 451481936 Change-Id: Ib26e41823606e612f017db0f606983262713066e
This commit is contained in:
committed by
Copybara-Service
parent
f3453cf87f
commit
6faf1d93de
+10
-30
@@ -19,7 +19,6 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <ostream>
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -551,8 +550,8 @@ string mjXUtil::FindValue(const mjMap* map, int mapsz, int value) {
|
|||||||
// the content is returned in "text", the numeric data in "data"
|
// the content is returned in "text", the numeric data in "data"
|
||||||
// return true if attribute found, false if not found and not required
|
// return true if attribute found, false if not found and not required
|
||||||
template<typename T>
|
template<typename T>
|
||||||
int mjXUtil::ReadAttrCpp(XMLElement* elem, const char* attr, const int len,
|
int mjXUtil::ReadAttr(XMLElement* elem, const char* attr, const int len,
|
||||||
T* data, string& text, bool required, bool exact) {
|
T* data, string& text, bool required, bool exact) {
|
||||||
const char* pstr = elem->Attribute(attr);
|
const char* pstr = elem->Attribute(attr);
|
||||||
|
|
||||||
// check if attribute exists
|
// check if attribute exists
|
||||||
@@ -596,36 +595,17 @@ int mjXUtil::ReadAttrCpp(XMLElement* elem, const char* attr, const int len,
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template int mjXUtil::ReadAttr(XMLElement* elem, const char* attr, const int len,
|
||||||
|
double* data, string& text, bool required, bool exact);
|
||||||
|
|
||||||
|
template int mjXUtil::ReadAttr(XMLElement* elem, const char* attr, const int len,
|
||||||
|
float* data, string& text, bool required, bool exact);
|
||||||
|
|
||||||
int mjXUtil::ReadAttr(XMLElement* elem, const char* attr, const int len,
|
template int mjXUtil::ReadAttr(XMLElement* elem, const char* attr, const int len,
|
||||||
double* data, string& text, bool required, bool exact) {
|
int* data, string& text, bool required, bool exact);
|
||||||
return ReadAttrCpp(elem, attr, len, data, text, required, exact);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
template int mjXUtil::ReadAttr(XMLElement* elem, const char* attr, const int len,
|
||||||
|
mjtByte* data, string& text, bool required, bool exact);
|
||||||
// float version
|
|
||||||
int mjXUtil::ReadAttr(XMLElement* elem, const char* attr, const int len,
|
|
||||||
float* data, string& text, bool required, bool exact) {
|
|
||||||
return ReadAttrCpp(elem, attr, len, data, text, required, exact);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// int version
|
|
||||||
int mjXUtil::ReadAttr(XMLElement* elem, const char* attr, const int len,
|
|
||||||
int* data, string& text, bool required, bool exact) {
|
|
||||||
return ReadAttrCpp(elem, attr, len, data, text, required, exact);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// byte version
|
|
||||||
int mjXUtil::ReadAttr(XMLElement* elem, const char* attr, const int len,
|
|
||||||
mjtByte* data, string& text, bool required, bool exact) {
|
|
||||||
return ReadAttrCpp(elem, attr, len, data, text, required, exact);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-21
@@ -100,28 +100,8 @@ class mjXUtil {
|
|||||||
|
|
||||||
// read any type from attribute, return number read
|
// read any type from attribute, return number read
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static int ReadAttrCpp(tinyxml2::XMLElement* elem, const char* attr, const int len,
|
|
||||||
T* data, std::string& text,
|
|
||||||
bool required = false, bool exact = true);
|
|
||||||
|
|
||||||
// read DOUBLE array from attribute, return number read
|
|
||||||
static int ReadAttr(tinyxml2::XMLElement* elem, const char* attr, const int len,
|
static int ReadAttr(tinyxml2::XMLElement* elem, const char* attr, const int len,
|
||||||
double* data, std::string& text,
|
T* data, std::string& text,
|
||||||
bool required = false, bool exact = true);
|
|
||||||
|
|
||||||
// read FLOAT array from attribute, return number read
|
|
||||||
static int ReadAttr(tinyxml2::XMLElement* elem, const char* attr, const int len,
|
|
||||||
float* data, std::string& text,
|
|
||||||
bool required = false, bool exact = true);
|
|
||||||
|
|
||||||
// read INT array from attribute, return number read
|
|
||||||
static int ReadAttr(tinyxml2::XMLElement* elem, const char* attr, const int len,
|
|
||||||
int* data, std::string& text,
|
|
||||||
bool required = false, bool exact = true);
|
|
||||||
|
|
||||||
// read BYTE array from attribute, return number read
|
|
||||||
static int ReadAttr(tinyxml2::XMLElement* elem, const char* attr, const int len,
|
|
||||||
mjtByte* data, std::string& text,
|
|
||||||
bool required = false, bool exact = true);
|
bool required = false, bool exact = true);
|
||||||
|
|
||||||
// read DOUBLE array into C++ vector, return number read
|
// read DOUBLE array into C++ vector, return number read
|
||||||
|
|||||||
Reference in New Issue
Block a user