The class that registers ParameterSettable types. More...

Classes

class  RegisterClassHelper< false, H >
 
class  RegisterClassHelper< true, H >
 

Public Member Functions

 ~Factory ()
 Destructor. More...
 
QStringList getAllSubclasses (QString className, int levelToStop=-1, bool noAbstractClasses=false)
 Returns all subclasses of a class up to the specified inheritance level. More...
 
ConfigurationWidgetgetEditorForType (ConfigurationParameters &params, QString prefix, QWidget *parent=NULL, Qt::WindowFlags f=0)
 Returns an editor for the given group. More...
 
bool isAbstract (QString className)
 Returns true if the class is abstract (i.e. More...
 
template<class NewClass >
void registerClass (QString className, QString parentClassName)
 Registers a new instatiable class. More...
 
template<class EditorType >
void registerEditorForType (QString type)
 Registers a class to be the editor for the give type. More...
 

Static Public Member Functions

static FactorygetInstance ()
 Returns the only instance of this class. More...
 
static ConfigurationParametersgetTypeDescriptions ()
 Returns the only instance of the typeDescriptions object. More...
 

Friends

class RealFactory
 RealFactory is friend to be able to call access the map of object creators. More...
 

Detailed Description

The class that registers ParameterSettable types.

Despite its name this class is not able to create any object. This is only used to register types (ParameterSettable subclasses) that can later be created using a ConfigurationParameters object. This also has some methods to get meta-information. Note that this class IS NOT THREAD-SAFE, so types registration must never be performed in parallel. Moreover no creation using ConfigurationParameters methods must be performed in parallel to types registrations as both registration and creation access the same structure that are not protected from concurrent accesses.

Note
This is a singleton, use getInstance to get the only instance of this class
This class it NOT thread-safe
This class is named "Factory" for historical reasons (it used to create objects, now the RealFactory class has taken this responsability)

Definition at line 119 of file factory.h.

Constructor & Destructor Documentation

~Factory ( )

Destructor.

Definition at line 46 of file factory.cpp.

Member Function Documentation

QStringList getAllSubclasses ( QString  className,
int  levelToStop = -1,
bool  noAbstractClasses = false 
)

Returns all subclasses of a class up to the specified inheritance level.

Parameters
classNamethe name of the parent class of the subclasses returned
levelToStopif -1 it returns all the subclasses on all level of inheritance; otherwise it returns the subclasses up to the specified level.
noAbstractClassesif true the abstract subclasses will be filtered out, otherwise they will be included into the returned list
Returns
the list of subclasses of the given class
Note
levelToStop == 1 means all direct children are returned; so levelToStop == 0 means no subclasses will be returned !!

Definition at line 55 of file factory.cpp.

References Factory::isAbstract().

ConfigurationWidget * getEditorForType ( ConfigurationParameters params,
QString  prefix,
QWidget *  parent = NULL,
Qt::WindowFlags  f = 0 
)

Returns an editor for the given group.

The ConfigurationWidget object receives the given ConfigurationParameters instance and the group (prefix) and can be used to edit that group parameters. Use the ConfigurationWidget::configuringSubgroups() function to understand if the widget also manages subgroups of prefix or not. For this function to work the group must be of a type that is present in typeDescriptions or have no type, otherwise an exception is thrown. If no editor is explicitly set NULL is returned.

Parameters
paramsthe configuration parameters object to edit
prefixthe group to edit
parentthe parent widget of the editor
fwindows flags for the editor
Returns
the editor for the group or NULL

Definition at line 88 of file factory.cpp.

References ConfigurationParameters::getValue(), and ConfigurationParameters::GroupSeparator().

Factory & getInstance ( )
static

Returns the only instance of this class.

Returns
the only instance of this class

Definition at line 26 of file factory.cpp.

Referenced by RealFactory::create(), and ParameterSettable::setGraphicalEditor().

ConfigurationParameters & getTypeDescriptions ( )
static

Returns the only instance of the typeDescriptions object.

Returns
the only instance of ConfigurationParameters that contains descriptions of types registered
Note
groups and parameters in the returned object are case sensitive

Definition at line 34 of file factory.cpp.

Referenced by ParameterSettable::BoolDescriptor::BoolDescriptor(), ParameterSettable::StringDescriptor::def(), ParameterSettable::IntDescriptor::def(), ParameterSettable::RealDescriptor::def(), ParameterSettable::BoolDescriptor::def(), ParameterSettable::EnumDescriptor::def(), ParameterSettable::Descriptor::Descriptor(), ParameterSettable::EnumDescriptor::EnumDescriptor(), RuntimeParameterSetter::get(), ConfigurationHelper::getDescribedParameterNames(), ConfigurationHelper::getDescribedSubgroupNames(), ConfigurationHelper::getParameterEnumValues(), ConfigurationHelper::getParameterTypeName(), ParameterSettable::StringDescriptor::help(), ParameterSettable::IntDescriptor::help(), ParameterSettable::RealDescriptor::help(), ParameterSettable::BoolDescriptor::help(), ParameterSettable::EnumDescriptor::help(), ParameterSettable::ObjectDescriptor::help(), ParameterSettable::SubgroupDescriptor::help(), ParameterSettable::IntDescriptor::IntDescriptor(), ConfigurationHelper::isRuntimeParameter(), ParameterSettable::IntDescriptor::limits(), ParameterSettable::RealDescriptor::limits(), ParameterSettable::ObjectDescriptor::ObjectDescriptor(), ConfigurationHelper::parameterIsDouble(), ParameterSettable::StringDescriptor::props(), ParameterSettable::IntDescriptor::props(), ParameterSettable::RealDescriptor::props(), ParameterSettable::BoolDescriptor::props(), ParameterSettable::EnumDescriptor::props(), ParameterSettable::ObjectDescriptor::props(), ParameterSettable::SubgroupDescriptor::props(), ParameterSettable::RealDescriptor::RealDescriptor(), RuntimeParameterSetter::set(), ParameterSettable::StringDescriptor::StringDescriptor(), ParameterSettable::SubgroupDescriptor::SubgroupDescriptor(), ParameterSettable::ObjectDescriptor::type(), ParameterSettable::SubgroupDescriptor::type(), and ParameterSettable::EnumDescriptor::values().

bool isAbstract ( QString  className)

Returns true if the class is abstract (i.e.

: it's not possibile to create it)

Parameters
classNamethe name of the class to check
Returns
true if the class is abstract

Definition at line 82 of file factory.cpp.

Referenced by Factory::getAllSubclasses().

void registerClass ( QString  className,
QString  parentClassName 
)

Registers a new instatiable class.

Parameters
classNamethe name of class used when requesting object creation
parentClassNamethe name of the parent class. parentClassName is used in order to keep track of the hierarchy of the registered classes, but only single inheritance is supported
Note
parentClassName is mandatory and you are not allowed to pass an empty QString; in fact all registrable classes has to inherit at least from ParameterSettableInConstructor or ParameterSettableWithConfigureFunction
It's IMPORTANT to register also all abstract classes even if it's not possibile to create them (as they could be the parent of other concrete classes)

Definition at line 382 of file factory.h.

void registerEditorForType ( QString  type)

Registers a class to be the editor for the give type.

The class being registered must be a subclass of ConfigurationWidget. Moreover the type must be already present in typeDescriptions, otherwise an exception is thrown

Parameters
typethe type whose editor is being registered. It must be already present in typeDescriptions, otherwise an exception is thrown

Definition at line 388 of file factory.h.

Referenced by ParameterSettable::setGraphicalEditor().

Friends And Related Function Documentation

friend class RealFactory
friend

RealFactory is friend to be able to call access the map of object creators.

Definition at line 314 of file factory.h.


The documentation for this class was generated from the following files: