T *make(const File &file)
This function constructs a plugin of type T from a provided File. The File name must already be in the registry to be made.
-
function definition:
static T *make(const File &file)
-
parameters:
Parameter Type Description file const File & File describing the object to be constructed -
output: (T) Returns an object of type T. T must inherit from Object.
- example:
Transform *transform = Factory<Transform>::make("ExampleTransform(Property1=Value1,Property2=Value2)"); // returns a pointer to an instance of ExampleTransform with property1 set to value1 // and property2 set to value 2.
QList<QSharedPointer<T>>makeAll
Make all of the registered plugins for a specific abstraction.
-
function definition:
static QList< QSharedPointer<T> > makeAll()
-
parameters: NONE
- output: (QList<QSharedPointer<T>>) Returns a list of all of the objects registered to a particular abstraction T
- example:
BR_REGISTER(Transform, FirstTransform) BR_REGISTER(Transform, SecondTransform) QList<QSharedPointer<Transform> > = Factory<Transform>::makeAll(); // returns a list with pointers to FirstTransform and SecondTransform
QStringList names()
Get the names of all of the registered objects for a specific abstraction.
-
function definition:
static QStringList names()
-
parameters: NONE
- output: (QStringList) Returns a list of object names from the registry
- example:
BR_REGISTER(Transform, FirstTransform) BR_REGISTER(Transform, SecondTransform) QStringList names = Factory<Transform>::names(); // returns ["First", "Second"]
QString parameters(const QString &name)
Get the parameters for the plugin defined by the provided name.
-
function definition:
static QString parameters(const QString &name)
-
parameters:
Parameter Type Description name const QString & Name of a plugin -
output: (QString) Returns a string with each property and its value seperated by commas.
- example:
class ExampleTransform : public Transform { Q_OBJECT Q_PROPERTY(int property1 READ get_property1 WRITE set_property1 RESET reset_property1 STORED false) Q_PROPERTY(float property2 READ get_property2 WRITE set_property2 RESET reset_property2 STORED false) Q_PROPERTY(QString property3 READ get_property3 WRITE set_property3 RESET reset_property3 STORED false) BR_PROPERTY(int, property1, 1) BR_PROPERTY(float, property2, 2.5) BR_PROPERTY(QString, property3, "Value") ... }; Factory<Transform>::parameters("Example"); // returns "int property1 = 1, float property2 = 2.5, QString property3 = Value" Factory<Transform>::parameters("Example(property3=NewValue)"); // returns "int property1 = 1, float property2 = 2.5, QString property3 = NewValue"