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

#include "aecxstartup.h"
#include "parametersetmanager.h"

AECXSTARTUP_NAMESPACE_BEGIN

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// SetValue/GetValue Functions
/// Gets or sets the requested value
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool LightDataTriggerDataType::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, "exposureZone") == 0)
    {
        __result = exposureZone.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "initialExposure") == 0)
    {
        if (__index < 3)
        {
            ParameterUtils::DoubleToString((double)initialExposure[__index], __value, __size, 0);
            __result = true;
        }
        else
        {
            SIZE_T __valuePos = 0;
            for (UINT32 i = 0; i < 3; i++)
            {
                if (i > 0)
                {
                    PARAMETER_STRCAT(__value, __size, ",");
                    __valuePos = PARAMETER_STRLEN(__value);
                }
                ParameterUtils::DoubleToString((double)initialExposure[i], &__value[__valuePos], (INT32)(__size - __valuePos), 0);
            }
            __result = true;
        }
    }

    return __result;
}

bool LightDataTriggerDataType::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, "exposureZone") == 0)
    {
        __result = exposureZone.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "initialExposure") == 0)
    {
        if (__index < 3)
        {
            const double dblValue = ParameterUtils::StringToDouble(__value, __result);
            if (__result)
            {
                initialExposure[__index] = (UINT64)dblValue; 
            }
        }
        else
        {
            SIZE_T __valueLen = PARAMETER_STRLEN(__value);
            UINT32 __pos = 0;

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

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

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

    return __result;
}

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

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

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

    return __result;
}

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

    return __result;
}

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

    return __result;
}

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

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

    return __result;
}

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

    return __result;
}

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

    return __result;
}

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

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

    return __result;
}

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

    return __result;
}

bool WarmStartType::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, "enableWarmStart") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            enableWarmStart = (BOOL)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "enableWarmStartCapping") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            enableWarmStartCapping = (BOOL)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "limits") == 0)
    {
        __result = limits.SetValue(&__path[__pos], __value);
    }

    return __result;
}

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

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

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

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

    return __result;
}

bool AECModeStartConfig::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, "type") == 0)
    {
        ParameterUtils::DoubleToString((double)(UINT32)type, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "exposures") == 0)
    {
        if (__index < 3)
        {
            ParameterUtils::DoubleToString((double)exposures[__index], __value, __size, 0);
            __result = true;
        }
        else
        {
            SIZE_T __valuePos = 0;
            for (UINT32 i = 0; i < 3; i++)
            {
                if (i > 0)
                {
                    PARAMETER_STRCAT(__value, __size, ",");
                    __valuePos = PARAMETER_STRLEN(__value);
                }
                ParameterUtils::DoubleToString((double)exposures[i], &__value[__valuePos], (INT32)(__size - __valuePos), 0);
            }
            __result = true;
        }
    }

    return __result;
}

bool AECModeStartConfig::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, "type") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            type = (aecxglobalelements::AECXStartUpExpType)(UINT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "exposures") == 0)
    {
        if (__index < 3)
        {
            const double dblValue = ParameterUtils::StringToDouble(__value, __result);
            if (__result)
            {
                exposures[__index] = (UINT64)dblValue; 
            }
        }
        else
        {
            SIZE_T __valueLen = PARAMETER_STRLEN(__value);
            UINT32 __pos = 0;

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

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

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

    return __result;
}

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

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

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

    return __result;
}

bool AECXStartUpType::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, "defaultStart") == 0)
    {
        __result = defaultStart.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "modeStarts") == 0)
    {
        if (__index < modeStartsCount)
        {
            __result = modeStarts[__index].GetValue(&__path[__pos], __value, __size);
        }
    }
    else if (PARAMETER_STRCMP(__name, "warmStart") == 0)
    {
        __result = warmStart.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "extSensorAssitStart") == 0)
    {
        __result = extSensorAssitStart.GetValue(&__path[__pos], __value, __size);
    }

    return __result;
}

