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

[5pt,8pt] Enable MESSAGE passing/ports #210

Closed
Tracked by #148
RalphSteinhagen opened this issue Oct 26, 2023 · 0 comments · Fixed by #254
Closed
Tracked by #148

[5pt,8pt] Enable MESSAGE passing/ports #210

RalphSteinhagen opened this issue Oct 26, 2023 · 0 comments · Fixed by #254
Assignees

Comments

@RalphSteinhagen
Copy link
Member

RalphSteinhagen commented Oct 26, 2023

Clarification and Proposals for the required MESSAGE port functionality

This is to summarise the required core features and expectations MESSAGE ports within GR 4.0.

  1. Streaming Ports (Syntax: In<T> in;, Out<T> out;): these are already implemented

    • handle the synchronous transmission of primitive data types (e.g., int, float, std::complex<float>) between Blocks.
    • developers must implement processOne(...) and processBulk(...) within the Block. The system triggers these functions once the specific input/output port constraints -- typically the available number of input/output sames sample -- are met
    • streams can assign unique Tags—comprising a pmtv::map_tand sample index — to distinct samples. Notably, a tag with an index of -1 signifies precedence or mandatory processing/forwarding, a feature already in place.
  2. Message Ports (Syntax: MsgIn msgIn;, MsgOut msgOut;):

    • operate asynchronously, facilitating consistent 'message' exchanges between Blocks.
    • every Block<T> inherently possesses a default MsgIn msgIn; and MsgOut msgOut; Port.
    • the Graph connect API shall be the same as for the streaming ports.
    • developers may create a void processMessages(std::span in0, ...) for intercepting, manipulating, and transmitting messages. The work(..) function invokes this function if there are unprocessed messages at any input message ports.
    • execution of void processMessages(std::span in0, ...) is independent of the streaming ports’ activities or constraints.
    • all Blocks’ 'msgIn' and 'msgOut' Ports link with the superordinate (Sub)Graph and Scheduler message ports, to allow communication for user settings and error feedback through from the UI->scheduler->Graph->...->Block system layers.
    • messages on 'msgIn' that have compatible block identifiers (uniquID of the block & Block field specifications) automatically initiate changes and potentially invoke the user-defined settingsChanged(...) function, akin to Tag-induced settings procedures.
    • exception -- which should be the exception -- in user code should be intercepted on the Block<T>::work(...) level, converted into messages, and emitted on the msgOut port.

Proposed Standard Message Format (DRAFT):

struct Message {
    std::string what;
    pmtv::map_t data;
    std::source_location location;
    // Potential integration of std::stacktrace backtrace; pending widespread availability

    Message(std::string_view msg, const pmtv::map_t& data_, const std::source_location& loc = std::source_location::current() /*, std::stacktrace trace = std::stacktrace::current()*/)
        : what(msg), data(data_), location(loc) /*, backtrace(trace)*/ {}

    Message(std::string msg, pmtv::map_t&& data_, const std::source_location& loc = std::source_location::current() /*, std::stacktrace trace = std::stacktrace::current()*/)
        : what(std::move(msg)), data(std::move(data_)), location(loc) /*, backtrace(trace)*/ {}

    // Additional functionalities might follow...
};
@RalphSteinhagen RalphSteinhagen changed the title STREAM or MESSAGE [Xpt] Enable MESSAGE passing/ports Oct 26, 2023
@RalphSteinhagen RalphSteinhagen moved this from 🆕 Ideas (∞) to 🔖 Selected (3) in Digitizer Reimplementation Oct 27, 2023
@github-project-automation github-project-automation bot moved this to 🆕 Ideas (∞) in Digitizer Reimplementation Oct 27, 2023
@RalphSteinhagen RalphSteinhagen changed the title [Xpt] Enable MESSAGE passing/ports [5pt] Enable MESSAGE passing/ports Oct 27, 2023
@ivan-cukic ivan-cukic self-assigned this Jan 9, 2024
@ivan-cukic ivan-cukic moved this from 🔖 Selected (3) to 🏗 In progress in Digitizer Reimplementation Jan 9, 2024
@ivan-cukic ivan-cukic linked a pull request Jan 25, 2024 that will close this issue
@ivan-cukic ivan-cukic moved this from 🏗 In progress to Finished Implementation (2) in Digitizer Reimplementation Jan 31, 2024
@ivan-cukic ivan-cukic changed the title [5pt] Enable MESSAGE passing/ports [5pt,8pt] Enable MESSAGE passing/ports Jan 31, 2024
@RalphSteinhagen RalphSteinhagen moved this from Finished Implementation (2) to ✅ QA-Accepted/Merged (∞) in Digitizer Reimplementation Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: QA-Accepted/Merged (∞)
Development

Successfully merging a pull request may close this issue.

2 participants