Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Communicate through swig that PathPointSet::insert takes ownership #3276

Merged
merged 3 commits into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Bindings/Java/swig/java_simulation.i
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ using namespace SimTK;

%rename OpenSim::PathPointSet::clone unused_clone;

// replace insert with a variant that takes ownership of passed in AbstractPathPoint.
// in java the method 'insert' ends in super class so we can call it internally
// and that hides the super class method
%typemap(javacode) OpenSim::PathPointSet %{
public boolean insert(int aIndex, AbstractPathPoint aObject) {
aObject.markAdopted();
return super.insert(aIndex, aObject);
}
%}

%extend OpenSim::Body {
void getInertia(Array<double>& rInertia) {
SimTK::Mat33 inertia= self->getInertia().toMat33();
Expand Down
4 changes: 4 additions & 0 deletions Bindings/Python/swig/python_simulation.i
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ MODEL_ADOPT_HELPER(Controller);
args[1]._markAdopted()
%}

// PathPointSet takes ownership of passed in object
%pythonappend OpenSim::PathPointSet::insert %{
aObject._markAdopted()
%}
// Typemaps
// ========
// None.
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ v4.4.1
======

- Made `Component::getSocketNames` a `const` member method (previously: non-const)
- Modifed the swig interface files to make OpenSim::PathPointSet adopt new PathPoints inserted into it. (Issue #3276)

v4.4
====
Expand Down