////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 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  aecarbitration.cpp
/// @brief Auto-generated Chromatix parameter file
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#include "aecarbitration.h"
#include "parametersetmanager.h"

AECARBITRATION_NAMESPACE_BEGIN

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// SetValue/GetValue Functions
/// Gets or sets the requested value
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool ISOSettingType::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, "previewISO100Gain") == 0)
    {
        ParameterUtils::DoubleToString((double)previewISO100Gain, __value, __size);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "enableAntiBandingVsISOPrio") == 0)
    {
        ParameterUtils::DoubleToString((double)enableAntiBandingVsISOPrio, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "enableISOQuantization") == 0)
    {
        ParameterUtils::DoubleToString((double)enableISOQuantization, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "thresQuantizationISOValue") == 0)
    {
        if (__index < thresQuantizationISOValueCount)
        {
            ParameterUtils::DoubleToString((double)thresQuantizationISOValue[__index], __value, __size);
            __result = true;
        }
        else
        {
            SIZE_T __valuePos = 0;
            for (UINT32 i = 0; i < thresQuantizationISOValueCount; i++)
            {
                if (i > 0)
                {
                    PARAMETER_STRCAT(__value, __size, ",");
                    __valuePos = PARAMETER_STRLEN(__value);
                }
                ParameterUtils::DoubleToString((double)thresQuantizationISOValue[i], &__value[__valuePos], (INT32)(__size - __valuePos));
            }
            __result = true;
        }
    }
    else if (PARAMETER_STRCMP(__name, "quantizedISOValue") == 0)
    {
        if (__index < quantizedISOValueCount)
        {
            ParameterUtils::DoubleToString((double)quantizedISOValue[__index], __value, __size);
            __result = true;
        }
        else
        {
            SIZE_T __valuePos = 0;
            for (UINT32 i = 0; i < quantizedISOValueCount; i++)
            {
                if (i > 0)
                {
                    PARAMETER_STRCAT(__value, __size, ",");
                    __valuePos = PARAMETER_STRLEN(__value);
                }
                ParameterUtils::DoubleToString((double)quantizedISOValue[i], &__value[__valuePos], (INT32)(__size - __valuePos));
            }
            __result = true;
        }
    }

    return __result;
}

bool ISOSettingType::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, "previewISO100Gain") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            previewISO100Gain = (float)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "enableAntiBandingVsISOPrio") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            enableAntiBandingVsISOPrio = (BOOL)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "enableISOQuantization") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            enableISOQuantization = (BOOL)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "thresQuantizationISOValue") == 0)
    {
        if (__index < thresQuantizationISOValueCount)
        {
            const double dblValue = ParameterUtils::StringToDouble(__value, __result);
            if (__result)
            {
                thresQuantizationISOValue[__index] = (float)dblValue; 
            }
        }
        else
        {
            const SIZE_T __valueLen = PARAMETER_STRLEN(__value);
            UINT32 __valuePos = 0;

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

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

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

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

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

                const double dblValue = ParameterUtils::StringToDouble(__valueStr, __result);
                if (__result)
                {
                    quantizedISOValue[__index] = (float)dblValue; 
                }
                __index++;
            }
            __result = true;
        }
    }

    return __result;
}

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

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

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

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

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

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

    return __result;
}

bool ExposureKneeType::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, "gain") == 0)
    {
        ParameterUtils::DoubleToString((double)gain, __value, __size);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "expTime") == 0)
    {
        ParameterUtils::DoubleToString((double)expTime, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "incrementPriority") == 0)
    {
        ParameterUtils::DoubleToString((double)(UINT32)incrementPriority, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "expIndex") == 0)
    {
        ParameterUtils::DoubleToString((double)expIndex, __value, __size);
        __result = true;
    }

    return __result;
}

bool ExposureKneeType::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, "gain") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            gain = (float)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "expTime") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            expTime = (UINT64)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "incrementPriority") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            incrementPriority = (aecglobalelements::AECExpIncPrioType)(UINT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "expIndex") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            expIndex = (float)dblValue; 
        }
    }

    return __result;
}

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

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

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

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

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

    return __result;
}

bool ExposureTableType::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, "sensitivityCorrectionFactor") == 0)
    {
        ParameterUtils::DoubleToString((double)sensitivityCorrectionFactor, __value, __size);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "expKneeEntries") == 0)
    {
        if (__index < expKneeEntriesCount)
        {
            __result = expKneeEntries[__index].GetValue(&__path[__pos], __value, __size);
        }
    }
    else if (PARAMETER_STRCMP(__name, "thresAntiBandingMinExpTimePct") == 0)
    {
        ParameterUtils::DoubleToString((double)thresAntiBandingMinExpTimePct, __value, __size);
        __result = true;
    }

    return __result;
}

bool ExposureTableType::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, "sensitivityCorrectionFactor") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            sensitivityCorrectionFactor = (float)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "expKneeEntries") == 0)
    {
        if (__index < expKneeEntriesCount)
        {
            __result = expKneeEntries[__index].SetValue(&__path[__pos], __value);
        }
    }
    else if (PARAMETER_STRCMP(__name, "thresAntiBandingMinExpTimePct") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            thresAntiBandingMinExpTimePct = (float)dblValue; 
        }
    }

    return __result;
}

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

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

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

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

    return __result;
}

bool AECCoreArbitrationType::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, "expTables") == 0)
    {
        if (__index < expTablesCount)
        {
            __result = expTables[__index].GetValue(&__path[__pos], __value, __size);
        }
    }
    else if (PARAMETER_STRCMP(__name, "minPreviewVertBlankTime") == 0)
    {
        ParameterUtils::DoubleToString((double)minPreviewVertBlankTime, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "enableEVExpTableAdj") == 0)
    {
        ParameterUtils::DoubleToString((double)enableEVExpTableAdj, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "enableEVGainCapping") == 0)
    {
        ParameterUtils::DoubleToString((double)enableEVGainCapping, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "maxEVCappingGain") == 0)
    {
        ParameterUtils::DoubleToString((double)maxEVCappingGain, __value, __size);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "ISOData") == 0)
    {
        __result = ISOData.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "antibandingVsFPSMethod") == 0)
    {
        ParameterUtils::DoubleToString((double)(UINT32)antibandingVsFPSMethod, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "enablePreviewManualISO") == 0)
    {
        ParameterUtils::DoubleToString((double)enablePreviewManualISO, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "enablePreviewManualExpTime") == 0)
    {
        ParameterUtils::DoubleToString((double)enablePreviewManualExpTime, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "enablePreviewManualFull") == 0)
    {
        ParameterUtils::DoubleToString((double)enablePreviewManualFull, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "disableBandingGainCapping") == 0)
    {
        ParameterUtils::DoubleToString((double)disableBandingGainCapping, __value, __size, 0);
        __result = true;
    }

    return __result;
}

bool AECCoreArbitrationType::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, "expTables") == 0)
    {
        if (__index < expTablesCount)
        {
            __result = expTables[__index].SetValue(&__path[__pos], __value);
        }
    }
    else if (PARAMETER_STRCMP(__name, "minPreviewVertBlankTime") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            minPreviewVertBlankTime = (UINT64)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "enableEVExpTableAdj") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            enableEVExpTableAdj = (BOOL)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "enableEVGainCapping") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            enableEVGainCapping = (BOOL)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "maxEVCappingGain") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            maxEVCappingGain = (float)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "ISOData") == 0)
    {
        __result = ISOData.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "antibandingVsFPSMethod") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            antibandingVsFPSMethod = (aecglobalelements::AECAntibandingVsFPSMethod)(UINT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "enablePreviewManualISO") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            enablePreviewManualISO = (BOOL)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "enablePreviewManualExpTime") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            enablePreviewManualExpTime = (BOOL)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "enablePreviewManualFull") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            enablePreviewManualFull = (BOOL)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "disableBandingGainCapping") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            disableBandingGainCapping = (BOOL)dblValue; 
        }
    }

    return __result;
}

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

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

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

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

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

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

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

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

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

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

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

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

    return __result;
}

