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

#include "modsaspatialgenv1.h"
#include "parametersetmanager.h"

MODSASPATIALGENV1_NAMESPACE_BEGIN

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// SetValue/GetValue Functions
/// Gets or sets the requested value
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool DistanceWeightsLevel1Type::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, "Description") == 0)
    {
        PARAMETER_STRCPY(__value, __size, Description);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "enableFlag") == 0)
    {
        ParameterUtils::DoubleToString((double)enableFlag, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "weights") == 0)
    {
        __result = weights.GetValue(&__path[__pos], __value, __size);
    }

    return __result;
}

bool DistanceWeightsLevel1Type::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, "Description") == 0)
    {
        // Cannot modify strings, risk of memory leaks or corruption
    }
    else if (PARAMETER_STRCMP(__name, "enableFlag") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            enableFlag = (awbglobalelements::enableFlagType)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "weights") == 0)
    {
        __result = weights.SetValue(&__path[__pos], __value);
    }

    return __result;
}

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

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

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

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

    return __result;
}

bool IntensityWeightsLevel1Type::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, "Description") == 0)
    {
        PARAMETER_STRCPY(__value, __size, Description);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "enableFlag") == 0)
    {
        ParameterUtils::DoubleToString((double)enableFlag, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "IntensityWeightComputationSelect") == 0)
    {
        ParameterUtils::DoubleToString((double)(UINT32)IntensityWeightComputationSelect, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "weights") == 0)
    {
        __result = weights.GetValue(&__path[__pos], __value, __size);
    }

    return __result;
}

bool IntensityWeightsLevel1Type::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, "Description") == 0)
    {
        // Cannot modify strings, risk of memory leaks or corruption
    }
    else if (PARAMETER_STRCMP(__name, "enableFlag") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            enableFlag = (awbglobalelements::enableFlagType)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "IntensityWeightComputationSelect") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            IntensityWeightComputationSelect = (awbglobalelements::awbSAIntensityWeightCmptType)(UINT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "weights") == 0)
    {
        __result = weights.SetValue(&__path[__pos], __value);
    }

    return __result;
}

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

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

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

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

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

    return __result;
}

bool ROIInfoType::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, "Description") == 0)
    {
        PARAMETER_STRCPY(__value, __size, Description);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "TargetColor") == 0)
    {
        __result = TargetColor.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "ROIPosition") == 0)
    {
        __result = ROIPosition.GetValue(&__path[__pos], __value, __size);
    }

    return __result;
}

bool ROIInfoType::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, "Description") == 0)
    {
        // Cannot modify strings, risk of memory leaks or corruption
    }
    else if (PARAMETER_STRCMP(__name, "TargetColor") == 0)
    {
        __result = TargetColor.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "ROIPosition") == 0)
    {
        __result = ROIPosition.SetValue(&__path[__pos], __value);
    }

    return __result;
}

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

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

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

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

    return __result;
}

bool chromatixSASpatialGenV1Type::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, "Description") == 0)
    {
        PARAMETER_STRCPY(__value, __size, Description);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "moduleID") == 0)
    {
        __result = moduleID.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "enableFlag") == 0)
    {
        ParameterUtils::DoubleToString((double)enableFlag, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "weight") == 0)
    {
        ParameterUtils::DoubleToString((double)weight, __value, __size);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "DefaultROIInfo") == 0)
    {
        if (__index < DefaultROIInfoCount)
        {
            __result = DefaultROIInfo[__index].GetValue(&__path[__pos], __value, __size);
        }
    }
    else if (PARAMETER_STRCMP(__name, "IntensityWeights") == 0)
    {
        __result = IntensityWeights.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "DistanceWeights") == 0)
    {
        __result = DistanceWeights.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "confidenceLevel") == 0)
    {
        __result = confidenceLevel.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "ROIAgregationWeights") == 0)
    {
        __result = ROIAgregationWeights.GetValue(&__path[__pos], __value, __size);
    }

    return __result;
}

bool chromatixSASpatialGenV1Type::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, "Description") == 0)
    {
        // Cannot modify strings, risk of memory leaks or corruption
    }
    else if (PARAMETER_STRCMP(__name, "moduleID") == 0)
    {
        __result = moduleID.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "enableFlag") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            enableFlag = (awbglobalelements::enableFlagType)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "weight") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            weight = (float)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "DefaultROIInfo") == 0)
    {
        if (__index < DefaultROIInfoCount)
        {
            __result = DefaultROIInfo[__index].SetValue(&__path[__pos], __value);
        }
    }
    else if (PARAMETER_STRCMP(__name, "IntensityWeights") == 0)
    {
        __result = IntensityWeights.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "DistanceWeights") == 0)
    {
        __result = DistanceWeights.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "confidenceLevel") == 0)
    {
        __result = confidenceLevel.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "ROIAgregationWeights") == 0)
    {
        __result = ROIAgregationWeights.SetValue(&__path[__pos], __value);
    }

    return __result;
}

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

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

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

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

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

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

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

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

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

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

    return __result;
}

bool chromatixSASpatialGenV1ArrayType::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, "SASpatialROIBasedAWBData") == 0)
    {
        __result = SASpatialROIBasedAWBData.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "SASpatialGenV1Data") == 0)
    {
        if (__index < SASpatialGenV1DataCount)
        {
            __result = SASpatialGenV1Data[__index].GetValue(&__path[__pos], __value, __size);
        }
    }
    else if (PARAMETER_STRCMP(__name, "enableFlag") == 0)
    {
        ParameterUtils::DoubleToString((double)enableFlag, __value, __size, 0);
        __result = true;
    }

    return __result;
}

bool chromatixSASpatialGenV1ArrayType::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, "SASpatialROIBasedAWBData") == 0)
    {
        __result = SASpatialROIBasedAWBData.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "SASpatialGenV1Data") == 0)
    {
        if (__index < SASpatialGenV1DataCount)
        {
            __result = SASpatialGenV1Data[__index].SetValue(&__path[__pos], __value);
        }
    }
    else if (PARAMETER_STRCMP(__name, "enableFlag") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            enableFlag = (awbglobalelements::enableFlagType)dblValue; 
        }
    }

    return __result;
}

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

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

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

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

    return __result;
}

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


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Default Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
chromatixSASpatialGenV1ArrayTypeClass::chromatixSASpatialGenV1ArrayTypeClass(
    const CHAR* const name)
    : ParameterModule(name, MAJOR, MINOR, PATCH, nullptr)
{
    PARAMETER_INITIALIZE(SymbolTableID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(SASpatialROIBasedAWBData);
    PARAMETER_INITIALIZE(SASpatialGenV1DataCount);
    PARAMETER_INITIALIZE(SASpatialGenV1Data);
    PARAMETER_INITIALIZE(enableFlag);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
chromatixSASpatialGenV1ArrayTypeClass::chromatixSASpatialGenV1ArrayTypeClass(
    const CHAR* const name,
    ModuleData* const moduleData)
    : ParameterModule(name, MAJOR, MINOR, PATCH, moduleData)
{
    PARAMETER_INITIALIZE(SymbolTableID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(SASpatialROIBasedAWBData);
    PARAMETER_INITIALIZE(SASpatialGenV1Data);
    PARAMETER_INITIALIZE(enableFlag);
}

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

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

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

    PARAMETER_INITIALIZE(Description);
    PARAMETER_INITIALIZE(enableFlag);
    PARAMETER_INITIALIZE(weights);


    // Reading String Description 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, Description, count, alignment)
    }
    SYMBOL_TABLE_ENTRY_READ(entry, result, enableFlag, alignment)
    if (result)
    {
        result = weights.Load(entry, alignment);
    }

    return result;
}

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

    PARAMETER_INITIALIZE(Description);
    PARAMETER_INITIALIZE(enableFlag);
    PARAMETER_INITIALIZE(IntensityWeightComputationSelect);
    PARAMETER_INITIALIZE(weights);


    // Reading String Description 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, Description, count, alignment)
    }
    SYMBOL_TABLE_ENTRY_READ(entry, result, enableFlag, alignment)
    if (result)
    {
        result = awbglobalelements::ReadEnum_awbSAIntensityWeightCmptType(entry, IntensityWeightComputationSelect, alignment);
    }
    if (result)
    {
        result = weights.Load(entry, alignment);
    }

    return result;
}

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

    PARAMETER_INITIALIZE(Description);
    PARAMETER_INITIALIZE(TargetColor);
    PARAMETER_INITIALIZE(ROIPosition);


    // Reading String Description 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, Description, count, alignment)
    }
    if (result)
    {
        result = TargetColor.Load(entry, alignment);
    }
    if (result)
    {
        result = ROIPosition.Load(entry, alignment);
    }

    return result;
}

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

    PARAMETER_INITIALIZE(Description);
    PARAMETER_INITIALIZE(moduleID);
    PARAMETER_INITIALIZE(enableFlag);
    PARAMETER_INITIALIZE(weight);
    PARAMETER_INITIALIZE(DefaultROIInfo);
    PARAMETER_INITIALIZE(IntensityWeights);
    PARAMETER_INITIALIZE(DistanceWeights);
    PARAMETER_INITIALIZE(confidenceLevel);
    PARAMETER_INITIALIZE(ROIAgregationWeights);


    // Reading String Description 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, Description, count, alignment)
    }
    if (result)
    {
        result = moduleID.Load(entry, alignment);
    }
    SYMBOL_TABLE_ENTRY_READ(entry, result, enableFlag, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, weight, alignment)

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

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

    return result;
}

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

    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(SASpatialROIBasedAWBData);
    PARAMETER_INITIALIZE(SASpatialGenV1Data);
    PARAMETER_INITIALIZE(enableFlag);

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

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

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

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load module_versionStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool chromatixSASpatialGenV1ArrayType::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;
}

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

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

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

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload chromatixSASpatialGenV1Type
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void chromatixSASpatialGenV1Type::Unload(ParameterFileSymbolTable* const __table)
{
    if (__table != nullptr && __table->ReleaseDupObject(Description))
    {
        PARAMETER_DELETE[] Description;
    }
    Description = nullptr;
    for (UINT32 i = 0; i < DefaultROIInfoCount; i++)
    {
        DefaultROIInfo[i].Unload(__table);
    }
    if (__table != nullptr && __table->ReleaseDupObject(DefaultROIInfo))
    {
        PARAMETER_DELETE[] DefaultROIInfo;
    }
    DefaultROIInfo = nullptr;
    IntensityWeights.Unload(__table);
    DistanceWeights.Unload(__table);
    confidenceLevel.Unload(__table);
    ROIAgregationWeights.Unload(__table);
}

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

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

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

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

    return (ParameterModule*)cls;
}

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

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

MODSASPATIALGENV1_NAMESPACE_END
