rogue
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
rogue::utilities::fileio::StreamWriterChannel Class Reference

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

#include <StreamWriterChannel.h>

Inheritance diagram for rogue::utilities::fileio::StreamWriterChannel:
rogue::interfaces::stream::Slave rogue::interfaces::stream::Pool rogue::EnableSharedFromThis< rogue::interfaces::stream::Slave > rogue::EnableSharedFromThis< rogue::interfaces::stream::Pool > rogue::EnableSharedFromThisBase rogue::EnableSharedFromThisBase

Public Member Functions

 StreamWriterChannel (std::shared_ptr< rogue::utilities::fileio::StreamWriter > writer, uint8_t channel)
 Constructs a stream writer channel.
 
 ~StreamWriterChannel ()
 Destroys stream writer channel.
 
void acceptFrame (std::shared_ptr< rogue::interfaces::stream::Frame > frame)
 Accepts and writes one incoming frame.
 
uint32_t getFrameCount ()
 Returns the number of accepted frames.
 
void setFrameCount (uint32_t count)
 Sets the accepted-frame counter to a specific value.
 
bool waitFrameCount (uint32_t count, uint64_t timeout)
 Waits until at least count frames have been accepted.
 
- Public Member Functions inherited from rogue::interfaces::stream::Slave
 Slave ()
 Constructs a stream slave.
 
virtual ~Slave ()
 Destroys the stream slave.
 
virtual void stop ()
 Shuts down threads associated with this object.
 
void setDebug (uint32_t debug, std::string name)
 Sets debug message verbosity and logger name.
 
uint64_t getFrameCount ()
 Returns frame counter.
 
uint64_t getByteCount ()
 Returns byte counter.
 
bool ensureSingleBuffer (std::shared_ptr< rogue::interfaces::stream::Frame > &frame, bool reqEn)
 Ensures frame is backed by a single buffer.
 
std::shared_ptr< rogue::interfaces::stream::FramereqLocalFrame (uint32_t size, bool zeroCopyEn)
 Services a local frame allocation request through this object's pool interface.
 
boost::python::object lshiftPy (boost::python::object p)
 Supports << operator usage from Python.
 
std::shared_ptr< rogue::interfaces::stream::Master > & operator<< (std::shared_ptr< rogue::interfaces::stream::Master > &other)
 Connects this slave to a master via stream chaining operator.
 
- Public Member Functions inherited from rogue::interfaces::stream::Pool
 Pool ()
 Constructs a pool with default allocation behavior enabled.
 
virtual ~Pool ()
 Destroys the pool and releases any cached buffer storage.
 
uint32_t getAllocBytes ()
 Returns total currently allocated bytes.
 
uint32_t getAllocCount ()
 Returns total currently allocated buffer count.
 
virtual std::shared_ptr< rogue::interfaces::stream::FrameacceptReq (uint32_t size, bool zeroCopyEn)
 Services a frame allocation request from a master.
 
virtual void retBuffer (uint8_t *data, uint32_t meta, uint32_t size)
 Returns buffer data to the allocator.
 
void setFixedSize (uint32_t size)
 Sets fixed-size mode.
 
uint32_t getFixedSize ()
 Returns fixed-size allocation setting.
 
void setPoolSize (uint32_t size)
 Sets buffer pool size.
 
uint32_t getPoolSize ()
 Returns configured maximum number of cached pool entries.
 
- Public Member Functions inherited from rogue::EnableSharedFromThis< rogue::interfaces::stream::Pool >
std::shared_ptr< rogue::interfaces::stream::Poolshared_from_this ()
 Returns a shared_ptr<T> for this instance.
 
- Public Member Functions inherited from rogue::EnableSharedFromThisBase
virtual ~EnableSharedFromThisBase ()
 Virtual destructor for polymorphic base usage.
 
- Public Member Functions inherited from rogue::EnableSharedFromThis< rogue::interfaces::stream::Slave >
std::shared_ptr< rogue::interfaces::stream::Slaveshared_from_this ()
 Returns a shared_ptr<T> for this instance.
 

Static Public Member Functions

