CIRCT 24.0.0git
Loading...
Searching...
No Matches
circt::esi::ServiceGeneratorDispatcher Class Reference

Class which "dispatches" a service implementation request to its specified generator. More...

#include <ESIServices.h>

Collaboration diagram for circt::esi::ServiceGeneratorDispatcher:

Public Types

using ServiceGeneratorFunc

Public Member Functions

 ServiceGeneratorDispatcher (DenseMap< StringRef, ServiceGeneratorFunc > genLookupTable, bool failIfNotFound)
 ServiceGeneratorDispatcher (const ServiceGeneratorDispatcher &that)=default
LogicalResult generate (ServiceImplementReqOp, ServiceDeclOpInterface)
 Generate a service implementation if a generator exists in this registry.
void registerGenerator (StringRef implType, ServiceGeneratorFunc gen)
 Add a generator to this registry.

Static Public Member Functions

static ServiceGeneratorDispatcher & globalDispatcher ()
 Get the global dispatcher.

Private Attributes

DenseMap< StringRef, ServiceGeneratorFunc > genLookupTable
bool failIfNotFound

Detailed Description

Class which "dispatches" a service implementation request to its specified generator.

Also serves as a registery for generators.

Definition at line 24 of file ESIServices.h.

Member Typedef Documentation

◆ ServiceGeneratorFunc

Initial value:
std::function<LogicalResult(
ServiceImplementReqOp, ServiceDeclOpInterface, ServiceImplRecordOp)>

Definition at line 27 of file ESIServices.h.

Constructor & Destructor Documentation

◆ ServiceGeneratorDispatcher() [1/2]

circt::esi::ServiceGeneratorDispatcher::ServiceGeneratorDispatcher ( DenseMap< StringRef, ServiceGeneratorFunc > genLookupTable,
bool failIfNotFound )
inline

Definition at line 34 of file ESIServices.h.

References failIfNotFound, and genLookupTable.

Referenced by globalDispatcher(), and ServiceGeneratorDispatcher().

◆ ServiceGeneratorDispatcher() [2/2]

circt::esi::ServiceGeneratorDispatcher::ServiceGeneratorDispatcher ( const ServiceGeneratorDispatcher & that)
default

Member Function Documentation

◆ generate()

LogicalResult ServiceGeneratorDispatcher::generate ( ServiceImplementReqOp req,
ServiceDeclOpInterface decl )

Generate a service implementation if a generator exists in this registry.

If one is not found, return failure if the failIfNotFound flag is set.

Definition at line 367 of file ESIServices.cpp.

References failIfNotFound, genLookupTable, and success().

◆ globalDispatcher()

ServiceGeneratorDispatcher & ServiceGeneratorDispatcher::globalDispatcher ( )
static

Get the global dispatcher.

Definition at line 397 of file ESIServices.cpp.

References ServiceGeneratorDispatcher().

Referenced by circtESIRegisterGlobalServiceGenerator().

◆ registerGenerator()

void ServiceGeneratorDispatcher::registerGenerator ( StringRef implType,
ServiceGeneratorFunc gen )

Add a generator to this registry.

Definition at line 401 of file ESIServices.cpp.

References genLookupTable.

Referenced by circtESIRegisterGlobalServiceGenerator().

Member Data Documentation

◆ failIfNotFound

bool circt::esi::ServiceGeneratorDispatcher::failIfNotFound
private

Definition at line 53 of file ESIServices.h.

Referenced by generate(), and ServiceGeneratorDispatcher().

◆ genLookupTable

DenseMap<StringRef, ServiceGeneratorFunc> circt::esi::ServiceGeneratorDispatcher::genLookupTable
private

Definition at line 52 of file ESIServices.h.

Referenced by generate(), registerGenerator(), and ServiceGeneratorDispatcher().


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