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

#include "aecdepth.h"
#include "parametersetmanager.h"

AECDEPTH_NAMESPACE_BEGIN

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// SetValue/GetValue Functions
/// Gets or sets the requested value
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool DepthConvergenceType::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, "convSpeedAdjRatio") == 0)
    {
        ParameterUtils::DoubleToString((double)convSpeedAdjRatio, __value, __size);
        __result = true;
    }

    return __result;
}

bool DepthConvergenceType::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, "convSpeedAdjRatio") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            convSpeedAdjRatio = (float)dblValue; 
        }
    }

    return __result;
}

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

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

    return __result;
}

bool DepthWeightZoneDataType::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, "weight") == 0)
    {
        ParameterUtils::DoubleToString((double)weight, __value, __size);
        __result = true;
    }

    return __result;
}

bool DepthWeightZoneDataType::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, "weight") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            weight = (float)dblValue; 
        }
    }

    return __result;
}

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

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

    return __result;
}

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

    return __result;
}

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

    return __result;
}

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

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

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

    return __result;
}

bool DepthMapLUT::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, "knees") == 0)
    {
        if (__index < kneesCount)
        {
            __result = knees[__index].GetValue(&__path[__pos], __value, __size);
        }
    }
    else if (PARAMETER_STRCMP(__name, "type") == 0)
    {
        ParameterUtils::DoubleToString((double)(UINT32)type, __value, __size, 0);
        __result = true;
    }

    return __result;
}

bool DepthMapLUT::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, "knees") == 0)
    {
        if (__index < kneesCount)
        {
            __result = knees[__index].SetValue(&__path[__pos], __value);
        }
    }
    else if (PARAMETER_STRCMP(__name, "type") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            type = (aecglobalelements::AECDepthLUTType)(UINT32)dblValue; 
        }
    }

    return __result;
}

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

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

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

    return __result;
}

bool DepthMeteringType::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, "depthMeteringWeight") == 0)
    {
        if (__index < depthMeteringWeightCount)
        {
            __result = depthMeteringWeight[__index].GetValue(&__path[__pos], __value, __size);
        }
    }
    else if (PARAMETER_STRCMP(__name, "mapsLUTs") == 0)
    {
        if (__index < mapsLUTsCount)
        {
            __result = mapsLUTs[__index].GetValue(&__path[__pos], __value, __size);
        }
    }
    else if (PARAMETER_STRCMP(__name, "temporalFilter") == 0)
    {
        ParameterUtils::DoubleToString((double)temporalFilter, __value, __size);
        __result = true;
    }

    return __result;
}

bool DepthMeteringType::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, "depthMeteringWeight") == 0)
    {
        if (__index < depthMeteringWeightCount)
        {
            __result = depthMeteringWeight[__index].SetValue(&__path[__pos], __value);
        }
    }
    else if (PARAMETER_STRCMP(__name, "mapsLUTs") == 0)
    {
        if (__index < mapsLUTsCount)
        {
            __result = mapsLUTs[__index].SetValue(&__path[__pos], __value);
        }
    }
    else if (PARAMETER_STRCMP(__name, "temporalFilter") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            temporalFilter = (float)dblValue; 
        }
    }

    return __result;
}

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

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

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

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

    return __result;
}

bool AECDepthType::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, "enableFlag") == 0)
    {
        ParameterUtils::DoubleToString((double)enableFlag, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "lumaDiffThres") == 0)
    {
        ParameterUtils::DoubleToString((double)lumaDiffThres, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "decisionMapValidGridCntThres") == 0)
    {
        ParameterUtils::DoubleToString((double)decisionMapValidGridCntThres, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "consecInvalidFrameCntThres") == 0)
    {
        ParameterUtils::DoubleToString((double)consecInvalidFrameCntThres, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "initValidFrameCntThres") == 0)
    {
        ParameterUtils::DoubleToString((double)initValidFrameCntThres, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "selectMapValidGridCntThres") == 0)
    {
        ParameterUtils::DoubleToString((double)selectMapValidGridCntThres, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "displayDebugMsg") == 0)
    {
        ParameterUtils::DoubleToString((double)displayDebugMsg, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "depthMtr") == 0)
    {
        __result = depthMtr.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "depthConv") == 0)
    {
        __result = depthConv.GetValue(&__path[__pos], __value, __size);
    }

    return __result;
}

bool AECDepthType::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, "enableFlag") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            enableFlag = (BOOL)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "lumaDiffThres") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            lumaDiffThres = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "decisionMapValidGridCntThres") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            decisionMapValidGridCntThres = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "consecInvalidFrameCntThres") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            consecInvalidFrameCntThres = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "initValidFrameCntThres") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            initValidFrameCntThres = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "selectMapValidGridCntThres") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            selectMapValidGridCntThres = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "displayDebugMsg") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            displayDebugMsg = (BOOL)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "depthMtr") == 0)
    {
        __result = depthMtr.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "depthConv") == 0)
    {
        __result = depthConv.SetValue(&__path[__pos], __value);
    }

    return __result;
}

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

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

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

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

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

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

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

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

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

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

    return __result;
}

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


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Default Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
AECDepthTypeClass::AECDepthTypeClass(
    const CHAR* const name)
    : ParameterModule(name, MAJOR, MINOR, PATCH, nullptr)
{
    PARAMETER_INITIALIZE(SymbolTableID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(parameter_version);
    PARAMETER_INITIALIZE(enableFlag);
    PARAMETER_INITIALIZE(lumaDiffThres);
    PARAMETER_INITIALIZE(decisionMapValidGridCntThres);
    PARAMETER_INITIALIZE(consecInvalidFrameCntThres);
    PARAMETER_INITIALIZE(initValidFrameCntThres);
    PARAMETER_INITIALIZE(selectMapValidGridCntThres);
    PARAMETER_INITIALIZE(displayDebugMsg);
    PARAMETER_INITIALIZE(depthMtr);
    PARAMETER_INITIALIZE(depthConv);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
AECDepthTypeClass::AECDepthTypeClass(
    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(enableFlag);
    PARAMETER_INITIALIZE(lumaDiffThres);
    PARAMETER_INITIALIZE(decisionMapValidGridCntThres);
    PARAMETER_INITIALIZE(consecInvalidFrameCntThres);
    PARAMETER_INITIALIZE(initValidFrameCntThres);
    PARAMETER_INITIALIZE(selectMapValidGridCntThres);
    PARAMETER_INITIALIZE(displayDebugMsg);
    PARAMETER_INITIALIZE(depthMtr);
    PARAMETER_INITIALIZE(depthConv);
}

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

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

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

    PARAMETER_INITIALIZE(convSpeedAdjRatio);

    SYMBOL_TABLE_ENTRY_READ(entry, result, convSpeedAdjRatio, alignment)

    return result;
}

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

    PARAMETER_INITIALIZE(weight);

    SYMBOL_TABLE_ENTRY_READ(entry, result, weight, alignment)

    return result;
}

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

    PARAMETER_INITIALIZE(triggerPt);
    PARAMETER_INITIALIZE(triggerData);

    result = triggerPt.Load(entry, alignment);
    if (result)
    {
        result = triggerData.Load(entry, alignment);
    }

    return result;
}

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

    PARAMETER_INITIALIZE(knees);
    PARAMETER_INITIALIZE(type);


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

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

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

    return result;
}

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

    PARAMETER_INITIALIZE(depthMeteringWeight);
    PARAMETER_INITIALIZE(mapsLUTs);
    PARAMETER_INITIALIZE(temporalFilter);


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

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

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

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

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

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

    return result;
}

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

    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(parameter_version);
    PARAMETER_INITIALIZE(enableFlag);
    PARAMETER_INITIALIZE(lumaDiffThres);
    PARAMETER_INITIALIZE(decisionMapValidGridCntThres);
    PARAMETER_INITIALIZE(consecInvalidFrameCntThres);
    PARAMETER_INITIALIZE(initValidFrameCntThres);
    PARAMETER_INITIALIZE(selectMapValidGridCntThres);
    PARAMETER_INITIALIZE(displayDebugMsg);
    PARAMETER_INITIALIZE(depthMtr);
    PARAMETER_INITIALIZE(depthConv);

    result = module_version.Load(entry, alignment);
    if (result)
    {
        result = parameter_version.Load(entry, alignment);
    }
    SYMBOL_TABLE_ENTRY_READ(entry, result, enableFlag, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, lumaDiffThres, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, decisionMapValidGridCntThres, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, consecInvalidFrameCntThres, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, initValidFrameCntThres, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, selectMapValidGridCntThres, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, displayDebugMsg, alignment)
    if (result)
    {
        result = depthMtr.Load(entry, alignment);
    }
    if (result)
    {
        result = depthConv.Load(entry, alignment);
    }

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load module_versionStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool AECDepthType::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 AECDepthType::parameter_versionStruct::Load(
    ParameterFileSymbolTableEntry* const entry,
    BYTE const alignment)
{
    bool result = true;

    PARAMETER_INITIALIZE(revision);


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

    return result;
}

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

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload DepthMeteringType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void DepthMeteringType::Unload(ParameterFileSymbolTable* const __table)
{
    if (__table != nullptr && __table->ReleaseDupObject(depthMeteringWeight))
    {
        PARAMETER_DELETE[] depthMeteringWeight;
    }
    depthMeteringWeight = nullptr;
    for (UINT32 i = 0; i < mapsLUTsCount; i++)
    {
        mapsLUTs[i].Unload(__table);
    }
    if (__table != nullptr && __table->ReleaseDupObject(mapsLUTs))
    {
        PARAMETER_DELETE[] mapsLUTs;
    }
    mapsLUTs = nullptr;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload AECDepthType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void AECDepthType::Unload(ParameterFileSymbolTable* const __table)
{
    parameter_version.Unload(__table);
    depthMtr.Unload(__table);
}

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

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

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

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Create module, and return a new object
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ParameterModule* AECDepthTypeClass::Create(
    ModuleData*    moduleData,
    DefaultModule* const defModule) const
{
    AECDepthTypeClass* 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 = (AECDepthTypeClass*)module;
        }
        else
        {
            cls = PARAMETER_NEW AECDepthTypeClass(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 AECDepthTypeClass, binary version (%lld) does not match source version (%lld)\n",
            moduleData->Version.Value, Version.Value);
    }
    else
    {
        PARAMETER_LOG_ERROR(moduleData->SetManager, "Unable to create AECDepthTypeClass, binary name (%s) does not match source name (%s)\n",
            moduleData->Type, Type);
    }

    return (ParameterModule*)cls;
}

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

    if (!Loaded)
    {
        BYTE const alignment = table->Alignment;
        AECDepthTypeClass* 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, "AECDepthTypeClass::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 AECDepthTypeClass::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 AECDepthTypeClass::Release()
{
    ParameterModule::Release();
}

AECDEPTH_NAMESPACE_END
