# HG changeset patch # User František Kučera # Date 1601725207 -7200 # Node ID a85c191709e639c20cb9b3cbbdedd0da5b174961 # Parent f56620b95180529e52512e24601d0b47cbe8d285 skip relations with missing mandatory attributes diff -r f56620b95180 -r a85c191709e6 src/JackHandler.h --- a/src/JackHandler.h Sat Oct 03 12:50:31 2020 +0200 +++ b/src/JackHandler.h Sat Oct 03 13:40:07 2020 +0200 @@ -100,6 +100,8 @@ */ class RelationContext { public: + bool skip = false; + size_t indexOfEvent = -1; size_t indexOfChannel = -1; size_t indexOfNoteOn = -1; @@ -155,6 +157,7 @@ jack_set_process_callback(realTimeContext.jackClient, RealTimeContext::processCallback, &realTimeContext); // TODO: report also other events (connections etc.) + // TODO: jack_set_error_function() + avoid mixing char and wchar output realTimeContext.jackPort = jack_port_register(realTimeContext.jackClient, "output", JACK_DEFAULT_MIDI_TYPE, JackPortIsOutput, 0); if (realTimeContext.jackPort == nullptr) throw JackException(L"Could not register port."); @@ -190,9 +193,16 @@ // TODO: check also data types and skipt relation if important attributes are missing // TODO: configurable relation name + + if (relationContext.indexOfEvent == -1 || relationContext.indexOfRaw == -1) { + relationContext.skip = true; + fwprintf(stderr, L"Relation „%ls“ will be ignored because mandatory attributes are missing.\n", name.c_str()); + } + } void attribute(const relpipe::common::type::StringX& value) override { + if (relationContext.skip) return; // TODO: switch to RelationalReaderStringHandler // TODO: if (continueProcessing) {} ?