CIRCT  20.0.0git
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
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:
Inheritance graph
[legend]
Collaboration diagram for esi::services::CallService::Callback:
Collaboration graph
[legend]

Public Member Functions

void connect (std::function< MessageData(const MessageData &)> callback, bool quick=false)
 Connect a callback to code which will be executed when the accelerator invokes the callback. More...
 
virtual std::optional< std::string > toString () const override
 
- Public Member Functions inherited from esi::services::ServicePort
virtual ~ServicePort ()=default
 
 BundlePort (AppID id, std::map< std::string, ChannelPort & > channels)
 Construct a port. More...
 
- Public Member Functions inherited from esi::BundlePort
 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 Callbackget (AcceleratorConnection &acc, AppID id, 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. More...
 

Private Member Functions

 Callback (AcceleratorConnection &acc, AppID id, const std::map< std::string, ChannelPort & > &channels)
 

Private Attributes

ReadChannelPortarg
 
WriteChannelPortresult
 
AcceleratorConnectionacc
 

Friends

class CallService
 

Detailed Description

A function call which gets attached to a service port.

Definition at line 288 of file Services.h.

Constructor & Destructor Documentation

◆ Callback()

CallService::Callback::Callback ( AcceleratorConnection acc,
AppID  id,
const std::map< std::string, ChannelPort & > &  channels 
)
private

Definition at line 255 of file Services.cpp.

References esi::BundlePort::channels.

Member Function Documentation

◆ connect()

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

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 271 of file Services.cpp.

Referenced by registerCallbacks().

◆ get()

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

Definition at line 264 of file Services.cpp.

◆ toString()

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

Reimplemented from esi::services::ServicePort.

Definition at line 304 of file Services.h.

References arg, esi::Type::getID(), esi::ChannelPort::getType(), and result.

Friends And Related Function Documentation

◆ CallService

friend class CallService
friend

Definition at line 289 of file Services.h.

Member Data Documentation

◆ acc

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

Definition at line 315 of file Services.h.

◆ arg

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

Definition at line 313 of file Services.h.

Referenced by toString().

◆ result

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

Definition at line 314 of file Services.h.

Referenced by toString().


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