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

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

#include "aecxmetering.h"
#include "parametersetmanager.h"

AECXMETERING_NAMESPACE_BEGIN

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

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

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

    return __result;
}

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

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

    if (PARAMETER_STRCMP(__name, "enableAntibandingPrioOverLuma") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            enableAntibandingPrioOverLuma = (BOOL)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "clampThresholdAsFactorOfMinExposure") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            clampThresholdAsFactorOfMinExposure = (float)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "exitThresholdAsFactorOfMinExposure") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            exitThresholdAsFactorOfMinExposure = (float)dblValue; 
        }
    }

    return __result;
}

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

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

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

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

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

    return __result;
}

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

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

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

    return __result;
}

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

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

    if (PARAMETER_STRCMP(__name, "enableAntibandingPrioOverADRC") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            enableAntibandingPrioOverADRC = (BOOL)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "exitThresholdAsFactorOfMinExposure") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            exitThresholdAsFactorOfMinExposure = (float)dblValue; 
        }
    }

    return __result;
}

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

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

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

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

    return __result;
}

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

    return __result;
}

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

    return __result;
}

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

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

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

    return __result;
}

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

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

    if (PARAMETER_STRCMP(__name, "enable") == 0)
    {
        ParameterUtils::DoubleToString((double)enable, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "SCDName") == 0)
    {
        PARAMETER_STRCPY(__value, __size, SCDName);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "scdDelayCount") == 0)
    {
        ParameterUtils::DoubleToString((double)scdDelayCount, __value, __size, 0);
        __result = true;
    }

    return __result;
}

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

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

    if (PARAMETER_STRCMP(__name, "enable") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            enable = (BOOL)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "SCDName") == 0)
    {
        // Cannot modify strings, risk of memory leaks or corruption
    }
    else if (PARAMETER_STRCMP(__name, "scdDelayCount") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            scdDelayCount = (INT32)dblValue; 
        }
    }

    return __result;
}

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

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

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

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

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

    return __result;
}

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

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

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

    return __result;
}

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

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

    if (PARAMETER_STRCMP(__name, "filteringFactor") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            filteringFactor = (float)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "enableCompensation") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            enableCompensation = (BOOL)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "refExposureForLuxIndexZero") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            refExposureForLuxIndexZero = (UINT64)dblValue; 
        }
    }

    return __result;
}

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

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

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

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

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

    return __result;
}

bool AECXMeteringType::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, "moduleID") == 0)
    {
        ParameterUtils::DoubleToString((double)(UINT32)moduleID, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "luxIndexOperation") == 0)
    {
        __result = luxIndexOperation.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "dynamicMtrLockEV") == 0)
    {
        __result = dynamicMtrLockEV.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "trackerStatsROIProcess") == 0)
    {
        __result = trackerStatsROIProcess.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "antibandingMetering") == 0)
    {
        __result = antibandingMetering.GetValue(&__path[__pos], __value, __size);
    }

    return __result;
}

bool AECXMeteringType::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, "moduleID") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            moduleID = (aecxglobalelements::AECXModuleIDType)(UINT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "luxIndexOperation") == 0)
    {
        __result = luxIndexOperation.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "dynamicMtrLockEV") == 0)
    {
        __result = dynamicMtrLockEV.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "trackerStatsROIProcess") == 0)
    {
        __result = trackerStatsROIProcess.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "antibandingMetering") == 0)
    {
        __result = antibandingMetering.SetValue(&__path[__pos], __value);
    }

    return __result;
}

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

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

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

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

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

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

    return __result;
}

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

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

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

    return __result;
}

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

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

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

    return __result;
}

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

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

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

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

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

    return __result;
}

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

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

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

    return __result;
}

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

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

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

    return __result;
}

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

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

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

    return __result;
}

bool AECXMeteringType::trackerStatsROIProcessStruct::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, "statsROIProcessEnable") == 0)
    {
        ParameterUtils::DoubleToString((double)statsROIProcessEnable, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "statsROIPriority") == 0)
    {
        __result = statsROIPriority.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "statsROIStable") == 0)
    {
        __result = statsROIStable.GetValue(&__path[__pos], __value, __size);
    }

    return __result;
}

bool AECXMeteringType::trackerStatsROIProcessStruct::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, "statsROIProcessEnable") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            statsROIProcessEnable = (statsglobalelements::glbEnableFlagType)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "statsROIPriority") == 0)
    {
        __result = statsROIPriority.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "statsROIStable") == 0)
    {
        __result = statsROIStable.SetValue(&__path[__pos], __value);
    }

    return __result;
}

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

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

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

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

    return __result;
}


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Default Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
AECXMeteringTypeClass::AECXMeteringTypeClass(
    const CHAR* const name)
    : ParameterModule(name, MAJOR, MINOR, PATCH, nullptr)
{
    PARAMETER_INITIALIZE(SymbolTableID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(parameter_version);
    PARAMETER_INITIALIZE(moduleID);
    PARAMETER_INITIALIZE(luxIndexOperation);
    PARAMETER_INITIALIZE(dynamicMtrLockEV);
    PARAMETER_INITIALIZE(trackerStatsROIProcess);
    PARAMETER_INITIALIZE(antibandingMetering);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
AECXMeteringTypeClass::AECXMeteringTypeClass(
    const CHAR* const name,
    ModuleData* const moduleData)
    : ParameterModule(name, MAJOR, MINOR, PATCH, moduleData)
{
    PARAMETER_INITIALIZE(SymbolTableID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(parameter_version);
    PARAMETER_INITIALIZE(moduleID);
    PARAMETER_INITIALIZE(luxIndexOperation);
    PARAMETER_INITIALIZE(dynamicMtrLockEV);
    PARAMETER_INITIALIZE(trackerStatsROIProcess);
    PARAMETER_INITIALIZE(antibandingMetering);
}

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

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

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

    PARAMETER_INITIALIZE(enableAntibandingPrioOverLuma);
    PARAMETER_INITIALIZE(clampThresholdAsFactorOfMinExposure);
    PARAMETER_INITIALIZE(exitThresholdAsFactorOfMinExposure);

    SYMBOL_TABLE_ENTRY_READ(entry, result, enableAntibandingPrioOverLuma, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, clampThresholdAsFactorOfMinExposure, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, exitThresholdAsFactorOfMinExposure, alignment)

    return result;
}

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

    PARAMETER_INITIALIZE(enableAntibandingPrioOverADRC);
    PARAMETER_INITIALIZE(exitThresholdAsFactorOfMinExposure);

    SYMBOL_TABLE_ENTRY_READ(entry, result, enableAntibandingPrioOverADRC, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, exitThresholdAsFactorOfMinExposure, alignment)

    return result;
}

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

    PARAMETER_INITIALIZE(antibandingVsADRC);
    PARAMETER_INITIALIZE(antibandingVsLuma);

    result = antibandingVsADRC.Load(entry, alignment);
    if (result)
    {
        result = antibandingVsLuma.Load(entry, alignment);
    }

    return result;
}

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

    PARAMETER_INITIALIZE(enable);
    PARAMETER_INITIALIZE(SCDName);
    PARAMETER_INITIALIZE(scdDelayCount);

    SYMBOL_TABLE_ENTRY_READ(entry, result, enable, alignment)

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

    return result;
}

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

    PARAMETER_INITIALIZE(filteringFactor);
    PARAMETER_INITIALIZE(enableCompensation);
    PARAMETER_INITIALIZE(refExposureForLuxIndexZero);

    SYMBOL_TABLE_ENTRY_READ(entry, result, filteringFactor, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, enableCompensation, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, refExposureForLuxIndexZero, alignment)

    return result;
}

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

    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(parameter_version);
    PARAMETER_INITIALIZE(moduleID);
    PARAMETER_INITIALIZE(luxIndexOperation);
    PARAMETER_INITIALIZE(dynamicMtrLockEV);
    PARAMETER_INITIALIZE(trackerStatsROIProcess);
    PARAMETER_INITIALIZE(antibandingMetering);

    result = module_version.Load(entry, alignment);
    if (result)
    {
        result = parameter_version.Load(entry, alignment);
    }
    if (result)
    {
        result = aecxglobalelements::ReadEnum_AECXModuleIDType(entry, moduleID, alignment);
    }
    if (result)
    {
        result = luxIndexOperation.Load(entry, alignment);
    }
    if (result)
    {
        result = dynamicMtrLockEV.Load(entry, alignment);
    }
    if (result)
    {
        result = trackerStatsROIProcess.Load(entry, alignment);
    }
    if (result)
    {
        result = antibandingMetering.Load(entry, alignment);
    }

    return result;
}

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

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

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

    return result;
}

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

    PARAMETER_INITIALIZE(revision);


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

    return result;
}

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

    PARAMETER_INITIALIZE(statsROIProcessEnable);
    PARAMETER_INITIALIZE(statsROIPriority);
    PARAMETER_INITIALIZE(statsROIStable);

    SYMBOL_TABLE_ENTRY_READ(entry, result, statsROIProcessEnable, alignment)
    if (result)
    {
        result = statsROIPriority.Load(entry, alignment);
    }
    if (result)
    {
        result = statsROIStable.Load(entry, alignment);
    }

    return result;
}

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

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload AECXMeteringType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void AECXMeteringType::Unload(ParameterFileSymbolTable* const __table)
{
    parameter_version.Unload(__table);
    dynamicMtrLockEV.Unload(__table);
    trackerStatsROIProcess.Unload(__table);
}

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

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload trackerStatsROIProcessStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void AECXMeteringType::trackerStatsROIProcessStruct::Unload(ParameterFileSymbolTable* const __table)
{
    statsROIPriority.Unload(__table);
    statsROIStable.Unload(__table);
}

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

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

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

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

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

    return (ParameterModule*)cls;
}

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

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

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

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

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

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

    return result;
}

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

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

AECXMETERING_NAMESPACE_END
