Clarify the DefaultDataConverter method names

This commit is contained in:
Robbert van der Helm
2021-05-20 14:36:07 +02:00
parent 06bae784a8
commit ccfda51a69
4 changed files with 38 additions and 36 deletions
+2 -2
View File
@@ -18,7 +18,7 @@
DefaultDataConverter::~DefaultDataConverter() noexcept {} DefaultDataConverter::~DefaultDataConverter() noexcept {}
EventPayload DefaultDataConverter::read(const int /*opcode*/, EventPayload DefaultDataConverter::read_data(const int /*opcode*/,
const int /*index*/, const int /*index*/,
const intptr_t /*value*/, const intptr_t /*value*/,
const void* data) const { const void* data) const {
@@ -44,7 +44,7 @@ std::optional<EventPayload> DefaultDataConverter::read_value(
return std::nullopt; return std::nullopt;
} }
void DefaultDataConverter::write(const int /*opcode*/, void DefaultDataConverter::write_data(const int /*opcode*/,
void* data, void* data,
const EventResult& response) const { const EventResult& response) const {
// The default behavior is to handle this as a null terminated C-style // The default behavior is to handle this as a null terminated C-style
+4 -4
View File
@@ -37,7 +37,7 @@ class DefaultDataConverter {
* Read data from the `data` void pointer into a an `EventPayload` value * Read data from the `data` void pointer into a an `EventPayload` value
* that can be serialized and conveys the meaning of the event. * that can be serialized and conveys the meaning of the event.
*/ */
virtual EventPayload read(const int opcode, virtual EventPayload read_data(const int opcode,
const int index, const int index,
const intptr_t value, const intptr_t value,
const void* data) const; const void* data) const;
@@ -53,7 +53,7 @@ class DefaultDataConverter {
/** /**
* Write the response back to the `data` pointer. * Write the response back to the `data` pointer.
*/ */
virtual void write(const int opcode, virtual void write_data(const int opcode,
void* data, void* data,
const EventResult& response) const; const EventResult& response) const;
@@ -165,7 +165,7 @@ class Vst2EventHandler : public AdHocSocketHandler<Thread> {
// are converted to C-style data structures in `passthrough_event()` so // are converted to C-style data structures in `passthrough_event()` so
// they can be passed to a plugin or callback function. // they can be passed to a plugin or callback function.
const EventPayload payload = const EventPayload payload =
data_converter.read(opcode, index, value, data); data_converter.read_data(opcode, index, value, data);
const std::optional<EventPayload> value_payload = const std::optional<EventPayload> value_payload =
data_converter.read_value(opcode, value); data_converter.read_value(opcode, value);
@@ -199,7 +199,7 @@ class Vst2EventHandler : public AdHocSocketHandler<Thread> {
response.value_payload); response.value_payload);
} }
data_converter.write(opcode, data, response); data_converter.write_data(opcode, data, response);
data_converter.write_value(opcode, value, response); data_converter.write_value(opcode, value, response);
return data_converter.return_value(opcode, response.return_value); return data_converter.return_value(opcode, response.return_value);
+6 -5
View File
@@ -190,7 +190,7 @@ class DispatchDataConverter : public DefaultDataConverter {
VstRect& editor_rectangle) noexcept VstRect& editor_rectangle) noexcept
: chunk(chunk_data), plugin(plugin), rect(editor_rectangle) {} : chunk(chunk_data), plugin(plugin), rect(editor_rectangle) {}
EventPayload read(const int opcode, EventPayload read_data(const int opcode,
const int index, const int index,
const intptr_t value, const intptr_t value,
const void* data) const override { const void* data) const override {
@@ -243,7 +243,7 @@ class DispatchDataConverter : public DefaultDataConverter {
return static_cast<native_size_t>( return static_cast<native_size_t>(
reinterpret_cast<size_t>(data)); reinterpret_cast<size_t>(data));
} else { } else {
return DefaultDataConverter::read(opcode, index, value, return DefaultDataConverter::read_data(opcode, index, value,
data); data);
} }
break; break;
@@ -301,7 +301,8 @@ class DispatchDataConverter : public DefaultDataConverter {
case effStopProcess: case effStopProcess:
return nullptr; return nullptr;
default: default:
return DefaultDataConverter::read(opcode, index, value, data); return DefaultDataConverter::read_data(opcode, index, value,
data);
break; break;
} }
} }
@@ -327,7 +328,7 @@ class DispatchDataConverter : public DefaultDataConverter {
} }
} }
void write(const int opcode, void write_data(const int opcode,
void* data, void* data,
const EventResult& response) const override { const EventResult& response) const override {
switch (opcode) { switch (opcode) {
@@ -405,7 +406,7 @@ class DispatchDataConverter : public DefaultDataConverter {
reinterpret_cast<uint8_t*>(output)); reinterpret_cast<uint8_t*>(output));
} break; } break;
default: default:
DefaultDataConverter::write(opcode, data, response); DefaultDataConverter::write_data(opcode, data, response);
break; break;
} }
} }
+5 -4
View File
@@ -492,7 +492,7 @@ class HostCallbackDataConverter : public DefaultDataConverter {
VstTimeInfo& last_time_info) noexcept VstTimeInfo& last_time_info) noexcept
: plugin(plugin), last_time_info(last_time_info) {} : plugin(plugin), last_time_info(last_time_info) {}
EventPayload read(const int opcode, EventPayload read_data(const int opcode,
const int index, const int index,
const intptr_t value, const intptr_t value,
const void* data) const override { const void* data) const override {
@@ -547,7 +547,8 @@ class HostCallbackDataConverter : public DefaultDataConverter {
return nullptr; return nullptr;
break; break;
default: default:
return DefaultDataConverter::read(opcode, index, value, data); return DefaultDataConverter::read_data(opcode, index, value,
data);
break; break;
} }
} }
@@ -558,7 +559,7 @@ class HostCallbackDataConverter : public DefaultDataConverter {
return DefaultDataConverter::read_value(opcode, value); return DefaultDataConverter::read_value(opcode, value);
} }
void write(const int opcode, void write_data(const int opcode,
void* data, void* data,
const EventResult& response) const override { const EventResult& response) const override {
switch (opcode) { switch (opcode) {
@@ -571,7 +572,7 @@ class HostCallbackDataConverter : public DefaultDataConverter {
} }
break; break;
default: default:
DefaultDataConverter::write(opcode, data, response); DefaultDataConverter::write_data(opcode, data, response);
break; break;
} }
} }