StreamWriter
The StreamWriter class is the utilitiy for writing Rogue data to a file. The writer class can accept streams from multiple sources, with the StreamWriterChannel serving as the interface to each incoming stream. This class can be sub-classed to support custom formats, by overriding the writeFile method.
The default format is the following:
The data file is a written as a series of banks, each associated with a written Frame. Each bank has a channel and frame flags. The channel is per source and the lower 24 bits of the incoming Frame flags are used as the flags.
The bank is proceeded by 2 - 32-bit headers to indicate bank information and length:
headerA:
31:0 = Length of data block in bytes
headerB:
31:24 = Channel ID
23:16 = Frame error
15:0 = Frame flags
StreamWriter objects in C++ are referenced by the following shared pointer typedef:
-
typedef std::shared_ptr<rogue::utilities::fileio::StreamWriter> rogue::utilities::fileio::StreamWriterPtr
The class description is shown below:
-
class StreamWriter : public rogue::EnableSharedFromThis<rogue::utilities::fileio::StreamWriter>
Stream writer central class.
Subclassed by rogue::utilities::fileio::LegacyStreamWriter
Public Functions
-
StreamWriter()
Creator.
-
virtual ~StreamWriter()
Deconstructor.
-
void open(std::string file)
Open a data file.
-
void close()
Close a data file.
-
bool isOpen()
Get open status.
-
void setBufferSize(uint32_t size)
Set buffering size, 0 to disable.
-
void setMaxSize(uint64_t size)
Set max file size, 0 for unlimited.
-
void setDropErrors(bool drop)
Set drop errors flag.
-
std::shared_ptr<rogue::utilities::fileio::StreamWriterChannel> getChannel(uint8_t channel)
Get a port.
-
uint64_t getTotalSize()
Get total file size.
-
uint64_t getCurrentSize()
Get current file size.
-
uint32_t getFrameCount()
Get current frame count.
-
bool waitFrameCount(uint32_t count, uint64_t timeout)
Block until a frame count is reached.
Public Static Functions
-
static std::shared_ptr<rogue::utilities::fileio::StreamWriter> create()
Class creation.
-
static void setup_python()
Setup class in python.
-
StreamWriter()