CIRCT  20.0.0git
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
esi::BundlePort Class Reference

Services provide connections to 'bundles' – collections of named, unidirectional communication channels. More...

#include <Ports.h>

Inheritance diagram for esi::BundlePort:
Inheritance graph
[legend]
Collaboration diagram for esi::BundlePort:
Collaboration graph
[legend]

Public Member Functions

 BundlePort (AppID id, std::map< std::string, ChannelPort & > channels)
 Construct a port. More...
 
virtual ~BundlePort ()=default
 
AppID getID () const
 Get the ID of the port. More...
 
WriteChannelPortgetRawWrite (const std::string &name) const
 Get access to the raw byte streams of a channel. More...
 
ReadChannelPortgetRawRead (const std::string &name) const
 
const std::map< std::string, ChannelPort & > & getChannels () const
 
template<typename T >
T * getAs () const
 Cast this Bundle port to a subclass which is actually useful. More...
 
bool poll ()
 Calls poll on all channels in the bundle and returns true if any of them returned true. More...
 

Static Public Member Functions

static bool isWrite (BundleType::Direction bundleDir)
 Compute the direction of a channel given the bundle direction and the bundle port's direction. More...
 

Private Attributes

AppID id
 
std::map< std::string, ChannelPort & > channels
 

Detailed Description

Services provide connections to 'bundles' – collections of named, unidirectional communication channels.

This class provides access to those ChannelPorts.

Definition at line 184 of file Ports.h.

Constructor & Destructor Documentation

◆ BundlePort()

BundlePort::BundlePort ( AppID  id,
std::map< std::string, ChannelPort & >  channels 
)

Construct a port.

Definition at line 22 of file Ports.cpp.

◆ ~BundlePort()

virtual esi::BundlePort::~BundlePort ( )
virtualdefault

Member Function Documentation

◆ getAs()

template<typename T >
T* esi::BundlePort::getAs ( ) const
inline

Cast this Bundle port to a subclass which is actually useful.

Returns nullptr if the cast fails.

Definition at line 214 of file Ports.h.

◆ getChannels()

const std::map<std::string, ChannelPort &>& esi::BundlePort::getChannels ( ) const
inline

Definition at line 205 of file Ports.h.

References channels.

Referenced by printPort(), and PYBIND11_MODULE().

◆ getID()

AppID esi::BundlePort::getID ( ) const
inline

Get the ID of the port.

Definition at line 197 of file Ports.h.

References id.

Referenced by printPort(), and PYBIND11_MODULE().

◆ getRawRead()

ReadChannelPort & BundlePort::getRawRead ( const std::string &  name) const

Definition at line 35 of file Ports.cpp.

References channels.

Referenced by PYBIND11_MODULE().

◆ getRawWrite()

WriteChannelPort & BundlePort::getRawWrite ( const std::string &  name) const

Get access to the raw byte streams of a channel.

Intended for internal usage and binding to other languages (e.g. Python) which have their own message serialization code. Exposed publicly as an escape hatch, but ordinary users should not use. You have been warned.

Definition at line 25 of file Ports.cpp.

References channels.

Referenced by PYBIND11_MODULE().

◆ isWrite()

static bool esi::BundlePort::isWrite ( BundleType::Direction  bundleDir)
inlinestatic

Compute the direction of a channel given the bundle direction and the bundle port's direction.

Definition at line 188 of file Ports.h.

Referenced by esi::backends::trace::TraceAccelerator::Impl::requestChannelsFor(), and esi::backends::cosim::CosimAccelerator::requestChannelsFor().

◆ poll()

bool esi::BundlePort::poll ( )
inline

Calls poll on all channels in the bundle and returns true if any of them returned true.

Definition at line 220 of file Ports.h.

References channels.

Member Data Documentation

◆ channels

std::map<std::string, ChannelPort &> esi::BundlePort::channels
private

◆ id

AppID esi::BundlePort::id
private

Definition at line 228 of file Ports.h.

Referenced by getID().


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