Skip to content

Instantly share code, notes, and snippets.

@traversaro
Created April 28, 2024 17:04
Show Gist options
  • Save traversaro/45c5265b57eaa6c671a6d732724c79d9 to your computer and use it in GitHub Desktop.
Save traversaro/45c5265b57eaa6c671a6d732724c79d9 to your computer and use it in GitHub Desktop.
Swig Friend Method Minimum Reproducible Example
#include "testswig.h"
ClassWithProtectedFriendMethod::ClassWithProtectedFriendMethod()
{
}
ClassWithProtectedFriendMethod::protectedFriendMethod()
{
return -42.0;
}
ClassWithProtectedFriendMethod::publicMethod()
{
return 42.0;
}
#ifndef SWIGEXAMPLE_H
#define SWIGEXAMPLE_H
/**
* \ingroup functionEncoder
*
* Encode any given function as a set of wavelet coefficients.
* The father wavelet used here is the \b db4.
*/
class ClassWithProtectedFriendMethod
{
protected:
friend double protectedFriendMethod();
public:
/**
* Constructor.
*/
ClassWithProtectedFriendMethod();
double publicMethod();
};
#endif
%module testswig
%{
#include "testswig.h"
%}
%include "testswig.h"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment