CIRCT 24.0.0git
Loading...
Searching...
No Matches
esi::services::CallService::Callback Class Reference

A function call which gets attached to a service port. More...

#include <Services.h>

Inheritance diagram for esi::services::CallService::Callback:
Collaboration diagram for esi::services::CallService::Callback:

Public Member Functions

void connect (std::function< MessageData(const MessageData &)> callback, bool quick=false, const ChannelPort::ConnectOptions &options={})
 Connect a callback to code which will be executed when the accelerator invokes the callback.
const esi::Type * getArgType () const
const esi::Type * getResultType () const
virtual std::optional< std::string > toString (bool oneLine=false) const override
Public Member Functions inherited from esi::services::ServicePort
virtual ~ServicePort ()=default
 BundlePort (AppID id, const BundleType *type, PortMap channels)
 Construct a port.
Public Member Functions inherited from esi::BundlePort
 BundlePort (AppID id, const BundleType *type, PortMap channels)
 Construct a port.
virtual ~BundlePort ()=default
AppID getID () const
 Get the ID of the port.
WriteChannelPort & getRawWrite (const std::string &name) const
 Get access to the raw byte streams of a channel.
ReadChannelPort & getRawRead (const std::string &name) const
const PortMap & getChannels () 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 Callback * get (AcceleratorConnection &acc, AppID id, const BundleType *type, WriteChannelPort &result, ReadChannelPort &arg)
Static Public Member Functions inherited from esi::BundlePort
static bool isWrite (BundleType::Direction bundleDir)
 Compute the direction of a channel given the bundle direction and the bundle port's direction.

Private Member Functions

 Callback (AcceleratorConnection &acc, AppID id, const BundleType *, PortMap channels)

Private Attributes

ReadChannelPort * arg
WriteChannelPort * result
AcceleratorConnection & acc

Friends

class CallService

Additional Inherited Members

Protected Attributes inherited from esi::BundlePort
AppID id
const BundleType * type
PortMap channels

Detailed Description

A function call which gets attached to a service port.

Definition at line 437 of file Services.h.

Constructor & Destructor Documentation

◆ Callback()

CallService::Callback::Callback ( AcceleratorConnection & acc,
AppID id,
const BundleType * type,
PortMap channels )
private

Definition at line 353 of file Services.cpp.

References acc, esi::BundlePort::channels, esi::BundlePort::id, and esi::BundlePort::type.

Referenced by CallService, and get().

Member Function Documentation

◆ connect()

void CallService::Callback::connect ( std::function< MessageData(const MessageData &)> callback,
bool quick = false,
const ChannelPort::ConnectOptions & options = {} )

Connect a callback to code which will be executed when the accelerator invokes the callback.

The 'quick' flag indicates that the callback is sufficiently fast that it could be called in the same thread as the port callback.

Definition at line 365 of file Services.cpp.

References acc, arg, esi::BundlePort::channels, esi::BundlePort::getRawRead(), esi::BundlePort::getRawWrite(), and result.

◆ get()

CallService::Callback * CallService::Callback::get ( AcceleratorConnection & acc,
AppID id,
const BundleType * type,
WriteChannelPort & result,
ReadChannelPort & arg )
static

Definition at line 357 of file Services.cpp.

References acc, arg, Callback(), result, and esi::BundlePort::type.

◆ getArgType()

const esi::Type * esi::services::CallService::Callback::getArgType ( ) const
inline

Definition at line 455 of file Services.h.

References esi::ChannelType::getInner(), and esi::BundlePort::type.

Referenced by toString().

◆ getResultType()

const esi::Type * esi::services::CallService::Callback::getResultType ( ) const
inline

Definition at line 460 of file Services.h.

References esi::ChannelType::getInner(), and esi::BundlePort::type.

Referenced by toString().

◆ toString()

virtual std::optional< std::string > esi::services::CallService::Callback::toString ( bool oneLine = false) const
inlineoverridevirtual

Reimplemented from esi::services::ServicePort.

Definition at line 467 of file Services.h.

References getArgType(), getResultType(), and esi::Type::toString().

◆ CallService

friend class CallService
friend

Definition at line 438 of file Services.h.

References acc, arg, Callback(), CallService, esi::BundlePort::channels, result, and esi::BundlePort::type.

Referenced by CallService.

Member Data Documentation

◆ acc

AcceleratorConnection& esi::services::CallService::Callback::acc
private

Definition at line 477 of file Services.h.

Referenced by Callback(), CallService, connect(), and get().

◆ arg

ReadChannelPort* esi::services::CallService::Callback::arg
private

Definition at line 475 of file Services.h.

Referenced by CallService, connect(), and get().

◆ result

WriteChannelPort* esi::services::CallService::Callback::result
private

Definition at line 476 of file Services.h.

Referenced by CallService, connect(), and get().


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