/BJEngine/src/Core.cpp

https://bitbucket.org/mild1/bj · 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. IDeck& Core::GetDeck()
  5. {
  6. return *deck_;
  7. }
  8. IStrategyCalculatorPtr Core::NewStrategyCalculator()
  9. {
  10. Rules rules;
  11. return IStrategyCalculatorPtr (new StrategyCalculator(rules));
  12. }
  13. std::ofstream& Core::GetLog()
  14. {
  15. return log_;
  16. }
  17. Core& Core::GetCore()
  18. {
  19. //no need in
  20. //static Core* core = new Core();
  21. //things aren't that complex yet
  22. static Core core;
  23. return core;
  24. }
  25. Core::Core(const Core& core){}
  26. Core::~Core()
  27. {
  28. delete deck_;
  29. log_.flush();
  30. log_.close();
  31. }
  32. Core::Core():
  33. deck_(new InfiniteDeck())
  34. , log_("bjengine.log", std::ios::out)
  35. {
  36. log_ << "Core was successfully created" << std::endl;
  37. }