Protected Member Functions | List of all members
ApplicationConfiguration Class Reference

Application configurations specify application injector bindings. More...

#include <ApplicationConfiguration.hpp>

Inheritance diagram for ApplicationConfiguration:
[legend]
Collaboration diagram for ApplicationConfiguration:
[legend]

Protected Member Functions

template<typename BaseT , typename DeleterT = std::default_delete<BaseT>>
BindingBuilder< BaseT, DeleterT > & bind (std::string_view name=std::string_view()) const
 Create a binding specification for the specified named or unnamed interface. More...
 
void registerPostConstructionCall (const std::function< void(const Injector &)> &call) const
 Register with the injector a callback that will be called by the injector at the end of construction. More...
 
void registerPreDestructionCall (const std::function< void()> &call) const
 Register with the injector a callback that will be called in the injector's destructor, before the bindings are deleted. More...
 
template<typename T >
void registerStaticSingleton (std::shared_ptr< T > *ptrPtr, std::string_view name=std::string_view()) const
 Register a static singleton pointer that the injector will set up post-construction and invalidate pre-destruction. More...
 

Additional Inherited Members

- Public Member Functions inherited from InjectorConfiguration
virtual void configure () const =0
 Configure the injector configuration. More...
 

Detailed Description

Application configurations specify application injector bindings.

One or more application configuration implementations are passed to the injector create function.

To implement a concrete application configuration class, implement this class and place the binding calls in the implemented configure() method.

Member Function Documentation

◆ bind()

BindingBuilder<BaseT, DeleterT>& bind ( std::string_view  name = std::string_view()) const
inlineprotected

Create a binding specification for the specified named or unnamed interface.

The deleter type is only used for unique bindings, otherwise it is ignored.

◆ registerPostConstructionCall()

void registerPostConstructionCall ( const std::function< void(const Injector &)> &  call) const
inlineprotected

Register with the injector a callback that will be called by the injector at the end of construction.

In order to use this method, inject the injector into the injectable via a weak pointer and call the method.

Parameters
callthe callback

◆ registerPreDestructionCall()

void registerPreDestructionCall ( const std::function< void()> &  call) const
inlineprotected

Register with the injector a callback that will be called in the injector's destructor, before the bindings are deleted.

Although pre-destruction callbacks must be noexcept(true), the pre-destruction function signature does not contain noexcept(true), as this is not yet handled by std::function in C++17. Despite this, functions registered as pre-destruction callbacks must nevertheless be noexcept(true).

In order to use this method, inject the injector into the injectable via a weak pointer and call the method.

Parameters
callthe callback

◆ registerStaticSingleton()

void registerStaticSingleton ( std::shared_ptr< T > *  ptrPtr,
std::string_view  name = std::string_view() 
) const
inlineprotected

Register a static singleton pointer that the injector will set up post-construction and invalidate pre-destruction.

The static pointer will be valid immediately after injection construction up to the start of injector destruction.

This call is a convenience method for calling the registerPostConstructionCall and registerPreDestructionCall methods in order to set up and tear down the static singleton pointer.

Template Parameters
Tthe binding type
Parameters
ptrPtra raw pointer to the statically allocated shared pointer
namean optional binding name

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