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

#include "aecxscenechangedetector.h"
#include "parametersetmanager.h"

AECXSCENECHANGEDETECTOR_NAMESPACE_BEGIN

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

    return __result;
}

bool HoldTimeEnterConfigType::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, "settleThres") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            settleThres = (float)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "settleTimeThres") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            settleTimeThres = (float)dblValue; 
        }
    }

    return __result;
}

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

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

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

    return __result;
}

bool HoldTimeConfigType::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, "enable") == 0)
    {
        ParameterUtils::DoubleToString((double)enable, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "holdTimeData") == 0)
    {
        __result = holdTimeData.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "holdTimeFilterType") == 0)
    {
        ParameterUtils::DoubleToString((double)(UINT32)holdTimeFilterType, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "strictHoldTimeEn") == 0)
    {
        ParameterUtils::DoubleToString((double)strictHoldTimeEn, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "holdTimeEnterConfig") == 0)
    {
        __result = holdTimeEnterConfig.GetValue(&__path[__pos], __value, __size);
    }

    return __result;
}

bool HoldTimeConfigType::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, "enable") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            enable = (BOOL)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "holdTimeData") == 0)
    {
        __result = holdTimeData.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "holdTimeFilterType") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            holdTimeFilterType = (HoldTimeFilterType)(UINT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "strictHoldTimeEn") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            strictHoldTimeEn = (BOOL)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "holdTimeEnterConfig") == 0)
    {
        __result = holdTimeEnterConfig.SetValue(&__path[__pos], __value);
    }

    return __result;
}

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

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

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

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

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

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

    return __result;
}

bool SCPostStableConfigType::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, "windowSize") == 0)
    {
        ParameterUtils::DoubleToString((double)windowSize, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "variationThres") == 0)
    {
        ParameterUtils::DoubleToString((double)variationThres, __value, __size);
        __result = true;
    }

    return __result;
}

bool SCPostStableConfigType::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, "windowSize") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            windowSize = (UINT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "variationThres") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            variationThres = (float)dblValue; 
        }
    }

    return __result;
}

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

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

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

    return __result;
}

bool SCThresCoreDataType::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, "valueThres") == 0)
    {
        ParameterUtils::DoubleToString((double)valueThres, __value, __size);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "countThres") == 0)
    {
        ParameterUtils::DoubleToString((double)countThres, __value, __size, 0);
        __result = true;
    }

    return __result;
}

bool SCThresCoreDataType::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, "valueThres") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            valueThres = (float)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "countThres") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            countThres = (UINT32)dblValue; 
        }
    }

    return __result;
}

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

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

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

    return __result;
}

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

    return __result;
}

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

    return __result;
}

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

    // trigger
    if (__name[0] == '\0')
    {
        __result = true;
        __info.Add(ParameterParserInfo("trigger", ParameterParserDataType::Structure));
    }
    else if (PARAMETER_STRCMP(__name, "trigger") == 0)
    {
        __result = trigger.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 SCThresLevel2DataType::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, "trigger") == 0)
    {
        __result = trigger.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "trigger3") == 0)
    {
        if (__index < trigger3Count)
        {
            __result = trigger3[__index].GetValue(&__path[__pos], __value, __size);
        }
    }

    return __result;
}

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

    return __result;
}

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

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

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

    return __result;
}

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

    return __result;
}

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

    return __result;
}

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

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

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

    return __result;
}

bool SCThresTriggerDataType::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, "trigger1DataBank") == 0)
    {
        __result = trigger1DataBank.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "trigger2DataBank") == 0)
    {
        __result = trigger2DataBank.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "trigger3DataBank") == 0)
    {
        __result = trigger3DataBank.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "trigger1") == 0)
    {
        if (__index < trigger1Count)
        {
            __result = trigger1[__index].GetValue(&__path[__pos], __value, __size);
        }
    }

    return __result;
}

bool SCThresTriggerDataType::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, "trigger1DataBank") == 0)
    {
        __result = trigger1DataBank.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "trigger2DataBank") == 0)
    {
        __result = trigger2DataBank.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "trigger3DataBank") == 0)
    {
        __result = trigger3DataBank.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "trigger1") == 0)
    {
        if (__index < trigger1Count)
        {
            __result = trigger1[__index].SetValue(&__path[__pos], __value);
        }
    }

    return __result;
}

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

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

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

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

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

    return __result;
}

