SETestErrorStatistics.h
1 /**************************************************************************************
2 Copyright 2015 Applied Research Associates, Inc.
3 Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4 this file except in compliance with the License. You may obtain a copy of the License
5 at:
6 http://www.apache.org/licenses/LICENSE-2.0
7 Unless required by applicable law or agreed to in writing, software distributed under
8 the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
9 CONDITIONS OF ANY KIND, either express or implied. See the License for the
10 specific language governing permissions and limitations under the License.
11 **************************************************************************************/
12 
13 #pragma once
14 #include <memory>
15 
16 #include <biogears/cdm/CommonDataModel.h>
17 #include <biogears/exports.h>
18 
19 CDM_BIND_DECL(TestErrorStatisticsData)
20 namespace biogears{
21 class SETestCase;
22 class SETestSuite;
23 class SEFunction;
24 
25 // This data class is intended for use in array based data
26 // Each value in the array is compared and can be tracked
27 // and this provides a summary of how many values in the array
28 // were wrong and some statistics to go along with all of those errors
29 class BIOGEARS_API SETestErrorStatistics : public Loggable {
30  friend SETestCase;
31  friend SETestSuite;
32 
33 protected:
35 
36 public:
37  virtual ~SETestErrorStatistics();
38 
39  virtual void Reset(); //reset values
40  virtual void Clear(); //clear memory
41 
42  bool Load(const CDM::TestErrorStatisticsData& in);
43  std::unique_ptr<CDM::TestErrorStatisticsData> Unload() const;
44 
45 protected:
46  void Unload(CDM::TestErrorStatisticsData& data) const;
47 
48 public:
49  bool IsValid();
50 
51  void SetPropertyName(const std::string& PropertyName);
52  std::string GetPropertyName() const;
53 
54  void SetComputedPropertyID(const std::string& ComputedPropertyID);
55  std::string GetComputedPropertyID() const;
56 
57  void SetExpectedPropertyID(const std::string& ExpectedPropertyID);
58  std::string GetExpectedPropertyID() const;
59 
60  void SetNumberOfErrors(int NumberOfErrors);
61  int GetNumberOfErrors() const;
62 
63  void SetMinimumError(double MinimumError);
64  double GetMinimumError() const;
65 
66  void SetMaximumError(double MaximumError);
67  double GetMaximumError() const;
68 
69  void SetAverageError(double AverageError);
70  double GetAverageError() const;
71 
72  void SetStandardDeviation(double StandardDeviation);
73  double GetStandardDeviation() const;
74 
75  void AddDifference(const std::string& difference);
76  const std::vector<std::string>* GetDifferences() const;
77 
78  // This a histogram that shows a percent tolerance and how many errors fall with in each bin
79  bool HasPercentTolerancevsNumErrorsHistogram() const;
80  SEFunction& GetPercentToleranceVsNumErrorsHistogram();
81  void SetPercentToleranceVsNumErrorsHistogram(SEFunction* PercentToleranceVsNumErrors);
82 
83 protected:
90  std::string m_PropertyName;
91  std::string m_ComputedPropertyID;
92  std::string m_ExpectedPropertyID;
94  std::vector<std::string> m_Differences;
95 };
96 }
std::string m_ExpectedPropertyID
Definition: SETestErrorStatistics.h:92
Definition: SEFunction.h:23
double m_PercentTolerance
Definition: SETestErrorStatistics.h:89
double m_StandardDeviation
Definition: SETestErrorStatistics.h:88
int m_NumberOfErrors
Definition: SETestErrorStatistics.h:84
friend SETestCase
Definition: SETestErrorStatistics.h:30
double m_MinimumError
Definition: SETestErrorStatistics.h:85
std::vector< std::string > m_Differences
Definition: SETestErrorStatistics.h:94
Definition: SETestErrorStatistics.h:29
friend SETestSuite
Definition: SETestErrorStatistics.h:31
Definition: Logger.h:27
Definition: Logger.h:75
std::string m_PropertyName
Definition: SETestErrorStatistics.h:90
SEFunction * m_PercentToleranceVsNumErrorsHistogram
Definition: SETestErrorStatistics.h:93
std::string m_ComputedPropertyID
Definition: SETestErrorStatistics.h:91
double m_AverageError
Definition: SETestErrorStatistics.h:87
Class corresponding to the TestErrorStatisticsData schema type.
Definition: TestReport.hxx:685
Definition: SEElectricalCircuit.h:18
double m_MaximumError
Definition: SETestErrorStatistics.h:86