OpenMS  2.5.0
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
DefaultParamHandler Class Reference

A base class for all classes handling default parameters. More...

#include <OpenMS/DATASTRUCTURES/DefaultParamHandler.h>

Inheritance diagram for DefaultParamHandler:
BaseModel< 1 > BaseModel< 2 > AbsoluteQuantitation AccurateMassSearchEngine AScore BaseGroupFinder BaseLabeler BaseModel< D > BaseSuperimposer BasicProteinInferenceAlgorithm BayesianProteinInferenceAlgorithm BernNorm BinnedSpectrumCompareFunctor CompNovoIdentificationBase CompNovoIonScoringBase ConsensusIDAlgorithm ConsensusMapMergerAlgorithm DeNovoAlgorithm DeNovoIdentification DeNovoIonScoring DeNovoPostScoring DetectabilitySimulation DiaPrescore DIAScoring DigestSimulation ElutionModelFitter ElutionPeakDetection EmgGradientDescent FalseDiscoveryRate FeatureDeconvolution FeatureDistance FeatureFinderAlgorithm FeatureFinderIdentificationAlgorithm FeatureFinderMultiplexAlgorithm FeatureFindingMetabo FeatureGroupingAlgorithm FIAMSDataProcessor FilterFunctor Fitter1D GaussFilter IDDecoyProbability IDMapper IDMergerAlgorithm IDRipper InclusionExclusionList IonizationSimulation IsobaricChannelExtractor IsobaricQuantifier IsobaricQuantitationMethod KDTreeFeatureMaps LinearResampler LowessSmoothing MapAlignmentAlgorithmIdentification MapAlignmentAlgorithmPoseClustering MapAlignmentAlgorithmSpectrumAlignment MapAlignmentAlgorithmTreeGuided MarkerMower MascotGenericFile MascotRemoteQuery MassDecompositionAlgorithm MasstraceCorrelator MassTraceDetection PosteriorErrorProbabilityModel MetaboliteFeatureDeconvolution MetaboliteSpectralMatching MorphologicalFilter MRMDecoy MRMFeatureFilter MRMFeatureFinderScoring MRMFragmentSelection MRMMapping MRMTransitionGroupPicker MSPFile MSPGenericFile MSSim MultiplexDeltaMassesGenerator NLargest Normalizer NucleicAcidSpectrumGenerator OfflinePrecursorIonSelection OpenPepXLAlgorithm OpenPepXLLFAlgorithm OptimizePeakDeconvolution ParentPeakMower PeakIntegrator PeakMarker PeakPickerCWT PeakPickerHiRes PeakPickerIterative PeakPickerMRM PeakPickerSH PeakSpectrumCompareFunctor PeptideAndProteinQuant PeptideIndexing PrecursorIonSelection PrecursorIonSelectionPreprocessing ProteinResolver ProtonDistributionModel PSLPFormulation QuantitativeExperimentalDesign RawMSSignalSimulation RawTandemMSSignalSimulation RTSimulation SavitzkyGolayFilter Scaler SignalToNoiseEstimator< Container > SimpleSearchEngineAlgorithm SimpleSVM SimpleTSGXLMS SiriusAdapterAlgorithm SONARScoring SpectraIdentificationViewWidget SpectraMerger SpectraMerger::SpectraDistance_ SpectrumAlignment SpectrumAnnotator SpectrumCanvas SqrtMower SvmTheoreticalSpectrumGenerator SvmTheoreticalSpectrumGeneratorTrainer SwathMapMassCorrection TargetedSpectraExtractor TheoreticalSpectrumGenerator TheoreticalSpectrumGeneratorXLMS ThresholdMower TOFCalibration TOPPASBase TOPPViewBase TraceFitter TransitionTSVFile TwoDOptimization WindowMower XFDRAlgorithm SignalToNoiseEstimator< ContainerT > SignalToNoiseEstimator< OpenMS::MSChromatogram >

Public Member Functions

 DefaultParamHandler (const String &name)
 Constructor with name that is displayed in error messages. More...
 
 DefaultParamHandler (const DefaultParamHandler &rhs)
 Copy constructor. More...
 
virtual ~DefaultParamHandler ()
 Destructor. More...
 
virtual DefaultParamHandleroperator= (const DefaultParamHandler &rhs)
 Assignment operator. More...
 
virtual bool operator== (const DefaultParamHandler &rhs) const
 Equality operator. More...
 
void setParameters (const Param &param)
 Sets the parameters. More...
 
