Sauce-0.10.1: sauce::Modules Class Reference

Sauce-0.10.1 A C++ Dependency Injection Framework

- Main Page
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

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.
Modules & | add (void(*module)(Binder &))
| Add the bindings defined by the given module function.
template<typename Module >
Modules & | add ()
| Add the bindings defined by the given Module type.
template<typename Module >
Modules & | add (Module &module)
| Add the bindings defined by the given Module instance.
sauce::shared_ptr< Injector > | createInjector () const
| Create an Injector that can provide dependencies specified by all added Modules.
template<typename Locker , typename Lockable >
sauce::shared_ptr< Injector > | createInjector (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:

- sauce/modules.h