// VisionResult.h: interface for the CVisionResult class.
//
//////////////////////////////////////////////////////////////////////
#pragma once

#include <map>
#include <string>
#include <vector>

#ifdef BUILD_COMMDLL
#define COMMDLL_DLLCLASS __declspec(dllexport)
#else
#define COMMDLL_DLLCLASS __declspec(dllimport)
#endif

class COMMDLL_DLLCLASS CVisionResult
{
public:
    enum RESULT_PARAM
    {
        fParamStart,
        fX = fParamStart,    // PMI2D / OCR XPos
        fY,                  // PMI2D / OCR YPos
        fA,                  // PMI2D / OCR Theta
        fCFD,                // PMI2DConfidence
        fOCRContrast = fCFD, // OCR Contrast
        fSC,                 // PMI2DSymContrast
        fSCSNR,              // PMI2DSymContrastSNR
        fHMG,                // PMI2DHorzMarkGrowth
        fVMG,                // PMI2DVertMarkGrowth
        fDMCW,               // PMI2DDataMatrixCellWidth
        fDMCH,               // PMI2DDataMatrixCellHeight
        fHMM,                // PMI2DHorzMarkMisplacement
        fVMM,                // PMI2DVertMarkMisplacement
        fUEC,                // PMI2DUnusedErrCorrection
        fCD,                 // PMI2DCellDefects
        fFPD,                // PMI2DFinderPatternDefects
        fSpare,              // Not yet use/defined

        // For $17x
        fLocationXRes = fParamStart,
        fLocationX,

        fLocationYRes,
        fLocationY,

        fSizeXRes,
        fSizeX,

        fSizeYRes,
        fSizeY,

        fOriRes,
        fOriVal,

        fAIMSymContrastRes,
        fAIMSymContrast,

        fAIMHorzGrowthRes,
        fAIMHorzGrowth,

        fAIMVertGrowthRes,
        fAIMVertGrowth,

        fAIMUnusedECCRes,
        fAIMUnusedECC,

        fSEMIUnusedECCRes,
        fSEMIUnusedECC,

        fSEMISymContrastRes,
        fSEMISymContrast,

        fSEMISymContrastSnrRes,
        fSEMISymContrastSnr,

        fSEMIHorzMarkGrowthRes,
        fSEMIHorzMarkGrowth,

        fSEMIVertMarkGrowthRes,
        fSEMIVertMarkGrowth,

        fSEMIHorzMarkMisplacementRes,
        fSEMIHorzMarkMisplacement,

        fSEMIVertMarkMisplacementRes,
        fSEMIVertMarkMisplacement,

        fSEMIMatrixCellWidthRes,
        fSEMIMatrixCellWidth,

        fSEMIMatrixCellHeightRes,
        fSEMIMatrixCellHeight,

        fSEMICellDefectsRes,
        fSEMICellDefects,

        fSEMIFinderPatDefectsRes,
        fSEMIFinderPatDefects,

        fISODecodeRes,
        fISODecodeGrade,

        fISOSymContrastRes,
        fISOSymContrastGrade,

        fISOModulationRes,
        fISOModulationGrade,

        fISOReflectanceMarginRes,
        fISOReflectanceMarginGrade,

        fISOFixedPatDamageRes,
        fISOFixedPatDamageGrade,

        fISOAxialNonUniformityRes,
        fISOAxialNonUniformityGrade,

        fISOGridNonUniformityRes,
        fISOGridNonUniformityGrade,

        fISOUnusedECCRes,
        fISOUnusedECCGrade,

        fISOOverallSymRes,
        fISOOverallSymGrade,

        fISOHorzPrintGrowthRes,
        fISOHorzPrintGrowth,

        fISOVertPrintGrowthRes,
        fISOVertPrintGrowth,

        fAIMDPMDecodeRes,
        fAIMDPMDecodeGrade,

        fAIMDPMCellContrastRes,
        fAIMDPMCellContrastGrade,

        fAIMDPMCellModulationRes,
        fAIMDPMCellModulationGrade,

