aboutsummaryrefslogtreecommitdiff
path: root/examples/basic/src/bootstrap.cpp
blob: 38edcc34143dd67a1c919cbaf0d99d3c87105e03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "bootstrap.hpp"

// Interfaces
#include "interfaces/enemy.hpp"
#include "interfaces/hero.hpp"
#include "interfaces/weapon.hpp"

// Concretes
#include "enemy.hpp"
#include "hero.hpp"
#include "sword.hpp"

yacppdic::Container bootstrap()
{
	auto container = yacppdic::Container();

	container.bind<IHero>().to<Hero>();
	container.bind<IWeapon>().to<Sword>();

	container.bind<IEnemyFactory>().to_factory(
		[]()
		{
			return std::make_unique<Enemy>();
		}
	);

	return container;
}