// // universe.h // engine_base // // Created by Sam Jaffe on 3/15/23. // #pragma once #include #include #include #include #include namespace engine { class Universe { private: std::shared_ptr mailbox_; std::shared_ptr config_; random::Random random_; serializer::Jsonizer jsonizer_; public: Mailbox & mailbox() const { return *mailbox_; } env::Config const & config() const { return *config_; } serializer::Jsonizer const & jsonizer() const { return jsonizer_; } random::Random const & random() const { return random_; } /** * @brief Construct a universe with all necessary components * @param cfg The config object generated from reading a config file or JSON * @param cache A serializer cache. If null, then we construct a default cache * @param rng A random number generator's underlying implementation. This * exists for dependency injection's sake. If rng is null, then random_ will * be constructed with the default random device. */ Universe(std::shared_ptr mailbox, env::Config const & cfg, std::shared_ptr cache, std::shared_ptr rng); void set_random(random::Random const &random) { random_ = random; } protected: template void load(std::string const & name, std::string const & fallback = ""); }; }