        fAIMDPMMinReflectanceRes,
        fAIMDPMMinReflectanceGrade,

        fAIMDPMFixedPatDamageRes,
        fAIMDPMFixedPatDamageGrade,

        fAIMDPMAxialNonUniformityRes,
        fAIMDPMAxialNonUniformityGrade,

        fAIMDPMGridNonUniformityRes,
        fAIMDPMGridNonUniformityGrade,

        fAIMDPMUnusedECCRes,
        fAIMDPMUnusedECCGrade,

        fAIMDPMOverallSymRes,
        fAIMDPMOverallSymGrade,

        fAIMDPMHorzPrintGrowthRes,
        fAIMDPMHorzPrintGrowth,

        fAIMDPMVertPrintGrowthRes,
        fAIMDPMVertPrintGrowthValue,

        NUM_RESULT_PARAMS
    };

    enum SUBRESULT_PARAM
    {
        sSINGLE,
        sSLANT,
        sSPARE01,
        sSPARE02,
        NUM_SUBRESULT_PARAMS
    };

    enum NOMINAL_DATA
    {
        NOM_DATA1,
        NOM_DATA2,
        NOM_DATA3,
        NOM_DATA4,
        NUM_NOMINAL_DATA
    };

    enum XYT_PVI_PARAM
    {
        fPVI_POSX,
        fPVI_POSY,
        fPVI_POSTHETA,

        fPVI_SETID,

        fPVI_VOIDMAXAREA,
        fPVI_VOIDMAXLEN,
        fPVI_VOIDMAXWIDTH,

        fPVI_CRACKMAXAREA,
        fPVI_CRACKMAXLEN,
        fPVI_CRACKMAXWIDTH,

        fPVI_PFMAXAREA,
        fPVI_PFMAXLEN,
        fPVI_PFMAXWIDTH,

        fPVI_SCRATCHMAXAREA,
        fPVI_SCRATCHMAXLEN,
        fPVI_SCRATCHMAXWIDTH,

        fPVI_CHIPMAXAREA,
        fPVI_CHIPMAXLEN,
        fPVI_CHIPMAXWIDTH,

        fPVI_FMMAXAREA,
        fPVI_FMMAXLEN,
        fPVI_FMMAXWIDTH,

        fPVI_TOPGLUEAREA,
        fPVI_TOPGLUELEN,
        fPVI_TOPGLUEWIDTH,

        fPVI_BTMGLUEAREA,
        fPVI_BTMGLUELEN,
        fPVI_BTMGLUEWIDTH,
        //
        // C330i
        fPVI_TIPHGAP,
        fPVI_TIPSPARE01,
        fPVI_TIPSPARE02,
        //
        MAX_PVI_PARAMS
    };

    CVisionResult();
    virtual ~CVisionResult();

    void ResetResultParams(double dDefaultResult = 0.0);
    void GetResultParams(std::vector<double>& vecResultParam);
    double GetResultParams(int nParamNo);
    void SetResultParams(int nParamNo, double dResult);

    //
    void ResetSubResultCodeParams(std::string csSubResultCode = _T(""));
    void GetSubResultCodeParams(std::vector<std::string>& vecSubResultCode);
    std::string GetSubResultCodeParams(int nParamNo);
    void SetSubResultCodeParams(int nParamNo, std::string csSubResultCode);

    void ResetNominalDatas(double dDefaultData = 0.0);
    void GetNominalDatas(std::vector<double>& vecNominalData);
    double GetNominalDatas(int nDataNo);
    void SetNominalDatas(int nDataNo, double dData);
    //
    std::string GetDecodedString();
    void SetDecodedString(std::string csDecodedString);

    //
    double GetPviParams(int nParamNo);
    void SetPviParams(int nParamNo, double dData);

    CVisionResult& operator=(const CVisionResult& visionResult);

private:
    // Methods

    // Attributes
    std::string m_strDecodedString;

    std::vector<std::string> m_vecSubResultCode;
    std::vector<double> m_vecResultParam;
    std::vector<double> m_vecNominalData;

    std::map<int, double> m_mapPVIParam;
};