bool AECXStartUpType::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, "defaultStart") == 0)
    {
        __result = defaultStart.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "modeStarts") == 0)
    {
        if (__index < modeStartsCount)
        {
            __result = modeStarts[__index].SetValue(&__path[__pos], __value);
        }
    }
    else if (PARAMETER_STRCMP(__name, "warmStart") == 0)
    {
        __result = warmStart.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "extSensorAssitStart") == 0)
    {
        __result = extSensorAssitStart.SetValue(&__path[__pos], __value);
    }

    return __result;
}

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

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

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

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

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

    return __result;
}

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

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

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

    return __result;
}


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Default Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
AECXStartUpTypeClass::AECXStartUpTypeClass(
    const CHAR* const name)
    : ParameterModule(name, MAJOR, MINOR, PATCH, nullptr)
{
    PARAMETER_INITIALIZE(SymbolTableID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(parameter_version);
    PARAMETER_INITIALIZE(defaultStart);
    PARAMETER_INITIALIZE(modeStartsCount);
    PARAMETER_INITIALIZE(modeStarts);
    PARAMETER_INITIALIZE(warmStart);
    PARAMETER_INITIALIZE(extSensorAssitStart);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
AECXStartUpTypeClass::AECXStartUpTypeClass(
    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(defaultStart);
    PARAMETER_INITIALIZE(modeStarts);
    PARAMETER_INITIALIZE(warmStart);
    PARAMETER_INITIALIZE(extSensorAssitStart);
}

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

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

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

    PARAMETER_INITIALIZE(exposureZone);
    PARAMETER_INITIALIZE(initialExposure);

    result = exposureZone.Load(entry, alignment);
    if (result)
    {
        result = entry->ReadArray(initialExposure, 3, alignment);
    }

    return result;
}

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

    PARAMETER_INITIALIZE(trigger);
    PARAMETER_INITIALIZE(trigger1Data);

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

    return result;
}

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

    PARAMETER_INITIALIZE(enable);
    PARAMETER_INITIALIZE(tables);

    SYMBOL_TABLE_ENTRY_READ(entry, result, enable, alignment)

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

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

    return result;
}

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

    PARAMETER_INITIALIZE(enableWarmStart);
    PARAMETER_INITIALIZE(enableWarmStartCapping);
    PARAMETER_INITIALIZE(limits);

    SYMBOL_TABLE_ENTRY_READ(entry, result, enableWarmStart, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, enableWarmStartCapping, alignment)
    if (result)
    {
        result = limits.Load(entry, alignment);
    }

    return result;
}

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

    PARAMETER_INITIALIZE(type);
    PARAMETER_INITIALIZE(exposures);

    result = aecxglobalelements::ReadEnum_AECXStartUpExpType(entry, type, alignment);
    if (result)
    {
        result = entry->ReadArray(exposures, 3, alignment);
    }

    return result;
}

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

    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(parameter_version);
    PARAMETER_INITIALIZE(defaultStart);
    PARAMETER_INITIALIZE(modeStarts);
    PARAMETER_INITIALIZE(warmStart);
    PARAMETER_INITIALIZE(extSensorAssitStart);

    result = module_version.Load(entry, alignment);
    if (result)
    {
        result = parameter_version.Load(entry, alignment);
    }
    if (result)
    {
        result = defaultStart.Load(entry, alignment);
    }

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

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

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load module_versionStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool AECXStartUpType::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 AECXStartUpType::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 ExtSensorAssitType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void ExtSensorAssitType::Unload(ParameterFileSymbolTable* const __table)
{
    if (__table != nullptr && __table->ReleaseDupObject(tables))
    {
        PARAMETER_DELETE[] tables;
    }
    tables = nullptr;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload AECXStartUpType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void AECXStartUpType::Unload(ParameterFileSymbolTable* const __table)
{
    parameter_version.Unload(__table);
    if (__table != nullptr && __table->ReleaseDupObject(modeStarts))
    {
        PARAMETER_DELETE[] modeStarts;
    }
    modeStarts = nullptr;
    extSensorAssitStart.Unload(__table);
}

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

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

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

    return (ParameterModule*)cls;
}

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

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

AECXSTARTUP_NAMESPACE_END
