realfactory.h
71 virtual ParameterSettable* create(ConfigurationParameters& settings, QString prefix, bool configure) const = 0;
115 virtual ParameterSettableInConstructor* create(ConfigurationParameters& settings, QString prefix, bool configure) const;
161 virtual ParameterSettableWithConfigureFunction* create(ConfigurationParameters& settings, QString prefix, bool configure) const;
252 TypeToCreate* create(const QString& className, QString prefix, bool configure = true, bool* actuallyConfigured = NULL);
282 TypeToCreate* createFromParameter(QString prefix, bool configure = true, bool* actuallyConfigured = NULL);
412 ParameterSettableInConstructor* ParameterSettableCreatorT<T, ConfigureInConstructor>::create(ConfigurationParameters& settings, QString prefix, bool /*configure*/) const
416 // Telling the ConfigurationParameters object that the object for the group in terminatedPrefix is about
424 // Telling the ConfigurationParameters object that the object for the group in terminatedPrefix has been
434 ParameterSettableWithConfigureFunction* ParameterSettableCreatorT<T, false>::create(ConfigurationParameters& settings, QString prefix, bool configure) const
438 // Telling the ConfigurationParameters object that the object for the group in terminatedPrefix is about
446 // Telling the ConfigurationParameters object that the object for the group in terminatedPrefix has been
453 // Telling the ConfigurationParameters object that the object for the group in terminatedPrefix is about
461 // Telling the ConfigurationParameters object that the object for the group in terminatedPrefix has been
472 TypeToCreate* RealFactory::create(const QString& className, QString prefix, bool configure, bool* actuallyConfigured)
474 // This is a simple class to implement RAII for the m_createRecursionLevel variable, so that in case
479 RecursionLevelRAII(unsigned int& createRecursionLevel, QList<ParameterSettable*>& objectsConfiguredNotInitialized) :
483 // As this is the first call to create for the current m_settings, we remove the list of objects, if
500 RecursionLevelRAII(const RecursionLevelRAII& other) : m_createRecursionLevel(other.m_createRecursionLevel) {}
505 RecursionLevelRAII recursionLevelRAII(m_createRecursionLevel, m_objectsConfiguredNotInitialized);
521 std::auto_ptr<ParameterSettable> newObj(Factory::getInstance().m_classMap[className]->create(m_configurationParameters, prefix, configure));
535 // If we are outside any call to ConfigurationParameters::getObjectFromGroup() and this is the most external
536 // call to create (m_createRecursionLevel has been incremented from 0 to 1 by the constructor of RecursionLevelRAII),
537 // here we initialize all objects that have been configured. If the most external call to this function have been
538 // performed inside a call to ConfigurationParameters::getObjectFromGroup(), that function will do the job
539 // NOTE: this check should be useless now that create is protected and can only be called by ConfigurationParameters:
540 // calling postConfigureInitialization is always done inside ConfigurationParameters::getObjectFromGroup().
542 if (m_configurationParameters.outsideCallsToGetObjectFromGroup() && (m_createRecursionLevel == 1)) {
558 TypeToCreate* RealFactory::createFromParameter(QString prefix, bool configure, bool* actuallyConfigured)
560 QString type = m_configurationParameters.getValue(prefix + ConfigurationParameters::GroupSeparator() + QString("type"), false);
577 QStringList objectsGroups = m_configurationParameters.getGroupsWithPrefixList(prefix, basename);
581 objects.push_back(createFromParameter<TypeToCreate>(prefix + ConfigurationParameters::GroupSeparator() + *it));
588 QVector<TypeToCreate *> RealFactory::createVectorFromParameter(QString prefix, QString basename)
593 QStringList objectsGroups = m_configurationParameters.getGroupsWithPrefixList(prefix, basename);
594 // Order the data, so that the index respect the number specified after the colon in the groupname
599 objects.push_back(createFromParameter<TypeToCreate>(prefix + ConfigurationParameters::GroupSeparator() + *it));