StreamReader

The StreamReader class is the utilitiy for reading data from a Rogue file in a streaming fashion.

The file format consumed by StreamReader is documented here:

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

typedef std::shared_ptr<rogue::utilities::fileio::StreamReader> rogue::utilities::fileio::StreamReaderPtr

The class description is shown below:

class StreamReader : public rogue::interfaces::stream::Master

Reads Rogue stream data files and emits frames on stream master interface.

StreamReader opens a file (or indexed file sequence) created by Rogue file writer utilities, parses frame headers/metadata, reconstructs stream frames, and forwards them downstream via sendFrame().

File sequence behavior:

  • If opened on a filename ending in .1, the reader attempts .2, .3, … automatically as each file completes.

  • Otherwise only the specified file is read.

Read activity runs in a background thread while isActive() is true.

Public Functions

StreamReader()

Constructs a stream reader instance.

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

~StreamReader()

Destroys stream reader and closes active file/thread.

void open(std::string file)

Opens a file and starts background read processing.

Parameters:

file – Input data filename.

void close()

Stops read thread and closes active file immediately.

bool isOpen()

Returns whether a file descriptor is currently open.

Returns:

true if file is open; otherwise false.

void closeWait()

Waits for read activity to complete, then closes file/thread.

bool isActive()

Returns read activity state.

Returns:

true while background reader is active.

Public Static Functions

static std::shared_ptr<rogue::utilities::fileio::StreamReader> create()

Creates a stream reader instance.

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.

Returns:

Shared pointer to the created reader.

static void setup_python()

Registers Python bindings for this class.