static std::shared_ptr< rogue::utilities::fileio::StreamWriterChannelcreate (std::shared_ptr< rogue::utilities::fileio::StreamWriter > writer, uint8_t channel)
 Creates a stream writer channel instance.
 
static void setup_python ()
 Registers Python bindings for this class.
 
- Static Public Member Functions inherited from rogue::interfaces::stream::Slave
static std::shared_ptr< rogue::interfaces::stream::Slavecreate ()
 Creates a new stream slave.
 
static void setup_python ()
 Registers this type with Python bindings.
 
- Static Public Member Functions inherited from rogue::interfaces::stream::Pool
static void setup_python ()
 Registers this type with Python bindings.
 

Additional Inherited Members

- Protected Member Functions inherited from rogue::interfaces::stream::Pool
std::shared_ptr< rogue::interfaces::stream::BufferallocBuffer (uint32_t size, uint32_t *total)
 Allocate a buffer passed size.
 
std::shared_ptr< rogue::interfaces::stream::BuffercreateBuffer (void *data, uint32_t meta, uint32_t size, uint32_t alloc)
 Creates a Buffer with a pre-allocated data block.
 
void decCounter (uint32_t alloc)
 Decrements allocation counter.
 

Detailed Description

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().

Definition at line 49 of file StreamWriterChannel.h.

Constructor & Destructor Documentation

◆ StreamWriterChannel()

rogue::utilities::fileio::StreamWriterChannel::StreamWriterChannel ( std::shared_ptr< rogue::utilities::fileio::StreamWriter writer,
uint8_t  channel 
)

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
writerDestination writer used to serialize frames.
channelOutput channel/tag. Use 0 to forward per-frame channel.

Definition at line 62 of file StreamWriterChannel.cpp.

◆ ~StreamWriterChannel()

rogue::utilities::fileio::StreamWriterChannel::~StreamWriterChannel ( )

Destroys stream writer channel.

Deconstructor.

Definition at line 69 of file StreamWriterChannel.cpp.

Member Function Documentation

◆ acceptFrame()

void rogue::utilities::fileio::StreamWriterChannel::acceptFrame ( std::shared_ptr< rogue::interfaces::stream::Frame frame)
virtual

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
frameInput frame to write.

Reimplemented from rogue::interfaces::stream::Slave.

Definition at line 72 of file StreamWriterChannel.cpp.

◆ create()

rogue::utilities::fileio::StreamWriterChannelPtr rogue::utilities::fileio::StreamWriterChannel::create ( std::shared_ptr< rogue::utilities::fileio::StreamWriter writer,
uint8_t  channel 
)
static

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.

Parameters
writerDestination writer used to serialize frames.
channelOutput channel/tag. Use 0 to forward per-frame channel.
Returns
Shared pointer to the created channel.

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.

Definition at line 43 of file StreamWriterChannel.cpp.

◆ getFrameCount()

uint32_t rogue::utilities::fileio::StreamWriterChannel::getFrameCount ( )

Returns the number of accepted frames.

Returns
Accepted frame count.

Definition at line 91 of file StreamWriterChannel.cpp.

◆ setFrameCount()

void rogue::utilities::fileio::StreamWriterChannel::setFrameCount ( uint32_t  count)

Sets the accepted-frame counter to a specific value.

Parameters
countNew frame counter value.

Definition at line 95 of file StreamWriterChannel.cpp.

◆ setup_python()

void rogue::utilities::fileio::StreamWriterChannel::setup_python ( )
static

Registers Python bindings for this class.

Setup class in python.

Definition at line 49 of file StreamWriterChannel.cpp.

◆ waitFrameCount()

bool rogue::utilities::fileio::StreamWriterChannel::waitFrameCount ( uint32_t  count,
uint64_t  timeout 
)

Waits until at least count frames have been accepted.

Parameters
countTarget accepted-frame count.
timeoutTimeout in microseconds. 0 waits indefinitely.
Returns
true if count was reached before timeout, else false.

Definition at line 101 of file StreamWriterChannel.cpp.


The documentation for this class was generated from the following files: