bufferSwitch

class bufferSwitch : public bufferMerge

Selects buffers based on the values in an updatable config endpoint.

An example config:

buffer_switch: kotekan_stage: bufferSwitch in_bufs:

  • network_data_0: gpu_data_buffer_0

  • network_data_1: gpu_data_buffer_1 out_buf: network_buffer updatable_config: “/buffer_switch/switch_status” switch_status: kotekan_update_endpoint: “json” network_data_0: false # Don’t merge frames from gpu_data_buffer_0 network_data_1: true # Merge frames from gpu_data_buffer_1

See bufferMerge for more docs. Requires internal names.

Author

Andre Renard

Param updatable_config:

String. JSON pointer to the updatable config block. An example block would be: switch_config: updatable_config: “json” internal_buffer_name_0: true internal_buffer_name_1: false

Public Functions

bufferSwitch(kotekan::Config &config, const std::string &unique_name, kotekan::bufferContainer &buffer_container)

Constructor.

~bufferSwitch() = default

Destructor.

virtual bool select_frame(const std::string &internal_name, Buffer *in_buf, uint32_t frame_id) override

Selects a buffer if it’s internal name is set to true in the updatable config block.

Parameters:
  • internal_name – The name given in the config to the buffer (not the buffer name)

  • in_buf – not used.

  • frame_id – not used.

Returns:

true if the internal name is set to true in enabled_buffers_lock

bool enabled_buffers_callback(nlohmann::json &json)

Called by the configUpdater to change which buffers are selected.