Renamed mjmModel to mjSpec.
PiperOrigin-RevId: 613516063 Change-Id: I09e360d3eba2accba2e260ec4754b0879b12892f
This commit is contained in:
committed by
Copybara-Service
parent
22cd96fbbc
commit
ef3cb7ec2e
+3
-3
@@ -99,7 +99,7 @@ class LocaleOverride {
|
||||
} // namespace
|
||||
|
||||
// Main writer function - calls mjXWrite
|
||||
std::string mjWriteXML(mjmModel* model, char* error, int error_sz) {
|
||||
std::string mjWriteXML(mjSpec* model, char* error, int error_sz) {
|
||||
LocaleOverride locale_override;
|
||||
|
||||
// check for empty model
|
||||
@@ -272,7 +272,7 @@ static void mjIncludeXML(mjXReader& reader, XMLElement* elem,
|
||||
|
||||
|
||||
// Main parser function
|
||||
mjmModel* mjParseXML(const char* filename, const mjVFS* vfs,
|
||||
mjSpec* mjParseXML(const char* filename, const mjVFS* vfs,
|
||||
char* error, int error_sz) {
|
||||
LocaleOverride locale_override;
|
||||
|
||||
@@ -285,7 +285,7 @@ mjmModel* mjParseXML(const char* filename, const mjVFS* vfs,
|
||||
}
|
||||
|
||||
// clear
|
||||
mjmModel* model = nullptr;
|
||||
mjSpec* model = nullptr;
|
||||
if (error) {
|
||||
error[0] = '\0';
|
||||
}
|
||||
|
||||
+2
-2
@@ -24,10 +24,10 @@
|
||||
// Top level API
|
||||
|
||||
// Main writer function
|
||||
std::string mjWriteXML(mjmModel* model, char* error, int error_sz);
|
||||
std::string mjWriteXML(mjSpec* model, char* error, int error_sz);
|
||||
|
||||
// Main parser function
|
||||
MJAPI mjmModel* mjParseXML(const char* filename, const mjVFS* vfs, char* error, int error_sz);
|
||||
MJAPI mjSpec* mjParseXML(const char* filename, const mjVFS* vfs, char* error, int error_sz);
|
||||
|
||||
|
||||
#endif // MUJOCO_SRC_XML_XML_H_
|
||||
|
||||
+5
-5
@@ -37,7 +37,7 @@
|
||||
class GlobalModel {
|
||||
public:
|
||||
// deletes current model and takes ownership of model
|
||||
void Set(mjmModel* model = nullptr);
|
||||
void Set(mjSpec* model = nullptr);
|
||||
|
||||
// writes XML to string
|
||||
std::optional<std::string> ToXML(const mjModel* m, char* error,
|
||||
@@ -46,7 +46,7 @@ class GlobalModel {
|
||||
private:
|
||||
// using raw pointers as GlobalModel needs to be trivially destructible
|
||||
std::mutex* mutex_ = new std::mutex();
|
||||
mjmModel* model_ = nullptr;
|
||||
mjSpec* model_ = nullptr;
|
||||
};
|
||||
|
||||
std::optional<std::string> GlobalModel::ToXML(const mjModel* m, char* error,
|
||||
@@ -64,7 +64,7 @@ std::optional<std::string> GlobalModel::ToXML(const mjModel* m, char* error,
|
||||
return result;
|
||||
}
|
||||
|
||||
void GlobalModel::Set(mjmModel* model) {
|
||||
void GlobalModel::Set(mjSpec* model) {
|
||||
std::lock_guard<std::mutex> lock(*mutex_);
|
||||
if (model_ != nullptr) {
|
||||
mjm_deleteModel(model_);
|
||||
@@ -91,9 +91,9 @@ mjModel* mj_loadXML(const char* filename, const mjVFS* vfs,
|
||||
char* error, int error_sz) {
|
||||
|
||||
// parse new model
|
||||
std::unique_ptr<mjmModel, std::function<void(mjmModel*)>> model(
|
||||
std::unique_ptr<mjSpec, std::function<void(mjSpec*)>> model(
|
||||
mjParseXML(filename, vfs, error, error_sz),
|
||||
[](mjmModel* m) { mjm_deleteModel(m); });
|
||||
[](mjSpec* m) { mjm_deleteModel(m); });
|
||||
if (!model) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ mjXBase::mjXBase() {
|
||||
|
||||
|
||||
// set model field
|
||||
void mjXBase::SetModel(mjmModel* _model) {
|
||||
void mjXBase::SetModel(mjSpec* _model) {
|
||||
model = _model;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -87,13 +87,13 @@ class mjXBase : public mjXUtil {
|
||||
};
|
||||
|
||||
// set the model allocated externally
|
||||
virtual void SetModel(mjmModel*);
|
||||
virtual void SetModel(mjSpec*);
|
||||
|
||||
// read alternative orientation specification
|
||||
static int ReadAlternative(tinyxml2::XMLElement* elem, mjmOrientation& alt);
|
||||
|
||||
protected:
|
||||
mjmModel* model; // internally-allocated model
|
||||
mjSpec* model; // internally-allocated model
|
||||
};
|
||||
|
||||
#endif // MUJOCO_SRC_XML_XML_BASE_H_
|
||||
|
||||
@@ -913,7 +913,7 @@ void mjXReader::Parse(XMLElement* root) {
|
||||
|
||||
|
||||
// compiler section parser
|
||||
void mjXReader::Compiler(XMLElement* section, mjmModel* mod) {
|
||||
void mjXReader::Compiler(XMLElement* section, mjSpec* mod) {
|
||||
string text;
|
||||
int n;
|
||||
|
||||
@@ -1100,7 +1100,7 @@ void mjXReader::Option(XMLElement* section, mjOption* opt) {
|
||||
|
||||
|
||||
// size section parser
|
||||
void mjXReader::Size(XMLElement* section, mjmModel* mod) {
|
||||
void mjXReader::Size(XMLElement* section, mjSpec* mod) {
|
||||
// read memory bytes
|
||||
{
|
||||
constexpr char err_msg[] =
|
||||
|
||||
@@ -42,9 +42,9 @@ class mjXReader : public mjXBase {
|
||||
void SetTextureDir(std::string texturedir);
|
||||
|
||||
// XML sections embedded in all formats
|
||||
static void Compiler(tinyxml2::XMLElement* section, mjmModel* mod); // compiler section
|
||||
static void Compiler(tinyxml2::XMLElement* section, mjSpec* mod); // compiler section
|
||||
static void Option(tinyxml2::XMLElement* section, mjOption* opt); // option section
|
||||
static void Size(tinyxml2::XMLElement* section, mjmModel* mod); // size section
|
||||
static void Size(tinyxml2::XMLElement* section, mjSpec* mod); // size section
|
||||
|
||||
private:
|
||||
// XML section specific to MJCF
|
||||
|
||||
@@ -765,7 +765,7 @@ mjXWriter::mjXWriter(void) {
|
||||
|
||||
|
||||
// cast model
|
||||
void mjXWriter::SetModel(mjmModel* modelspec) {
|
||||
void mjXWriter::SetModel(mjSpec* modelspec) {
|
||||
if (modelspec) {
|
||||
model = (mjCModel*)modelspec->element;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class mjXWriter : public mjXBase {
|
||||
public:
|
||||
mjXWriter(); // constructor
|
||||
virtual ~mjXWriter() = default; // destructor
|
||||
void SetModel(mjmModel* modelspec);
|
||||
void SetModel(mjSpec* modelspec);
|
||||
|
||||
// write XML document to string
|
||||
std::string Write(char *error, std::size_t error_sz);
|
||||
|
||||
Reference in New Issue
Block a user