blob: 85498bc7e42d4ab41c06e07154de0a0d02f253cd (
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
29
30
31
32
33
34
35
36
|
#include "bootstrap.hpp"
// Interfaces
#include "interfaces/argument_parser.hpp"
#include "interfaces/randomization.hpp"
// Implementations
#include "argument_parser.hpp"
#include "randomization/generator.hpp"
#include "randomization/seed_generator.hpp"
#include <memory>
#include <random>
Container bootstrap()
{
auto container = Container();
container.bind<IArgumentParser>().to<ArgumentParser>();
container.bind<IRandomNumberGeneratorFactory>().to_factory(
[](const unsigned int &seed)
{
return std::dynamic_pointer_cast<IRandomNumberGenerator>(
std::make_shared<RandomNumberGenerator>(seed));
});
container.bind<ISeedGeneratorFactory>().to_factory(
[]()
{
return std::dynamic_pointer_cast<ISeedGenerator>(
std::make_shared<SeedGenerator>(std::make_unique<std::random_device>()));
});
return container;
}
|