StreamWriterChannel

The StreamWriterChannel class is the interface between the StreamWriter class and the incoming data streams.

For conceptual utility usage, see:

StreamWriterChannel objects in C++ are referenced by the following shared pointer typedef:

typedef std::shared_ptr<rogue::utilities::fileio::StreamWriterChannel> rogue::utilities::fileio::StreamWriterChannelPtr
[header]

The class description is shown below:

class StreamWriterChannel : public rogue::interfaces::stream::Slave
[header]

Stream sink that writes incoming frames into a tagged writer channel.

StreamWriterChannel is a stream::Slave front end for StreamWriter. Each instance is bound to a channel/tag value used in the output file bank header. If constructed with channel == 0, the channel is taken from each incoming frame (frame->getChannel()); otherwise the configured channel is forced for all writes.

The class also tracks how many frames have been accepted so callers can synchronize on data capture progress with waitFrameCount().

Public Functions

StreamWriterChannel(std::shared_ptr<rogue::utilities::fileio::StreamWriter> writer, uint8_t channel)
[header] [impl]

Constructs a stream writer channel.

Creator.

This constructor is a low-level C++ allocation path. Prefer create() when shared ownership or Python exposure is required.

Parameters:
  • writer – Destination writer used to serialize frames.

  • channel – Output channel/tag. Use 0 to forward per-frame channel.

~StreamWriterChannel()
[header] [impl]

Destroys stream writer channel.

Deconstructor.

virtual void acceptFrame(std::shared_ptr<rogue::interfaces::stream::Frame> frame)
[header] [impl]

Accepts and writes one incoming frame.

Accept a frame from master.

The method writes the frame through StreamWriter, increments the local accepted-frame counter, and wakes waiters in waitFrameCount().

Parameters:

frame – Input frame to write.

uint32_t getFrameCount()
[header] [impl]

Returns the number of accepted frames.

Returns:

Accepted frame count.

void setFrameCount(uint32_t count)
[header] [impl]

Sets the accepted-frame counter to a specific value.

Parameters:

count – New frame counter value.

bool waitFrameCount(uint32_t count, uint64_t timeout)
[header] [impl]

Waits until at least count frames have been accepted.

Parameters:
  • count – Target accepted-frame count.

  • timeout – Timeout in microseconds. 0 waits indefinitely.

Returns:

true if count was reached before timeout, else false.

Public Static Functions

static std::shared_ptr<rogue::utilities::fileio::StreamWriterChannel> create(std::shared_ptr<rogue::utilities::fileio::StreamWriter> writer, uint8_t channel)
[header] [impl]

Creates a stream writer channel instance.

Class creation.

Parameter semantics are identical to the constructor; see StreamWriterChannel() for output-channel behavior details. This static factory is the preferred construction path when the object is shared across Rogue graph connections or exposed to Python. It returns std::shared_ptr ownership compatible with Rogue pointer typedefs.

Company : SLAC National Accelerator Laboratory

Description : Class to act as a slave interface to the StreamWriterChannel. Each slave is associated with a tag. The tag is included in the bank header of each write.

This file is part of the rogue software platform. It is subject to the license terms in the LICENSE.txt file found in the top-level directory of this distribution and at: https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. No part of the rogue software platform, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the LICENSE.txt file.

Parameters:
  • writer – Destination writer used to serialize frames.

  • channel – Output channel/tag. Use 0 to forward per-frame channel.

Returns:

Shared pointer to the created channel.

static void setup_python()
[header] [impl]

Registers Python bindings for this class.

Setup class in python.