Skip to content

Refactor Oscillator source

Li-Ta Lo requested to merge ollielo/vtk-m:osc_refactor into master

This MR serves as a prototype for the Filter redesign #601 (closed). Modeled after the Tangle and Wavelet source, the OscillatorSource worklet now resides in the Oscillator.cxx instead of a separate header file in the worklet directory. This allows client code to not depend on device compiler.

Since the OscillatorSource worklet is stateful and the states are exposed to the client code through the public interface of Oscillator there is a circular dependency in the declaration and definition of these two. That is, in order to define Oscillator which has OscillatorSource as a data member, the compiler needs to see the definition of OscillatorSource first, defeating the effort to hide the worklet from client code. A PImpl pattern is used to resolve this dependency. Instead of an object of OscillatorSource as a data member, now Oscillator has a std::unique_ptr<OscillatorSource> as a data member. The compiler now does not need to see the definition of OscillatorSource in order to compile Oscillator thus allowing OscillatorSource to be defined in the .cxx file.

Merge request reports