Skip to content

Commit

Permalink
Add missing inner implemenations.
Browse files Browse the repository at this point in the history
  • Loading branch information
tychedelia committed Nov 3, 2023
1 parent 77827e4 commit f7e0bac
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 4 deletions.
4 changes: 4 additions & 0 deletions td-rs-dat/src/RustDatPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ class RustDatPlugin : public DatPlugin {
public:
virtual ~RustDatPlugin(){};

virtual void* inner() const = 0;

virtual void* innerMut() = 0;

virtual void getGeneralInfo(DAT_GeneralInfo &info,
const OP_Inputs &inputs) = 0;

Expand Down
8 changes: 8 additions & 0 deletions td-rs-dat/src/cxx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ extern "C" fn dat_new(info: &'static OP_NodeInfo) -> *mut RustDatPluginImplCpp {
}

impl RustDatPlugin_methods for RustDatPluginImpl {
fn inner(&self) -> *mut c_void {
self.inner.as_ref() as *const dyn Dat as *mut c_void
}

fn innerMut(&mut self) -> *mut c_void {
self.inner.as_mut() as *mut dyn Dat as *mut c_void
}

fn getGeneralInfo(&mut self, mut info: Pin<&mut DAT_GeneralInfo>, inputs: &OP_Inputs) {
let input = OperatorInputs::new(inputs);
if let Some(params) = self.inner.params_mut() {
Expand Down
8 changes: 4 additions & 4 deletions td-rs-derive-py/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ fn impl_py_op(input: &DeriveInput) -> TokenStream {
return std::ptr::null_mut();
}
let py_chop = {
// let me = cxx::plugin_cast(me);
// let me = me.as_plugin_mut().inner();
let me = cxx::plugin_cast(me);
let me = me.as_plugin().inner();
&mut *(me as *mut #struct_name)
};
py::ToPyObj::to_py_obj(py_chop.#field_name)
Expand Down Expand Up @@ -176,7 +176,7 @@ fn impl_py_op(input: &DeriveInput) -> TokenStream {
}
let py_chop = {
let me = cxx::plugin_cast(me);
let me = me.as_plugin_mut().inner();
let me = me.as_plugin_mut().innerMut();
&mut *(me as *mut #struct_name)
};

Expand Down Expand Up @@ -331,7 +331,7 @@ pub fn py_op_methods(_attr: TokenStream, item: TokenStream) -> TokenStream {
}
let py_chop = {
let me = cxx::plugin_cast(me);
let me = me.as_plugin_mut().inner();
let me = me.as_plugin_mut().innerMut();
&mut *(me as *mut #struct_name)
};
let res = py_chop.#fn_name(args, nargs as usize);
Expand Down
4 changes: 4 additions & 0 deletions td-rs-sop/src/RustSopPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ class RustSopPlugin : public SopPlugin {
public:
virtual ~RustSopPlugin() {};

virtual void* inner() const = 0;

virtual void* innerMut() = 0;

virtual void getGeneralInfo(SOP_GeneralInfo &info, const OP_Inputs &inputs) = 0;

virtual void execute(SOP_Output &outputs, const OP_Inputs &inputs) = 0;
Expand Down
8 changes: 8 additions & 0 deletions td-rs-sop/src/cxx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ extern "C" fn sop_new(info: &'static OP_NodeInfo) -> *mut RustSopPluginImplCpp {
}

impl RustSopPlugin_methods for RustSopPluginImpl {
fn inner(&self) -> *mut c_void {
self.inner.as_ref() as *const dyn Sop as *mut c_void
}

fn innerMut(&mut self) -> *mut c_void {
self.inner.as_mut() as *mut dyn Sop as *mut c_void
}

fn getGeneralInfo(&mut self, mut info: Pin<&mut SOP_GeneralInfo>, inputs: &OP_Inputs) {
let input = OperatorInputs::new(inputs);
if let Some(params) = self.inner.params_mut() {
Expand Down
4 changes: 4 additions & 0 deletions td-rs-top/src/RustTopPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ class RustTopPlugin : public TopPlugin {
public:
virtual ~RustTopPlugin() {};

virtual void* inner() const = 0;

virtual void* innerMut() = 0;

virtual void getGeneralInfo(TOP_GeneralInfo &info,
const OP_Inputs &inputs) = 0;

Expand Down
8 changes: 8 additions & 0 deletions td-rs-top/src/cxx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ extern "C" fn top_new(
}

impl RustTopPlugin_methods for RustTopPluginImpl {
fn inner(&self) -> *mut c_void {
self.inner.as_ref() as *const dyn Top as *mut c_void
}

fn innerMut(&mut self) -> *mut c_void {
self.inner.as_mut() as *mut dyn Top as *mut c_void
}

fn getGeneralInfo(&mut self, mut info: Pin<&mut TOP_GeneralInfo>, inputs: &OP_Inputs) {
let input = OperatorInputs::new(inputs);
if let Some(params) = self.inner.params_mut() {
Expand Down

0 comments on commit f7e0bac

Please sign in to comment.