Origen V93K SMT7 Library
 All Classes Namespaces Files Functions Variables Typedefs Macros
base.hpp
Go to the documentation of this file.
1 #ifndef ORIGEN_TEST_METHOD_BASE_INCLUDED
2 #define ORIGEN_TEST_METHOD_BASE_INCLUDED
3 
4 #include "../../origen.hpp"
5 #include "../test_method.hpp"
6 #include "mapi.hpp"
7 #include "testmethod.hpp"
8 using namespace std;
9 
10 namespace Origen {
11 namespace TestMethod {
12 
13 class Base : public testmethod::TestMethod {
14  bool _async;
15  bool _syncup;
16 
17  public:
18  Base();
19  virtual ~Base();
20 
21  Base& async(bool v) {
22  _async = v;
23  return *this;
24  }
25  Base& syncup(bool v) {
26  _syncup = v;
27  return *this;
28  }
29 
30  void execute() { _execute(); }
31 
32  virtual void SMC_backgroundProcessing(){};
33 
34  protected:
35  int numberOfPhysicalSites;
36  ARRAY_I activeSites;
37  string suiteName;
38  bool bFirstRun;
39 
40  string _testName;
42  string _onPassFlag;
43  string _onFailFlag;
44 
45  int offline();
46  void initialize();
47  void run();
48  int testNumber();
49  int testNumber(string);
50  TMLimits::LimitInfo testLimits();
51  TMLimits::LimitInfo testLimits(string);
52  void datalog(double);
53  void datalog(string, double);
54  void judgeAndDatalog(double);
55  void judgeAndDatalog(string, double);
56  bool preJudge(double);
57  bool preJudge(string, double);
58  string testName();
59  int invertFunctionalResultIfRequired(int);
60  bool isWithinLimits(double, LIMIT);
61  LIMIT toNALimit(LIMIT);
62  vector<int> suiteFailed;
63 
64  virtual void init() {}
65 
67  virtual void _setup() {}
68 
69  // Called immediately before the first RDI operation is executed
70  virtual void preBody() {}
71  virtual void preBody(int site) {}
72 
73  virtual void body() { execute(); }
74 
75  virtual void _execute() {}
76 
77  // Called before the main RDI operation is executed, giving the chance to add
78  // additional settings to it
79  virtual void filterRDI(SMART_RDI::dcBase& prdi) {}
80  virtual void filterRDI(SMART_RDI::DIG_CAP& prdi) {}
81  virtual void filterRDI(SMART_RDI::FUNC& prdi) {}
82 
83  // If the test has a hold state, this will be called immediately after the
84  // hold
85  // state pattern has run
86  virtual void holdState() {}
87  virtual void holdState(int site) {}
88 
89  // Called after the last RDI operation has executed and all results have been
90  // fetched
91  virtual void postBody() {}
92  virtual void postBody(int site) {}
93 
94  // Called immediately before the final result processing. If the test is
95  // configured for async
96  // processing then this will be called later in the background. Contrast this
97  // with the
98  // postTestFunc which will be called before the main test body completes.
99  virtual void process(int site) {}
100 
101  // Called before the main test result is judged, giving a chance to transform
102  // it
103  virtual double filterResult(double result) { return result; }
104 
105  virtual bool async() { return _async; }
106  virtual bool syncup() { return _syncup; }
107 
108  virtual void serialProcessing(int site){};
109 
111  if (async()) {
112  rdi.hiddenUpload(TA::ALL);
113  } else {
114  rdi.hiddenUpload(TA::NO);
115  }
116  }
117 
118  void callPreBody() {
119  if (syncup()) {
120  synchronize();
121  }
122  preBody();
123  FOR_EACH_SITE_BEGIN();
124  preBody(CURRENT_SITE_NUMBER());
125  FOR_EACH_SITE_END();
126  }
127 
128  void callHoldState() {
129  holdState();
130  FOR_EACH_SITE_BEGIN();
131  holdState(CURRENT_SITE_NUMBER());
132  FOR_EACH_SITE_END();
133  }
134 
135  template <class T>
136  void callPostBody(T* obj) {
137  ON_FIRST_INVOCATION_BEGIN();
138  postBody();
139  FOR_EACH_SITE_BEGIN();
140  postBody(CURRENT_SITE_NUMBER());
141  FOR_EACH_SITE_END();
142  ON_FIRST_INVOCATION_END();
143 
144  if (async()) {
145  SMC_ARM_internal(obj);
146  } else {
147  process(CURRENT_SITE_NUMBER());
148  this->serialProcessing(CURRENT_SITE_NUMBER());
149  }
150  }
151 };
152 }
153 }
154 
155 #endif /* BASE_HPP_ */
void callHoldState()
Definition: base.hpp:128
Definition: base.hpp:13
virtual void postBody(int site)
Definition: base.hpp:92
virtual void serialProcessing(int site)
Definition: base.hpp:108
Base & async(bool v)
Definition: base.hpp:21
virtual void _execute()
Definition: base.hpp:75
virtual void holdState()
Definition: base.hpp:86
virtual bool async()
Definition: base.hpp:105
virtual void _setup()
For internal use, don&#39;t override.
Definition: base.hpp:67
virtual void init()
Definition: base.hpp:64
void callPostBody(T *obj)
Definition: base.hpp:136
void execute()
Definition: base.hpp:30
void callPreBody()
Definition: base.hpp:118
virtual void preBody(int site)
Definition: base.hpp:71
Site & site()
Definition: origen.cpp:13
virtual void body()
Definition: base.hpp:73
void enableHiddenUpload()
Definition: base.hpp:110
string _testName
Definition: base.hpp:40
virtual void filterRDI(SMART_RDI::DIG_CAP &prdi)
Definition: base.hpp:80
string _onFailFlag
Definition: base.hpp:43
Base & syncup(bool v)
Definition: base.hpp:25
virtual void preBody()
Definition: base.hpp:70
virtual void filterRDI(SMART_RDI::FUNC &prdi)
Definition: base.hpp:81
virtual bool syncup()
Definition: base.hpp:106
string _onPassFlag
Definition: base.hpp:42
ARRAY_I activeSites
Definition: base.hpp:36
void synchronize(double timeout)
Definition: misc.cpp:292
virtual void holdState(int site)
Definition: base.hpp:87
string suiteName
Definition: base.hpp:37
virtual void postBody()
Definition: base.hpp:91
virtual double filterResult(double result)
Definition: base.hpp:103
virtual void process(int site)
Definition: base.hpp:99
bool bFirstRun
Definition: base.hpp:38
int _forcePass
Definition: base.hpp:41
virtual void filterRDI(SMART_RDI::dcBase &prdi)
Definition: base.hpp:79
vector< int > suiteFailed
Definition: base.hpp:62
virtual void SMC_backgroundProcessing()
Definition: base.hpp:32