Sauce-0.10.1
A C++ Dependency Injection Framework
|
A container for bindings. More...
#include <sauce/internal/bindings.h>
Public Member Functions | |
void | put (OpaqueBindingPtr binding) |
Insert the given binding. | |
template<typename Dependency > | |
sauce::shared_ptr< ResolvedBinding< Dependency > > | getProvidingBinding (std::string const name) const |
template<typename Dependency > | |
std::vector< sauce::shared_ptr< ResolvedBinding< Dependency > > > | getModifierBindings (std::string const name) const |
template<typename Dependency > | |
void | validateAcyclic (bool validateProviding, InjectorPtr injector, TypeIds &ids, std::string const name) const |
template<typename Dependency > | |
void | get (typename Key< Dependency >::Ptr &injected, InjectorPtr injector, std::string const name) const |
Inject the named Dependency. More... | |
template<typename Scope > | |
void | eagerlyInject (InjectorPtr injector) const |
A container for bindings.
Each Modules objects creates a Bindings, and passes a const copy to each Injector it creates. The set of bindings an Injector uses is therefore read-only.
When providing instances (eagerly and not) the injector is passed in and the dependency is returned directly, instead of giving the binding to the injector (the binding details stay hidden.)
The template parameter is a strategy type that attempts to located unknown bindings dynamically (implicitly.) Due to the threat of circular dependencies (in Sauce's type space), Bindings itself can't be aware of concrete Binding implementations. The only time it needs to know about them is when resolving implicit bindings. So, this functionality is hidden behind the templated strategy.
|
inline |
Inject the named Dependency.
If no binding is found, the implicit bindings are checked.