Add copy constructors to body subelements.
PiperOrigin-RevId: 614665384 Change-Id: I1ad2b644cf9816fb9490b5634c16e95f360a8684
This commit is contained in:
committed by
Copybara-Service
parent
b1a941db8b
commit
8413a615d7
@@ -605,6 +605,21 @@ mjCBase::mjCBase() {
|
||||
|
||||
|
||||
|
||||
mjCBase::mjCBase(const mjCBase& other) {
|
||||
*this = other;
|
||||
}
|
||||
|
||||
|
||||
|
||||
mjCBase& mjCBase::operator=(const mjCBase& other) {
|
||||
if (this != &other) {
|
||||
*static_cast<mjCBase_*>(this) = static_cast<const mjCBase_&>(other);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// load resource if found (fallback to OS filesystem)
|
||||
mjResource* mjCBase::LoadResource(string filename, const mjVFS* vfs) {
|
||||
// try reading from provided VFS
|
||||
@@ -1349,6 +1364,24 @@ mjCJoint::mjCJoint(mjCModel* _model, mjCDef* _def) {
|
||||
|
||||
|
||||
|
||||
mjCJoint::mjCJoint(const mjCJoint& other) {
|
||||
*this = other;
|
||||
}
|
||||
|
||||
|
||||
|
||||
mjCJoint& mjCJoint::operator=(const mjCJoint& other) {
|
||||
if (this != &other) {
|
||||
this->spec = other.spec;
|
||||
*static_cast<mjCJoint_*>(this) = static_cast<const mjCJoint_&>(other);
|
||||
*static_cast<mjmJoint*>(this) = static_cast<const mjmJoint&>(other);
|
||||
}
|
||||
PointToLocal();
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool mjCJoint::is_limited() const { return islimited(limited, range); }
|
||||
bool mjCJoint::is_actfrclimited() const { return islimited(actfrclimited, actfrcrange); }
|
||||
|
||||
@@ -1543,6 +1576,24 @@ mjCGeom::mjCGeom(mjCModel* _model, mjCDef* _def) {
|
||||
|
||||
|
||||
|
||||
mjCGeom::mjCGeom(const mjCGeom& other) {
|
||||
*this = other;
|
||||
}
|
||||
|
||||
|
||||
|
||||
mjCGeom& mjCGeom::operator=(const mjCGeom& other) {
|
||||
if (this != &other) {
|
||||
this->spec = other.spec;
|
||||
*static_cast<mjCGeom_*>(this) = static_cast<const mjCGeom_&>(other);
|
||||
*static_cast<mjmGeom*>(this) = static_cast<const mjmGeom&>(other);
|
||||
}
|
||||
PointToLocal();
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// to be called after any default copy constructor
|
||||
void mjCGeom::PointToLocal(void) {
|
||||
spec.element = (mjElement)this;
|
||||
@@ -2144,6 +2195,24 @@ mjCSite::mjCSite(mjCModel* _model, mjCDef* _def) {
|
||||
|
||||
|
||||
|
||||
mjCSite::mjCSite(const mjCSite& other) {
|
||||
*this = other;
|
||||
}
|
||||
|
||||
|
||||
|
||||
mjCSite& mjCSite::operator=(const mjCSite& other) {
|
||||
if (this != &other) {
|
||||
this->spec = other.spec;
|
||||
*static_cast<mjCSite_*>(this) = static_cast<const mjCSite_&>(other);
|
||||
*static_cast<mjmSite*>(this) = static_cast<const mjmSite&>(other);
|
||||
}
|
||||
PointToLocal();
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void mjCSite::PointToLocal() {
|
||||
spec.element = (mjElement)this;
|
||||
spec.name = (mjString)&name;
|
||||
@@ -2286,6 +2355,24 @@ mjCCamera::mjCCamera(mjCModel* _model, mjCDef* _def) {
|
||||
|
||||
|
||||
|
||||
mjCCamera::mjCCamera(const mjCCamera& other) {
|
||||
*this = other;
|
||||
}
|
||||
|
||||
|
||||
|
||||
mjCCamera& mjCCamera::operator=(const mjCCamera& other) {
|
||||
if (this != &other) {
|
||||
this->spec = other.spec;
|
||||
*static_cast<mjCCamera_*>(this) = static_cast<const mjCCamera_&>(other);
|
||||
*static_cast<mjmCamera*>(this) = static_cast<const mjmCamera&>(other);
|
||||
}
|
||||
PointToLocal();
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void mjCCamera::PointToLocal() {
|
||||
spec.element = (mjElement)this;
|
||||
spec.name = (mjString)&name;
|
||||
@@ -2420,6 +2507,24 @@ mjCLight::mjCLight(mjCModel* _model, mjCDef* _def) {
|
||||
|
||||
|
||||
|
||||
mjCLight::mjCLight(const mjCLight& other) {
|
||||
*this = other;
|
||||
}
|
||||
|
||||
|
||||
|
||||
mjCLight& mjCLight::operator=(const mjCLight& other) {
|
||||
if (this != &other) {
|
||||
this->spec = other.spec;
|
||||
*static_cast<mjCLight_*>(this) = static_cast<const mjCLight_&>(other);
|
||||
*static_cast<mjmLight*>(this) = static_cast<const mjmLight&>(other);
|
||||
}
|
||||
PointToLocal();
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void mjCLight::PointToLocal() {
|
||||
spec.element = (mjElement)this;
|
||||
spec.name = (mjString)&name;
|
||||
|
||||
Reference in New Issue
Block a user