Sauce-0.10.1: sauce::AbstractProvider< Dependency > Class Template Reference

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 >:
[legend]
Collaboration diagram for sauce::AbstractProvider< Dependency >:
[legend]

## 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.

## 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 | ( |  | ) |
| inlinevirtual

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 >.

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

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

- sauce/provider.h