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

[0pt,6pt] Clean up the prototype code for presenting to wider GR audience #45

Closed
8 tasks done
Tracked by #42
Assignees

Comments

@ivan-cukic
Copy link
Contributor

ivan-cukic commented Feb 1, 2023

Background

We need two types of processing: a) synchronous stream- as well as b) asynchronous message-type processing (i.e. chunked and/or DataSet based data). The original OpenDigitizer draft design intended that the latter would be done using RxCpp. However, since the RxCpp development somewhat stalled and because both processing types are graph-type problems, the proposal was to rationalise and merge both designs into one using GNU Radio in it's 4.0 version incarnation.

The graph-prototype is targeted as an enhancement and replacement of the low-level GNU Radio 4.0 API to enable such message-type processing using graphs.

Immediate things to be refactored prior to merging with GR 4.0 -- 'Step one'

using namespace gr;
struct node_settings { // node domain object specialised/derived/modified (as needed)
    float samp_rate = 44100.f;
    int scaling_factor = 1;
};
ENABLE_REFLECTION_FOR(node_settings, samp_rate, scaling_factor) // <- refl::cpp macro

template<typename T>
class my_node : public node<my_node<T>>, Setting<node_settings> {
public:
    IN<T> in0;
    IN<T> in1;
    OUT<T> out;
    
    [[nodiscard]] constexpr T process_one(T value1, T value2) const noexcept {
        return  settings.scaling_factor * some_math_func(value1, value2); // ... do some operation with values from ports in[0,1]
    }
};
ENABLE_REFLECTION_FOR((my_node, float, double, int), in0, in1, out) // <- refl::cpp macro for my_node

Steps afterward (EPIC: #42)

@ivan-cukic ivan-cukic changed the title Clean up the prototype code for presenting to wider GR audience [0pt] Clean up the prototype code for presenting to wider GR audience Feb 1, 2023
@ivan-cukic
Copy link
Contributor Author

  • the implementation is split into separate header files
  • refactored the code
  • implemented a nicer connection API
  • split the work function into several reusable parts
  • delay the connection logic until graph is explicitly initialized

@RalphSteinhagen
Copy link
Member

Done. Thanks a lot to @ivan-cukic and the good work he put into this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment