////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 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 V7.4.1 (8cca6579792b9fcef3bc725ff070c5ec453c7c85)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

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

#include "modbgstatsconfigv1.h"
#include "parametersetmanager.h"

MODBGSTATSCONFIGV1_NAMESPACE_BEGIN

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// SetValue/GetValue Functions
/// Gets or sets the requested value
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool bitDepthConfigV1Type::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;

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

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

    return __result;
}

bool bitDepthConfigV1Type::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;

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

    if (PARAMETER_STRCMP(__name, "enableFlag") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            enableFlag = (awbglobalelements::enableFlagType)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "bitDepth") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            bitDepth = (INT32)dblValue; 
        }
    }

    return __result;
}

bool bitDepthConfigV1Type::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;

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

    // enableFlag
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("enableFlag", ParameterParserDataType::Int32, (double)enableFlag, 0));
    }
    else if (PARAMETER_STRCMP(__name, "enableFlag") == 0)
    {
        __result = true;
        __info.Add(ParameterParserInfo(nullptr, ParameterParserDataType::Int32, (double)enableFlag, 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));
    }

    return __result;
}

bool modBGStatsConfigV1Type::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, "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 < YComputationColorWeightFixedCount)
        {
            ParameterUtils::DoubleToString((double)YComputationColorWeight[__index], __value, __size);
            __result = true;
        }
        else
        {
            SIZE_T __valuePos = 0;
            for (UINT32 i = 0; i < YComputationColorWeightFixedCount; 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 < minStatsChannelThresholdFixedCount)
        {
            ParameterUtils::DoubleToString((double)minStatsChannelThreshold[__index], __value, __size);
            __result = true;
        }
        else
        {
            SIZE_T __valuePos = 0;
            for (UINT32 i = 0; i < minStatsChannelThresholdFixedCount; 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 < maxStatsChannelThresholdFixedCount)
        {
            ParameterUtils::DoubleToString((double)maxStatsChannelThreshold[__index], __value, __size);
            __result = true;
        }
        else
        {
            SIZE_T __valuePos = 0;
            for (UINT32 i = 0; i < maxStatsChannelThresholdFixedCount; 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, "bitDepthConfig") == 0)
    {
        __result = bitDepthConfig.GetValue(&__path[__pos], __value, __size);
    }

    return __result;
}

bool modBGStatsConfigV1Type::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, "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 < YComputationColorWeightFixedCount)
        {
            const double dblValue = ParameterUtils::StringToDouble(__value, __result);
            if (__result)
            {
                YComputationColorWeight[__index] = (float)dblValue; 
            }
        }
        else
        {
            const SIZE_T __valueLen = PARAMETER_STRLEN(__value);
            UINT32 __valuePos = 0;

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

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

                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 < minStatsChannelThresholdFixedCount)
        {
            const double dblValue = ParameterUtils::StringToDouble(__value, __result);
            if (__result)
            {
                minStatsChannelThreshold[__index] = (float)dblValue; 
            }
        }
        else
        {
            const SIZE_T __valueLen = PARAMETER_STRLEN(__value);
            UINT32 __valuePos = 0;

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

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

                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 < maxStatsChannelThresholdFixedCount)
        {
            const double dblValue = ParameterUtils::StringToDouble(__value, __result);
            if (__result)
            {
                maxStatsChannelThreshold[__index] = (float)dblValue; 
            }
        }
        else
        {
            const SIZE_T __valueLen = PARAMETER_STRLEN(__value);
            UINT32 __valuePos = 0;

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

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

                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 = (modBGStatsROIConfigType)(UINT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "bitDepthConfig") == 0)
    {
        __result = bitDepthConfig.SetValue(&__path[__pos], __value);
    }

    return __result;
}

bool modBGStatsConfigV1Type::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);

    // 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, YComputationColorWeightFixedCount));
    }

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

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

    // 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));
    }

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

    return __result;
}

bool chromatixBGStatsConfigV1Type::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, "moduleID") == 0)
    {
        __result = moduleID.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "module_version") == 0)
    {
        __result = module_version.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "BGStatsConfig") == 0)
    {
        __result = BGStatsConfig.GetValue(&__path[__pos], __value, __size);
    }

    return __result;
}

bool chromatixBGStatsConfigV1Type::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, "moduleID") == 0)
    {
        __result = moduleID.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "module_version") == 0)
    {
        __result = module_version.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "BGStatsConfig") == 0)
    {
        __result = BGStatsConfig.SetValue(&__path[__pos], __value);
    }

    return __result;
}

bool chromatixBGStatsConfigV1Type::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);

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

    // 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);
    }

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

    return __result;
}

bool chromatixBGStatsConfigV1Type::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;

    (void)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 chromatixBGStatsConfigV1Type::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;

    (void)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 chromatixBGStatsConfigV1Type::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;

    (void)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;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Default Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
chromatixBGStatsConfigV1TypeClass::chromatixBGStatsConfigV1TypeClass(
    const CHAR* name)
    : ParameterModule(name, MAJOR, MINOR, PATCH, nullptr)
{
    PARAMETER_INITIALIZE(SymbolTableID);
    PARAMETER_INITIALIZE(moduleID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(BGStatsConfig);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
chromatixBGStatsConfigV1TypeClass::chromatixBGStatsConfigV1TypeClass(
    const CHAR*       name,
    ModuleData* const moduleData)
    : ParameterModule(name, MAJOR, MINOR, PATCH, moduleData)
{
    PARAMETER_INITIALIZE(SymbolTableID);
    PARAMETER_INITIALIZE(moduleID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(BGStatsConfig);
}

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


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load bitDepthConfigV1Type
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void bitDepthConfigV1Type::Load(
    ParameterLoadParameters& parentParams)
{
    PARAMETER_INITIALIZE(enableFlag);
    PARAMETER_INITIALIZE(bitDepth);

    ParameterFileSymbolTableEntry* const entry = parentParams.Entry;
    ParameterLoadParameters localParams(parentParams);
    localParams.Element   = nullptr;
    localParams.UseParent = false;
    localParams.Index     = 0;

    if (parentParams.Element != nullptr)
    {
        bool _posChanged = false;
        localParams.Element = entry->AdjustPositionAndGetElement(parentParams, true, _posChanged);
    }

    // If parentParams.Element != null && localParams.Element == null, then this element is not defined in the binary file.
    // If parentParams.Element == null then this binary file does not contain a definition table or
    // the full backwards compatibility feature is disabled (for memory or performance reasons)
    if (parentParams.Element == nullptr || parentParams.Element->Verified || localParams.Element != nullptr)
    {
        localParams.Position      = entry->Position;
        localParams.LoadDataLimit = entry->ReadLoadDataLimit(parentParams.LoadDataLimit);

        localParams.NameHash = 0x89a1d7b1468113d1;
        entry->ReadSimpleTypeFixedArray(&enableFlag, 1, localParams);
        localParams.NameHash = 0xaab439c4c2ada27b;
        entry->ReadSimpleTypeFixedArray(&bitDepth, 1, localParams);

        entry->UpdatePosition(localParams.LoadDataLimit);
    }
    else
    {
        PARAMETER_LOG_ERROR(entry->Table->SetManager, "%s: 0x%llx entry not found in the binary file, all values will be 0\n",
            __FUNCTION__, parentParams.NameHash);
    }
}

void bitDepthConfigV1Type::LoadArray(
    ParameterLoadParameters& __params,
    void*                    __array,
    UINT32                   __count)
{
    if (__array != nullptr)
    {
        bitDepthConfigV1Type* arrayPtr = (bitDepthConfigV1Type*)__array;
        for (UINT32 i = 0; i < __count; i++)
        {
            __params.Index = i;
            arrayPtr[i].Load(__params);
        }
    }
}

void* bitDepthConfigV1Type::AllocArray(
    UINT32 __count)
{
    bitDepthConfigV1Type* result = nullptr;
    if (__count > 0)
    {
        result = PARAMETER_NEW bitDepthConfigV1Type[__count];
    }
    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load modBGStatsConfigV1Type
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void modBGStatsConfigV1Type::Load(
    ParameterLoadParameters& parentParams)
{
    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(bitDepthConfig);

    ParameterFileSymbolTableEntry* const entry = parentParams.Entry;
    ParameterLoadParameters localParams(parentParams);
    localParams.Element   = nullptr;
    localParams.UseParent = false;
    localParams.Index     = 0;

    if (parentParams.Element != nullptr)
    {
        bool _posChanged = false;
        localParams.Element = entry->AdjustPositionAndGetElement(parentParams, true, _posChanged);
    }

    // If parentParams.Element != null && localParams.Element == null, then this element is not defined in the binary file.
    // If parentParams.Element == null then this binary file does not contain a definition table or
    // the full backwards compatibility feature is disabled (for memory or performance reasons)
    if (parentParams.Element == nullptr || parentParams.Element->Verified || localParams.Element != nullptr)
    {
        localParams.Position      = entry->Position;
        localParams.LoadDataLimit = entry->ReadLoadDataLimit(parentParams.LoadDataLimit);

        localParams.NameHash = 0xe16fd65f3215484c;
        entry->ReadSimpleTypeFixedArray(&numOfRegionsHorizontal, 1, localParams);
        localParams.NameHash = 0xdc021e8232d58a5f;
        entry->ReadSimpleTypeFixedArray(&numOfRegionsVertical, 1, localParams);
        localParams.NameHash = 0x910a54c2a86b8858;
        entry->ReadSimpleTypeFixedArray(&enableStatsQuadSync, 1, localParams);
        localParams.NameHash = 0xa0e7150fec656af8;
        entry->ReadSimpleTypeFixedArray(&enableSaturatedStats, 1, localParams);
        localParams.NameHash = 0xae954bd22563aeec;
        entry->ReadSimpleTypeFixedArray(&enableYComputedStats, 1, localParams);
        localParams.NameHash = 0xe59604ed4c89f950;
        entry->ReadSimpleTypeFixedArray<float>(YComputationColorWeight, YComputationColorWeightFixedCount,
            localParams);
        localParams.NameHash = 0xb540096c3942094e;
        entry->ReadSimpleTypeFixedArray<float>(minStatsChannelThreshold, minStatsChannelThresholdFixedCount,
            localParams);
        localParams.NameHash = 0xc4bbf5b5012d5345;
        entry->ReadSimpleTypeFixedArray<float>(maxStatsChannelThreshold, maxStatsChannelThresholdFixedCount,
            localParams);
        localParams.NameHash = 0xafc2bc4f65deda01;
        entry->ReadSimpleTypeFixedArray(&HWStatsSkipFactor, 1, localParams);
        localParams.NameHash = 0xfd424caac0d75ef6;
        entry->ReadEnumFixedArray(&ROIConfigControl, 1, localParams);
        localParams.UseParent       = false;
        localParams.UseParentOffset = true;
        localParams.NameHash        = 0xf2cd86da9fb01eaa;
        bitDepthConfig.Load(localParams);

        entry->UpdatePosition(localParams.LoadDataLimit);
    }
    else
    {
        PARAMETER_LOG_ERROR(entry->Table->SetManager, "%s: 0x%llx entry not found in the binary file, all values will be 0\n",
            __FUNCTION__, parentParams.NameHash);
    }
}

void modBGStatsConfigV1Type::LoadArray(
    ParameterLoadParameters& __params,
    void*                    __array,
    UINT32                   __count)
{
    if (__array != nullptr)
    {
        modBGStatsConfigV1Type* arrayPtr = (modBGStatsConfigV1Type*)__array;
        for (UINT32 i = 0; i < __count; i++)
        {
            __params.Index = i;
            arrayPtr[i].Load(__params);
        }
    }
}

void* modBGStatsConfigV1Type::AllocArray(
    UINT32 __count)
{
    modBGStatsConfigV1Type* result = nullptr;
    if (__count > 0)
    {
        result = PARAMETER_NEW modBGStatsConfigV1Type[__count];
    }
    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixBGStatsConfigV1Type
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void chromatixBGStatsConfigV1Type::Load(
    ParameterLoadParameters& parentParams)
{
    PARAMETER_INITIALIZE(moduleID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(BGStatsConfig);

    ParameterFileSymbolTableEntry* const entry = parentParams.Entry;
    ParameterLoadParameters localParams(parentParams);
    localParams.Element   = nullptr;
    localParams.UseParent = false;
    localParams.Index     = 0;

    if (parentParams.Element != nullptr)
    {
        bool _posChanged = false;
        localParams.Element = entry->AdjustPositionAndGetElement(parentParams, true, _posChanged);
    }

    // If parentParams.Element != null && localParams.Element == null, then this element is not defined in the binary file.
    // If parentParams.Element == null then this binary file does not contain a definition table or
    // the full backwards compatibility feature is disabled (for memory or performance reasons)
    if (parentParams.Element == nullptr || parentParams.Element->Verified || localParams.Element != nullptr)
    {
        localParams.Position      = entry->Position;
        localParams.LoadDataLimit = entry->ReadLoadDataLimit(parentParams.LoadDataLimit);

        localParams.UseParent       = false;
        localParams.UseParentOffset = true;
        localParams.NameHash        = 0xb5bb6c7a408ed007;
        moduleID.Load(localParams);
        localParams.NameHash        = 0xe11cd9f365a2599f;
        module_version.Load(localParams);
        localParams.NameHash        = 0x84acffcde59acd1f;
        BGStatsConfig.Load(localParams);

        entry->UpdatePosition(localParams.LoadDataLimit);
    }
    else
    {
        PARAMETER_LOG_ERROR(entry->Table->SetManager, "%s: 0x%llx entry not found in the binary file, all values will be 0\n",
            __FUNCTION__, parentParams.NameHash);
    }
}

void chromatixBGStatsConfigV1Type::LoadArray(
    ParameterLoadParameters& __params,
    void*                    __array,
    UINT32                   __count)
{
    if (__array != nullptr)
    {
        chromatixBGStatsConfigV1Type* arrayPtr = (chromatixBGStatsConfigV1Type*)__array;
        for (UINT32 i = 0; i < __count; i++)
        {
            __params.Index = i;
            arrayPtr[i].Load(__params);
        }
    }
}

void* chromatixBGStatsConfigV1Type::AllocArray(
    UINT32 __count)
{
    chromatixBGStatsConfigV1Type* result = nullptr;
    if (__count > 0)
    {
        result = PARAMETER_NEW chromatixBGStatsConfigV1Type[__count];
    }
    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load module_versionStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void chromatixBGStatsConfigV1Type::module_versionStruct::Load(
    ParameterLoadParameters& parentParams)
{
    PARAMETER_INITIALIZE(major_revision);
    PARAMETER_INITIALIZE(minor_revision);
    PARAMETER_INITIALIZE(incr_revision);

    ParameterFileSymbolTableEntry* const entry = parentParams.Entry;
    ParameterLoadParameters localParams(parentParams);
    localParams.Element   = nullptr;
    localParams.UseParent = false;
    localParams.Index     = 0;

    if (parentParams.Element != nullptr)
    {
        bool _posChanged = false;
        localParams.Element = entry->AdjustPositionAndGetElement(parentParams, true, _posChanged);
    }

    // If parentParams.Element != null && localParams.Element == null, then this element is not defined in the binary file.
    // If parentParams.Element == null then this binary file does not contain a definition table or
    // the full backwards compatibility feature is disabled (for memory or performance reasons)
    if (parentParams.Element == nullptr || parentParams.Element->Verified || localParams.Element != nullptr)
    {
        localParams.Position      = entry->Position;
        localParams.LoadDataLimit = entry->ReadLoadDataLimit(parentParams.LoadDataLimit);

        localParams.NameHash = 0xcd66249477636693;
        entry->ReadSimpleTypeFixedArray(&major_revision, 1, localParams);
        localParams.NameHash = 0xc5497493137a9c25;
        entry->ReadSimpleTypeFixedArray(&minor_revision, 1, localParams);
        localParams.NameHash = 0xb27b8a668efb2a56;
        entry->ReadSimpleTypeFixedArray(&incr_revision, 1, localParams);

        entry->UpdatePosition(localParams.LoadDataLimit);
    }
    else
    {
        PARAMETER_LOG_ERROR(entry->Table->SetManager, "%s: 0x%llx entry not found in the binary file, all values will be 0\n",
            __FUNCTION__, parentParams.NameHash);
    }
}

void chromatixBGStatsConfigV1Type::module_versionStruct::LoadArray(
    ParameterLoadParameters& __params,
    void*                    __array,
    UINT32                   __count)
{
    if (__array != nullptr)
    {
        module_versionStruct* arrayPtr = (module_versionStruct*)__array;
        for (UINT32 i = 0; i < __count; i++)
        {
            __params.Index = i;
            arrayPtr[i].Load(__params);
        }
    }
}

void* chromatixBGStatsConfigV1Type::module_versionStruct::AllocArray(
    UINT32 __count)
{
    module_versionStruct* result = nullptr;
    if (__count > 0)
    {
        result = PARAMETER_NEW module_versionStruct[__count];
    }
    return result;
}

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

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

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// GetModuleName: Returns ParameterModule::Name variable
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const CHAR* chromatixBGStatsConfigV1Type::GetModuleName()
{
    return ((chromatixBGStatsConfigV1TypeClass*)this)->Name;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// GetModuleName: Returns ParameterModule::NameHash variable
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
UINT64 chromatixBGStatsConfigV1Type::GetModuleNameHash()
{
    return ((chromatixBGStatsConfigV1TypeClass*)this)->NameHash;
}

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

    if (IsModuleMatch(moduleData) && 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 = (chromatixBGStatsConfigV1TypeClass*)module;
        }
        else
        {
            cls = PARAMETER_NEW chromatixBGStatsConfigV1TypeClass(Name, moduleData);
            cls->SymbolTableID = id;
            defModule->AddModule((ParameterModule*)cls);
        }
    }
    else if (Version.Value != moduleData->Version.Value)
    {
        PARAMETER_LOG_ERROR(moduleData->SetManager, "Unable to create chromatixBGStatsConfigV1TypeClass, binary version (%lld) does not match source version (%lld)\n",
            moduleData->Version.Value, Version.Value);
    }
    else
    {
        PARAMETER_LOG_ERROR(moduleData->SetManager, "Unable to create chromatixBGStatsConfigV1TypeClass, binary name hash (0x%016llx) does not match source name hash (0x%016llx)\n",
            moduleData->NameHash, NameHash);
    }

    return (ParameterModule*)cls;
}

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

#ifdef PARAMETER_USE_MUTEX
    ParameterMutexLocker lock(Mutex); // Unique LOCK
#endif

    if (!Loaded)
    {
        chromatixBGStatsConfigV1TypeClass* 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 & 0x00ffffffU);

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


        ParameterDefinitionElement* _element = nullptr;
        if (table->ModuleDefinitions != nullptr && !table->ModuleDefinitions->empty())
        {
            _element = table->BuildModuleElement(NameHash);
        }

        ParameterLoadParameters parentParams(entry, NameHash, true, true, _element, entry->Position, 0, ParameterFileSymbolTableEntry::LOAD_LIMIT_MAX);
        cls->Load(parentParams);
        PARAMETER_DELETE _element;
        Modified++;
        Loaded = true;
    }

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

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload module data
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void chromatixBGStatsConfigV1TypeClass::UnloadModule()
{
#ifdef PARAMETER_USE_MUTEX
    ParameterMutexLocker lock(Mutex); // Unique LOCK
#endif

    if (Loaded)
    {
        Loaded = false;
    }
}

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

MODBGSTATSCONFIGV1_NAMESPACE_END
