/BJEngine/src/Core.cpp
C++ | 45 lines | 34 code | 8 blank | 3 comment | 0 complexity | be1c898542c2869ea35ad28ea15b4bb4 MD5 | raw file
1#include "Core.h"
2#include "InfiniteDeck.h"
3#include "StrategyCalculator.h"
4
5IDeck& Core::GetDeck()
6{
7 return *deck_;
8}
9
10IStrategyCalculatorPtr Core::NewStrategyCalculator()
11{
12 Rules rules;
13 return IStrategyCalculatorPtr (new StrategyCalculator(rules));
14}
15
16std::ofstream& Core::GetLog()
17{
18 return log_;
19}
20
21Core& Core::GetCore()
22{
23 //no need in
24 //static Core* core = new Core();
25 //things aren't that complex yet
26 static Core core;
27 return core;
28}
29
30Core::Core(const Core& core){}
31
32Core::~Core()
33{
34 delete deck_;
35
36 log_.flush();
37 log_.close();
38}
39
40Core::Core():
41deck_(new InfiniteDeck())
42, log_("bjengine.log", std::ios::out)
43{
44 log_ << "Core was successfully created" << std::endl;
45}