Compute Graph Framework SDK Reference  5.8
dw::framework::ManagedPortInputBase Class Reference

Detailed Description

Base class encapsulates ownership of buffers and interactions with channel in type-agnostic way.

Definition at line 158 of file ManagedPort.hpp.

Inheritance diagram for dw::framework::ManagedPortInputBase:
Collaboration diagram for dw::framework::ManagedPortInputBase:

Classes

struct  BoundProperties
 
struct  ConstructProperties
 
struct  Properties
 

Public Types

using RingBuffer = dw::core::RingBuffer< GenericData >
 

Public Member Functions

void bindChannel (ChannelObject *channel) override
 
const PropertiesgetProperties () const noexcept
 
bool isBound () const noexcept override
 
bool isBufferAvailable () const noexcept
 
void recv ()
 
void release ()
 
void reset () override
 
- Public Member Functions inherited from dw::framework::ManagedPortBase
virtual void bindChannel (ChannelObject *channel)=0
 
virtual bool isBound () const noexcept=0
 
 ManagedPortBase ()
 
 ManagedPortBase (const ManagedPortBase &other)=delete
 
 ManagedPortBase (ManagedPortBase &&other)=delete
 
ManagedPortBaseoperator= (const ManagedPortBase &other)=delete
 
ManagedPortBaseoperator= (ManagedPortBase &&other)=delete
 
virtual void reset ()
 
void setCycleCount (uint32_t cycleCount)
 
virtual ~ManagedPortBase ()=default
 
- Public Member Functions inherited from dw::framework::PortBase
virtual ~PortBase ()=default
 

Protected Member Functions

GenericData getBufferGeneric () const
 
 ManagedPortInputBase (ConstructProperties props, GenericDataReference &&ref)
 
GenericData popBufferGeneric ()
 
void releaseToChannel (void *data)
 

Protected Attributes

RingBuffer m_buffers
 
GenericData m_stashedFuturePacket
 
bool m_stashValid
 
- Protected Attributes inherited from dw::framework::ManagedPortBase
uint32_t m_cycleCount
 

Class Documentation

◆ dw::framework::ManagedPortInputBase::BoundProperties

struct dw::framework::ManagedPortInputBase::BoundProperties
Class Members
uint32_t dataOffset

Offset from when an incoming packet was produced to the current cycle that must elapse before a packet can be releaesd to a consumer.

bool enableReuse

If all buffers have been released and there are no new buffers available on channel since recv() was last called, enableReuse will allow the last buffer acquired from the channel to be returned. Only 1 buffer will be re-usable in case multiple buffers were last acquired.

TODO(chale): move this to ConstructProperties once properties are passed by node instead of via channel.

bool syncEnabled

Whether this port is a sync port and will validate a packet's cycle counter.

◆ dw::framework::ManagedPortInputBase::ConstructProperties

struct dw::framework::ManagedPortInputBase::ConstructProperties
Class Members
uint32_t maxBuffers

The maximum number of buffers this port can acquire at once.

dwTime_t waitTime

When recv() is called, calling thread will block at least waitTime number of us for a packet to arrive on the channel. TODO(chale): move to BoundProperties once it is supported.

◆ dw::framework::ManagedPortInputBase::Properties

struct dw::framework::ManagedPortInputBase::Properties
Collaboration diagram for dw::framework::ManagedPortInputBase::Properties:
Class Members
BoundProperties boundProperties

Properties deduced once port is bound to channel.

ConstructProperties constructProperties

Properties deduced when port is constructed.

Member Typedef Documentation

◆ RingBuffer

Definition at line 161 of file ManagedPort.hpp.

Constructor & Destructor Documentation

◆ ManagedPortInputBase()

dw::framework::ManagedPortInputBase::ManagedPortInputBase ( ConstructProperties  props,
GenericDataReference &&  ref 
)
protected

Member Function Documentation

◆ bindChannel()

void dw::framework::ManagedPortInputBase::bindChannel ( ChannelObject channel)
overridevirtual

◆ getBufferGeneric()

GenericData dw::framework::ManagedPortInputBase::getBufferGeneric ( ) const
protected

◆ getProperties()

const Properties & dw::framework::ManagedPortInputBase::getProperties ( ) const
noexcept
Returns
Get the properties to initialize the port.

◆ isBound()

bool dw::framework::ManagedPortInputBase::isBound ( ) const
overridevirtualnoexcept

◆ isBufferAvailable()

bool dw::framework::ManagedPortInputBase::isBufferAvailable ( ) const
noexcept
Returns
true if the Port is holding a buffer acquired from the channel.

◆ popBufferGeneric()

GenericData dw::framework::ManagedPortInputBase::popBufferGeneric ( )
protected

◆ recv()

void dw::framework::ManagedPortInputBase::recv ( )

Receive buffers from the channel

Note
client should check after with isBufferAvailable() to know if a buffer was actually received.
when no buffers are available on the channel, this call will block waiting a buffer to arrive. (wait time given by properties)
once a buffers has arrived on channel, port will attempt to receive buffers until there are no more available or the maximum number has been received (max number given by properties)
Exceptions
whenunexpected error is received from channel or when buffers were already received (and not released).

◆ release()

void dw::framework::ManagedPortInputBase::release ( )

Release buffers to the channel

Note
when no buffers had previously been received this operation is a no-op.
Exceptions
whenunexpected error is received from channel.

◆ releaseToChannel()

void dw::framework::ManagedPortInputBase::releaseToChannel ( void *  data)
protected

◆ reset()

void dw::framework::ManagedPortInputBase::reset ( )
overridevirtual

Return all buffers to the channel as release() does, but also returns buffers held for re-use.

Note
does not drop the bound channel. Resets the input's port cycle count to 0.

Reimplemented from dw::framework::ManagedPortBase.

Member Data Documentation

◆ m_buffers

RingBuffer dw::framework::ManagedPortInputBase::m_buffers
protected

Definition at line 272 of file ManagedPort.hpp.

◆ m_stashedFuturePacket

GenericData dw::framework::ManagedPortInputBase::m_stashedFuturePacket
protected

Definition at line 273 of file ManagedPort.hpp.

◆ m_stashValid

bool dw::framework::ManagedPortInputBase::m_stashValid
protected

Definition at line 274 of file ManagedPort.hpp.


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