bool SCDetectionThresConfigType::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, "thresData") == 0)
    {
        __result = thresData.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "baselineType") == 0)
    {
        ParameterUtils::DoubleToString((double)(UINT32)baselineType, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "fixedBaselineValue") == 0)
    {
        ParameterUtils::DoubleToString((double)fixedBaselineValue, __value, __size);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "bUsePercentageError") == 0)
    {
        ParameterUtils::DoubleToString((double)bUsePercentageError, __value, __size, 0);
        __result = true;
    }

    return __result;
}

bool SCDetectionThresConfigType::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, "thresData") == 0)
    {
        __result = thresData.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "baselineType") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            baselineType = (SCDetectionBaselineType)(UINT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "fixedBaselineValue") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            fixedBaselineValue = (float)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "bUsePercentageError") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            bUsePercentageError = (BOOL)dblValue; 
        }
    }

    return __result;
}

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

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

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

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

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

    return __result;
}

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

    return __result;
}

bool SCDetectionInputDataType::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, "inputDataSource") == 0)
    {
        __result = inputDataSource.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "windowSize") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            windowSize = (UINT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "filterType") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            filterType = (SCDetectionDataFilterType)(UINT32)dblValue; 
        }
    }

    return __result;
}

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

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

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

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

    return __result;
}

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

    return __result;
}

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

    return __result;
}

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

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

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

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

    return __result;
}

bool AECSCDType::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, "enable") == 0)
    {
        ParameterUtils::DoubleToString((double)enable, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "priority") == 0)
    {
        ParameterUtils::DoubleToString((double)(UINT32)priority, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "SCDId") == 0)
    {
        ParameterUtils::DoubleToString((double)SCDId, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "SCDName") == 0)
    {
        PARAMETER_STRCPY(__value, __size, SCDName);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "SCDetectionConfig") == 0)
    {
        __result = SCDetectionConfig.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "holdTimeConfig") == 0)
    {
        __result = holdTimeConfig.GetValue(&__path[__pos], __value, __size);
    }

    return __result;
}

bool AECSCDType::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, "enable") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            enable = (BOOL)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "priority") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            priority = (SCDetectionRunPriority)(UINT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "SCDId") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            SCDId = (UINT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "SCDName") == 0)
    {
        // Cannot modify strings, risk of memory leaks or corruption
    }
    else if (PARAMETER_STRCMP(__name, "SCDetectionConfig") == 0)
    {
        __result = SCDetectionConfig.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "holdTimeConfig") == 0)
    {
        __result = holdTimeConfig.SetValue(&__path[__pos], __value);
    }

    return __result;
}

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

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

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

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

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

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

    return __result;
}

bool AECXSceneChangeDetectorType::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, "scdBank") == 0)
    {
        if (__index < scdBankCount)
        {
            __result = scdBank[__index].GetValue(&__path[__pos], __value, __size);
        }
    }

    return __result;
}

