The class that registers ParameterSettable types. More...
Classes | |
class | RegisterClassHelper< false, H > |
class | RegisterClassHelper< true, H > |
Public Member Functions | |
~Factory () | |
Destructor. | |
QStringList | getAllSubclasses (QString className, int levelToStop=-1, bool noAbstractClasses=false) |
Returns all subclasses of a class up to the specified inheritance level. | |
bool | isAbstract (QString className) |
Returns true if the class is abstract (i.e. | |
template<class NewClass > | |
void | registerClass (QString className, QString parentClassName) |
Registers a new instatiable class. | |
Static Public Member Functions | |
static Factory & | getInstance () |
Returns the only instance of this class. | |
static ConfigurationParameters & | getTypeDescriptions () |
Returns the only instance of the typeDescriptions object. | |
Friends | |
class | RealFactory |
RealFactory is friend to be able to call access the map of object creators. | |
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)
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
-
className the name of the parent class of the subclasses returned levelToStop if -1 it returns all the subclasses on all level of inheritance; otherwise it returns the subclasses up to the specified level. noAbstractClasses if 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().
|
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().
|
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
-
className the 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
-
className the name of class used when requesting object creation parentClassName the 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)
Friends And Related Function Documentation
|
friend |
RealFactory is friend to be able to call access the map of object creators.
The documentation for this class was generated from the following files:
- configuration/include/factory.h
- configuration/src/factory.cpp