Generator.cpp 421 B

123456789101112131415161718192021222324
  1. #include <Generator.h>
  2. #include <mutex>
  3. namespace mdd
  4. {
  5. std::map<std::string, std::shared_ptr<IGenerator>>&
  6. GetGenerators(
  7. const std::string& name,
  8. const std::shared_ptr<IGenerator>& generator)
  9. {
  10. static std::map<std::string, std::shared_ptr<IGenerator>> gens;
  11. static std::mutex mutex;
  12. if (generator != nullptr)
  13. {
  14. mutex.lock();
  15. gens[name] = generator;
  16. mutex.unlock();
  17. }
  18. return gens;
  19. }
  20. }