bool AECXSceneChangeDetectorType::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, "scdBank") == 0)
    {
        if (__index < scdBankCount)
        {
            __result = scdBank[__index].SetValue(&__path[__pos], __value);
        }
    }

    return __result;
}

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

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

    return __result;
}

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

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

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

    return __result;
}

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

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

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

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

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

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

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

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

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

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

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

    if (result)
    {
        switch (uintValue)
        {
        case static_cast<UINT32>(SCDetectionRunPriority::MeteringStart):
            enumValue = SCDetectionRunPriority::MeteringStart;
            result    = true;
            break;
        case static_cast<UINT32>(SCDetectionRunPriority::ConvergenceStart):
            enumValue = SCDetectionRunPriority::ConvergenceStart;
            result    = true;
            break;
        case static_cast<UINT32>(SCDetectionRunPriority::ExtensionStart):
            enumValue = SCDetectionRunPriority::ExtensionStart;
            result    = true;
            break;
        case static_cast<UINT32>(SCDetectionRunPriority::ExtensionEnd):
            enumValue = SCDetectionRunPriority::ExtensionEnd;
            result    = true;
            break;
        case static_cast<UINT32>(SCDetectionRunPriority::EndOfFrame):
            enumValue = SCDetectionRunPriority::EndOfFrame;
            result    = true;
            break;
        case static_cast<UINT32>(SCDetectionRunPriority::Invalid):
            enumValue = SCDetectionRunPriority::Invalid;
            result    = true;
            break;
        default:
            PARAMETER_LOG_ERROR(entry->SetManager, "Invalid value(% u) converting UINT32 to SCDetectionRunPriority", uintValue);
            break;
        }
    }
    return result;
}


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Default Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
AECXSceneChangeDetectorTypeClass::AECXSceneChangeDetectorTypeClass(
    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(scdBankCount);
    PARAMETER_INITIALIZE(scdBank);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
AECXSceneChangeDetectorTypeClass::AECXSceneChangeDetectorTypeClass(
    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(scdBank);
}

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

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

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

    PARAMETER_INITIALIZE(enable);
    PARAMETER_INITIALIZE(settleThres);
    PARAMETER_INITIALIZE(settleTimeThres);

    SYMBOL_TABLE_ENTRY_READ(entry, result, enable, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, settleThres, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, settleTimeThres, alignment)

    return result;
}

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

    PARAMETER_INITIALIZE(enable);
    PARAMETER_INITIALIZE(holdTimeData);
    PARAMETER_INITIALIZE(holdTimeFilterType);
    PARAMETER_INITIALIZE(strictHoldTimeEn);
    PARAMETER_INITIALIZE(holdTimeEnterConfig);

    SYMBOL_TABLE_ENTRY_READ(entry, result, enable, alignment)
    if (result)
    {
        result = holdTimeData.Load(entry, alignment);
    }
    if (result)
    {
        result = aecxscenechangedetector::ReadEnum_HoldTimeFilterType(entry, holdTimeFilterType, alignment);
    }
    SYMBOL_TABLE_ENTRY_READ(entry, result, strictHoldTimeEn, alignment)
    if (result)
    {
        result = holdTimeEnterConfig.Load(entry, alignment);
    }

    return result;
}

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

    PARAMETER_INITIALIZE(windowSize);
    PARAMETER_INITIALIZE(variationThres);

    SYMBOL_TABLE_ENTRY_READ(entry, result, windowSize, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, variationThres, alignment)

    return result;
}

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

    PARAMETER_INITIALIZE(valueThres);
    PARAMETER_INITIALIZE(countThres);

    SYMBOL_TABLE_ENTRY_READ(entry, result, valueThres, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, countThres, alignment)

    return result;
}

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

    PARAMETER_INITIALIZE(trigger);
    PARAMETER_INITIALIZE(triggerData);

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

    return result;
}

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

    PARAMETER_INITIALIZE(trigger);
    PARAMETER_INITIALIZE(trigger3);

    result = trigger.Load(entry, alignment);

    // Reading Array trigger3 from symbol table
    // Do not check result value here because the count value needs to be initialized in this block
    {
        trigger3Count = 0;
        SYMBOL_TABLE_ENTRY_READ(entry, result, trigger3Count, 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)
        {
            trigger3ID = pointerEntry->ID;
            DupObjInfo* trigger3DupInfo = pointerEntry->GetDupObject(trigger3Count, file, line);
            if (trigger3DupInfo != nullptr && trigger3DupInfo->Object != nullptr)
            {
                trigger3 = (SCThresLevel3DataType*)trigger3DupInfo->Object;
                if (trigger3 == nullptr)
                {
                    if (trigger3DupInfo->File != nullptr)
                    {
                        PARAMETER_LOG_ERROR(entry->SetManager, "trigger3 duplicate found but object is nullptr: %s:%d, RefCount: %d\n",
                            trigger3DupInfo->File, trigger3DupInfo->Line, trigger3DupInfo->RefCount);
                    }
                    else
                    {
                        PARAMETER_LOG_ERROR(entry->SetManager, "trigger3 duplicate found but Object is nullptr: <nullptr file ptr>:%d, RefCount: %d\n",
                            trigger3DupInfo->Line, trigger3DupInfo->RefCount);
                    }
                }
            }

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

    return result;
}

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

    PARAMETER_INITIALIZE(trigger);
    PARAMETER_INITIALIZE(trigger2);

    result = trigger.Load(entry, alignment);

    // Reading Array trigger2 from symbol table
    // Do not check result value here because the count value needs to be initialized in this block
    {
        trigger2Count = 0;
        SYMBOL_TABLE_ENTRY_READ(entry, result, trigger2Count, 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)
        {
            trigger2ID = pointerEntry->ID;
            DupObjInfo* trigger2DupInfo = pointerEntry->GetDupObject(trigger2Count, file, line);
            if (trigger2DupInfo != nullptr && trigger2DupInfo->Object != nullptr)
            {
                trigger2 = (SCThresLevel2DataType*)trigger2DupInfo->Object;
                if (trigger2 == nullptr)
                {
                    if (trigger2DupInfo->File != nullptr)
                    {
                        PARAMETER_LOG_ERROR(entry->SetManager, "trigger2 duplicate found but object is nullptr: %s:%d, RefCount: %d\n",
                            trigger2DupInfo->File, trigger2DupInfo->Line, trigger2DupInfo->RefCount);
                    }
                    else
                    {
                        PARAMETER_LOG_ERROR(entry->SetManager, "trigger2 duplicate found but Object is nullptr: <nullptr file ptr>:%d, RefCount: %d\n",
                            trigger2DupInfo->Line, trigger2DupInfo->RefCount);
                    }
                }
            }

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

    return result;
}

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

    PARAMETER_INITIALIZE(trigger1DataBank);
    PARAMETER_INITIALIZE(trigger2DataBank);
    PARAMETER_INITIALIZE(trigger3DataBank);
    PARAMETER_INITIALIZE(trigger1);

    result = trigger1DataBank.Load(entry, alignment);
    if (result)
    {
        result = trigger2DataBank.Load(entry, alignment);
    }
    if (result)
    {
        result = trigger3DataBank.Load(entry, alignment);
    }

    // Reading Array trigger1 from symbol table
    // Do not check result value here because the count value needs to be initialized in this block
    {
        trigger1Count = 0;
        SYMBOL_TABLE_ENTRY_READ(entry, result, trigger1Count, 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)
        {
            trigger1ID = pointerEntry->ID;
            DupObjInfo* trigger1DupInfo = pointerEntry->GetDupObject(trigger1Count, file, line);
            if (trigger1DupInfo != nullptr && trigger1DupInfo->Object != nullptr)
            {
                trigger1 = (SCThresLevel1DataType*)trigger1DupInfo->Object;
                if (trigger1 == nullptr)
                {
                    if (trigger1DupInfo->File != nullptr)
                    {
                        PARAMETER_LOG_ERROR(entry->SetManager, "trigger1 duplicate found but object is nullptr: %s:%d, RefCount: %d\n",
                            trigger1DupInfo->File, trigger1DupInfo->Line, trigger1DupInfo->RefCount);
                    }
                    else
                    {
                        PARAMETER_LOG_ERROR(entry->SetManager, "trigger1 duplicate found but Object is nullptr: <nullptr file ptr>:%d, RefCount: %d\n",
                            trigger1DupInfo->Line, trigger1DupInfo->RefCount);
                    }
                }
            }

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

    return result;
}

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

    PARAMETER_INITIALIZE(thresData);
    PARAMETER_INITIALIZE(baselineType);
    PARAMETER_INITIALIZE(fixedBaselineValue);
    PARAMETER_INITIALIZE(bUsePercentageError);

    result = thresData.Load(entry, alignment);
    if (result)
    {
        result = aecxscenechangedetector::ReadEnum_SCDetectionBaselineType(entry, baselineType, alignment);
    }
    SYMBOL_TABLE_ENTRY_READ(entry, result, fixedBaselineValue, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, bUsePercentageError, alignment)

    return result;
}

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

    PARAMETER_INITIALIZE(inputDataSource);
    PARAMETER_INITIALIZE(windowSize);
    PARAMETER_INITIALIZE(filterType);

    result = inputDataSource.Load(entry, alignment);
    SYMBOL_TABLE_ENTRY_READ(entry, result, windowSize, alignment)
    if (result)
    {
        result = aecxscenechangedetector::ReadEnum_SCDetectionDataFilterType(entry, filterType, alignment);
    }

    return result;
}

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

    PARAMETER_INITIALIZE(inputDataConfig);
    PARAMETER_INITIALIZE(thresConfig);
    PARAMETER_INITIALIZE(SCPostStableConfig);

    result = inputDataConfig.Load(entry, alignment);
    if (result)
    {
        result = thresConfig.Load(entry, alignment);
    }
    if (result)
    {
        result = SCPostStableConfig.Load(entry, alignment);
    }

    return result;
}

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

    PARAMETER_INITIALIZE(enable);
    PARAMETER_INITIALIZE(priority);
    PARAMETER_INITIALIZE(SCDId);
    PARAMETER_INITIALIZE(SCDName);
    PARAMETER_INITIALIZE(SCDetectionConfig);
    PARAMETER_INITIALIZE(holdTimeConfig);

    SYMBOL_TABLE_ENTRY_READ(entry, result, enable, alignment)
    if (result)
    {
        result = aecxscenechangedetector::ReadEnum_SCDetectionRunPriority(entry, priority, alignment);
    }
    SYMBOL_TABLE_ENTRY_READ(entry, result, SCDId, 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)
    }
    if (result)
    {
        result = SCDetectionConfig.Load(entry, alignment);
    }
    if (result)
    {
        result = holdTimeConfig.Load(entry, alignment);
    }

    return result;
}

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

    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(parameter_version);
    PARAMETER_INITIALIZE(moduleID);
    PARAMETER_INITIALIZE(scdBank);

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

    // Reading Array scdBank from symbol table
    // Do not check result value here because the count value needs to be initialized in this block
    {
        scdBankCount = 0;
        SYMBOL_TABLE_ENTRY_READ(entry, result, scdBankCount, 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)
        {
            scdBankID = pointerEntry->ID;
            DupObjInfo* scdBankDupInfo = pointerEntry->GetDupObject(scdBankCount, file, line);
            if (scdBankDupInfo != nullptr && scdBankDupInfo->Object != nullptr)
            {
                scdBank = (AECSCDType*)scdBankDupInfo->Object;
                if (scdBank == nullptr)
                {
                    if (scdBankDupInfo->File != nullptr)
                    {
                        PARAMETER_LOG_ERROR(entry->SetManager, "scdBank duplicate found but object is nullptr: %s:%d, RefCount: %d\n",
                            scdBankDupInfo->File, scdBankDupInfo->Line, scdBankDupInfo->RefCount);
                    }
                    else
                    {
                        PARAMETER_LOG_ERROR(entry->SetManager, "scdBank duplicate found but Object is nullptr: <nullptr file ptr>:%d, RefCount: %d\n",
                            scdBankDupInfo->Line, scdBankDupInfo->RefCount);
                    }
                }
            }

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

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load module_versionStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool AECXSceneChangeDetectorType::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 AECXSceneChangeDetectorType::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 HoldTimeConfigType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void HoldTimeConfigType::Unload(ParameterFileSymbolTable* const __table)
{
    holdTimeData.Unload(__table);
}

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

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

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

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload SCDetectionThresConfigType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void SCDetectionThresConfigType::Unload(ParameterFileSymbolTable* const __table)
{
    thresData.Unload(__table);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload SCDetectionConfigType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void SCDetectionConfigType::Unload(ParameterFileSymbolTable* const __table)
{
    thresConfig.Unload(__table);
}

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

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload AECXSceneChangeDetectorType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void AECXSceneChangeDetectorType::Unload(ParameterFileSymbolTable* const __table)
{
    parameter_version.Unload(__table);
    for (UINT32 i = 0; i < scdBankCount; i++)
    {
        scdBank[i].Unload(__table);
    }
    if (__table != nullptr && __table->ReleaseDupObject(scdBank))
    {
        PARAMETER_DELETE[] scdBank;
    }
    scdBank = nullptr;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload parameter_versionStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void AECXSceneChangeDetectorType::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 AECXSceneChangeDetectorType::Release()
{
    ((AECXSceneChangeDetectorTypeClass*)this)->Release();
}

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

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

    return (ParameterModule*)cls;
}

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

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

AECXSCENECHANGEDETECTOR_NAMESPACE_END