const ParamgetParameters () const
 Non-mutable access to the parameters. More...
 
const ParamgetDefaults () const
 Non-mutable access to the default parameters. More...
 
const StringgetName () const
 Non-mutable access to the name. More...
 
void setName (const String &name)
 Mutable access to the name. More...
 
const std::vector< String > & getSubsections () const
 Non-mutable access to the registered subsections. More...
 

Protected Member Functions

virtual void updateMembers_ ()
 This method is used to update extra member variables at the end of the setParameters() method. More...
 
void defaultsToParam_ ()
 Updates the parameters after the defaults have been set in the constructor. More...
 

Protected Attributes

Param param_
 Container for current parameters. More...
 
Param defaults_
 Container for default parameters. This member should be filled in the constructor of derived classes! More...
 
std::vector< Stringsubsections_
 Container for registered subsections. This member should be filled in the constructor of derived classes! More...
 
String error_name_
 Name that is displayed in error messages during the parameter checking. More...
 
bool check_defaults_
 If this member is set to false no checking if parameters in done;. More...
 
bool warn_empty_defaults_
 If this member is set to false no warning is emitted when defaults are empty;. More...
 

Private Member Functions

 DefaultParamHandler ()
 Hidden default C'tor (class name parameter is required!) More...
 

Detailed Description

A base class for all classes handling default parameters.

This class facilitates the handling of parameters:

range restrictions of numeric parameters

subsections that are passed to other classes can be excluded from the check (subsections_)

Extra member variables are needed if getting the value from param_ would be too slow e.g. when they are used in methods that are called very often.

No matter if you have extra variables or not, do the following:

If you have extra member variables you need to synchronize with param_, do the following:

Base classes:
If you create a class A that is derived from DefaultParamHandler and derive another class B for A, you should set use the setName(String) method to set the name used for error messages to B.

Parameter documentation:
Each default parameter has to be documented in a comprehensive way. This is done using the Param::setValue methods and the Param::setDescription method.

Flags:
Flags (boolean parameters) are not supported directly. It's best to implement them as a string parameter with valid strings 'true' and 'false'.

Constructor & Destructor Documentation

◆ DefaultParamHandler() [1/3]

DefaultParamHandler ( const String name)

Constructor with name that is displayed in error messages.

◆ DefaultParamHandler() [2/3]

Copy constructor.

◆ ~DefaultParamHandler()

virtual ~DefaultParamHandler ( )
virtual

Destructor.

◆ DefaultParamHandler() [3/3]

DefaultParamHandler ( )
private

Hidden default C'tor (class name parameter is required!)

Member Function Documentation

◆ defaultsToParam_()

void defaultsToParam_ ( )
protected

◆ getDefaults()

const Param& getDefaults ( ) const

◆ getName()

const String& getName ( ) const

Non-mutable access to the name.

◆ getParameters()

const Param& getParameters ( ) const

◆ getSubsections()

const std::vector<String>& getSubsections ( ) const

Non-mutable access to the registered subsections.

◆ operator=()

virtual DefaultParamHandler& operator= ( const DefaultParamHandler rhs)
virtual

◆ operator==()

virtual bool operator== ( const DefaultParamHandler rhs) const
virtual

Equality operator.

◆ setName()

void setName ( const String name)

◆ setParameters()

void setParameters ( const Param param)

◆ updateMembers_()

virtual void updateMembers_ ( )
protectedvirtual

This method is used to update extra member variables at the end of the setParameters() method.

Also call it at the end of the derived classes' copy constructor and assignment operator.

The default implementation is empty.

