Operator Console
|
An abstract class that defines an image test to be performed. More...
#include <ImageTest.h>
Public Member Functions | |
ImageTest (void) | |
virtual | ~ImageTest (void) |
virtual void | ParseResults (string &results)=0 |
This must be implemented by subclass. More... | |
virtual void | Run () |
Runs the test pointed to by m_imatestFunc. More... | |
virtual void | Run (void *raw_pixels, int width, int height, const Config *config) |
void | GetLog (CString &dst) |
void | GetFailInfo (CString &dst) |
void | GetJSON (CString &dst) |
void | GetName (CString &name) |
void | GetSummary (CString &dst) |
void | Init (void *raw_pixels, int width, int height, const Config *config) |
bool | Passed () |
void | SetBuffer (void *buf) |
ImageTest (void) | |
virtual | ~ImageTest (void) |
virtual void | ParseResults (string &results)=0 |
This must be implemented by subclass. More... | |
virtual void | Run () |
virtual void | Run (void *raw_pixels, int width, int height, const Config *config) |
void | GetLog (CString &dst) |
void | GetFailInfo (CString &dst) |
void | GetJSON (CString &dst) |
void | GetName (CString &name) |
void | GetSummary (CString &dst) |
void | Init (void *raw_pixels, int width, int height, const Config *config) |
bool | Passed () |
void | SetBuffer (void *buf) |
Static Public Member Functions | |
static UINT __cdecl | ThreadProc (void *param) |
param must be a pointer to a ThreadControl object; param->m_data must point to an ImageTest object More... | |
static UINT __cdecl | ThreadProc (void *param) |
param must be a pointer to a ThreadControl object; param->m_data must point to an ImageTest object More... | |
Public Attributes | |
int | m_width |
int | m_height |
int | m_ncolors |
const char * | m_extension |
const char * | m_fileroot |
const char * | m_serialNumber |
const char * | m_partNumber |
const char * | m_iniFilePathName |
const char * | m_programPath |
const char * | m_name |
long long | m_elapsed |
CString | m_elapsedStr |
Timestamp | m_timestamp |
Protected Member Functions | |
bool | AllocateRGB () |
void | AppendLog (CString &log) |
void | ClearLog () |
void | ClearJSON () |
void | ClearFailInfo () |
void | ClearSummary () |
void | DeleteRGB () |
bool | GetDataNode (string &results, JSONNode &data, bool logErrors=true) |
bool | GetPassFailNode (JSONNode &data, JSONNode &passFail, bool logErrors=true) |
void | PlanesFromRGB () |
converts from m_rawPixels to m_rgb More... | |
void | GetString (JSONNode &node, const char *name, json_string &string, bool logErrors=true) |
void | InitResults () |
void | ParseFailures (const JSONNode *data) |
void | RGBFromPlanes (UINT *rgb) |
converts from m_rgb to rgb More... | |
void | SaveImage (RGBQUAD *buf, const char *filename) |
void | SetJSON (string &src) |
void | SetSummary (CString &src) |
bool | AllocateRGB () |
void | AppendLog (CString &log) |
void | ClearLog () |
void | ClearJSON () |
void | ClearFailInfo () |
void | ClearSummary () |
void | DeleteRGB () |
bool | GetDataNode (string &results, JSONNode &data, bool logErrors=true) |
bool | GetPassFailNode (JSONNode &data, JSONNode &passFail, bool logErrors=true) |
void | PlanesFromRGB () |
void | GetString (JSONNode &node, const char *name, json_string &string, bool logErrors=true) |
void | InitResults () |
void | ParseFailures (const JSONNode *data) |
void | RGBFromPlanes (UINT *rgb) |
void | SaveImage (RGBQUAD *buf, const char *filename) |
void | SetJSON (string &src) |
void | SetSummary (CString &src) |
Protected Attributes | |
const void * | m_rawPixels |
unsigned char * | m_rgb |
bool | m_passed |
const TestID * | m_tests |
int | m_numTests |
Timer | m_time |
ImatestShellFunc | m_imatestFunc |
CriticalCString | m_jsonResults |
the full results of the test in JSON format More... | |
CriticalCString | m_summary |
the summary results of the test (these get displayed in the dialog) More... | |
CriticalCString | m_failInfo |
reasons that image failed the test More... | |
CriticalCString | m_log |
log message(s) More... | |
An abstract class that defines an image test to be performed.
ImageTest is an abstract class that defines an image test to be performed (e.g. blemish, SFRplus). To use this class, create a subclass and implement the ParseResults() method.
Some member variables are used by more than 1 thread. To prevent these variables from being accessed simultaneously from multiple threads, they are protected by critical sections, which limit access to one thread at a time.
In theory there shouldn't be a case where both threads are trying to access the variable simultaneously, but theory is often different than the real world. The sequence of events in the threads is as follows:
The main thread signals the ImageTest thread to run its test once.
The test runs once It sets the values of the shared member variables It sends a "done" message to the main thread It waits for a signal to run again Repeat
The main thread receives the "done" message It makes copies of the shared member variables It signals the ImageTest thread to run once Repeat
In this scenario, the main thread only accesses the shared data when it has received the "done" message (i.e. after the ImageTest thread is finished using the shared data), and the ImageTest thread only accesses the shared data while the main thread is doing other things.
ImageTest::ImageTest | ( | void | ) |
References m_extension, m_fileroot, m_height, m_imatestFunc, m_iniFilePathName, m_name, m_partNumber, m_programPath, m_rawPixels, m_rgb, m_serialNumber, and m_width.
|
virtual |
ImageTest::ImageTest | ( | void | ) |
|
virtual |
|
protected |
|
protected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
protected |
References m_rgb.
Referenced by AllocateRGB(), and ~ImageTest().
|
protected |
|
protected |
References CriticalCString::Append(), Timestamp::Get(), m_log, m_timestamp, and libjson::parse().
|
protected |
|
inline |
|
inline |
Referenced by COperatorConsoleApp::GetResults().
|
inline |
|
inline |
Referenced by COperatorConsoleApp::GetResults().
|
inline |
|
inline |
Referenced by COperatorConsoleApp::GetResults().
|
inline |
|
inline |
|
protected |
References CriticalCString::Append(), Timestamp::Get(), m_log, and m_timestamp.
|
protected |
|
protected |
References CriticalCString::Append(), JSONNode::as_array(), JSONNode::as_string(), Timestamp::Get(), m_log, and m_timestamp.
|
protected |
|
inline |
Referenced by COperatorConsoleApp::GetResults().
|
inline |
void ImageTest::Init | ( | void * | raw_pixels, |
int | width, | ||
int | height, | ||
const Config * | config | ||
) |
References AllocateRGB(), height, Config::m_extension, m_extension, Config::m_fileRoot, m_fileroot, m_height, Config::m_iniFilePathName, m_iniFilePathName, Config::m_ncolors, m_ncolors, Config::m_partNumber, m_partNumber, Config::m_programPath, m_programPath, m_rawPixels, Config::m_serialNumber, m_serialNumber, m_width, and width.
Referenced by COperatorConsoleApp::InitBlemishThread(), COperatorConsoleApp::InitSFRplusThread(), and Run().
void ImageTest::Init | ( | void * | raw_pixels, |
int | width, | ||
int | height, | ||
const Config * | config | ||
) |
|
protected |
References CriticalCString::Clear(), m_failInfo, m_jsonResults, m_log, m_passed, and m_summary.
Referenced by Run().
|
protected |
|
protected |
References CriticalCString::Append(), JSONNode::as_array(), JSONNode::as_bool(), FAIL_DELIMITER, m_failInfo, m_log, m_numTests, m_tests, and CriticalCString::Set().
|
protected |
|
pure virtual |
This must be implemented by subclass.
Implemented in SFRplusTest, SFRplusTest, BlemishTest, and BlemishTest.
Referenced by Run().
|
pure virtual |
This must be implemented by subclass.
Implemented in SFRplusTest, SFRplusTest, BlemishTest, and BlemishTest.
|
inline |
|
inline |
|
protected |
converts from m_rawPixels to m_rgb
References m_height, m_rawPixels, m_rgb, and m_width.
Referenced by Run().
|
protected |
|
protected |
|
protected |
|
virtual |
Runs the test pointed to by m_imatestFunc.
References AppendLog(), Timestamp::Get(), INI_RAW_JSON_MODE, InitResults(), m_extension, m_fileroot, m_height, m_imatestFunc, m_iniFilePathName, m_name, m_ncolors, m_partNumber, m_passed, m_programPath, m_rgb, m_serialNumber, m_timestamp, m_width, ParseResults(), PlanesFromRGB(), prepareTestSettings(), RGBFromPlanes(), SaveImage(), and SetJSON().
Referenced by Run(), and ThreadProc().
|
virtual |
|
virtual |
|
virtual |
|
protected |
|
protected |
|
inline |
|
inline |
|
inlineprotected |
Referenced by Run().
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
static |
param must be a pointer to a ThreadControl object; param->m_data must point to an ImageTest object
|
static |
param must be a pointer to a ThreadControl object; param->m_data must point to an ImageTest object
References DONE_INDEX, Timer::Get(), ThreadControl::m_data, m_elapsed, m_elapsedStr, ThreadControl::m_events, ThreadControl::m_parentID, ThreadControl::m_threadMsg, m_time, NUM_THREAD_EVENTS, Run(), RUN_INDEX, Timer::Start(), and Timer::Stop().
Referenced by COperatorConsoleApp::InitBlemishThread(), and COperatorConsoleApp::InitSFRplusThread().
long long ImageTest::m_elapsed |
Referenced by ThreadProc(), and COperatorConsoleApp::UpdateResults().
CString ImageTest::m_elapsedStr |
Referenced by ThreadProc(), and COperatorConsoleApp::UpdateResults().
const char * ImageTest::m_extension |
Referenced by ImageTest(), Init(), and Run().
|
protected |
reasons that image failed the test
Referenced by InitResults(), and ParseFailures().
const char * ImageTest::m_fileroot |
Referenced by ImageTest(), Init(), and Run().
int ImageTest::m_height |
Referenced by AllocateRGB(), ImageTest(), Init(), PlanesFromRGB(), RGBFromPlanes(), Run(), and SaveImage().
|
protected |
Referenced by ImageTest(), and Run().
const char * ImageTest::m_iniFilePathName |
Referenced by ImageTest(), Init(), COperatorConsoleApp::OnSetup(), and Run().
|
protected |
the full results of the test in JSON format
Referenced by InitResults().
|
protected |
log message(s)
Referenced by GetDataNode(), GetPassFailNode(), GetString(), InitResults(), and ParseFailures().
const char * ImageTest::m_name |
Referenced by ImageTest(), Run(), and COperatorConsoleApp::UpdateResults().
int ImageTest::m_ncolors |
Referenced by AllocateRGB(), Init(), and Run().
|
protected |
Referenced by ParseFailures().
const char * ImageTest::m_partNumber |
Referenced by ImageTest(), Init(), COperatorConsoleApp::OnSetup(), and Run().
|
protected |
Referenced by InitResults(), and Run().
const char * ImageTest::m_programPath |
Referenced by ImageTest(), Init(), COperatorConsoleApp::OnSetup(), and Run().
|
protected |
Referenced by ImageTest(), Init(), and PlanesFromRGB().
|
protected |
Referenced by AllocateRGB(), DeleteRGB(), ImageTest(), PlanesFromRGB(), RGBFromPlanes(), and Run().
const char * ImageTest::m_serialNumber |
Referenced by ImageTest(), Init(), COperatorConsoleApp::OnSetup(), and Run().
|
protected |
the summary results of the test (these get displayed in the dialog)
Referenced by InitResults().
|
protected |
Referenced by ParseFailures().
|
protected |
Referenced by ThreadProc().
Timestamp ImageTest::m_timestamp |
Referenced by GetDataNode(), GetPassFailNode(), GetString(), and Run().
int ImageTest::m_width |
Referenced by AllocateRGB(), ImageTest(), Init(), PlanesFromRGB(), RGBFromPlanes(), Run(), and SaveImage().