Sauce-0.10.1 A C++ Dependency Injection Framework

- Main Page
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Friends | List of all members
sauce::AbstractProvider< Dependency > Class Template Referenceabstract

An interface for including custom factories in an Injector. More...

`#include <sauce/provider.h>`

Inheritance diagram for sauce::AbstractProvider< Dependency >:

## Public Types
typedef Abstract | RequestsSelfInjection
Public Types inherited from sauce::Provider< Dependency >
typedef i::Key< Dependency >::Iface | Provides
| Indicates to template magic that this type exposes sauce::shared_ptr<Provides> get().

## Public Member Functions
void | setSelf (sauce::weak_ptr< Abstract > weak)
sauce::shared_ptr< Iface > | get ()
| Provide an Iface. More...

## Friends
class | i::DisposalDeleter< Iface, Abstract >

## Detailed Description

### template<typename Dependency>
class sauce::AbstractProvider< Dependency >

An interface for including custom factories in an Injector.

## Member Function Documentation

template<typename Dependency >

sauce::shared_ptr<Iface> sauce::AbstractProvider< Dependency >::get | ( |  | ) |
| inline virtual

Provide an Iface.

A naked instance pointer is obtained with provide(), and wrapped in a shared_ptr. It is also given a custom deleter, to dispose of the naked pointer with dispose(Iface *).

Implements sauce::Provider< Dependency >.

79 {
80 sauce::shared_ptr<Abstract> self = weak.lock();
81 assert(self.get() == this);
82 Deleter deleter(sauce::static_pointer_cast<Abstract>(self));
83 return sauce::shared_ptr<Iface>(provide(), deleter);
84 }

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

- sauce/provider.h