configurationparameters.h
292 static bool registerFileFormat(QString format, ParametersFileLoaderSaver *fileLoaderSaver, QString defaultExtension);
871 TypeToCreate* getObjectFromGroup(QString group, bool configure = true, bool forceObjectCreation = false);
912 TypeToCreate* getObjectFromParameter(QString param, bool alsoMatchParents = false, bool configure = true, bool forceObjectCreation = false)
1083 bool setObjectFromGroupStatusToCreatedAndConfigured(QString group, ParameterSettable *object = NULL);
1195 TypeToCreate* ConfigurationParameters::getObjectFromGroup(QString group, bool configure, bool forceObjectCreation)
1197 // This is a simple class to implement RAII for the m_getObjectFromGroupRecursionLevel variable
1198 // and the m_objectsToConfigure list so that they are properly finalized on getObjectFromGroup() exit.
1199 // Note that to configure objects you have to explicitly call "release", the destructor doesn't call
1204 RecursionLevelRAII(unsigned int *var, QList<ConfigurationParameters::ObjectAndRecursionLevel> *list, QList<SimpleResourcesUser> *resourcesUsers, ConfigurationParameters ¶ms, RealFactory& factory) :
1252 RecursionLevelRAII(const RecursionLevelRAII& /*other*/) : m_params(*((ConfigurationParameters *) NULL)), m_factory(*((RealFactory *) NULL)) {}
1269 // If the recursion level is 0 (this is the most external call to getObjectFromGroup), we always configure
1270 // the object. This check is needed because otherwise, if the most external call to this function has
1277 RecursionLevelRAII recursionLevelRAII(&m_getObjectFromGroupRecursionLevel, &m_objectsToConfigure, &m_resourcesUserPerRecursionLevel, *this, *m_factory);
1286 // This is set to true because we use it to decide whether to add the object to the list or not:
1287 // if true it is not added, if false it is added (an this is only modified when the object is created
1306 // Checking we haven't been requested a new object (we cannot do this because another object exists
1307 // but is not configured - this is the safest policy, even if perhaps we could do something more smart).
1324 ParameterSettableWithConfigureFunction *const o = dynamic_cast<ParameterSettableWithConfigureFunction *>(retObj);
1332 // Checking we haven't been requested a new object (we cannot do this because another object exists
1333 // and is being configured - this is the safest policy, even if perhaps we could do something more smart).
1349 // Object is in creation and configuration phase, cannot return it and cannot create another object
1358 // If we were requested a new object, creating it, otherwise we return the already existing one
1382 // Releasing resources (explicitly, so that unconfigured objects that can be configured at this recursion level
1386 // Now checking if we have to call postConfigureInitialization() for all configured objects. The check is here (as
1387 // well as inside RealFactory::create) because this function can call RealFactory::create and vice-versa, so we have to check
1389 // NOTE: now that the factory cannot be used directly this check should be useless (we always call postConfigureInitialization()
1394 // Safety check, just to be sure: when we get here, there should be no object in the list of objects yet to configure
1396 qFatal( "INTERNAL ERROR: The list of objects yet to be configured is not empty at the exit of the most external call to ConfigurationParameters::getObjectFromGroup(). The number of objects still in the list is %d", m_objectsToConfigure.size());
TypeToCreate * getObjectFromParameter(QString param, bool alsoMatchParents=false, bool configure=true, bool forceObjectCreation=false)
Returns the object for the given parameter, creating it if it doesn't exist.
Definition: configurationparameters.h:912
This file contains the common type defitions used on the whole framework.
A simple class to access/declare resources (not thread-safe)
Definition: resourcesuser.h:227
The exception thrown when casting an ParameterSettable object to the requested type fails...
Definition: configurationexceptions.h:252
The exception thrown when a cyclic dependency is discovered during object creation using the Configur...
Definition: configurationexceptions.h:581
Definition: configurationhelper.cpp:24
The class containing configuration parameters.
Definition: configurationparameters.h:259
ObjectAndStatus getObjectForNode(QString path) const
Returns the object corresponding to the given node.
Definition: configurationnode.cpp:248
virtual void configure(ConfigurationParameters ¶ms, QString prefix)=0
Configures the object using a ConfigurationParameters object.
The base for classes that can be configured/saved using a ConfigurationParameters object...
Definition: parametersettable.h:51
The class implementing the create function of the class above.
Definition: realfactory.h:93
static QString ParentGroup()
The sequence used to indicate the parent group.
Definition: configurationparameters.h:276
The exception thrown when the user requests a new object for a group but there is another object for ...
Definition: configurationexceptions.h:761
void resetGroupObjectAssociations()
Resets all associations between groups and objects.
Definition: configurationparameters.cpp:262
FactoryObserver class to keep trace on operations done by Factory.
Definition: factoryobserver.h:36
QString createSubGroup(QString parentPath, QString groupName)
Create a sub-group of parent group specified.
Definition: configurationparameters.h:621
The structure with the object for a node and its status.
Definition: configurationnode.h:70
TypeToCreate * getObjectFromGroup(QString group, bool configure=true, bool forceObjectCreation=false)
Returns the object for the given group, creating it if it doesn't exist.
Definition: configurationparameters.h:1195
The base for classes that can be configured using a ConfigurationParameters object.
Definition: parametersettable.h:789
void createParameter(QString groupPath, QString parameter, QString value)
Create a parameter in the group path specified and set its value.
Definition: configurationparameters.h:647
static QString GroupSeparator()
The character used to split path in groups.
Definition: configurationparameters.h:268
void createParameter(QString groupPath, QString parameter, ParameterSettable *object)
Create a parameter in the group path specified and set its value to point to an object.
Definition: configurationparameters.h:663
ConfigurationParameters & operator=(const ConfigurationParameters &other)
Assignment operator.
Definition: configurationparameters.cpp:92
The base for all classes able to load/save configuration parameters from/to file. ...
Definition: parametersfileloadersaver.h:39
bool setObjectForNode(QString path, ParameterSettable *object, ObjectCreationStatus status=ObjectCreatedAndConfigured)
Sets the object corresponding to the given node to object.
Definition: configurationnode.cpp:224