AbsValueOrQuantile.hpp
1 #pragma once
2 
3 //OPALS
4 #include "opals/config.hpp"
5 #include "opals/String.hpp"
6 #include "opals/CustomOptionType.hpp"
7 
8 namespace opals
9 {
10  /// \brief AbsValueOrQuantile provides a container to either store an absolute value or a realtive quantile, percentage value.
11  ///
12  ///
13  /// \author JO
14  /// \date 17.03.2022
15  class OPALS_API AbsValueOrQuantile : public CustomOptionType<AbsValueOrQuantile>
16  {
17  public:
20  AbsValueOrQuantile(double val, bool isAbsValue = true);
21  virtual ~AbsValueOrQuantile();
22 
23  bool isEmpty() const;
24  bool isAbsValue() const;
25  bool isQuantile() const;
26 
27  double getAbsValue() const; ///< get absolute value
28  double getQuantile() const; ///< get quantile value
29  double getPercentage() const; ///< get quantile value as percentage
30 
31  void reset();
32 
33  void setAbsValue(const double& value);
34  void setQuantile(const double& quantile);
35  void setPercentage(const double& percentage);
36 
37  // output functions
38  //String logAbsValueOrQuantile() const; ///< for xml output
39  //String printAttributeDescription() const; ///< for log output (in more readable format)
40 
41  bool operator==(const AbsValueOrQuantile &ref) const;
42  bool operator!=(const AbsValueOrQuantile &ref) const;
43 
44  static const char* help(bool);
45  static const char* syntax();
46  static bool exportsPythonType();
47 
48  private:
49  double absValue;
50  double quantile;
51  };
52 }
Base class for all custom parameter types.
Definition: CustomOptionType.hpp:39
AbsValueOrQuantile provides a container to either store an absolute value or a realtive quantile,...
Definition: AbsValueOrQuantile.hpp:15
Contains the public interface of OPALS.
Definition: AbsValueOrQuantile.hpp:8
A dynamic character string whose interface conforms to STL's std::string.
Definition: String.hpp:35