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:

For conceptual utility usage, see:

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

typedef std::shared_ptr<rogue::utilities::fileio::StreamReader> rogue::utilities::fileio::StreamReaderPtr
[header]

The class description is shown below:

class StreamReader : public rogue::interfaces::stream::Master
[header]

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()
[header] [impl]

Constructs a stream reader instance.

Creator.

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

~StreamReader()
[header] [impl]

Destroys stream reader and closes active file/thread.

Deconstructor.

void open(std::string file)
[header] [impl]

Opens a file and starts background read processing.

Open a data file.

Parameters:

file – Input data filename.

void close()
[header] [impl]

Stops read thread and closes active file immediately.

Close a data file.

bool isOpen()
[header] [impl]

Returns whether a file descriptor is currently open.

Get open status.

Returns:

true if file is open; otherwise false.

void closeWait()
[header] [impl]

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

Close when done.

bool isActive()
[header] [impl]

Returns read activity state.

Return true when done.

Returns:

true while background reader is active.

Public Static Functions

static std::shared_ptr<rogue::utilities::fileio::StreamReader> create()
[header] [impl]

Creates a stream reader instance.

Class creation.

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 read data files.

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.

Returns:

Shared pointer to the created reader.

static void setup_python()
[header] [impl]

Registers Python bindings for this class.

Setup class in python.