Make default class members private.
PiperOrigin-RevId: 634288934 Change-Id: I1b7a5ec8dd51c65377b09bcb85c56a849573cac7
This commit is contained in:
committed by
Copybara-Service
parent
6e58cedb47
commit
e885a3dc3d
+93
-94
@@ -557,22 +557,22 @@ int mjCBoundingVolumeHierarchy::MakeBVH(
|
||||
//------------------------- class mjCDef implementation --------------------------------------------
|
||||
|
||||
// constructor
|
||||
mjCDef::mjCDef(void) {
|
||||
mjCDef::mjCDef() {
|
||||
name.clear();
|
||||
parentid = -1;
|
||||
childid.clear();
|
||||
mjs_defaultJoint(&joint.spec);
|
||||
mjs_defaultGeom(&geom.spec);
|
||||
mjs_defaultSite(&site.spec);
|
||||
mjs_defaultCamera(&camera.spec);
|
||||
mjs_defaultLight(&light.spec);
|
||||
mjs_defaultFlex(&flex.spec);
|
||||
mjs_defaultMesh(&mesh.spec);
|
||||
mjs_defaultMaterial(&material.spec);
|
||||
mjs_defaultPair(&pair.spec);
|
||||
mjs_defaultEquality(&equality.spec);
|
||||
mjs_defaultTendon(&tendon.spec);
|
||||
mjs_defaultActuator(&actuator.spec);
|
||||
mjs_defaultJoint(&joint_.spec);
|
||||
mjs_defaultGeom(&geom_.spec);
|
||||
mjs_defaultSite(&site_.spec);
|
||||
mjs_defaultCamera(&camera_.spec);
|
||||
mjs_defaultLight(&light_.spec);
|
||||
mjs_defaultFlex(&flex_.spec);
|
||||
mjs_defaultMesh(&mesh_.spec);
|
||||
mjs_defaultMaterial(&material_.spec);
|
||||
mjs_defaultPair(&pair_.spec);
|
||||
mjs_defaultEquality(&equality_.spec);
|
||||
mjs_defaultTendon(&tendon_.spec);
|
||||
mjs_defaultActuator(&actuator_.spec);
|
||||
|
||||
// make sure all the pointers are local
|
||||
PointToLocal();
|
||||
@@ -592,12 +592,12 @@ void mjCDef::Compile(const mjCModel* model) {
|
||||
CopyFromSpec();
|
||||
|
||||
// enforce length of all default userdata arrays
|
||||
joint.userdata_.resize(model->nuser_jnt);
|
||||
geom.userdata_.resize(model->nuser_geom);
|
||||
site.userdata_.resize(model->nuser_site);
|
||||
camera.userdata_.resize(model->nuser_cam);
|
||||
tendon.userdata_.resize(model->nuser_tendon);
|
||||
actuator.userdata_.resize(model->nuser_actuator);
|
||||
joint_.userdata_.resize(model->nuser_jnt);
|
||||
geom_.userdata_.resize(model->nuser_geom);
|
||||
site_.userdata_.resize(model->nuser_site);
|
||||
camera_.userdata_.resize(model->nuser_cam);
|
||||
tendon_.userdata_.resize(model->nuser_tendon);
|
||||
actuator_.userdata_.resize(model->nuser_actuator);
|
||||
}
|
||||
|
||||
|
||||
@@ -608,18 +608,18 @@ mjCDef& mjCDef::operator=(const mjCDef& other) {
|
||||
name = other.name;
|
||||
parentid = other.parentid;
|
||||
childid = other.childid;
|
||||
joint = other.joint;
|
||||
geom = other.geom;
|
||||
site = other.site;
|
||||
camera = other.camera;
|
||||
light = other.light;
|
||||
flex = other.flex;
|
||||
mesh = other.mesh;
|
||||
material = other.material;
|
||||
pair = other.pair;
|
||||
equality = other.equality;
|
||||
tendon = other.tendon;
|
||||
actuator = other.actuator;
|
||||
joint_ = other.joint_;
|
||||
geom_ = other.geom_;
|
||||
site_ = other.site_;
|
||||
camera_ = other.camera_;
|
||||
light_ = other.light_;
|
||||
flex_ = other.flex_;
|
||||
mesh_ = other.mesh_;
|
||||
material_ = other.material_;
|
||||
pair_ = other.pair_;
|
||||
equality_ = other.equality_;
|
||||
tendon_ = other.tendon_;
|
||||
actuator_ = other.actuator_;
|
||||
}
|
||||
PointToLocal();
|
||||
return *this;
|
||||
@@ -628,49 +628,49 @@ mjCDef& mjCDef::operator=(const mjCDef& other) {
|
||||
|
||||
|
||||
void mjCDef::PointToLocal() {
|
||||
joint.PointToLocal();
|
||||
geom.PointToLocal();
|
||||
site.PointToLocal();
|
||||
camera.PointToLocal();
|
||||
light.PointToLocal();
|
||||
flex.PointToLocal();
|
||||
mesh.PointToLocal();
|
||||
material.PointToLocal();
|
||||
pair.PointToLocal();
|
||||
equality.PointToLocal();
|
||||
tendon.PointToLocal();
|
||||
actuator.PointToLocal();
|
||||
joint_.PointToLocal();
|
||||
geom_.PointToLocal();
|
||||
site_.PointToLocal();
|
||||
camera_.PointToLocal();
|
||||
light_.PointToLocal();
|
||||
flex_.PointToLocal();
|
||||
mesh_.PointToLocal();
|
||||
material_.PointToLocal();
|
||||
pair_.PointToLocal();
|
||||
equality_.PointToLocal();
|
||||
tendon_.PointToLocal();
|
||||
actuator_.PointToLocal();
|
||||
spec.element = static_cast<mjElement*>(this);
|
||||
spec.name = (mjString)&name;
|
||||
spec.joint = &joint.spec;
|
||||
spec.geom = &geom.spec;
|
||||
spec.site = &site.spec;
|
||||
spec.camera = &camera.spec;
|
||||
spec.light = &light.spec;
|
||||
spec.flex = &flex.spec;
|
||||
spec.mesh = &mesh.spec;
|
||||
spec.material = &material.spec;
|
||||
spec.pair = &pair.spec;
|
||||
spec.equality = &equality.spec;
|
||||
spec.tendon = &tendon.spec;
|
||||
spec.actuator = &actuator.spec;
|
||||
spec.joint = &joint_.spec;
|
||||
spec.geom = &geom_.spec;
|
||||
spec.site = &site_.spec;
|
||||
spec.camera = &camera_.spec;
|
||||
spec.light = &light_.spec;
|
||||
spec.flex = &flex_.spec;
|
||||
spec.mesh = &mesh_.spec;
|
||||
spec.material = &material_.spec;
|
||||
spec.pair = &pair_.spec;
|
||||
spec.equality = &equality_.spec;
|
||||
spec.tendon = &tendon_.spec;
|
||||
spec.actuator = &actuator_.spec;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void mjCDef::CopyFromSpec() {
|
||||
joint.CopyFromSpec();
|
||||
geom.CopyFromSpec();
|
||||
site.CopyFromSpec();
|
||||
camera.CopyFromSpec();
|
||||
light.CopyFromSpec();
|
||||
flex.CopyFromSpec();
|
||||
mesh.CopyFromSpec();
|
||||
material.CopyFromSpec();
|
||||
pair.CopyFromSpec();
|
||||
equality.CopyFromSpec();
|
||||
tendon.CopyFromSpec();
|
||||
actuator.CopyFromSpec();
|
||||
joint_.CopyFromSpec();
|
||||
geom_.CopyFromSpec();
|
||||
site_.CopyFromSpec();
|
||||
camera_.CopyFromSpec();
|
||||
light_.CopyFromSpec();
|
||||
flex_.CopyFromSpec();
|
||||
mesh_.CopyFromSpec();
|
||||
material_.CopyFromSpec();
|
||||
pair_.CopyFromSpec();
|
||||
equality_.CopyFromSpec();
|
||||
tendon_.CopyFromSpec();
|
||||
actuator_.CopyFromSpec();
|
||||
}
|
||||
|
||||
|
||||
@@ -1674,12 +1674,12 @@ mjCJoint::mjCJoint(mjCModel* _model, mjCDef* _def) {
|
||||
|
||||
// reset to default if given
|
||||
if (_def) {
|
||||
*this = _def->joint;
|
||||
*this = _def->Joint();
|
||||
}
|
||||
|
||||
// set model, def
|
||||
model = _model;
|
||||
def = (_def ? _def : (_model ? _model->Defaults()[0] : 0));
|
||||
def = (_def ? _def : (_model ? _model->Defaults(0) : 0));
|
||||
|
||||
// point to local
|
||||
PointToLocal();
|
||||
@@ -1878,12 +1878,12 @@ mjCGeom::mjCGeom(mjCModel* _model, mjCDef* _def) {
|
||||
|
||||
// reset to default if given
|
||||
if (_def) {
|
||||
*this = _def->geom;
|
||||
*this = _def->Geom();
|
||||
}
|
||||
|
||||
// set model, def
|
||||
model = _model;
|
||||
def = (_def ? _def : (_model ? _model->Defaults()[0] : 0));
|
||||
def = (_def ? _def : (_model ? _model->Defaults(0) : 0));
|
||||
|
||||
// point to local
|
||||
PointToLocal();
|
||||
@@ -1964,7 +1964,7 @@ void mjCGeom::NameSpace(const mjCModel* m) {
|
||||
|
||||
|
||||
// compute geom volume
|
||||
double mjCGeom::GetVolume(void) {
|
||||
double mjCGeom::GetVolume() const {
|
||||
double height;
|
||||
|
||||
// get from mesh
|
||||
@@ -2512,7 +2512,7 @@ mjCSite::mjCSite(mjCModel* _model, mjCDef* _def) {
|
||||
|
||||
// reset to default if given
|
||||
if (_def) {
|
||||
*this = _def->site;
|
||||
*this = _def->Site();
|
||||
}
|
||||
|
||||
// point to local
|
||||
@@ -2523,7 +2523,7 @@ mjCSite::mjCSite(mjCModel* _model, mjCDef* _def) {
|
||||
|
||||
// set model, def
|
||||
model = _model;
|
||||
def = (_def ? _def : (_model ? _model->Defaults()[0] : 0));
|
||||
def = (_def ? _def : (_model ? _model->Defaults(0) : 0));
|
||||
}
|
||||
|
||||
|
||||
@@ -2664,12 +2664,12 @@ mjCCamera::mjCCamera(mjCModel* _model, mjCDef* _def) {
|
||||
|
||||
// reset to default if given
|
||||
if (_def) {
|
||||
*this = _def->camera;
|
||||
*this = _def->Camera();
|
||||
}
|
||||
|
||||
// set model, def
|
||||
model = _model;
|
||||
def = (_def ? _def : (_model ? _model->Defaults()[0] : 0));
|
||||
def = (_def ? _def : (_model ? _model->Defaults(0) : 0));
|
||||
|
||||
// point to local
|
||||
PointToLocal();
|
||||
@@ -2818,12 +2818,12 @@ mjCLight::mjCLight(mjCModel* _model, mjCDef* _def) {
|
||||
|
||||
// reset to default if given
|
||||
if (_def) {
|
||||
*this = _def->light;
|
||||
*this = _def->Light();
|
||||
}
|
||||
|
||||
// set model, def
|
||||
model = _model;
|
||||
def = (_def ? _def : (_model ? _model->Defaults()[0] : 0));
|
||||
def = (_def ? _def : (_model ? _model->Defaults(0) : 0));
|
||||
|
||||
PointToLocal();
|
||||
CopyFromSpec();
|
||||
@@ -3855,12 +3855,12 @@ mjCMaterial::mjCMaterial(mjCModel* _model, mjCDef* _def) {
|
||||
|
||||
// reset to default if given
|
||||
if (_def) {
|
||||
*this = _def->material;
|
||||
*this = _def->Material();
|
||||
}
|
||||
|
||||
// set model, def
|
||||
model = _model;
|
||||
def = (_def ? _def : (_model ? _model->Defaults()[0] : 0));
|
||||
def = (_def ? _def : (_model ? _model->Defaults(0) : 0));
|
||||
|
||||
// point to local
|
||||
PointToLocal();
|
||||
@@ -3943,12 +3943,12 @@ mjCPair::mjCPair(mjCModel* _model, mjCDef* _def) {
|
||||
|
||||
// reset to default if given
|
||||
if (_def) {
|
||||
*this = _def->pair;
|
||||
*this = _def->Pair();
|
||||
}
|
||||
|
||||
// set model, def
|
||||
model = _model;
|
||||
def = (_def ? _def : (_model ? _model->Defaults()[0] : 0));
|
||||
def = (_def ? _def : (_model ? _model->Defaults(0) : 0));
|
||||
|
||||
// point to local
|
||||
PointToLocal();
|
||||
@@ -4304,12 +4304,12 @@ mjCEquality::mjCEquality(mjCModel* _model, mjCDef* _def) {
|
||||
|
||||
// reset to default if given
|
||||
if (_def) {
|
||||
*this = _def->equality;
|
||||
*this = _def->Equality();
|
||||
}
|
||||
|
||||
// set model, def
|
||||
model = _model;
|
||||
def = (_def ? _def : (_model ? _model->Defaults()[0] : 0));
|
||||
def = (_def ? _def : (_model ? _model->Defaults(0) : 0));
|
||||
|
||||
// point to local
|
||||
PointToLocal();
|
||||
@@ -4466,12 +4466,12 @@ mjCTendon::mjCTendon(mjCModel* _model, mjCDef* _def) {
|
||||
|
||||
// reset to default if given
|
||||
if (_def) {
|
||||
*this = _def->tendon;
|
||||
*this = _def->Tendon();
|
||||
}
|
||||
|
||||
// set model, def
|
||||
model = _model;
|
||||
def = (_def ? _def : (_model ? _model->Defaults()[0] : 0));
|
||||
def = (_def ? _def : (_model ? _model->Defaults(0) : 0));
|
||||
|
||||
// point to local
|
||||
PointToLocal();
|
||||
@@ -4629,19 +4629,18 @@ void mjCTendon::WrapPulley(double divisor, std::string_view info) {
|
||||
|
||||
|
||||
// get number of wraps
|
||||
int mjCTendon::NumWraps(void) {
|
||||
int mjCTendon::NumWraps() const {
|
||||
return (int)path.size();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// get pointer to specified wrap
|
||||
mjCWrap* mjCTendon::GetWrap(int id) {
|
||||
if (id>=0 && id<(int)path.size()) {
|
||||
return path[id];
|
||||
} else {
|
||||
return 0;
|
||||
const mjCWrap* mjCTendon::GetWrap(int i) const {
|
||||
if (i >= 0 && i < (int)path.size()) {
|
||||
return path[i];
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -4945,12 +4944,12 @@ mjCActuator::mjCActuator(mjCModel* _model, mjCDef* _def) {
|
||||
|
||||
// reset to default if given
|
||||
if (_def) {
|
||||
*this = _def->actuator;
|
||||
*this = _def->Actuator();
|
||||
}
|
||||
|
||||
// set model, def
|
||||
model = _model;
|
||||
def = (_def ? _def : (_model ? _model->Defaults()[0] : 0));
|
||||
def = (_def ? _def : (_model ? _model->Defaults(0) : 0));
|
||||
|
||||
// in case this actuator is not compiled
|
||||
CopyFromSpec();
|
||||
|
||||
Reference in New Issue
Block a user