bool AECCoreArbitrationType::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 AECCoreArbitrationType::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 AECCoreArbitrationType::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;
}

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

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

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

    return __result;
}

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

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

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

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Default Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
AECCoreArbitrationTypeClass::AECCoreArbitrationTypeClass(
    const CHAR* name)
    : ParameterModule(name, MAJOR, MINOR, PATCH, nullptr)
{
    PARAMETER_INITIALIZE(SymbolTableID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(parameter_version);
    PARAMETER_INITIALIZE(expTablesCount);
    PARAMETER_INITIALIZE(expTables);
    PARAMETER_INITIALIZE(minPreviewVertBlankTime);
    PARAMETER_INITIALIZE(enableEVExpTableAdj);
    PARAMETER_INITIALIZE(enableEVGainCapping);
    PARAMETER_INITIALIZE(maxEVCappingGain);
    PARAMETER_INITIALIZE(ISOData);
    PARAMETER_INITIALIZE(antibandingVsFPSMethod);
    PARAMETER_INITIALIZE(enablePreviewManualISO);
    PARAMETER_INITIALIZE(enablePreviewManualExpTime);
    PARAMETER_INITIALIZE(enablePreviewManualFull);
    PARAMETER_INITIALIZE(disableBandingGainCapping);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
AECCoreArbitrationTypeClass::AECCoreArbitrationTypeClass(
    const CHAR*       name,
    ModuleData* const moduleData)
    : ParameterModule(name, MAJOR, MINOR, PATCH, moduleData)
{
    PARAMETER_INITIALIZE(SymbolTableID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(parameter_version);
    PARAMETER_INITIALIZE(expTables);
    PARAMETER_INITIALIZE(minPreviewVertBlankTime);
    PARAMETER_INITIALIZE(enableEVExpTableAdj);
    PARAMETER_INITIALIZE(enableEVGainCapping);
    PARAMETER_INITIALIZE(maxEVCappingGain);
    PARAMETER_INITIALIZE(ISOData);
    PARAMETER_INITIALIZE(antibandingVsFPSMethod);
    PARAMETER_INITIALIZE(enablePreviewManualISO);
    PARAMETER_INITIALIZE(enablePreviewManualExpTime);
    PARAMETER_INITIALIZE(enablePreviewManualFull);
    PARAMETER_INITIALIZE(disableBandingGainCapping);
}

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


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load ISOSettingType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void ISOSettingType::Load(
    ParameterLoadParameters& parentParams)
{
    PARAMETER_INITIALIZE(previewISO100Gain);
    PARAMETER_INITIALIZE(enableAntiBandingVsISOPrio);
    PARAMETER_INITIALIZE(enableISOQuantization);
    PARAMETER_INITIALIZE(thresQuantizationISOValueCount);
    PARAMETER_INITIALIZE(thresQuantizationISOValue);
    PARAMETER_INITIALIZE(quantizedISOValueCount);
    PARAMETER_INITIALIZE(quantizedISOValue);

    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 = 0xca69f153183d04c5;
        entry->ReadSimpleTypeFixedArray(&previewISO100Gain, 1, localParams);
        localParams.NameHash = 0xe3a03af489838216;
        entry->ReadSimpleTypeFixedArray(&enableAntiBandingVsISOPrio, 1, localParams);
        localParams.NameHash = 0xe8f4302b5428541b;
        entry->ReadSimpleTypeFixedArray(&enableISOQuantization, 1, localParams);
        localParams.NameHash = 0xae65ae6a3acdaa57;
        entry->ReadSimpleTypeArray(thresQuantizationISOValue, thresQuantizationISOValueCount, thresQuantizationISOValueID, 1,
            localParams, __COUNTER__);
        localParams.NameHash = 0xaae79c589625515c;
        entry->ReadSimpleTypeArray(quantizedISOValue, quantizedISOValueCount, quantizedISOValueID, 1,
            localParams, __COUNTER__);

        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 ISOSettingType::LoadArray(
    ParameterLoadParameters& __params,
    void*                    __array,
    UINT32                   __count)
{
    if (__array != nullptr)
    {
        ISOSettingType* arrayPtr = (ISOSettingType*)__array;
        for (UINT32 i = 0; i < __count; i++)
        {
            __params.Index = i;
            arrayPtr[i].Load(__params);
        }
    }
}

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

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load ExposureKneeType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void ExposureKneeType::Load(
    ParameterLoadParameters& parentParams)
{
    PARAMETER_INITIALIZE(gain);
    PARAMETER_INITIALIZE(expTime);
    PARAMETER_INITIALIZE(incrementPriority);
    PARAMETER_INITIALIZE(expIndex);

    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 = 0xb6319f731f23430c;
        entry->ReadSimpleTypeFixedArray(&gain, 1, localParams);
        localParams.NameHash = 0xbc9e1d8198d41a44;
        entry->ReadSimpleTypeFixedArray(&expTime, 1, localParams);
        localParams.NameHash = 0xb832139a7724de59;
        entry->ReadEnumFixedArray(&incrementPriority, 1, localParams);
        localParams.NameHash = 0xb16df62887dea6d4;
        entry->ReadSimpleTypeFixedArray(&expIndex, 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 ExposureKneeType::LoadArray(
    ParameterLoadParameters& __params,
    void*                    __array,
    UINT32                   __count)
{
    if (__array != nullptr)
    {
        ExposureKneeType* arrayPtr = (ExposureKneeType*)__array;
        for (UINT32 i = 0; i < __count; i++)
        {
            __params.Index = i;
            arrayPtr[i].Load(__params);
        }
    }
}

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

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load ExposureTableType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void ExposureTableType::Load(
    ParameterLoadParameters& parentParams)
{
    PARAMETER_INITIALIZE(sensitivityCorrectionFactor);
    PARAMETER_INITIALIZE(expKneeEntriesCount);
    PARAMETER_INITIALIZE(expKneeEntries);
    PARAMETER_INITIALIZE(thresAntiBandingMinExpTimePct);

    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 = 0xf9876f72faccc589;
        entry->ReadSimpleTypeFixedArray(&sensitivityCorrectionFactor, 1, localParams);
        localParams.NameHash = 0xf6577403ad33af77;
        entry->ReadStructureArray(expKneeEntries, expKneeEntriesCount, expKneeEntriesID, 1, localParams, __COUNTER__);
        localParams.NameHash = 0xcdcaa926a89226eb;
        entry->ReadSimpleTypeFixedArray(&thresAntiBandingMinExpTimePct, 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 ExposureTableType::LoadArray(
    ParameterLoadParameters& __params,
    void*                    __array,
    UINT32                   __count)
{
    if (__array != nullptr)
    {
        ExposureTableType* arrayPtr = (ExposureTableType*)__array;
        for (UINT32 i = 0; i < __count; i++)
        {
            __params.Index = i;
            arrayPtr[i].Load(__params);
        }
    }
}

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

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load AECCoreArbitrationType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void AECCoreArbitrationType::Load(
    ParameterLoadParameters& parentParams)
{
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(parameter_version);
    PARAMETER_INITIALIZE(expTablesCount);
    PARAMETER_INITIALIZE(expTables);
    PARAMETER_INITIALIZE(minPreviewVertBlankTime);
    PARAMETER_INITIALIZE(enableEVExpTableAdj);
    PARAMETER_INITIALIZE(enableEVGainCapping);
    PARAMETER_INITIALIZE(maxEVCappingGain);
    PARAMETER_INITIALIZE(ISOData);
    PARAMETER_INITIALIZE(antibandingVsFPSMethod);
    PARAMETER_INITIALIZE(enablePreviewManualISO);
    PARAMETER_INITIALIZE(enablePreviewManualExpTime);
    PARAMETER_INITIALIZE(enablePreviewManualFull);
    PARAMETER_INITIALIZE(disableBandingGainCapping);

    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        = 0xe11cd9f365a2599f;
        module_version.Load(localParams);
        localParams.NameHash        = 0xca3106e199a12935;
        parameter_version.Load(localParams);
        localParams.NameHash = 0xf847e7a2dbab515e;
        entry->ReadStructureArray(expTables, expTablesCount, expTablesID, 1, localParams, __COUNTER__);
        localParams.NameHash = 0xc373da77c2a539d3;
        entry->ReadSimpleTypeFixedArray(&minPreviewVertBlankTime, 1, localParams);
        localParams.NameHash = 0xab3cbeae0bfad850;
        entry->ReadSimpleTypeFixedArray(&enableEVExpTableAdj, 1, localParams);
        localParams.NameHash = 0xb89e5e2509419208;
        entry->ReadSimpleTypeFixedArray(&enableEVGainCapping, 1, localParams);
        localParams.NameHash = 0x9f30ffe725f1a614;
        entry->ReadSimpleTypeFixedArray(&maxEVCappingGain, 1, localParams);
        localParams.NameHash        = 0xd585fe0e719a22ab;
        ISOData.Load(localParams);
        localParams.NameHash = 0xdb38eb4961d6cd3f;
        entry->ReadEnumFixedArray(&antibandingVsFPSMethod, 1, localParams);
        localParams.NameHash = 0xe125c375c6cae702;
        entry->ReadSimpleTypeFixedArray(&enablePreviewManualISO, 1, localParams);
        localParams.NameHash = 0xa260f54c1a1c8208;
        entry->ReadSimpleTypeFixedArray(&enablePreviewManualExpTime, 1, localParams);
        localParams.NameHash = 0xd0c4453f82b44f74;
        entry->ReadSimpleTypeFixedArray(&enablePreviewManualFull, 1, localParams);
        localParams.NameHash = 0xd3a3c1a3e2f825b2;
        entry->ReadSimpleTypeFixedArray(&disableBandingGainCapping, 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 AECCoreArbitrationType::LoadArray(
    ParameterLoadParameters& __params,
    void*                    __array,
    UINT32                   __count)
{
    if (__array != nullptr)
    {
        AECCoreArbitrationType* arrayPtr = (AECCoreArbitrationType*)__array;
        for (UINT32 i = 0; i < __count; i++)
        {
            __params.Index = i;
            arrayPtr[i].Load(__params);
        }
    }
}

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

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load module_versionStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void AECCoreArbitrationType::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 AECCoreArbitrationType::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* AECCoreArbitrationType::module_versionStruct::AllocArray(
    UINT32 __count)
{
    module_versionStruct* result = nullptr;
    if (__count > 0)
    {
        result = PARAMETER_NEW module_versionStruct[__count];
    }
    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load parameter_versionStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void AECCoreArbitrationType::parameter_versionStruct::Load(
    ParameterLoadParameters& parentParams)
{
    PARAMETER_INITIALIZE(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 = 0xd594eed07a5650c5;
        entry->ReadStringFixedArray(&revision, 1, localParams, __COUNTER__);

        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 AECCoreArbitrationType::parameter_versionStruct::LoadArray(
    ParameterLoadParameters& __params,
    void*                    __array,
    UINT32                   __count)
{
    if (__array != nullptr)
    {
        parameter_versionStruct* arrayPtr = (parameter_versionStruct*)__array;
        for (UINT32 i = 0; i < __count; i++)
        {
            __params.Index = i;
            arrayPtr[i].Load(__params);
        }
    }
}

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

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload ISOSettingType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void ISOSettingType::Unload(ParameterFileSymbolTable* const __table)
{
    ParameterFileSymbolTable::ReleaseObject(__table, thresQuantizationISOValue);
    ParameterFileSymbolTable::ReleaseObject(__table, quantizedISOValue);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload ExposureTableType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void ExposureTableType::Unload(ParameterFileSymbolTable* const __table)
{
    ParameterFileSymbolTable::ReleaseObject(__table, expKneeEntries);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload AECCoreArbitrationType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void AECCoreArbitrationType::Unload(ParameterFileSymbolTable* const __table)
{
    parameter_version.Unload(__table);
    for (UINT32 i = 0; expTables != nullptr && i < expTablesCount; i++)
    {
        expTables[i].Unload(__table);
    }
    ParameterFileSymbolTable::ReleaseObject(__table, expTables);
    ISOData.Unload(__table);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload parameter_versionStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void AECCoreArbitrationType::parameter_versionStruct::Unload(ParameterFileSymbolTable* const __table)
{
    ParameterFileSymbolTable::ReleaseObject(__table, revision);
}

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

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

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

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

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Create module, and return a new object
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ParameterModule* AECCoreArbitrationTypeClass::Create(
    ModuleData* const    moduleData,
    DefaultModule* const defModule) const
{
    AECCoreArbitrationTypeClass* 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 = (AECCoreArbitrationTypeClass*)module;
        }
        else
        {
            cls = PARAMETER_NEW AECCoreArbitrationTypeClass(Name, moduleData);
            cls->SymbolTableID = id;
            defModule->AddModule((ParameterModule*)cls);
        }
    }
    else if (Version.Value != moduleData->Version.Value)
    {
        PARAMETER_LOG_ERROR(moduleData->SetManager, "Unable to create AECCoreArbitrationTypeClass, binary version (%lld) does not match source version (%lld)\n",
            moduleData->Version.Value, Version.Value);
    }
    else
    {
        PARAMETER_LOG_ERROR(moduleData->SetManager, "Unable to create AECCoreArbitrationTypeClass, 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 AECCoreArbitrationTypeClass::LoadModule(
    ParameterFileSymbolTable* const table)
{
    bool result = true;

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

    if (!Loaded)
    {
        AECCoreArbitrationTypeClass* 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, "AECCoreArbitrationTypeClass::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 AECCoreArbitrationTypeClass::UnloadModule()
{
#ifdef PARAMETER_USE_MUTEX
    ParameterMutexLocker lock(Mutex); // Unique LOCK
#endif

    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 AECCoreArbitrationTypeClass::Release()
{
    ParameterModule::Release();
}

AECARBITRATION_NAMESPACE_END
