CIRCT 21.0.0git
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected 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, const BundleType *type, PortMap channels)
 Construct a port.
 
virtual ~BundlePort ()=default
 
AppID getID () const
 Get the ID of the port.
 
WriteChannelPortgetRawWrite (const std::string &name) const
 Get access to the raw byte streams of a channel.
 
ReadChannelPortgetRawRead (const std::string &name) const
 
const PortMapgetChannels () const
 
template<typename T >
T * getAs () const
 Cast this Bundle port to a subclass which is actually useful.
 
bool poll ()
 Calls poll on all channels in the bundle and returns true if any of them returned true.
 

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.
 

Protected Attributes

AppID id
 
const BundleTypetype
 
PortMap channels
 

Detailed Description

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

This class provides access to those ChannelPorts.

Definition at line 226 of file Ports.h.

Constructor & Destructor Documentation

◆ BundlePort()

BundlePort::BundlePort ( AppID  id,
const BundleType type,
PortMap  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 254 of file Ports.h.

◆ getChannels()

const PortMap & esi::BundlePort::getChannels ( ) const
inline

Definition at line 247 of file Ports.h.

References channels.

Referenced by printPort().

◆ getID()

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

Get the ID of the port.

Definition at line 239 of file Ports.h.

References id.

Referenced by printPort().

◆ getRawRead()

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

Definition at line 35 of file Ports.cpp.

References channels.

◆ 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.

◆ 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 230 of file Ports.h.

References esi::BundleType::To.

Referenced by esi::backends::cosim::CosimEngine::createPort().

◆ 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 260 of file Ports.h.

References channels.

Member Data Documentation

◆ channels

PortMap esi::BundlePort::channels
protected

Definition at line 270 of file Ports.h.

Referenced by getChannels(), getRawRead(), getRawWrite(), and poll().

◆ id

AppID esi::BundlePort::id
protected

Definition at line 268 of file Ports.h.

Referenced by getID().

◆ type

const BundleType* esi::BundlePort::type
protected

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