Reimplemented in PeptideIndexing, MRMTransitionGroupPicker, TargetedSpectraExtractor, SignalToNoiseEstimatorMedian< Container >, SignalToNoiseEstimatorMedian< OpenMS::MSChromatogram >, SignalToNoiseEstimatorMedian< ContainerT >, SignalToNoiseEstimatorMeanIterative< Container >, LinearResamplerAlign, PeptideAndProteinQuant, MapAlignmentAlgorithmSpectrumAlignment, AccurateMassSearchEngine, MRMFeatureFinderScoring, SvmTheoreticalSpectrumGenerator, TwoDOptimization, ProductModel< 2 >, SavitzkyGolayFilter, IDMapper, TransitionTSVFile, MRMDecoy, IsobaricChannelExtractor, GaussFilter, PrecursorIonSelection, PeakPickerHiRes, AScore, FeatureFindingMetabo, OptimizePeakDeconvolution, InterpolationModel, ConsensusIDAlgorithmPEPMatrix, MetaboliteSpectralMatching, SimpleTSGXLMS, TraceFitter, FIAMSDataProcessor, SiriusAdapterAlgorithm, EmgGradientDescent, LinearResampler, RTSimulation, DIAScoring, StablePairFinder, PeakPickerCWT, FeatureDistance, TheoreticalSpectrumGeneratorXLMS, BaseModel< D >, BaseModel< 1 >, BaseModel< 2 >, ElutionPeakDetection, OpenPepXLAlgorithm, MSSim, PrecursorIonSelectionPreprocessing, FeatureFinderAlgorithmPicked, KDTreeFeatureMaps, IsotopeModel, OpenPepXLLFAlgorithm, EGHTraceFitter, PeakPickerIterative, FeatureFinderIdentificationAlgorithm, PeakPickerMRM, MaxLikeliFitter1D, Normalizer, IonizationSimulation, MapAlignmentAlgorithmTreeGuided, LevMarqFitter1D, XFDRAlgorithm, SimplePairFinder, EmgFitter1D, ExtendedIsotopeModel, EGHFitter1D, ITRAQLabeler, GaussTraceFitter, SpectrumAnnotator, CompNovoIonScoringBase, EGHModel, Fitter1D, ConsensusIDAlgorithm, SILACLabeler, FeatureFinderAlgorithmIsotopeWavelet, MetaboliteFeatureDeconvolution, NLargest, FeatureDeconvolution, BinnedSumAgreeingIntensities, RawMSSignalSimulation, MassTraceDetection, ICPLLabeler, BiGaussModel, EmgModel, FeatureFinderAlgorithmMRM, GaussModel, CompNovoIdentificationCID, MRMMapping, TMTElevenPlexQuantitationMethod, TMTSixteenPlexQuantitationMethod, TMTTenPlexQuantitationMethod, NucleicAcidSpectrumGenerator, BinnedSpectralContrastAngle, MapAlignmentAlgorithmPoseClustering, TheoreticalSpectrumGenerator, BinnedSharedPeakCount, ItraqEightPlexQuantitationMethod, TMTSixPlexQuantitationMethod, MassDecompositionAlgorithm, ItraqFourPlexQuantitationMethod, CompNovoIdentificationBase, DetectabilitySimulation, ExtendedIsotopeFitter1D, BiGaussFitter1D, SpectraMerger::SpectraDistance_, IsotopeFitter1D, BayesianProteinInferenceAlgorithm, SONARScoring, IsobaricQuantifier, MRMFeatureFilter, GaussFitter1D, DiaPrescore, LowessSmoothing, MascotGenericFile, ConsensusIDAlgorithmPEPIons, SimpleSearchEngineAlgorithm, SwathMapMassCorrection, PeakIntegrator, AbsoluteQuantitation, MSPGenericFile, and MascotRemoteQuery.

Member Data Documentation

◆ check_defaults_

bool check_defaults_
protected

If this member is set to false no checking if parameters in done;.

The only reason to set this member to false is that the derived class has no parameters! However, if a grand-child has defaults and you are using a base class cast, checking will not be done when casting back to grand-child. To just omit the warning, use 'warn_empty_defaults_'

◆ defaults_

Param defaults_
protected

Container for default parameters. This member should be filled in the constructor of derived classes!

Note
call the defaultsToParam_() method at the end of the constructor in order to copy the defaults to param_.

Referenced by BaseModel< 2 >::BaseModel(), FeatureFinderAlgorithm::getDefaultParameters(), TOPPViewBase::initializeDefaultParameters_(), SignalToNoiseEstimatorMeanIterative< Container >::SignalToNoiseEstimatorMeanIterative(), SignalToNoiseEstimatorMedian< ContainerT >::SignalToNoiseEstimatorMedian(), and TOPPASBase::TOPPASBase().

◆ error_name_

String error_name_
protected

Name that is displayed in error messages during the parameter checking.

◆ param_

Param param_
protected

◆ subsections_

std::vector<String> subsections_
protected

Container for registered subsections. This member should be filled in the constructor of derived classes!

Note
Do not add a ':' character at the end of subsections.

Referenced by TOPPViewBase::initializeDefaultParameters_().

◆ warn_empty_defaults_

bool warn_empty_defaults_
protected

If this member is set to false no warning is emitted when defaults are empty;.

The only reason to set this member to false is that the derived class has no parameters!

See also
check_defaults_