/////////////////////////////////////////////////////////////////////// // // Factory to get SeedModifiers, copied from MethodFactory // // Author: Matt Mottram // // REVISION HISTORY: // - 2015-10-19: M Mottram - first instance // /////////////////////////////////////////////////////////////////////// #ifndef __RAT_SeedModifier_SeedModifierFactory_ #define __RAT_SeedModifier_SeedModifierFactory_ #include #include #include namespace RAT { namespace SeedModifiers { class SeedModifierFactory { public: // Returns the only instance of the class static SeedModifierFactory* GetInstance() { return Get(); } inline static SeedModifierFactory* Get(); // Register a seedModifier in the factory // // An example call is Register( MySeedModifier::GetName(), new Alloc()) // // "name" is the name of the seedModifier // "allocator" is an instance of an Alloc with the correct seedModifier type void Register( std::string name, AllocBase* allocator ); // Returns the seedModifier by name SeedModifier* GetSeedModifier( const std::string& name ); // SeedModifier name or name-init, init will be passed to the seedModifier private: // Private constructor to prevent instantiation SeedModifierFactory(); Factory fFactory; // SeedModifier factory, contains allocators for SeedModifiers }; inline SeedModifierFactory* SeedModifierFactory::Get() { static SeedModifierFactory seedModifierFactory; return &seedModifierFactory; } } //::SeedModifier } //::RAT #endif