CIRCT  20.0.0git
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
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:
Collaboration graph
[legend]

Public Types

using ServiceGeneratorFunc = std::function< LogicalResult(ServiceImplementReqOp, ServiceDeclOpInterface, ServiceImplRecordOp)>
 

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. More...
 
void registerGenerator (StringRef implType, ServiceGeneratorFunc gen)
 Add a generator to this registry. More...
 

Static Public Member Functions

static ServiceGeneratorDispatcherglobalDispatcher ()
 Get the global dispatcher. More...
 

Private Attributes

DenseMap< StringRef, ServiceGeneratorFuncgenLookupTable
 
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

using circt::esi::ServiceGeneratorDispatcher::ServiceGeneratorFunc = 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.

◆ 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 287 of file ESIServices.cpp.

References failIfNotFound, and genLookupTable.

◆ globalDispatcher()

ServiceGeneratorDispatcher & ServiceGeneratorDispatcher::globalDispatcher ( )
static

Get the global dispatcher.

Definition at line 316 of file ESIServices.cpp.

References globalDispatcher.

Referenced by circtESIRegisterGlobalServiceGenerator().

◆ registerGenerator()

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

Add a generator to this registry.

Definition at line 320 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().

◆ genLookupTable

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

Definition at line 52 of file ESIServices.h.

Referenced by generate(), and registerGenerator().


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