OpenMS
DefaultParamHandler.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Timo Sachsenberg$
6 // $Authors: Marc Sturm $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
13 #include <OpenMS/OpenMSConfig.h>
14 #include <vector>
15 
16 namespace OpenMS
17 {
18  class MetaInfoInterface;
65  class OPENMS_DLLAPI DefaultParamHandler
66  {
67  public:
70 
73 
76 
79 
81  virtual bool operator==(const DefaultParamHandler& rhs) const;
82 
92  void setParameters(const Param& param);
93 
95  const Param& getParameters() const;
96 
98  const Param& getDefaults() const;
99 
101  const String& getName() const;
102 
104  void setName(const String& name);
105 
107  const std::vector<String>& getSubsections() const;
108 
119  static void writeParametersToMetaValues(const Param& write_this, MetaInfoInterface& write_here, const String& key_prefix = "");
120 
121  protected:
129  virtual void updateMembers_();
130 
137 
140 
147 
153  std::vector<String> subsections_;
154 
157 
166 
174 
175  private:
178 
179  }; // class
180 
181 } // namespace OpenMS
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:66
virtual ~DefaultParamHandler()
Destructor.
virtual bool operator==(const DefaultParamHandler &rhs) const
Equality operator.
const Param & getParameters() const
Non-mutable access to the parameters.
void defaultsToParam_()
Updates the parameters after the defaults have been set in the constructor.
Param param_
Container for current parameters.
Definition: DefaultParamHandler.h:139
const std::vector< String > & getSubsections() const
Non-mutable access to the registered subsections.
String error_name_
Name that is displayed in error messages during the parameter checking.
Definition: DefaultParamHandler.h:156
DefaultParamHandler & operator=(const DefaultParamHandler &rhs)
Assignment operator.
Param defaults_
Container for default parameters. This member should be filled in the constructor of derived classes!
Definition: DefaultParamHandler.h:146
virtual void updateMembers_()
This method is used to update extra member variables at the end of the setParameters() method.
void setName(const String &name)
Mutable access to the name.
DefaultParamHandler()
Hidden default C'tor (class name parameter is required!)
bool check_defaults_
If this member is set to false no checking if parameters in done;.
Definition: DefaultParamHandler.h:165
static void writeParametersToMetaValues(const Param &write_this, MetaInfoInterface &write_here, const String &key_prefix="")
Writes all parameters to meta values.
DefaultParamHandler(const DefaultParamHandler &rhs)
Copy constructor.
const String & getName() const
Non-mutable access to the name.
bool warn_empty_defaults_
If this member is set to false no warning is emitted when defaults are empty;.
Definition: DefaultParamHandler.h:173
void setParameters(const Param &param)
Sets the parameters.
std::vector< String > subsections_
Container for registered subsections. This member should be filled in the constructor of derived clas...
Definition: DefaultParamHandler.h:153
const Param & getDefaults() const
Non-mutable access to the default parameters.
DefaultParamHandler(const String &name)
Constructor with name that is displayed in error messages.
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:35
Management and storage of parameters / INI files.
Definition: Param.h:44
A more convenient string class.
Definition: String.h:34
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19