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

#include "aecx1dvectorprocessor.h"
#include "parametersetmanager.h"

AECX1DVECTORPROCESSOR_NAMESPACE_BEGIN

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

    return __result;
}

bool FilterType::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, "method") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            method = (FilteringMethodType)(UINT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "filterLength") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            filterLength = (UINT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "FIRCoefficients") == 0)
    {
        if (__index < FIRCoefficientsCount)
        {
            const double dblValue = ParameterUtils::StringToDouble(__value, __result);
            if (__result)
            {
                FIRCoefficients[__index] = (float)dblValue; 
            }
        }
        else
        {
            SIZE_T __valueLen = PARAMETER_STRLEN(__value);
            UINT32 __pos = 0;

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

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

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

    return __result;
}

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

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

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

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

    return __result;
}

bool VectorProcessorType::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, "description") == 0)
    {
        PARAMETER_STRCPY(__value, __size, description);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "input") == 0)
    {
        __result = input.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "output") == 0)
    {
        __result = output.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "filtering") == 0)
    {
        __result = filtering.GetValue(&__path[__pos], __value, __size);
    }

    return __result;
}

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

    return __result;
}

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

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

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

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

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

    return __result;
}

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

    return __result;
}

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

    return __result;
}

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

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

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

    return __result;
}

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

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

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

    return __result;
}

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

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

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


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Default Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
AECX1DVectorProcessorTypeClass::AECX1DVectorProcessorTypeClass(
    const CHAR* const name)
    : ParameterModule(name, MAJOR, MINOR, PATCH, nullptr)
{
    PARAMETER_INITIALIZE(SymbolTableID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(parameter_version);
    PARAMETER_INITIALIZE(gyroVectorProcessor);
    PARAMETER_INITIALIZE(vectorProcessorsCount);
    PARAMETER_INITIALIZE(vectorProcessors);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
AECX1DVectorProcessorTypeClass::AECX1DVectorProcessorTypeClass(
    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(gyroVectorProcessor);
    PARAMETER_INITIALIZE(vectorProcessors);
}

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

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

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

    PARAMETER_INITIALIZE(method);
    PARAMETER_INITIALIZE(filterLength);
    PARAMETER_INITIALIZE(FIRCoefficients);

    result = aecx1dvectorprocessor::ReadEnum_FilteringMethodType(entry, method, alignment);
    SYMBOL_TABLE_ENTRY_READ(entry, result, filterLength, alignment)

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

            if (FIRCoefficients == nullptr)
            {
                if (result && FIRCoefficientsCount > 0)
                {
                    FIRCoefficients = pointerEntry->ReadArray<float>(FIRCoefficientsCount, alignment);
                    result = FIRCoefficients != nullptr;
                }
                if (!result || FIRCoefficients == nullptr)
                {
                    if (FIRCoefficientsCount > 0)
                    {
                        PARAMETER_LOG_ERROR(entry->SetManager, "Failed to allocate FIRCoefficients\n");
                    }
                    FIRCoefficientsCount = 0;
                }
            }
        }
        if (FIRCoefficients == nullptr)
        {
            FIRCoefficientsCount = 0;
        }
    }

    return result;
}

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

    PARAMETER_INITIALIZE(enable);
    PARAMETER_INITIALIZE(description);
    PARAMETER_INITIALIZE(input);
    PARAMETER_INITIALIZE(output);
    PARAMETER_INITIALIZE(filtering);

    SYMBOL_TABLE_ENTRY_READ(entry, result, enable, alignment)

    // 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 = input.Load(entry, alignment);
    }
    if (result)
    {
        result = output.Load(entry, alignment);
    }
    if (result)
    {
        result = filtering.Load(entry, alignment);
    }

    return result;
}

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

    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(parameter_version);
    PARAMETER_INITIALIZE(gyroVectorProcessor);
    PARAMETER_INITIALIZE(vectorProcessors);

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

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

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

    return result;
}

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

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

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

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

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

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

    return (ParameterModule*)cls;
}

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

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

AECX1DVECTORPROCESSOR_NAMESPACE_END
