OpenMS
Loading...
Searching...
No Matches
DefaultParamHandler.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- 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
16namespace OpenMS
17{
18 class MetaInfoInterface;
65 class OPENMS_DLLAPI DefaultParamHandler
66 {
67 public:
69 DefaultParamHandler(const std::string& name);
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 std::string& getName() const;
102
104 void setName(const std::string& name);
105
107 const std::vector<std::string>& getSubsections() const;
108
119 static void writeParametersToMetaValues(const Param& write_this, MetaInfoInterface& write_here, const std::string& key_prefix = "");
120
121 protected:
129 virtual void updateMembers_();
130
137
140
147
153 std::vector<std::string> subsections_;
154
156 std::string error_name_;
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< std::string > & getSubsections() const
Non-mutable access to the registered subsections.
const std::string & getName() const
Non-mutable access to the name.
const Param & getDefaults() const
Non-mutable access to the default parameters.
std::string error_name_
Name that is displayed in error messages during the parameter checking.
Definition DefaultParamHandler.h:156
static void writeParametersToMetaValues(const Param &write_this, MetaInfoInterface &write_here, const std::string &key_prefix="")
Writes all parameters to meta values.
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.
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
std::vector< std::string > subsections_
Container for registered subsections. This member should be filled in the constructor of derived clas...
Definition DefaultParamHandler.h:153
DefaultParamHandler(const DefaultParamHandler &rhs)
Copy constructor.
void setName(const std::string &name)
Mutable access to the name.
DefaultParamHandler(const std::string &name)
Constructor with name that is displayed in error messages.
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.
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:46
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19