OTX-Runtime for C++  
Interval.h
1 #ifndef OpenTestSystem_Otx_Runtime_Api_DataTypes_Interval_H
2 #define OpenTestSystem_Otx_Runtime_Api_DataTypes_Interval_H
3 
4 #include "Object.h"
5 
6 #include <memory>
7 
8 namespace OpenTestSystem { namespace Otx { namespace Runtime { namespace Api { namespace DataTypes {
9  class Quantity;
10 }}}}}
11 
12 namespace OpenTestSystem { namespace Otx { namespace Runtime { namespace Api {
16  namespace DataTypes {
20  enum class IntervalSemantics
21  {
25  None,
26 
30  Success,
31 
35  Info,
36 
40  Warning,
41 
45  Error
46  };
47 
51  class API_EXPORTS Interval : public Object
52  {
53  public:
59 
64  std::string GetLabel() const;
65 
70  std::string GetSemanticAsString() const;
71  protected:
72  IntervalSemantics _semantic;
73  std::string _label;
74  };
75 
79  class API_EXPORTS NumericInterval : public Interval
80  {
81  };
82 
86  class API_EXPORTS FloatInterval : public NumericInterval
87  {
88  public:
93 
99  double lowerLimit);
100 
109  double lowerLimit,
110  double upperLimit,
112  const std::string& label = "");
113 
114  virtual ~FloatInterval();
115 
120  double GetLowerLimit() const;
121 
126  double GetUpperLimit() const;
127 
132  std::string ToLiteralString() const override;
133 
134  bool IsInsideInterval(double value);
135  private:
136  double _lowerLimit;
137  double _upperLimit;
138  };
139 
143  class API_EXPORTS IntegerInterval : public NumericInterval
144  {
145  public:
150 
156  long long lowerLimit);
157 
166  long long lowerLimit,
167  long long upperLimit,
169  const std::string& label = "");
170 
171  virtual ~IntegerInterval();
172 
177  long long GetLowerLimit() const;
178 
183  long long GetUpperLimit() const;
184 
189  std::string ToLiteralString() const override;
190 
191  bool IsInsideInterval(long long value);
192  private:
193  long long _lowerLimit;
194  long long _upperLimit;
195  };
196 
200  class API_EXPORTS QuantityInterval : public NumericInterval
201  {
202  public:
207 
213  std::shared_ptr<Quantity> lowerLimit);
214 
223  std::shared_ptr<Quantity> lowerLimit,
224  std::shared_ptr<Quantity> upperLimit,
226  const std::string& label = "");
227 
228  virtual ~QuantityInterval();
229 
234  std::shared_ptr<Quantity> GetLowerLimit() const;
235 
240  std::shared_ptr<Quantity> GetUpperLimit() const;
241 
246  std::string ToLiteralString() const override;
247 
248  bool IsInsideInterval(std::shared_ptr<Quantity> value);
249  private:
250  std::shared_ptr<Quantity> _lowerLimit;
251  std::shared_ptr<Quantity> _upperLimit;
252  };
253 
257  class API_EXPORTS StringInterval : public Interval
258  {
259  public:
264 
272  const std::string& regExp,
274  const std::string& label = "");
275 
276  virtual ~StringInterval();
277 
282  std::string GetRegExp() const;
283 
288  std::string ToLiteralString() const override;
289 
290  bool IsInsideInterval(const std::string& value);
291  private:
292  std::string _regExp;
293  };
294  }
295 }}}}
296 
297 #endif//OpenTestSystem_Otx_Runtime_Api_DataTypes_Interval_H
A FloatInterval is a NumericInterval and represents an interval with a lower and an upper limit....
Definition: Interval.h:87
FloatInterval(double lowerLimit)
Initializes a new instance of the FloatInterval class.
double GetUpperLimit() const
Gets the upper limit of the interval. If the upper limit is omitted, the upper limit is Infinity.
std::string ToLiteralString() const override
Gets literal string.
FloatInterval(double lowerLimit, double upperLimit, IntervalSemantics semantic=IntervalSemantics::None, const std::string &label="")
Initializes a new instance of the FloatInterval class.
double GetLowerLimit() const
Gets the lower limit of the interval. If the lower limit is omitted, the lower limit is -Infinity.
FloatInterval()
Initializes a new instance of the FloatInterval class.
An IntegerInterval is a NumericInterval and represents an interval with a lower and an upper limit....
Definition: Interval.h:144
IntegerInterval(long long lowerLimit, long long upperLimit, IntervalSemantics semantic=IntervalSemantics::None, const std::string &label="")
Initializes a new instance of the IntegerInterval class.
IntegerInterval()
Initializes a new instance of the IntegerInterval class.
IntegerInterval(long long lowerLimit)
Initializes a new instance of the IntegerInterval class.
long long GetUpperLimit() const
Gets the upper limit of the interval. If the upper limit is omitted, the upper limit is the upper bou...
long long GetLowerLimit() const
Gets the lower limit of the interval. If the lower limit is omitted, the lower limit is the lower bou...
std::string ToLiteralString() const override
Gets literal string.
An Interval is an otx:ComplexType and represents the abstract base data type for all interval data ty...
Definition: Interval.h:52
IntervalSemantics GetSemantic() const
Gets the semantics of how values inside the interval are interpreted. If the type is omitted,...
std::string GetLabel() const
Gets the optional label of the interval. If the label is omitted, the label is an empty String.
std::string GetSemanticAsString() const
Gets the optional semantics of the interval as a string. If the semantics is omitted,...
A NumericInterval represents the abstract base data type for all numeric interval data types.
Definition: Interval.h:80
Represents base of OTX DataTypes.
Definition: Object.h:17
A QuantityInterval is an NumericInterval and represents an interval with a lower and an upper limit....
Definition: Interval.h:201
std::shared_ptr< Quantity > GetUpperLimit() const
Gets the upper limit of the interval. If the upper limit is omitted, the upper limit is Infinity.
std::string ToLiteralString() const override
Gets literal string.
QuantityInterval(std::shared_ptr< Quantity > lowerLimit, std::shared_ptr< Quantity > upperLimit, IntervalSemantics semantic=IntervalSemantics::None, const std::string &label="")
Initializes a new instance of the QuantityInterval class.
std::shared_ptr< Quantity > GetLowerLimit() const
Gets the lower limit of the interval. If the lower limit is omitted, the lower limit is -Infinity.
QuantityInterval(std::shared_ptr< Quantity > lowerLimit)
Initializes a new instance of the QuantityInterval class.
QuantityInterval()
Initializes a new instance of the QuantityInterval class.
StringInterval(const std::string &regExp, IntervalSemantics semantic=IntervalSemantics::None, const std::string &label="")
Initializes a new instance of the StringInterval class.
std::string GetRegExp() const
Gets a regular expression. If the regular expression is omitted, the interval includes all possible s...
StringInterval()
Initializes a new instance of the StringInterval class.
std::string ToLiteralString() const override
Gets literal string.
IntervalSemantics
An IntervalSemantics describes the meaning of a value inside an interval.
Definition: Interval.h:21
@ Warning
Values inside the interval indicate that there might be a problem.
@ Info
Values inside the interval deserve consideration.
@ Success
The interval describes the successful case.
@ None
Values inside the interval have no semantics (Default).
@ Error
Values inside the interval indicate that there is a problem.
Namespace containing all objects related to testing inside automotive industry