CIRCT  20.0.0git
Public Member Functions | Static Public Member Functions | Private Types | Private Attributes | List of all members
esi::Context Class Reference

AcceleratorConnections, Accelerators, and Manifests must all share a context. More...

#include <Context.h>

Collaboration diagram for esi::Context:
Collaboration graph
[legend]

Public Member Functions

 Context ()
 
 Context (std::unique_ptr< Logger > logger)
 
std::optional< const Type * > getType (Type::ID id) const
 Resolve a type id to the type. More...
 
void registerType (Type *type)
 Register a type with the context. Takes ownership of the pointer type. More...
 
std::unique_ptr< AcceleratorConnectionconnect (std::string backend, std::string connection)
 Connect to an accelerator backend. More...
 
void setLogger (std::unique_ptr< Logger > logger)
 Register a logger with the accelerator. Assumes ownership of the logger. More...
 
LoggergetLogger ()
 

Static Public Member Functions

template<typename T , typename... Args>
static Context withLogger (Args &&...args)
 Create a context with a specific logger type. More...
 

Private Types

using TypeCache = std::map< Type::ID, std::unique_ptr< Type > >
 

Private Attributes

std::unique_ptr< Loggerlogger
 
TypeCache types
 

Detailed Description

AcceleratorConnections, Accelerators, and Manifests must all share a context.

It owns all the types, uniquifying them.

Definition at line 31 of file Context.h.

Member Typedef Documentation

◆ TypeCache

using esi::Context::TypeCache = std::map<Type::ID, std::unique_ptr<Type> >
private

Definition at line 68 of file Context.h.

Constructor & Destructor Documentation

◆ Context() [1/2]

esi::Context::Context ( )
inline

Definition at line 33 of file Context.h.

Referenced by withLogger().

◆ Context() [2/2]

esi::Context::Context ( std::unique_ptr< Logger logger)
inline

Definition at line 34 of file Context.h.

Member Function Documentation

◆ connect()

std::unique_ptr< AcceleratorConnection > Context::connect ( std::string  backend,
std::string  connection 
)

Connect to an accelerator backend.

Definition at line 27 of file Context.cpp.

References esi::registry::connect().

Referenced by PYBIND11_MODULE().

◆ getLogger()

Logger& esi::Context::getLogger ( )
inline

Definition at line 62 of file Context.h.

References logger.

Referenced by esi::AcceleratorConnection::getLogger().

◆ getType()

std::optional<const Type *> esi::Context::getType ( Type::ID  id) const
inline

Resolve a type id to the type.

Definition at line 43 of file Context.h.

References types.

◆ registerType()

void Context::registerType ( Type type)

Register a type with the context. Takes ownership of the pointer type.

Definition at line 20 of file Context.cpp.

References esi::Type::getID(), and types.

◆ setLogger()

void esi::Context::setLogger ( std::unique_ptr< Logger logger)
inline

Register a logger with the accelerator. Assumes ownership of the logger.

Definition at line 57 of file Context.h.

References logger.

◆ withLogger()

template<typename T , typename... Args>
static Context esi::Context::withLogger ( Args &&...  args)
inlinestatic

Create a context with a specific logger type.

Definition at line 38 of file Context.h.

References Context().

Member Data Documentation

◆ logger

std::unique_ptr<Logger> esi::Context::logger
private

Definition at line 65 of file Context.h.

Referenced by getLogger(), and setLogger().

◆ types

TypeCache esi::Context::types
private

Definition at line 69 of file Context.h.

Referenced by getType(), and registerType().


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