// // Created by Cristobal Mendoza on 12/3/17. // #ifndef MAGSLIDETRANSITIONFACTORY_H #define MAGSLIDETRANSITIONFACTORY_H #include "magSlide.h" #include "magSlideTransition.h" /** * Factory class to register and instantiate transitions. */ class magSlideTransitionFactory { public: static magSlideTransitionFactory* instance(); std::shared_ptr createTransition(string transitionName, std::shared_ptr slide, ofParameterGroup &group, u_int64_t duration); template void registerTransition(T transition) { if (transitionsMap.count(transition.getName()) == 0) { transitionsMap[transition.getName()] = [](){ return std::make_shared(); }; } } protected: std::unordered_map()>> transitionsMap; private: static magSlideTransitionFactory* _instance; magSlideTransitionFactory(); }; #endif //MAGSLIDETRANSITIONFACTORY_H