This interface class lets the MainController do its work. More...
Classes | |
class | Constrainer |
A Constrainer objects can impose restrictions on a particular FactoryType. More... | |
struct | ProcessorEntry |
a simple POD which contains the id and the name of a Processor type. More... | |
Public Member Functions | |
virtual bool | allowType (const Identifier &typeName) const |
Checks if the type of the processor is found in the type name. More... | |
virtual Processor * | createProcessor (int typeIndex, const String &ProcessorId)=0 |
Overwrite this function and return a processor of the specific type index. More... | |
FactoryType (Processor *owner_) | |
Creates a Factory type. More... | |
virtual int | fillPopupMenu (PopupMenu &m, int startIndex=1) |
Fills a popupmenu with all allowed processor types. More... | |
virtual Array< ProcessorEntry > | getAllowedTypes () |
Returns a string array with all allowed types that this factory can produce. More... | |
String | getNameFromPopupMenuResult (int resultFromPopupMenu) |
Returns the typeName using the result from the previously created popupmenu. More... | |
virtual int | getNumProcessors () |
Returns the number of Processors that this factory can create. More... | |
virtual int | getProcessorTypeIndex (const Identifier &typeName) const |
Returns the index of the type. More... | |
Identifier | getTypeNameFromPopupMenuResult (int resultFromPopupMenu) |
Returns the typeName using the result from the previously created popupmenu. More... | |
virtual void | setConstrainer (Constrainer *newConstrainer, bool ownConstrainer=true) |
adds a Constrainer to a FactoryType. More... | |
Static Public Member Functions | |
static String | getUniqueName (Processor *id, String name=String()) |
Returns a unique ID for the new Processor. More... | |
Protected Member Functions | |
virtual const Array< ProcessorEntry > & | getTypeNames () const =0 |
This should only be overwritten by the subclasses. More... | |
This interface class lets the MainController do its work.
You can tell a Processor (which should also be a Chain to make sense) to use a specific FactoryType with Processor::setFactoryType(), which will then use it in its popup menu to create the possible Processors. Simply overwrite these two functions in your subclass:
Processor* createProcessor (int typeIndex, const String &id); const StringArray& getTypeNames() const;
A FactoryType constrains the number of creatable Processors by
FactoryType | ( | Processor * | owner_ | ) |
Creates a Factory type.
|
virtual |
Checks if the type of the processor is found in the type name.
You can overwrite this and add more conditions (in this case, call the base class method first to keep things safe!
|
pure virtual |
Overwrite this function and return a processor of the specific type index.
|
virtual |
Fills a popupmenu with all allowed processor types.
You can pass in a startIndex, if you overwrite this method for nested calls.
It returns the last index that can be used for the next menus.
|
virtual |
Returns a string array with all allowed types that this factory can produce.
String getNameFromPopupMenuResult | ( | int | resultFromPopupMenu | ) |
Returns the typeName using the result from the previously created popupmenu.
|
virtual |
Returns the number of Processors that this factory can create.
the rules defined in allowType are applied before counting the possible processors.
|
virtual |
Returns the index of the type.
Identifier getTypeNameFromPopupMenuResult | ( | int | resultFromPopupMenu | ) |
Returns the typeName using the result from the previously created popupmenu.
|
protectedpure virtual |
This should only be overwritten by the subclasses.
For external usage, use getAllowedTypes().
|
static |
Returns a unique ID for the new Processor.
It scans all Processors and returns something like "Processor12" if there are 11 other Processors with the same ID
|
virtual |
adds a Constrainer to a FactoryType.
It will be owned by the FactoryType. You can pass nullptr.