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

Refactor plotting and block handling #177

Merged
merged 26 commits into from
Apr 26, 2024
Merged

Refactor plotting and block handling #177

merged 26 commits into from
Apr 26, 2024

Conversation

frankosterfeld
Copy link
Contributor

@frankosterfeld frankosterfeld commented Apr 17, 2024

  • Plot rendering is now done by "ImPlotSink" (formerly DataSink) following Ralph's suggestion (draw() called in the UI thread).
  • All the blocks currently defined in the UI (including ImPlotSink and RemoteSource) are in blocks/ and have no further dependencies to the UI, i.e. they can be moved to gr-digitizers, graph-prototype etc. easily.
  • Type registration and block creation was simplified: BlockType and Block are simple "type-erased" data structures containing typenames, properties etc. needed to create the blocks using the gr::PluginLoader (and can be serialized easily for service<->UI and UI<-> scheduler communication)
  • GRC loading uses gr::load_grc

Things that this does not yet contain:

  • The types known to the UI are still registered in a hardcoded manner in main() (If gr::BlockRegistry/PluginLoader would have a similar structure like BlockType to list meta information for all available types, this could be avoided)
  • The GR graph is still recreated when the topology changes - UI blocks (Plot, Toolbar) are created as part of the graph but accessed from the UI thread to draw().
  • GRC loading loads the graph, inspects it to create the Block instances on the UI side, and the drops the graph (and the creates a graph for actual execution from the Block list). Here we would need better type support in gr::load_grc (instantiates everything as Foo) and the UI (uses always float and DataSet_float)

@frankosterfeld frankosterfeld marked this pull request as ready for review April 26, 2024 13:45
namespace opendigitizer::meta {

template<typename T>
struct is_dataset {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an existing gr::DataSetLike<T> concept that defines this.


for (const auto &s : sources) {
if (!s.IsMap()) ERROR_RETURN("source is no map");
if (!s.IsMap()) throw std::runtime_error("source is no map");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use gr::exception(...), you would get implicitly also the std::source_location and time trace when/where this exception was thrown.

@RalphSteinhagen RalphSteinhagen merged commit b0a5e25 into main Apr 26, 2024
8 of 9 checks passed
@RalphSteinhagen RalphSteinhagen deleted the frank/refactor branch April 26, 2024 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[3-5SP, 5SP] UI: Implement charts that can show DataSets
4 participants