OSSIA
Open Scenario System for Interactive Application
Loading...
Searching...
No Matches
messages.hpp
1#pragma once
2#include <ossia/dataflow/data.hpp>
3#include <ossia/dataflow/execution_state.hpp>
4#include <ossia/dataflow/graph_node.hpp>
5#include <ossia/dataflow/value_port.hpp>
7
8namespace ossia::nodes
9{
10// This is only used for testing so not very efficient by design
11class messages final : public ossia::graph_node
12{
13public:
14 messages() { }
15
16 std::string label() const noexcept override { return "messages"; }
17 void run(const ossia::token_request&, ossia::exec_state_facade e) noexcept override
18 {
19 for(auto& msg : data)
20 {
21 ossia::value_port p;
22 p.add_local_value(
23 ossia::typed_value{msg.message_value, msg.dest.index, msg.dest.unit});
24
25 e.impl->insert(msg.dest.address(), p);
26 }
27 }
28
29 std::vector<ossia::message> data;
30};
31}