DataWriter Device Class

DataWriter is a base device for writing received stream frames to files. It defines the normal tree-facing control surface for a file writer, but it does not implement the actual file format or stream endpoint by itself. For application use, StreamWriter is the concrete subclass you should typically instantiate. In the current implementation it provides:

  • DataFile for the selected output path

  • Open, Close, and AutoName commands

  • Status variables such as IsOpen, CurrentSize, TotalSize, Bandwidth, and FrameCount

  • Writer controls such as BufferSize and MaxFileSize

That makes DataWriter the reusable base class for file-writer devices that should look like ordinary PyRogue nodes in the tree.

When To Use DataWriter

Use DataWriter when you are implementing a custom file-writing device and want to reuse the standard PyRogue control/status Variables and commands.

If you only want to record stream traffic to file, use StreamWriter, documented in Writing Frames To A File, which is the concrete built-in subclass most applications actually instantiate.

What You Usually Set

Most DataWriter subclasses care about only a few constructor parameters:

  • hidden when the writer should stay out of the main user tree

  • bufferSize for filesystem buffering

  • maxFileSize for rolling to a new file after a size limit

How Subclassing Works

DataWriter is intentionally a base class. The core file operations are empty or stub implementations until a subclass supplies the real writer backend.

The main override points are:

  • _open()

  • _close()

  • _isOpen()

  • _setBufferSize()

  • _setMaxFileSize()

  • _getCurrentSize()

  • _getTotalSize()

  • _getBandwidth()

  • _getFrameCount()

That split is what lets StreamWriter reuse the same tree-facing controls while delegating the actual writing behavior to the Rogue file-I/O utility.

The base class always creates the same operator-facing controls:

  • DataFile holds the path that Open will use.

  • Open and Close control the underlying writer.

  • AutoName creates a timestamped filename using the current DataFile directory, if any.

  • BufferSize and MaxFileSize are writable control points.

  • IsOpen, CurrentSize, TotalSize, Bandwidth, and FrameCount are read-only status/monitoring fields.

This common interface is useful because scripts and GUIs can treat custom writers and built-in writers the same way at the tree level.

API Reference

See DataWriter for generated API details.