lintel 0.2.0
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
lintel::di::Registration Struct Reference

#include <Container.h>

Public Member Functions

std::shared_ptr< void > castTo (const std::type_index &key, const std::shared_ptr< void > &concrete) const
 

Public Attributes

std::vector< std::type_index > keys
 
bool singleton = false
 
std::function< std::shared_ptr< void >(Container &)> factory
 
std::unordered_map< std::type_index, std::function< std::shared_ptr< void >(const std::shared_ptr< void > &)> > casts
 
std::shared_ptr< void > instance
 
std::mutex mutex
 

Detailed Description

A single registration, shared by all keys it is exposed under.

Member Function Documentation

◆ castTo()

std::shared_ptr< void > lintel::di::Registration::castTo ( const std::type_index &  key,
const std::shared_ptr< void > &  concrete 
) const
inline

Convert the concrete instance pointer to the subobject addressed by key.

Member Data Documentation

◆ casts

std::unordered_map<std::type_index, std::function<std::shared_ptr<void>(const std::shared_ptr<void> &)> > lintel::di::Registration::casts

Per key conversion of the concrete instance to the key's (possibly non-first) base pointer.

◆ factory

std::function<std::shared_ptr<void>(Container &)> lintel::di::Registration::factory

Creates the concrete instance; called once per activation (once in total for singletons).

◆ instance

std::shared_ptr<void> lintel::di::Registration::instance

Cached singleton instance, empty until the first activation.

◆ keys

std::vector<std::type_index> lintel::di::Registration::keys

Every key this registration is reachable through (self plus interfaces).

◆ mutex

std::mutex lintel::di::Registration::mutex

Serializes the activation of a singleton.

◆ singleton

bool lintel::di::Registration::singleton = false

Whether the activated instance is cached and reused.


The documentation for this struct was generated from the following file: