////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// THIS IS AUTO-GENERATED CODE.  PLEASE DO NOT EDIT (File bug reports against tools).
///
/// Auto-generated by: Parameter Parser V5.5.1 (2411131018)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @file  aecstatsconfig.cpp
/// @brief Auto-generated Chromatix parameter file
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#include "aecstatsconfig.h"
#include "parametersetmanager.h"

AECSTATSCONFIG_NAMESPACE_BEGIN

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// SetValue/GetValue Functions
/// Gets or sets the requested value
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool AECGridStatsConfig::GetValue(
    const CHAR* const __path,
    CHAR* const       __value,
    UINT32 const      __size)
{
    constexpr SIZE_T MAX_SIZE = 129;
    CHAR   __name[MAX_SIZE] = "";
    UINT32 __index          = MAX_UINT;
    bool   __result         = false;

    ParameterUtils::GetVariable(__path, __name, __index, MAX_SIZE);

    if (PARAMETER_STRCMP(__name, "numOfRegionsHorizontal") == 0)
    {
        ParameterUtils::DoubleToString((double)numOfRegionsHorizontal, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "numOfRegionsVertical") == 0)
    {
        ParameterUtils::DoubleToString((double)numOfRegionsVertical, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "enableStatsQuadSync") == 0)
    {
        ParameterUtils::DoubleToString((double)enableStatsQuadSync, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "enableSaturatedStats") == 0)
    {
        ParameterUtils::DoubleToString((double)enableSaturatedStats, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "enableYComputedStats") == 0)
    {
        ParameterUtils::DoubleToString((double)enableYComputedStats, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "YComputationColorWeight") == 0)
    {
        if (__index < 3)
        {
            ParameterUtils::DoubleToString((double)YComputationColorWeight[__index], __value, __size);
            __result = true;
        }
        else
        {
            SIZE_T __valuePos = 0;
            for (UINT32 i = 0; i < 3; i++)
            {
                if (i > 0)
                {
                    PARAMETER_STRCAT(__value, __size, ",");
                    __valuePos = PARAMETER_STRLEN(__value);
                }
                ParameterUtils::DoubleToString((double)YComputationColorWeight[i], &__value[__valuePos], (INT32)(__size - __valuePos));
            }
            __result = true;
        }
    }
    else if (PARAMETER_STRCMP(__name, "minStatsChannelThreshold") == 0)
    {
        if (__index < 4)
        {
            ParameterUtils::DoubleToString((double)minStatsChannelThreshold[__index], __value, __size);
            __result = true;
        }
        else
        {
            SIZE_T __valuePos = 0;
            for (UINT32 i = 0; i < 4; i++)
            {
                if (i > 0)
                {
                    PARAMETER_STRCAT(__value, __size, ",");
                    __valuePos = PARAMETER_STRLEN(__value);
                }
                ParameterUtils::DoubleToString((double)minStatsChannelThreshold[i], &__value[__valuePos], (INT32)(__size - __valuePos));
            }
            __result = true;
        }
    }
    else if (PARAMETER_STRCMP(__name, "maxStatsChannelThreshold") == 0)
    {
        if (__index < 4)
        {
            ParameterUtils::DoubleToString((double)maxStatsChannelThreshold[__index], __value, __size);
            __result = true;
        }
        else
        {
            SIZE_T __valuePos = 0;
            for (UINT32 i = 0; i < 4; i++)
            {
                if (i > 0)
                {
                    PARAMETER_STRCAT(__value, __size, ",");
                    __valuePos = PARAMETER_STRLEN(__value);
                }
                ParameterUtils::DoubleToString((double)maxStatsChannelThreshold[i], &__value[__valuePos], (INT32)(__size - __valuePos));
            }
            __result = true;
        }
    }
    else if (PARAMETER_STRCMP(__name, "HWStatsSkipFactor") == 0)
    {
        ParameterUtils::DoubleToString((double)HWStatsSkipFactor, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "ROIConfigControl") == 0)
    {
        ParameterUtils::DoubleToString((double)(UINT32)ROIConfigControl, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "bitDepth") == 0)
    {
        ParameterUtils::DoubleToString((double)bitDepth, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "siteSelection") == 0)
    {
        ParameterUtils::DoubleToString((double)(UINT32)siteSelection, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "pixelExpSelect") == 0)
    {
        ParameterUtils::DoubleToString((double)(UINT32)pixelExpSelect, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "regionSampling") == 0)
    {
        ParameterUtils::DoubleToString((double)regionSampling, __value, __size, 0);
        __result = true;
    }

    return __result;
}

bool AECGridStatsConfig::SetValue(
    const CHAR* const __path,
    const CHAR* const __value)
{
    constexpr SIZE_T MAX_SIZE = 129;
    CHAR   __name[MAX_SIZE] = "";
    UINT32 __index          = MAX_UINT;
    bool   __result         = false;

    ParameterUtils::GetVariable(__path, __name, __index, MAX_SIZE);

    if (PARAMETER_STRCMP(__name, "numOfRegionsHorizontal") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            numOfRegionsHorizontal = (UINT16)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "numOfRegionsVertical") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            numOfRegionsVertical = (UINT16)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "enableStatsQuadSync") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            enableStatsQuadSync = (BOOL)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "enableSaturatedStats") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            enableSaturatedStats = (BOOL)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "enableYComputedStats") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            enableYComputedStats = (BOOL)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "YComputationColorWeight") == 0)
    {
        if (__index < 3)
        {
            const double dblValue = ParameterUtils::StringToDouble(__value, __result);
            if (__result)
            {
                YComputationColorWeight[__index] = (float)dblValue; 
            }
        }
        else
        {
            SIZE_T __valueLen = PARAMETER_STRLEN(__value);
            UINT32 __pos = 0;

            __index = 0;
            while (__pos < __valueLen && __index < 3)
            {
                CHAR __valueStr[MAX_SIZE];

                __pos += ParameterUtils::GetSubString(&__value[__pos], ',', __valueStr, MAX_SIZE);
                __pos++;

                const double dblValue = ParameterUtils::StringToDouble(__valueStr, __result);
                if (__result)
                {
                    YComputationColorWeight[__index] = (float)dblValue; 
                }
                __index++;
            }
            __result = true;
        }
    }
    else if (PARAMETER_STRCMP(__name, "minStatsChannelThreshold") == 0)
    {
        if (__index < 4)
        {
            const double dblValue = ParameterUtils::StringToDouble(__value, __result);
            if (__result)
            {
                minStatsChannelThreshold[__index] = (float)dblValue; 
            }
        }
        else
        {
            SIZE_T __valueLen = PARAMETER_STRLEN(__value);
            UINT32 __pos = 0;

            __index = 0;
            while (__pos < __valueLen && __index < 4)
            {
                CHAR __valueStr[MAX_SIZE];

                __pos += ParameterUtils::GetSubString(&__value[__pos], ',', __valueStr, MAX_SIZE);
                __pos++;

                const double dblValue = ParameterUtils::StringToDouble(__valueStr, __result);
                if (__result)
                {
                    minStatsChannelThreshold[__index] = (float)dblValue; 
                }
                __index++;
            }
            __result = true;
        }
    }
    else if (PARAMETER_STRCMP(__name, "maxStatsChannelThreshold") == 0)
    {
        if (__index < 4)
        {
            const double dblValue = ParameterUtils::StringToDouble(__value, __result);
            if (__result)
            {
                maxStatsChannelThreshold[__index] = (float)dblValue; 
            }
        }
        else
        {
            SIZE_T __valueLen = PARAMETER_STRLEN(__value);
            UINT32 __pos = 0;

            __index = 0;
            while (__pos < __valueLen && __index < 4)
            {
                CHAR __valueStr[MAX_SIZE];

                __pos += ParameterUtils::GetSubString(&__value[__pos], ',', __valueStr, MAX_SIZE);
                __pos++;

                const double dblValue = ParameterUtils::StringToDouble(__valueStr, __result);
                if (__result)
                {
                    maxStatsChannelThreshold[__index] = (float)dblValue; 
                }
                __index++;
            }
            __result = true;
        }
    }
    else if (PARAMETER_STRCMP(__name, "HWStatsSkipFactor") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            HWStatsSkipFactor = (UINT8)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "ROIConfigControl") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            ROIConfigControl = (AECROIConfigControlType)(UINT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "bitDepth") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            bitDepth = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "siteSelection") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            siteSelection = (aecglobalelements::AECStatsSiteSelection)(UINT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "pixelExpSelect") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            pixelExpSelect = (aecglobalelements::AECStatsPixelExpSelect)(UINT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "regionSampling") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            regionSampling = (INT32)dblValue; 
        }
    }

    return __result;
}

bool AECGridStatsConfig::GetInfo(
    const CHAR* const           __path,
    PList<ParameterParserInfo>& __info)
{
    constexpr SIZE_T MAX_SIZE = 129;
    CHAR   __name[MAX_SIZE] = "";
    UINT32 __index          = MAX_UINT;
    bool   __result         = false;

    ParameterUtils::GetVariable(__path, __name, __index, MAX_SIZE);

    // numOfRegionsHorizontal
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("numOfRegionsHorizontal", ParameterParserDataType::UInt16, (double)numOfRegionsHorizontal, 0));
    }
    else if (PARAMETER_STRCMP(__name, "numOfRegionsHorizontal") == 0)
    {
        __result = true;
        __info.Add(ParameterParserInfo(nullptr, ParameterParserDataType::UInt16, (double)numOfRegionsHorizontal, 0));
    }

    // numOfRegionsVertical
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("numOfRegionsVertical", ParameterParserDataType::UInt16, (double)numOfRegionsVertical, 0));
    }
    else if (PARAMETER_STRCMP(__name, "numOfRegionsVertical") == 0)
    {
        __result = true;
        __info.Add(ParameterParserInfo(nullptr, ParameterParserDataType::UInt16, (double)numOfRegionsVertical, 0));
    }

    // enableStatsQuadSync
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("enableStatsQuadSync", ParameterParserDataType::Boolean, (double)enableStatsQuadSync, 0));
    }
    else if (PARAMETER_STRCMP(__name, "enableStatsQuadSync") == 0)
    {
        __result = true;
        __info.Add(ParameterParserInfo(nullptr, ParameterParserDataType::Boolean, (double)enableStatsQuadSync, 0));
    }

    // enableSaturatedStats
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("enableSaturatedStats", ParameterParserDataType::Boolean, (double)enableSaturatedStats, 0));
    }
    else if (PARAMETER_STRCMP(__name, "enableSaturatedStats") == 0)
    {
        __result = true;
        __info.Add(ParameterParserInfo(nullptr, ParameterParserDataType::Boolean, (double)enableSaturatedStats, 0));
    }

    // enableYComputedStats
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("enableYComputedStats", ParameterParserDataType::Boolean, (double)enableYComputedStats, 0));
    }
    else if (PARAMETER_STRCMP(__name, "enableYComputedStats") == 0)
    {
        __result = true;
        __info.Add(ParameterParserInfo(nullptr, ParameterParserDataType::Boolean, (double)enableYComputedStats, 0));
    }

    // YComputationColorWeight
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("YComputationColorWeight", ParameterParserDataType::Float, true, false, 3));
    }

    // minStatsChannelThreshold
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("minStatsChannelThreshold", ParameterParserDataType::Float, true, false, 4));
    }

    // maxStatsChannelThreshold
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("maxStatsChannelThreshold", ParameterParserDataType::Float, true, false, 4));
    }

    // HWStatsSkipFactor
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("HWStatsSkipFactor", ParameterParserDataType::UInt8, (double)HWStatsSkipFactor, 0));
    }
    else if (PARAMETER_STRCMP(__name, "HWStatsSkipFactor") == 0)
    {
        __result = true;
        __info.Add(ParameterParserInfo(nullptr, ParameterParserDataType::UInt8, (double)HWStatsSkipFactor, 0));
    }

    // ROIConfigControl
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("ROIConfigControl", ParameterParserDataType::Enum, (double)(UINT32)ROIConfigControl, 0));
    }
    else if (PARAMETER_STRCMP(__name, "ROIConfigControl") == 0)
    {
        __result = true;
        __info.Add(ParameterParserInfo(nullptr, ParameterParserDataType::Enum, (double)(UINT32)ROIConfigControl, 0));
    }

    // bitDepth
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("bitDepth", ParameterParserDataType::Int32, (double)bitDepth, 0));
    }
    else if (PARAMETER_STRCMP(__name, "bitDepth") == 0)
    {
        __result = true;
        __info.Add(ParameterParserInfo(nullptr, ParameterParserDataType::Int32, (double)bitDepth, 0));
    }

    // siteSelection
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("siteSelection", ParameterParserDataType::Enum, (double)(UINT32)siteSelection, 0));
    }
    else if (PARAMETER_STRCMP(__name, "siteSelection") == 0)
    {
        __result = true;
        __info.Add(ParameterParserInfo(nullptr, ParameterParserDataType::Enum, (double)(UINT32)siteSelection, 0));
    }

    // pixelExpSelect
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("pixelExpSelect", ParameterParserDataType::Enum, (double)(UINT32)pixelExpSelect, 0));
    }
    else if (PARAMETER_STRCMP(__name, "pixelExpSelect") == 0)
    {
        __result = true;
        __info.Add(ParameterParserInfo(nullptr, ParameterParserDataType::Enum, (double)(UINT32)pixelExpSelect, 0));
    }

    // regionSampling
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("regionSampling", ParameterParserDataType::Int32, (double)regionSampling, 0));
    }
    else if (PARAMETER_STRCMP(__name, "regionSampling") == 0)
    {
        __result = true;
        __info.Add(ParameterParserInfo(nullptr, ParameterParserDataType::Int32, (double)regionSampling, 0));
    }

    return __result;
}

bool HistIndividualConfigType::GetValue(
    const CHAR* const __path,
    CHAR* const       __value,
    UINT32 const      __size)
{
    constexpr SIZE_T MAX_SIZE = 129;
    CHAR   __name[MAX_SIZE] = "";
    UINT32 __index          = MAX_UINT;
    bool   __result         = false;

    ParameterUtils::GetVariable(__path, __name, __index, MAX_SIZE);

    if (PARAMETER_STRCMP(__name, "histogramType") == 0)
    {
        ParameterUtils::DoubleToString((double)(UINT32)histogramType, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "binUniformity") == 0)
    {
        ParameterUtils::DoubleToString((double)(UINT32)binUniformity, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "colorChannel") == 0)
    {
        ParameterUtils::DoubleToString((double)(UINT32)colorChannel, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "siteSelection") == 0)
    {
        ParameterUtils::DoubleToString((double)(UINT32)siteSelection, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "pixelExpSelect") == 0)
    {
        ParameterUtils::DoubleToString((double)(UINT32)pixelExpSelect, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "ROIConfigControl") == 0)
    {
        ParameterUtils::DoubleToString((double)(UINT32)ROIConfigControl, __value, __size, 0);
        __result = true;
    }

    return __result;
}

bool HistIndividualConfigType::SetValue(
    const CHAR* const __path,
    const CHAR* const __value)
{
    constexpr SIZE_T MAX_SIZE = 129;
    CHAR   __name[MAX_SIZE] = "";
    UINT32 __index          = MAX_UINT;
    bool   __result         = false;

    ParameterUtils::GetVariable(__path, __name, __index, MAX_SIZE);

    if (PARAMETER_STRCMP(__name, "histogramType") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            histogramType = (aecglobalelements::AECStatsHistogramType)(UINT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "binUniformity") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            binUniformity = (aecglobalelements::AECStatsHistogramUniformityType)(UINT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "colorChannel") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            colorChannel = (aecglobalelements::AECStatsHistogramChannelType)(UINT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "siteSelection") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            siteSelection = (aecglobalelements::AECStatsSiteSelection)(UINT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "pixelExpSelect") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            pixelExpSelect = (aecglobalelements::AECStatsPixelExpSelect)(UINT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "ROIConfigControl") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            ROIConfigControl = (AECROIConfigControlType)(UINT32)dblValue; 
        }
    }

    return __result;
}

bool HistIndividualConfigType::GetInfo(
    const CHAR* const           __path,
    PList<ParameterParserInfo>& __info)
{
    constexpr SIZE_T MAX_SIZE = 129;
    CHAR   __name[MAX_SIZE] = "";
    UINT32 __index          = MAX_UINT;
    bool   __result         = false;

    ParameterUtils::GetVariable(__path, __name, __index, MAX_SIZE);

    // histogramType
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("histogramType", ParameterParserDataType::Enum, (double)(UINT32)histogramType, 0));
    }
    else if (PARAMETER_STRCMP(__name, "histogramType") == 0)
    {
        __result = true;
        __info.Add(ParameterParserInfo(nullptr, ParameterParserDataType::Enum, (double)(UINT32)histogramType, 0));
    }

    // binUniformity
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("binUniformity", ParameterParserDataType::Enum, (double)(UINT32)binUniformity, 0));
    }
    else if (PARAMETER_STRCMP(__name, "binUniformity") == 0)
    {
        __result = true;
        __info.Add(ParameterParserInfo(nullptr, ParameterParserDataType::Enum, (double)(UINT32)binUniformity, 0));
    }

    // colorChannel
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("colorChannel", ParameterParserDataType::Enum, (double)(UINT32)colorChannel, 0));
    }
    else if (PARAMETER_STRCMP(__name, "colorChannel") == 0)
    {
        __result = true;
        __info.Add(ParameterParserInfo(nullptr, ParameterParserDataType::Enum, (double)(UINT32)colorChannel, 0));
    }

    // siteSelection
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("siteSelection", ParameterParserDataType::Enum, (double)(UINT32)siteSelection, 0));
    }
    else if (PARAMETER_STRCMP(__name, "siteSelection") == 0)
    {
        __result = true;
        __info.Add(ParameterParserInfo(nullptr, ParameterParserDataType::Enum, (double)(UINT32)siteSelection, 0));
    }

    // pixelExpSelect
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("pixelExpSelect", ParameterParserDataType::Enum, (double)(UINT32)pixelExpSelect, 0));
    }
    else if (PARAMETER_STRCMP(__name, "pixelExpSelect") == 0)
    {
        __result = true;
        __info.Add(ParameterParserInfo(nullptr, ParameterParserDataType::Enum, (double)(UINT32)pixelExpSelect, 0));
    }

    // ROIConfigControl
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("ROIConfigControl", ParameterParserDataType::Enum, (double)(UINT32)ROIConfigControl, 0));
    }
    else if (PARAMETER_STRCMP(__name, "ROIConfigControl") == 0)
    {
        __result = true;
        __info.Add(ParameterParserInfo(nullptr, ParameterParserDataType::Enum, (double)(UINT32)ROIConfigControl, 0));
    }

    return __result;
}

bool AECHistStatsConfig::GetValue(
    const CHAR* const __path,
    CHAR* const       __value,
    UINT32 const      __size)
{
    constexpr SIZE_T MAX_SIZE = 129;
    CHAR   __name[MAX_SIZE] = "";
    UINT32 __index          = MAX_UINT;
    bool   __result         = false;

    const UINT32 __pos = ParameterUtils::GetVariable(__path, __name, __index, MAX_SIZE);

    if (PARAMETER_STRCMP(__name, "ROIConfigControl") == 0)
    {
        ParameterUtils::DoubleToString((double)(UINT32)ROIConfigControl, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "histograms") == 0)
    {
        if (__index < histogramsCount)
        {
            __result = histograms[__index].GetValue(&__path[__pos], __value, __size);
        }
    }

    return __result;
}

bool AECHistStatsConfig::SetValue(
    const CHAR* const __path,
    const CHAR* const __value)
{
    constexpr SIZE_T MAX_SIZE = 129;
    CHAR   __name[MAX_SIZE] = "";
    UINT32 __index          = MAX_UINT;
    bool   __result         = false;

    const UINT32 __pos = ParameterUtils::GetVariable(__path, __name, __index, MAX_SIZE);

    if (PARAMETER_STRCMP(__name, "ROIConfigControl") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            ROIConfigControl = (AECROIConfigControlType)(UINT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "histograms") == 0)
    {
        if (__index < histogramsCount)
        {
            __result = histograms[__index].SetValue(&__path[__pos], __value);
        }
    }

    return __result;
}

bool AECHistStatsConfig::GetInfo(
    const CHAR* const           __path,
    PList<ParameterParserInfo>& __info)
{
    constexpr SIZE_T MAX_SIZE = 129;
    CHAR   __name[MAX_SIZE] = "";
    UINT32 __index          = MAX_UINT;
    bool   __result         = false;

    const UINT32 __pos = ParameterUtils::GetVariable(__path, __name, __index, MAX_SIZE);

    // ROIConfigControl
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("ROIConfigControl", ParameterParserDataType::Enum, (double)(UINT32)ROIConfigControl, 0));
    }
    else if (PARAMETER_STRCMP(__name, "ROIConfigControl") == 0)
    {
        __result = true;
        __info.Add(ParameterParserInfo(nullptr, ParameterParserDataType::Enum, (double)(UINT32)ROIConfigControl, 0));
    }

    // histograms
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("histograms", ParameterParserDataType::Structure, true, false, histogramsCount));
    }
    else if (PARAMETER_STRCMP(__name, "histograms") == 0)
    {
        if (__index < histogramsCount)
        {
            __result = histograms[__index].GetInfo(&__path[__pos], __info);
        }
        else
        {
            __result = true;
            __info.Add(ParameterParserInfo(nullptr, ParameterParserDataType::Structure, true, false, histogramsCount));
        }
    }

    return __result;
}

bool AECStatsConfig::GetValue(
    const CHAR* const __path,
    CHAR* const       __value,
    UINT32 const      __size)
{
    constexpr SIZE_T MAX_SIZE = 129;
    CHAR   __name[MAX_SIZE] = "";
    UINT32 __index          = MAX_UINT;
    bool   __result         = false;

    const UINT32 __pos = ParameterUtils::GetVariable(__path, __name, __index, MAX_SIZE);

    if (PARAMETER_STRCMP(__name, "module_version") == 0)
    {
        __result = module_version.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "parameter_version") == 0)
    {
        __result = parameter_version.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "histStatsConfig") == 0)
    {
        __result = histStatsConfig.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "gridStatsConfig") == 0)
    {
        __result = gridStatsConfig.GetValue(&__path[__pos], __value, __size);
    }

    return __result;
}

bool AECStatsConfig::SetValue(
    const CHAR* const __path,
    const CHAR* const __value)
{
    constexpr SIZE_T MAX_SIZE = 129;
    CHAR   __name[MAX_SIZE] = "";
    UINT32 __index          = MAX_UINT;
    bool   __result         = false;

    const UINT32 __pos = ParameterUtils::GetVariable(__path, __name, __index, MAX_SIZE);

    if (PARAMETER_STRCMP(__name, "module_version") == 0)
    {
        __result = module_version.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "parameter_version") == 0)
    {
        __result = parameter_version.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "histStatsConfig") == 0)
    {
        __result = histStatsConfig.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "gridStatsConfig") == 0)
    {
        __result = gridStatsConfig.SetValue(&__path[__pos], __value);
    }

    return __result;
}

bool AECStatsConfig::GetInfo(
    const CHAR* const           __path,
    PList<ParameterParserInfo>& __info)
{
    constexpr SIZE_T MAX_SIZE = 129;
    CHAR   __name[MAX_SIZE] = "";
    UINT32 __index          = MAX_UINT;
    bool   __result         = false;

    const UINT32 __pos = ParameterUtils::GetVariable(__path, __name, __index, MAX_SIZE);

    // module_version
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("module_version", ParameterParserDataType::Structure));
    }
    else if (PARAMETER_STRCMP(__name, "module_version") == 0)
    {
        __result = module_version.GetInfo(&__path[__pos], __info);
    }

    // parameter_version
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("parameter_version", ParameterParserDataType::Structure));
    }
    else if (PARAMETER_STRCMP(__name, "parameter_version") == 0)
    {
        __result = parameter_version.GetInfo(&__path[__pos], __info);
    }

    // histStatsConfig
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("histStatsConfig", ParameterParserDataType::Structure));
    }
    else if (PARAMETER_STRCMP(__name, "histStatsConfig") == 0)
    {
        __result = histStatsConfig.GetInfo(&__path[__pos], __info);
    }

    // gridStatsConfig
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("gridStatsConfig", ParameterParserDataType::Structure));
    }
    else if (PARAMETER_STRCMP(__name, "gridStatsConfig") == 0)
    {
        __result = gridStatsConfig.GetInfo(&__path[__pos], __info);
    }

    return __result;
}

bool AECStatsConfig::module_versionStruct::GetValue(
    const CHAR* const __path,
    CHAR* const       __value,
    UINT32 const      __size)
{
    constexpr SIZE_T MAX_SIZE = 129;
    CHAR   __name[MAX_SIZE] = "";
    UINT32 __index          = MAX_UINT;
    bool   __result         = false;

    ParameterUtils::GetVariable(__path, __name, __index, MAX_SIZE);

    if (PARAMETER_STRCMP(__name, "major_revision") == 0)
    {
        ParameterUtils::DoubleToString((double)major_revision, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "minor_revision") == 0)
    {
        ParameterUtils::DoubleToString((double)minor_revision, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "incr_revision") == 0)
    {
        ParameterUtils::DoubleToString((double)incr_revision, __value, __size, 0);
        __result = true;
    }

    return __result;
}

bool AECStatsConfig::module_versionStruct::SetValue(
    const CHAR* const __path,
    const CHAR* const __value)
{
    constexpr SIZE_T MAX_SIZE = 129;
    CHAR   __name[MAX_SIZE] = "";
    UINT32 __index          = MAX_UINT;
    bool   __result         = false;

    ParameterUtils::GetVariable(__path, __name, __index, MAX_SIZE);

    if (PARAMETER_STRCMP(__name, "major_revision") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            major_revision = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "minor_revision") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            minor_revision = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "incr_revision") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            incr_revision = (INT32)dblValue; 
        }
    }

    return __result;
}

bool AECStatsConfig::module_versionStruct::GetInfo(
    const CHAR* const           __path,
    PList<ParameterParserInfo>& __info)
{
    constexpr SIZE_T MAX_SIZE = 129;
    CHAR   __name[MAX_SIZE] = "";
    UINT32 __index          = MAX_UINT;
    bool   __result         = false;

    ParameterUtils::GetVariable(__path, __name, __index, MAX_SIZE);

    // major_revision
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("major_revision", ParameterParserDataType::Int32, (double)major_revision, 0));
    }
    else if (PARAMETER_STRCMP(__name, "major_revision") == 0)
    {
        __result = true;
        __info.Add(ParameterParserInfo(nullptr, ParameterParserDataType::Int32, (double)major_revision, 0));
    }

    // minor_revision
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("minor_revision", ParameterParserDataType::Int32, (double)minor_revision, 0));
    }
    else if (PARAMETER_STRCMP(__name, "minor_revision") == 0)
    {
        __result = true;
        __info.Add(ParameterParserInfo(nullptr, ParameterParserDataType::Int32, (double)minor_revision, 0));
    }

    // incr_revision
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("incr_revision", ParameterParserDataType::Int32, (double)incr_revision, 0));
    }
    else if (PARAMETER_STRCMP(__name, "incr_revision") == 0)
    {
        __result = true;
        __info.Add(ParameterParserInfo(nullptr, ParameterParserDataType::Int32, (double)incr_revision, 0));
    }

    return __result;
}

bool AECStatsConfig::parameter_versionStruct::GetValue(
    const CHAR* const __path,
    CHAR* const       __value,
    UINT32 const      __size)
{
    constexpr SIZE_T MAX_SIZE = 129;
    CHAR   __name[MAX_SIZE] = "";
    UINT32 __index          = MAX_UINT;
    bool   __result         = false;

    ParameterUtils::GetVariable(__path, __name, __index, MAX_SIZE);

    if (PARAMETER_STRCMP(__name, "revision") == 0)
    {
        PARAMETER_STRCPY(__value, __size, revision);
        __result = true;
    }

    return __result;
}

bool AECStatsConfig::parameter_versionStruct::SetValue(
    const CHAR* const __path,
    const CHAR* const /*__value*/)
{
    constexpr SIZE_T MAX_SIZE = 129;
    CHAR   __name[MAX_SIZE] = "";
    UINT32 __index          = MAX_UINT;
    bool   __result         = false;

    ParameterUtils::GetVariable(__path, __name, __index, MAX_SIZE);

    if (PARAMETER_STRCMP(__name, "revision") == 0)
    {
        // Cannot modify strings, risk of memory leaks or corruption
    }

    return __result;
}

bool AECStatsConfig::parameter_versionStruct::GetInfo(
    const CHAR* const           __path,
    PList<ParameterParserInfo>& __info)
{
    constexpr SIZE_T MAX_SIZE = 129;
    CHAR   __name[MAX_SIZE] = "";
    UINT32 __index          = MAX_UINT;
    bool   __result         = false;

    ParameterUtils::GetVariable(__path, __name, __index, MAX_SIZE);

    // revision
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("revision", ParameterParserDataType::String, revision));
    }
    else if (PARAMETER_STRCMP(__name, "revision") == 0)
    {
        __result = true;
        __info.Add(ParameterParserInfo(nullptr, ParameterParserDataType::String, revision));
    }

    return __result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Read enum value
/// @param entry [in] Symbol table entry
/// @param enumValue [out] Enum value to read
/// @param alignment [in] Symbol table byte alignment
/// @return true if successful
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool ReadEnum_AECROIConfigControlType(
    ParameterFileSymbolTableEntry* const entry,
    AECROIConfigControlType& enumValue,
    BYTE const alignment)
{
    bool result {false};

    UINT32 uintValue {entry->ReadEnum(&result, alignment)};

    if (result)
    {
        switch (uintValue)
        {
        case static_cast<UINT32>(AECROIConfigControlType::AECROIConfigControlTypeCroppedFOV):
            enumValue = AECROIConfigControlType::AECROIConfigControlTypeCroppedFOV;
            result    = true;
            break;
        case static_cast<UINT32>(AECROIConfigControlType::AECROIConfigControlTypeFullFOV):
            enumValue = AECROIConfigControlType::AECROIConfigControlTypeFullFOV;
            result    = true;
            break;
        default:
            PARAMETER_LOG_ERROR(entry->SetManager, "Invalid value(% u) converting UINT32 to AECROIConfigControlType", uintValue);
            break;
        }
    }
    return result;
}


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Default Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
AECStatsConfigClass::AECStatsConfigClass(
    const CHAR* const name)
    : ParameterModule(name, MAJOR, MINOR, PATCH, nullptr)
{
    PARAMETER_INITIALIZE(SymbolTableID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(parameter_version);
    PARAMETER_INITIALIZE(histStatsConfig);
    PARAMETER_INITIALIZE(gridStatsConfig);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
AECStatsConfigClass::AECStatsConfigClass(
    const CHAR* const name,
    ModuleData* const moduleData)
    : ParameterModule(name, MAJOR, MINOR, PATCH, moduleData)
{
    PARAMETER_INITIALIZE(SymbolTableID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(parameter_version);
    PARAMETER_INITIALIZE(histStatsConfig);
    PARAMETER_INITIALIZE(gridStatsConfig);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Destructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
AECStatsConfigClass::~AECStatsConfigClass()
{
    if (Loaded)
    {
        UnloadModule();
    }
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// GetName
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const CHAR* AECStatsConfigClass::GetName(
    const CHAR* const type)
{
    const CHAR* name = type;
    CHAR temp[ParameterFileSymbolTableEntry::TYPE_LEN + 1];
    if (PARAMETER_STRCMP(type, ModuleData::GetType(temp, "StatsDefaultConfig")) == 0)
    {
        name = "StatsDefaultConfig";
    }
    return name;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load AECGridStatsConfig
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool AECGridStatsConfig::Load(
    ParameterFileSymbolTableEntry* const entry,
    BYTE const alignment)
{
    bool result = true;

    PARAMETER_INITIALIZE(numOfRegionsHorizontal);
    PARAMETER_INITIALIZE(numOfRegionsVertical);
    PARAMETER_INITIALIZE(enableStatsQuadSync);
    PARAMETER_INITIALIZE(enableSaturatedStats);
    PARAMETER_INITIALIZE(enableYComputedStats);
    PARAMETER_INITIALIZE(YComputationColorWeight);
    PARAMETER_INITIALIZE(minStatsChannelThreshold);
    PARAMETER_INITIALIZE(maxStatsChannelThreshold);
    PARAMETER_INITIALIZE(HWStatsSkipFactor);
    PARAMETER_INITIALIZE(ROIConfigControl);
    PARAMETER_INITIALIZE(bitDepth);
    PARAMETER_INITIALIZE(siteSelection);
    PARAMETER_INITIALIZE(pixelExpSelect);
    PARAMETER_INITIALIZE(regionSampling);

    SYMBOL_TABLE_ENTRY_READ(entry, result, numOfRegionsHorizontal, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, numOfRegionsVertical, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, enableStatsQuadSync, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, enableSaturatedStats, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, enableYComputedStats, alignment)
    if (result)
    {
        result = entry->ReadArray(YComputationColorWeight, 3, alignment);
    }
    if (result)
    {
        result = entry->ReadArray(minStatsChannelThreshold, 4, alignment);
    }
    if (result)
    {
        result = entry->ReadArray(maxStatsChannelThreshold, 4, alignment);
    }
    SYMBOL_TABLE_ENTRY_READ(entry, result, HWStatsSkipFactor, alignment)
    if (result)
    {
        result = aecStatsConfig::ReadEnum_AECROIConfigControlType(entry, ROIConfigControl, alignment);
    }
    SYMBOL_TABLE_ENTRY_READ(entry, result, bitDepth, alignment)
    if (result)
    {
        result = aecglobalelements::ReadEnum_AECStatsSiteSelection(entry, siteSelection, alignment);
    }
    if (result)
    {
        result = aecglobalelements::ReadEnum_AECStatsPixelExpSelect(entry, pixelExpSelect, alignment);
    }
    SYMBOL_TABLE_ENTRY_READ(entry, result, regionSampling, alignment)

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load HistIndividualConfigType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool HistIndividualConfigType::Load(
    ParameterFileSymbolTableEntry* const entry,
    BYTE const alignment)
{
    bool result = true;

    PARAMETER_INITIALIZE(histogramType);
    PARAMETER_INITIALIZE(binUniformity);
    PARAMETER_INITIALIZE(colorChannel);
    PARAMETER_INITIALIZE(siteSelection);
    PARAMETER_INITIALIZE(pixelExpSelect);
    PARAMETER_INITIALIZE(ROIConfigControl);

    result = aecglobalelements::ReadEnum_AECStatsHistogramType(entry, histogramType, alignment);
    if (result)
    {
        result = aecglobalelements::ReadEnum_AECStatsHistogramUniformityType(entry, binUniformity, alignment);
    }
    if (result)
    {
        result = aecglobalelements::ReadEnum_AECStatsHistogramChannelType(entry, colorChannel, alignment);
    }
    if (result)
    {
        result = aecglobalelements::ReadEnum_AECStatsSiteSelection(entry, siteSelection, alignment);
    }
    if (result)
    {
        result = aecglobalelements::ReadEnum_AECStatsPixelExpSelect(entry, pixelExpSelect, alignment);
    }
    if (result)
    {
        result = aecStatsConfig::ReadEnum_AECROIConfigControlType(entry, ROIConfigControl, alignment);
    }

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load AECHistStatsConfig
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool AECHistStatsConfig::Load(
    ParameterFileSymbolTableEntry* const entry,
    BYTE const alignment)
{
    bool result = true;

    PARAMETER_INITIALIZE(ROIConfigControl);
    PARAMETER_INITIALIZE(histograms);

    result = aecStatsConfig::ReadEnum_AECROIConfigControlType(entry, ROIConfigControl, alignment);

    // Reading Array histograms from symbol table
    // Do not check result value here because the count value needs to be initialized in this block
    {
        histogramsCount = 0;
        SYMBOL_TABLE_ENTRY_READ(entry, result, histogramsCount, alignment)
        constexpr const CHAR* const file {__FILE__};
        constexpr INT32 line {LINE_CONST};
        ParameterFileSymbolTableEntry  pointerEntryCls;
        ParameterFileSymbolTableEntry* const pointerEntry = &pointerEntryCls;
        if (result)
        {
            result = entry->Table->ReadPointerEntry(pointerEntryCls, entry, alignment);
        }

        if (result)
        {
            histogramsID = pointerEntry->ID;
            DupObjInfo* histogramsDupInfo = pointerEntry->GetDupObject(histogramsCount, file, line);
            if (histogramsDupInfo != nullptr && histogramsDupInfo->Object != nullptr)
            {
                histograms = (HistIndividualConfigType*)histogramsDupInfo->Object;
                if (histograms == nullptr)
                {
                    if (histogramsDupInfo->File != nullptr)
                    {
                        PARAMETER_LOG_ERROR(entry->SetManager, "histograms duplicate found but object is nullptr: %s:%d, RefCount: %d\n",
                            histogramsDupInfo->File, histogramsDupInfo->Line, histogramsDupInfo->RefCount);
                    }
                    else
                    {
                        PARAMETER_LOG_ERROR(entry->SetManager, "histograms duplicate found but Object is nullptr: <nullptr file ptr>:%d, RefCount: %d\n",
                            histogramsDupInfo->Line, histogramsDupInfo->RefCount);
                    }
                }
            }

            if (histograms == nullptr)
            {
                if (result && histogramsCount > 0)
                {
                    histograms = PARAMETER_NEW HistIndividualConfigType[histogramsCount];
                    (void)pointerEntry->SetDupObject(histograms, histogramsCount, file, line);
                }
                if (!result || histograms == nullptr)
                {
                    if (histogramsCount > 0)
                    {
                        PARAMETER_LOG_ERROR(entry->SetManager, "Failed to allocate histograms\n");
                    }
                    histogramsCount = 0;
                }
                for (UINT32 i = 0; result && i < histogramsCount; i++)
                {
                    result = histograms[i].Load(pointerEntry, alignment);
                }
            }
        }
        if (histograms == nullptr)
        {
            histogramsCount = 0;
        }
    }

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load AECStatsConfig
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool AECStatsConfig::Load(
    ParameterFileSymbolTableEntry* const entry,
    BYTE const alignment)
{
    bool result = true;

    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(parameter_version);
    PARAMETER_INITIALIZE(histStatsConfig);
    PARAMETER_INITIALIZE(gridStatsConfig);

    result = module_version.Load(entry, alignment);
    if (result)
    {
        result = parameter_version.Load(entry, alignment);
    }
    if (result)
    {
        result = histStatsConfig.Load(entry, alignment);
    }
    if (result)
    {
        result = gridStatsConfig.Load(entry, alignment);
    }

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load module_versionStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool AECStatsConfig::module_versionStruct::Load(
    ParameterFileSymbolTableEntry* const entry,
    BYTE const alignment)
{
    bool result = true;

    PARAMETER_INITIALIZE(major_revision);
    PARAMETER_INITIALIZE(minor_revision);
    PARAMETER_INITIALIZE(incr_revision);

    SYMBOL_TABLE_ENTRY_READ(entry, result, major_revision, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, minor_revision, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, incr_revision, alignment)

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load parameter_versionStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool AECStatsConfig::parameter_versionStruct::Load(
    ParameterFileSymbolTableEntry* const entry,
    BYTE const alignment)
{
    bool result = true;

    PARAMETER_INITIALIZE(revision);


    // Reading String revision from symbol table
    {
        UINT32 count = 0;
        SYMBOL_TABLE_ENTRY_READ(entry, result, count, alignment)
        ParameterFileSymbolTableEntry stringPointerEntryCls;
        ParameterFileSymbolTableEntry* const stringPointerEntry = &stringPointerEntryCls;
        if (result)
        {
            result = entry->Table->ReadPointerEntry(stringPointerEntryCls, entry, alignment);
        }
        SYMBOL_TABLE_ENTRY_READ_STRING(stringPointerEntry, result, revision, count, alignment)
    }

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload AECHistStatsConfig
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void AECHistStatsConfig::Unload(ParameterFileSymbolTable* const __table)
{
    if (__table != nullptr && __table->ReleaseDupObject(histograms))
    {
        PARAMETER_DELETE[] histograms;
    }
    histograms = nullptr;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload AECStatsConfig
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void AECStatsConfig::Unload(ParameterFileSymbolTable* const __table)
{
    parameter_version.Unload(__table);
    histStatsConfig.Unload(__table);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload parameter_versionStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void AECStatsConfig::parameter_versionStruct::Unload(ParameterFileSymbolTable* const __table)
{
    if (__table != nullptr && __table->ReleaseDupObject(revision))
    {
        PARAMETER_DELETE[] revision;
    }
    revision = nullptr;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Release the ParameterModule object
/// Requires that this object was created via a ParameterSetManager::GetModule call
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void AECStatsConfig::Release()
{
    ((AECStatsConfigClass*)this)->Release();
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Returns the ParameterModule::Modified value
/// The Modified value is incremented when the module's data or pointer values change
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
UINT32 AECStatsConfig::GetModified()
{
    return ((AECStatsConfigClass*)this)->Modified;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Create module, and return a new object
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ParameterModule* AECStatsConfigClass::Create(
    ModuleData*    moduleData,
    DefaultModule* const defModule) const
{
    AECStatsConfigClass* cls = nullptr;

    if (PARAMETER_STRCMP(Type, moduleData->Type) == 0 && Version.Value == moduleData->Version.Value)
    {
        const UINT32 id = moduleData->DuplicateID > 0 ? moduleData->DuplicateID : moduleData->ID;

        ParameterModule* const module = defModule->Find(id);
        if (module != nullptr)
        {
            cls = (AECStatsConfigClass*)module;
        }
        else
        {
            cls = PARAMETER_NEW AECStatsConfigClass(GetName(moduleData->Type), moduleData);
            cls->SymbolTableID = id;
            defModule->AddModule((ParameterModule*)cls);
        }
    }
    else if (Version.Value != moduleData->Version.Value)
    {
        PARAMETER_LOG_ERROR(moduleData->SetManager, "Unable to create AECStatsConfigClass, binary version (%lld) does not match source version (%lld)\n",
            moduleData->Version.Value, Version.Value);
    }
    else
    {
        PARAMETER_LOG_ERROR(moduleData->SetManager, "Unable to create AECStatsConfigClass, binary name (%s) does not match source name (%s)\n",
            moduleData->Type, Type);
    }

    return (ParameterModule*)cls;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load module data, return true is successful
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool AECStatsConfigClass::LoadModule(
    ParameterFileSymbolTable* const table)
{
    bool result = true;

    if (!Loaded)
    {
        BYTE const alignment = table->Alignment;
        AECStatsConfigClass* const cls = this;

        ParameterFileSymbolTableEntry  entryObj;
        ParameterFileSymbolTableEntry* const entry = &entryObj;
        // With EzTune enabled, the unused upper byte of SymbolTableID value can change, so clear it
        result = table->Find(entryObj, SymbolTableID & 0x00ffffff);

        if (!result)
        {
            PARAMETER_LOG_ERROR(entry->SetManager, "AECStatsConfigClass::LoadModule Failed to find module ID (%d) in Symbol Table\n", SymbolTableID);
        }

        if (result)
        {
            result = cls->Load(entry, alignment);
        }
        Modified++;
        Loaded = true;
    }

    if (!result)
    {
        /// Module failed to fully load, unload it
        UnloadModule();
    }

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload module data
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void AECStatsConfigClass::UnloadModule()
{
    if (Loaded)
    {
        if (Data != nullptr && Data->SymbolTable != nullptr)
        {
            Unload(Data->SymbolTable);
        }
        else
        {
            PARAMETER_LOG_ERROR(Data != nullptr ? Data->SetManager : nullptr, "UnloadModule %s called with nullptr "
                "Data->SymbolTable object\n", Name);
            Unload(nullptr);
        }
        Loaded = false;
    }
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// /// Release the ParameterModule object
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void AECStatsConfigClass::Release()
{
    ParameterModule::Release();
}

AECSTATSCONFIG_NAMESPACE_END
