chronon::OutPort
#include <OutPort.hpp>
Inherits from chronon::sender::PortBase
Public Functions
| Name | |
|---|---|
| void | setPerCycleCapacity(size_t cap) |
| size_t | sentThisCycle() const |
| bool | sendImmediate(const T & data) |
| bool | sendImmediate(T && data) |
| bool | send(const T & data) |
| bool | send(T && data) |
| size_t | remainingThisCycle() const |
| size_t | perCycleCapacity() const |
| bool | isConnected() const |
| uint64_t | getCurrentCycle() const |
| const std::vector< std::unique_ptr< Connection< T > > > & | connections() const |
| Connection< T > * | connectionTo(const InPort< T > * to) Find the first connection targeting to, or nullptr if not connected. |
| const Connection< T > * | connectionTo(const InPort< T > * to) const Find the first connection targeting to, or nullptr if not connected. |
| size_t | connectionCount() const |
| Connection< T > * | connect(InPort< T > * to, uint32_t delay) |
| void | cancelInFlight() |
| bool | canSend() const |
| OutPort(Unit * owner, std::string name, size_t per_cycle_capacity =UNLIMITED_CAPACITY) |
Public Attributes
| Name | |
|---|---|
| size_t | UNLIMITED_CAPACITY |
Additional inherited members
Public Functions inherited from chronon::sender::PortBase
| Name | |
|---|---|
| virtual | ~PortBase() =default |
| Unit * | owner() const |
| const std::string & | name() const |
| virtual void | clearPendingMessages() |
| virtual void | arbitrateMPSCConsumerDriven() |
Protected Functions inherited from chronon::sender::PortBase
| Name | |
|---|---|
| PortBase(Unit * owner, std::string name) |
Protected Attributes inherited from chronon::sender::PortBase
| Name | |
|---|---|
| Unit * | owner_ |
| std::string | name_ |
Detailed Description
template <typename T >
class chronon::OutPort;
OutPort - Sends data to connected InPorts.
Features:
- Connects to multiple InPorts with different delays
- Synchronous send for tick-based units
Usage: OutPort
// In tick() method. canSend() is only a preflight check; callers // must still handle send() returning false. if (out.canSend() && out.send(42)) { // local state can now advance }
Public Functions Documentation
function setPerCycleCapacity
inline void setPerCycleCapacity(
size_t cap
)
Set the per-cycle send capacity at runtime (UNLIMITED_CAPACITY = unlimited). Passing 0 is accepted as the legacy unlimited spelling.
function sentThisCycle
inline size_t sentThisCycle() const
function sendImmediate
inline bool sendImmediate(
const T & data
)
function sendImmediate
inline bool sendImmediate(
T && data
)
function send
inline bool send(
const T & data
)
Parameters:
- data The data to send
Return: true if all sends succeeded, false if any destination was full. Multi-destination sends are preflighted before transfer so normal back-pressure failure is all-or-none.
Send data through all connections.
The current cycle is obtained from the owner unit.
function send
inline bool send(
T && data
)
Return: true if all sends succeeded, false if any destination was full. Multi-destination sends are preflighted before transfer so normal back-pressure failure is all-or-none.
Send data with move semantics.
function remainingThisCycle
inline size_t remainingThisCycle() const
Return: Remaining sends, or UNLIMITED_CAPACITY if unlimited.
function perCycleCapacity
inline size_t perCycleCapacity() const
Return: Max sends per cycle (UNLIMITED_CAPACITY = unlimited).
function isConnected
inline bool isConnected() const
function getCurrentCycle
uint64_t getCurrentCycle() const
Read the owning Unit's localCycle. Public so Connection
function connections
inline const std::vector< std::unique_ptr< Connection< T > > > & connections() const
function connectionTo
inline Connection< T > * connectionTo(
const InPort< T > * to
)
Find the first connection targeting to, or nullptr if not connected.
function connectionTo
inline const Connection< T > * connectionTo(
const InPort< T > * to
) const
Find the first connection targeting to, or nullptr if not connected.
function connectionCount
inline size_t connectionCount() const
function connect
inline Connection< T > * connect(
InPort< T > * to,
uint32_t delay
)
Parameters:
- to The destination input port
- delay The delivery delay in cycles
Return: The created connection
Connect to an input port with specified delay.
function cancelInFlight
inline void cancelInFlight()
Cancel all in-flight messages previously sent on this OutPort.
Advances a per-connection cancellation epoch. Messages already enqueued at destination ports will be dropped on receive.
function canSend
inline bool canSend() const
Check if all connected destinations can accept data.
Use this to check before sending when back pressure is important.
function OutPort
inline OutPort(
Unit * owner,
std::string name,
size_t per_cycle_capacity =UNLIMITED_CAPACITY
)
Public Attributes Documentation
variable UNLIMITED_CAPACITY
static size_t UNLIMITED_CAPACITY = std::numeric_limits<size_t>::max();
Parameters:
- owner The unit that owns this port
- name The port name (for debugging)
- per_cycle_capacity Max sends per cycle (UNLIMITED_CAPACITY = unlimited, default). Passing 0 is accepted as the legacy unlimited spelling.
Create an output port.
Automatically registers with PortDirectory when owner's TreeNode is set.
Updated on 2026-05-26 at 05:42:32 +0000