|
rogue
|
Stream master endpoint. More...
#include <Master.h>
Public Member Functions | |
| Master () | |
| Constructs a stream master. | |
| virtual | ~Master () |
| Destroys the stream master. | |
| uint32_t | slaveCount () |
| Returns the number of attached slaves. | |
| void | addSlave (std::shared_ptr< rogue::interfaces::stream::Slave > slave) |
| Attaches a downstream slave. | |
| std::shared_ptr< rogue::interfaces::stream::Frame > | reqFrame (uint32_t size, bool zeroCopyEn) |
| Requests allocation of a new frame from the primary slave. | |
| void | sendFrame (std::shared_ptr< rogue::interfaces::stream::Frame > frame) |
| Sends a frame to all attached slaves. | |
| bool | ensureSingleBuffer (std::shared_ptr< rogue::interfaces::stream::Frame > &frame, bool reqEn) |
| Ensures a frame is represented by a single buffer. | |
| virtual void | stop () |
| Stops frame generation and shuts down associated threads. | |
| void | equalsPy (boost::python::object p) |
Supports == operator usage from Python. | |
| boost::python::object | rshiftPy (boost::python::object p) |
Supports >> operator usage from Python. | |
| void | operator== (std::shared_ptr< rogue::interfaces::stream::Slave > &other) |
Supports == operator usage in C++. | |
| std::shared_ptr< rogue::interfaces::stream::Slave > & | operator>> (std::shared_ptr< rogue::interfaces::stream::Slave > &other) |
| Connects this master to a slave via stream chaining operator. | |
Public Member Functions inherited from rogue::EnableSharedFromThis< rogue::interfaces::stream::Master > | |
| std::shared_ptr< rogue::interfaces::stream::Master > | shared_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. | |
Static Public Member Functions | |
| static std::shared_ptr< rogue::interfaces::stream::Master > | create () |
| Creates a stream master. | |
| static void | setup_python () |
| Registers this type with Python bindings. | |
Stream master endpoint.
Source object for sending frames to one or more stream slaves. The first attached slave is used to allocate new frames and is the last to receive sent frames.
Master is not an abstract class (no pure virtual methods), but it is commonly used as a base for protocol/source implementations.
Subclass expectations in practice:
Master method is required to be overridden.addSlave(), reqFrame(), and sendFrame() as-is and call reqFrame()/sendFrame() from their own public APIs or worker threads (for example protocol transmit paths and file readers).stop() is the primary Master method intended for override when the subclass owns worker threads, timers, sockets, or device handles.Slave and overriding Slave::acceptFrame(), while egress uses this Master interface. | rogue::interfaces::stream::Master::Master | ( | ) |
Constructs a stream master.
Creator.
This constructor is a low-level C++ allocation path. Prefer create() when shared ownership or Python exposure is required.
Definition at line 46 of file Master.cpp.
|
virtual |
| void rogue::interfaces::stream::Master::addSlave | ( | std::shared_ptr< rogue::interfaces::stream::Slave > | slave | ) |
Attaches a downstream slave.
Add slave.
Multiple slaves are supported. The first attached slave is used for frame allocation and receives frames last during send. Exposed as _addSlave() in Python.
| slave | Stream slave pointer. |
Definition at line 59 of file Master.cpp.
|
static |
Creates a stream master.
Class creation.
Exposed as rogue.interfaces.stream.Master() in Python. 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.
Description:
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
Definition at line 40 of file Master.cpp.
| bool rogue::interfaces::stream::Master::ensureSingleBuffer | ( | std::shared_ptr< rogue::interfaces::stream::Frame > & | frame, |
| bool | reqEn | ||
| ) |
Ensures a frame is represented by a single buffer.
If the reqEn flag is true and the passed frame is not a single buffer, a new frame will be requested and the frame data will be copied, with the passed frame pointer being updated. The return value will indicate if the frame is a single buffer at the end of the process. A frame lock must be held when this method is called.
Not exposed to Python.
| frame | Reference to frame pointer. |
| reqEn | Set to true to allow allocating and copying into a new frame. |
true if the resulting frame is single-buffer. Definition at line 91 of file Master.cpp.
| void rogue::interfaces::stream::Master::equalsPy | ( | boost::python::object | p | ) |
Supports == operator usage from Python.
| p | Python object expected to resolve to a stream Slave. |
Definition at line 138 of file Master.cpp.
| void rogue::interfaces::stream::Master::operator== | ( | std::shared_ptr< rogue::interfaces::stream::Slave > & | other | ) |
Supports == operator usage in C++.
Support == operator in C++.
| other | Downstream slave to attach. |
Definition at line 224 of file Master.cpp.
| rogue::interfaces::stream::SlavePtr & rogue::interfaces::stream::Master::operator>> | ( | std::shared_ptr< rogue::interfaces::stream::Slave > & | other | ) |
Connects this master to a slave via stream chaining operator.
Support >> operator in C++.
| other | Downstream slave to attach. |
other for chaining. Definition at line 243 of file Master.cpp.
| rogue::interfaces::stream::FramePtr rogue::interfaces::stream::Master::reqFrame | ( | uint32_t | size, |
| bool | zeroCopyEn | ||
| ) |
Requests allocation of a new frame from the primary slave.
Request frame from primary slave.
Creates an empty frame with at least the requested payload capacity. The Master will forward this request to the primary Slave object. The request for a new Frame includes a flag which indicates if a zeroCopy frame is allowed. In most cases this flag can be set to true. Non-zero-copy frames are requested if the Master may need to transmit the same frame multiple times. Exposed as _reqFrame() in Python.
| size | Minimum requested payload size in bytes. |
| zeroCopyEn | Set to true when zero-copy frame allocation is allowed. |
Definition at line 66 of file Master.cpp.
| boost::python::object rogue::interfaces::stream::Master::rshiftPy | ( | boost::python::object | p | ) |
Supports >> operator usage from Python.
| p | Python object expected to resolve to a stream Slave. |
Definition at line 191 of file Master.cpp.
| void rogue::interfaces::stream::Master::sendFrame | ( | std::shared_ptr< rogue::interfaces::stream::Frame > | frame | ) |
Sends a frame to all attached slaves.
Push frame to slaves.
This method sends the passed Frame to all of the attached Slave objects by calling their acceptFrame() method. First the secondary Slaves are called in order of attachment, followed last by the primary Slave. If the Frame is a zero copy frame it will most likely be empty when the sendFrame() method returns
Exposed as _sendFrame() in Python.
| frame | Frame to send. |
Definition at line 77 of file Master.cpp.
|
static |
Registers this type with Python bindings.
Definition at line 121 of file Master.cpp.
| uint32_t rogue::interfaces::stream::Master::slaveCount | ( | ) |
Returns the number of attached slaves.
Exposed as _slaveCount() in Python.
Definition at line 54 of file Master.cpp.
|
virtual |
Stops frame generation and shuts down associated threads.
Exposed as stop() in Python.
This is the primary subclass hook on Master. Override when the subclass owns background activity or transport resources that require deterministic shutdown.
Reimplemented in rogue::hardware::axi::AxiStreamDma, rogue::interfaces::stream::TcpCore, rogue::protocols::udp::Client, rogue::protocols::udp::Server, and rogue::protocols::xilinx::Xvc.
Definition at line 119 of file Master.cpp.