FEDEM Model Database  R8.0
Source code of the FEDEM model database
FmThreshold.H
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2023 SAP SE
2 //
3 // SPDX-License-Identifier: Apache-2.0
4 //
5 // This file is part of FEDEM - https://openfedem.org
7 
8 #ifndef FM_THRESHOLD_H
9 #define FM_THRESHOLD_H
10 
12 
13 #include <iostream>
14 #include <string>
15 
16 
25 {
26 public:
28 
29  bool isDefined() const { return active > UNDEF; }
30  bool isActive() const { return active == ACTIVE; }
31 
32  void writeAppJson(std::ostream& os,
33  const std::string& tag, const std::string src,
34  size_t indent = 4) const;
35 
36  bool operator==(const FmThreshold& a) const;
37 
38  enum Active { UNDEF = -1, INACTIVE = 0, ACTIVE = 1 };
39  enum Severity { LOW = 1, MEDIUM = 2, HIGH = 3 };
40 
41 private:
43  FFaEnumEntry(UNDEF, "UNDEFINED");
44  FFaEnumEntry(INACTIVE, "INACTIVE");
45  FFaEnumEntry(ACTIVE, "ACTIVE");
47  };
48 
50  FFaEnumEntry(LOW, "LOW");
51  FFaEnumEntry(MEDIUM, "MEDIUM");
52  FFaEnumEntry(HIGH, "HIGH");
54  };
55 
56 public:
57  ActiveEnum active;
58  double threshold;
59  int min, skip;
60  SeverityEnum severity;
61  std::string description;
62 };
63 
64 std::ostream& operator<<(std::ostream& os, const FmThreshold& fld);
65 std::istream& operator>>(std::istream& is, FmThreshold& fld);
66 
67 #endif
Enum variables with text representations.
#define FFaEnumEntryEnd
Defines the end of an enum mapping definition.
Definition: FFaEnum.H:237
#define FFaEnumEntry(Value, Text)
Adds one entry to the current enum mapping definition.
Definition: FFaEnum.H:234
std::istream & operator>>(std::istream &is, FmThreshold &fld)
Definition: FmThreshold.C:34
std::ostream & operator<<(std::ostream &os, const FmThreshold &fld)
Definition: FmThreshold.C:24
Class holding threshold settings for digital twin output functions.
Definition: FmThreshold.H:25
ActiveEnum active
Definition: FmThreshold.H:54
double threshold
Definition: FmThreshold.H:58
bool operator==(const FmThreshold &a) const
Definition: FmThreshold.C:11
bool isActive() const
Definition: FmThreshold.H:30
Severity
Definition: FmThreshold.H:39
@ HIGH
Definition: FmThreshold.H:39
@ MEDIUM
Definition: FmThreshold.H:39
@ LOW
Definition: FmThreshold.H:39
bool isDefined() const
Definition: FmThreshold.H:29
FFaEnumMapping(Active)
Definition: FmThreshold.H:42
SeverityEnum severity
Definition: FmThreshold.H:60
FFaEnumMapping(Severity)
Definition: FmThreshold.H:49
Active
Definition: FmThreshold.H:38
@ INACTIVE
Definition: FmThreshold.H:38
@ UNDEF
Definition: FmThreshold.H:38
@ ACTIVE
Definition: FmThreshold.H:38
void writeAppJson(std::ostream &os, const std::string &tag, const std::string src, size_t indent=4) const
Definition: FmThreshold.C:54
std::string description
Definition: FmThreshold.H:61
FmThreshold()
Definition: FmThreshold.H:27
int min
Definition: FmThreshold.H:59
int skip
Definition: FmThreshold.H:59