Sauce-0.10.1
A C++ Dependency Injection Framework
Public Member Functions | List of all members
sauce::Modules Class Reference

A factory that accepts Modules and creates Injectors. More...

#include <sauce/modules.h>

Public Member Functions

 Modules ()
 Create an empty Modules.
 
Modulesadd (void(*module)(Binder &))
 Add the bindings defined by the given module function.
 
template<typename Module >
Modulesadd ()
 Add the bindings defined by the given Module type.
 
template<typename Module >
Modulesadd (Module &module)
 Add the bindings defined by the given Module instance.
 
sauce::shared_ptr< InjectorcreateInjector () const
 Create an Injector that can provide dependencies specified by all added Modules.
 
template<typename Locker , typename Lockable >
sauce::shared_ptr< InjectorcreateInjector (Lockable &lockable) const
 Create an Injector that can provide dependencies specified by all added Modules.
 

Detailed Description

A factory that accepts Modules and creates Injectors.

Member Function Documentation

Modules& sauce::Modules::add ( void(*)(Binder &)  module)
inline

Add the bindings defined by the given module function.

An Injector created after adding a module will understand how to provide dependencies specified by that module.

{
module(binder);
binder.throwAnyPending();
return *this;
}

Here is the call graph for this function:

template<typename Module >
Modules& sauce::Modules::add ( )
inline

Add the bindings defined by the given Module type.

The module here is any default constructable type providing operator()(Binding & bindings).

An Injector created after adding a module will understand how to provide dependencies specified by that module.

{
Module module;
module(binder);
binder.throwAnyPending();
return *this;
}

Here is the call graph for this function:

template<typename Module >
Modules& sauce::Modules::add ( Module &  module)
inline

Add the bindings defined by the given Module instance.

The module here is any value providing operator()(Binding & bindings).

An Injector created after adding a module will understand how to provide dependencies specified by that module.

{
module(binder);
binder.throwAnyPending();
return *this;
}

Here is the call graph for this function:

sauce::shared_ptr<Injector> sauce::Modules::createInjector ( ) const
inline

Create an Injector that can provide dependencies specified by all added Modules.

Any modules added after an Injector is created will have no effect on that Injector.

{
sauce::auto_ptr<i::LockFactory> lockFactory(new i::NullLockFactory());
return createInjector(lockFactory);
}
template<typename Locker , typename Lockable >
sauce::shared_ptr<Injector> sauce::Modules::createInjector ( Lockable &  lockable) const
inline

Create an Injector that can provide dependencies specified by all added Modules.

Any modules added after an Injector is created will have no effect on that Injector.

{
sauce::auto_ptr<i::LockFactory> lockFactory(new i::LockerLockFactory<Locker, Lockable>(lockable));
return createInjector(lockFactory);
}

Here is the call graph for this function:


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