Change request #1824
Add model parameters to spectral registry handling
So far, each model in a spectral registry is identified by it’s name which is extracted from the
type() method of the model (the same is true for the other registries, in particular the spatial registry).
It is proposed to add the parameter names of each model to the registry so that the XML parser can allocate the right class based on a combination of model type and model parameters (see #1821).
Thinking about the possible implementation, it occurred to me that the actual model name needs not to be stored in the registry class (as it is done now), since it can in fact be extracted from the model’s type. In the same way, the parameters can be extracted from the model class through the model parameter access operator. Hence the only thing that is needed is a replacement of the
GModelSpectralRegistry::alloc(const std::string& name)method by a
GModelSpectralRegistry::alloc(const GXmlElement& spectral)that is called in the
GModelSky::xml_spectral method. The new
GModelSpectralRegistry::alloc method would then determine all parameter names in the XML file and search for an appropriate class in the registry.
To allow for legacy parameter names in a spectral parameter (for example the existence of both the
Scale and the
PivotEnergy parameter names) it would be sufficient to create a type and parameter name constructor for each spectral class that takes as input the type and parameter name strings.