JD2022-TU1/main/extern/Soundwich/Solution/Engine/Src/SynthFactory.h

33 lines
1.1 KiB
C++

#pragma once
#include "Inc/Soundwich.h"
#include "Util/Dictionary.h"
#include "Util/String.h"
namespace Soundwich
{
class Module;
class Component;
class Connection;
typedef void (*ComponentCreateMethod)( Synth* synth, const Util::String& name, Component** component );
typedef void (*ConnectionCreateMethod)( Synth* synth, Connection** connection );
class SynthFactory
{
public:
SynthFactory( Soundwich::Engine::Impl* engine );
SoundResult CreateComponent( Synth* synth, const Util::String& type, const Util::String& name, Component** component );
SoundResult CreateConnection( Synth* synth, const Util::String& type, Connection** connection );
private:
void AddComponentCreateMethod( const Util::String& type, ComponentCreateMethod createMethod );
void AddConnectionCreateMethod( const Util::String& type, ConnectionCreateMethod connectMethod );
private:
Util::StringDictionary< ComponentCreateMethod > _createComponentMethods;
Util::StringDictionary< ConnectionCreateMethod > _createConnectionMethods;
};
}