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

#include "camxmoduleconfig.h"
#include "parametersetmanager.h"

CAMX_NAMESPACE_BEGIN

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// SetValue/GetValue Functions
/// Gets or sets the requested value
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @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_CameraPosition(
    ParameterFileSymbolTableEntry* const entry,
    CameraPosition& enumValue,
    BYTE const alignment)
{
    bool result {false};

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

    if (result)
    {
        switch (uintValue)
        {
        case static_cast<UINT32>(CameraPosition::REAR):
            enumValue = CameraPosition::REAR;
            result    = true;
            break;
        case static_cast<UINT32>(CameraPosition::FRONT):
            enumValue = CameraPosition::FRONT;
            result    = true;
            break;
        case static_cast<UINT32>(CameraPosition::REAR_AUX):
            enumValue = CameraPosition::REAR_AUX;
            result    = true;
            break;
        case static_cast<UINT32>(CameraPosition::FRONT_AUX):
            enumValue = CameraPosition::FRONT_AUX;
            result    = true;
            break;
        case static_cast<UINT32>(CameraPosition::EXTERNAL):
            enumValue = CameraPosition::EXTERNAL;
            result    = true;
            break;
        case static_cast<UINT32>(CameraPosition::VIRTUAL):
            enumValue = CameraPosition::VIRTUAL;
            result    = true;
            break;
        default:
            PARAMETER_LOG_ERROR(entry->SetManager, "Invalid value(% u) converting UINT32 to CameraPosition", uintValue);
            break;
        }
    }
    return result;
}

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

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

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

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

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

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


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Default Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
CameraModuleDataClass::CameraModuleDataClass(
    const CHAR* const name)
    : ParameterModule(name, MAJOR, MINOR, PATCH, nullptr)
{
    PARAMETER_INITIALIZE(SymbolTableID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(moduleGroup);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
CameraModuleDataClass::CameraModuleDataClass(
    const CHAR* const name,
    ModuleData* const moduleData)
    : ParameterModule(name, MAJOR, MINOR, PATCH, moduleData)
{
    PARAMETER_INITIALIZE(SymbolTableID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(moduleGroup);
}

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

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

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

    PARAMETER_INITIALIZE(laneAssignExists);
    PARAMETER_INITIALIZE(laneAssign);
    PARAMETER_INITIALIZE(isComboModeExists);
    PARAMETER_INITIALIZE(isComboMode);
    PARAMETER_INITIALIZE(isSharedModeExists);
    PARAMETER_INITIALIZE(isSharedMode);
    PARAMETER_INITIALIZE(cphyDphyComboModeExists);
    PARAMETER_INITIALIZE(cphyDphyComboMode);
    PARAMETER_INITIALIZE(channelTypeExists);
    PARAMETER_INITIALIZE(channelType);


    // Reading Optional parameter laneAssign from symbol table
    {
        SYMBOL_TABLE_ENTRY_READ(entry, result, laneAssignExists, alignment)
        laneAssignID = entry->ID;
        ParameterFileSymbolTableEntry  pointerEntryCls;
        ParameterFileSymbolTableEntry* const pointerEntry = &pointerEntryCls;
        if (result)
        {
            result = entry->Table->ReadPointerEntry(pointerEntryCls, entry, alignment);
        }
        if (result && laneAssignExists)
        {
            SYMBOL_TABLE_ENTRY_READ(pointerEntry, result, laneAssign, alignment)
        }
        else
        {
            PARAMETER_INITIALIZE(laneAssign);
        }
    }

    // Reading Optional parameter isComboMode from symbol table
    {
        SYMBOL_TABLE_ENTRY_READ(entry, result, isComboModeExists, alignment)
        isComboModeID = entry->ID;
        ParameterFileSymbolTableEntry  pointerEntryCls;
        ParameterFileSymbolTableEntry* const pointerEntry = &pointerEntryCls;
        if (result)
        {
            result = entry->Table->ReadPointerEntry(pointerEntryCls, entry, alignment);
        }
        if (result && isComboModeExists)
        {
            SYMBOL_TABLE_ENTRY_READ(pointerEntry, result, isComboMode, alignment)
        }
        else
        {
            PARAMETER_INITIALIZE(isComboMode);
        }
    }

    // Reading Optional parameter isSharedMode from symbol table
    {
        SYMBOL_TABLE_ENTRY_READ(entry, result, isSharedModeExists, alignment)
        isSharedModeID = entry->ID;
        ParameterFileSymbolTableEntry  pointerEntryCls;
        ParameterFileSymbolTableEntry* const pointerEntry = &pointerEntryCls;
        if (result)
        {
            result = entry->Table->ReadPointerEntry(pointerEntryCls, entry, alignment);
        }
        if (result && isSharedModeExists)
        {
            SYMBOL_TABLE_ENTRY_READ(pointerEntry, result, isSharedMode, alignment)
        }
        else
        {
            PARAMETER_INITIALIZE(isSharedMode);
        }
    }

    // Reading Optional parameter cphyDphyComboMode from symbol table
    {
        SYMBOL_TABLE_ENTRY_READ(entry, result, cphyDphyComboModeExists, alignment)
        cphyDphyComboModeID = entry->ID;
        ParameterFileSymbolTableEntry  pointerEntryCls;
        ParameterFileSymbolTableEntry* const pointerEntry = &pointerEntryCls;
        if (result)
        {
            result = entry->Table->ReadPointerEntry(pointerEntryCls, entry, alignment);
        }
        if (result && cphyDphyComboModeExists)
        {
            SYMBOL_TABLE_ENTRY_READ(pointerEntry, result, cphyDphyComboMode, alignment)
        }
        else
        {
            PARAMETER_INITIALIZE(cphyDphyComboMode);
        }
    }

    // Reading Optional parameter channelType from symbol table
    {
        SYMBOL_TABLE_ENTRY_READ(entry, result, channelTypeExists, alignment)
        channelTypeID = entry->ID;
        ParameterFileSymbolTableEntry  pointerEntryCls;
        ParameterFileSymbolTableEntry* const pointerEntry = &pointerEntryCls;
        if (result)
        {
            result = entry->Table->ReadPointerEntry(pointerEntryCls, entry, alignment);
        }
        if (result && channelTypeExists)
        {
            if (result)
            {
                result = ReadEnum_CSIPHYChannelType(pointerEntry, channelType, alignment);
            }
        }
        else
        {
            PARAMETER_INITIALIZE(channelType);
        }
    }

    return result;
}

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

    PARAMETER_INITIALIZE(isSharedBusExists);
    PARAMETER_INITIALIZE(isSharedBus);


    // Reading Optional parameter isSharedBus from symbol table
    {
        SYMBOL_TABLE_ENTRY_READ(entry, result, isSharedBusExists, alignment)
        isSharedBusID = entry->ID;
        ParameterFileSymbolTableEntry  pointerEntryCls;
        ParameterFileSymbolTableEntry* const pointerEntry = &pointerEntryCls;
        if (result)
        {
            result = entry->Table->ReadPointerEntry(pointerEntryCls, entry, alignment);
        }
        if (result && isSharedBusExists)
        {
            SYMBOL_TABLE_ENTRY_READ(pointerEntry, result, isSharedBus, alignment)
        }
        else
        {
            PARAMETER_INITIALIZE(isSharedBus);
        }
    }

    return result;
}

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

    PARAMETER_INITIALIZE(libraryName);
    PARAMETER_INITIALIZE(preprocLibraryName);
    PARAMETER_INITIALIZE(depthOutputFormat);


    // Reading String libraryName 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, libraryName, count, alignment)
    }

    // Reading String preprocLibraryName 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, preprocLibraryName, count, alignment)
    }

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

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

    return result;
}

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

    PARAMETER_INITIALIZE(focalLength);
    PARAMETER_INITIALIZE(fNumber);
    PARAMETER_INITIALIZE(minFocusDistance);
    PARAMETER_INITIALIZE(maxFocusDistance);
    PARAMETER_INITIALIZE(horizontalViewAngle);
    PARAMETER_INITIALIZE(verticalViewAngle);
    PARAMETER_INITIALIZE(maxRollDegreeExists);
    PARAMETER_INITIALIZE(maxRollDegree);
    PARAMETER_INITIALIZE(maxPitchDegreeExists);
    PARAMETER_INITIALIZE(maxPitchDegree);
    PARAMETER_INITIALIZE(maxYawDegreeExists);
    PARAMETER_INITIALIZE(maxYawDegree);

    SYMBOL_TABLE_ENTRY_READ(entry, result, focalLength, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, fNumber, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, minFocusDistance, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, maxFocusDistance, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, horizontalViewAngle, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, verticalViewAngle, alignment)

    // Reading Optional parameter maxRollDegree from symbol table
    {
        SYMBOL_TABLE_ENTRY_READ(entry, result, maxRollDegreeExists, alignment)
        maxRollDegreeID = entry->ID;
        ParameterFileSymbolTableEntry  pointerEntryCls;
        ParameterFileSymbolTableEntry* const pointerEntry = &pointerEntryCls;
        if (result)
        {
            result = entry->Table->ReadPointerEntry(pointerEntryCls, entry, alignment);
        }
        if (result && maxRollDegreeExists)
        {
            SYMBOL_TABLE_ENTRY_READ(pointerEntry, result, maxRollDegree, alignment)
        }
        else
        {
            PARAMETER_INITIALIZE(maxRollDegree);
        }
    }

    // Reading Optional parameter maxPitchDegree from symbol table
    {
        SYMBOL_TABLE_ENTRY_READ(entry, result, maxPitchDegreeExists, alignment)
        maxPitchDegreeID = entry->ID;
        ParameterFileSymbolTableEntry  pointerEntryCls;
        ParameterFileSymbolTableEntry* const pointerEntry = &pointerEntryCls;
        if (result)
        {
            result = entry->Table->ReadPointerEntry(pointerEntryCls, entry, alignment);
        }
        if (result && maxPitchDegreeExists)
        {
            SYMBOL_TABLE_ENTRY_READ(pointerEntry, result, maxPitchDegree, alignment)
        }
        else
        {
            PARAMETER_INITIALIZE(maxPitchDegree);
        }
    }

    // Reading Optional parameter maxYawDegree from symbol table
    {
        SYMBOL_TABLE_ENTRY_READ(entry, result, maxYawDegreeExists, alignment)
        maxYawDegreeID = entry->ID;
        ParameterFileSymbolTableEntry  pointerEntryCls;
        ParameterFileSymbolTableEntry* const pointerEntry = &pointerEntryCls;
        if (result)
        {
            result = entry->Table->ReadPointerEntry(pointerEntryCls, entry, alignment);
        }
        if (result && maxYawDegreeExists)
        {
            SYMBOL_TABLE_ENTRY_READ(pointerEntry, result, maxYawDegree, alignment)
        }
        else
        {
            PARAMETER_INITIALIZE(maxYawDegree);
        }
    }

    return result;
}

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

    PARAMETER_INITIALIZE(cameraId);
    PARAMETER_INITIALIZE(moduleNameExists);
    PARAMETER_INITIALIZE(moduleName);
    PARAMETER_INITIALIZE(sensorName);
    PARAMETER_INITIALIZE(sensorVersion);
    PARAMETER_INITIALIZE(sensorSlaveAddressExists);
    PARAMETER_INITIALIZE(sensorSlaveAddress);
    PARAMETER_INITIALIZE(sensorI2CFrequencyModeExists);
    PARAMETER_INITIALIZE(sensorI2CFrequencyMode);
    PARAMETER_INITIALIZE(actuatorNameExists);
    PARAMETER_INITIALIZE(actuatorName);
    PARAMETER_INITIALIZE(actuatorSlaveAddressExists);
    PARAMETER_INITIALIZE(actuatorSlaveAddress);
    PARAMETER_INITIALIZE(oisNameExists);
    PARAMETER_INITIALIZE(oisName);
    PARAMETER_INITIALIZE(eepromNameExists);
    PARAMETER_INITIALIZE(eepromName);
    PARAMETER_INITIALIZE(eepromSlaveAddressExists);
    PARAMETER_INITIALIZE(eepromSlaveAddress);
    PARAMETER_INITIALIZE(flashNameExists);
    PARAMETER_INITIALIZE(flashName);
    PARAMETER_INITIALIZE(flashNameSecondaryExists);
    PARAMETER_INITIALIZE(flashNameSecondary);
    PARAMETER_INITIALIZE(chromatixNameExists);
    PARAMETER_INITIALIZE(chromatixName);
    PARAMETER_INITIALIZE(i2cFrequencyModeExists);
    PARAMETER_INITIALIZE(i2cFrequencyMode);
    PARAMETER_INITIALIZE(aonCamInfoExists);
    PARAMETER_INITIALIZE(aonCamInfo);
    PARAMETER_INITIALIZE(position);
    PARAMETER_INITIALIZE(CSIInfo);
    PARAMETER_INITIALIZE(lensInfo);
    PARAMETER_INITIALIZE(pdafNameExists);
    PARAMETER_INITIALIZE(pdafName);
    PARAMETER_INITIALIZE(depthConversionLibInfoExists);
    PARAMETER_INITIALIZE(depthConversionLibInfo);
    PARAMETER_INITIALIZE(sensorBroadcastNameExists);
    PARAMETER_INITIALIZE(sensorBroadcastName);
    PARAMETER_INITIALIZE(numSensorsInBroadcastExists);
    PARAMETER_INITIALIZE(numSensorsInBroadcast);

    SYMBOL_TABLE_ENTRY_READ(entry, result, cameraId, alignment)

    // Reading Optional parameter moduleName from symbol table
    {
        SYMBOL_TABLE_ENTRY_READ(entry, result, moduleNameExists, alignment)
        moduleNameID = entry->ID;
        ParameterFileSymbolTableEntry  pointerEntryCls;
        ParameterFileSymbolTableEntry* const pointerEntry = &pointerEntryCls;
        if (result)
        {
            result = entry->Table->ReadPointerEntry(pointerEntryCls, entry, alignment);
        }
        if (result && moduleNameExists)
        {

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

    // Reading String sensorName 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, sensorName, count, alignment)
    }
    SYMBOL_TABLE_ENTRY_READ(entry, result, sensorVersion, alignment)

    // Reading Optional parameter sensorSlaveAddress from symbol table
    {
        SYMBOL_TABLE_ENTRY_READ(entry, result, sensorSlaveAddressExists, alignment)
        sensorSlaveAddressID = entry->ID;
        ParameterFileSymbolTableEntry  pointerEntryCls;
        ParameterFileSymbolTableEntry* const pointerEntry = &pointerEntryCls;
        if (result)
        {
            result = entry->Table->ReadPointerEntry(pointerEntryCls, entry, alignment);
        }
        if (result && sensorSlaveAddressExists)
        {
            SYMBOL_TABLE_ENTRY_READ(pointerEntry, result, sensorSlaveAddress, alignment)
        }
        else
        {
            PARAMETER_INITIALIZE(sensorSlaveAddress);
        }
    }

    // Reading Optional parameter sensorI2CFrequencyMode from symbol table
    {
        SYMBOL_TABLE_ENTRY_READ(entry, result, sensorI2CFrequencyModeExists, alignment)
        sensorI2CFrequencyModeID = entry->ID;
        ParameterFileSymbolTableEntry  pointerEntryCls;
        ParameterFileSymbolTableEntry* const pointerEntry = &pointerEntryCls;
        if (result)
        {
            result = entry->Table->ReadPointerEntry(pointerEntryCls, entry, alignment);
        }
        if (result && sensorI2CFrequencyModeExists)
        {
            if (result)
            {
                result = ReadEnum_I2CFrequencyMode(pointerEntry, sensorI2CFrequencyMode, alignment);
            }
        }
        else
        {
            PARAMETER_INITIALIZE(sensorI2CFrequencyMode);
        }
    }

    // Reading Optional parameter actuatorName from symbol table
    {
        SYMBOL_TABLE_ENTRY_READ(entry, result, actuatorNameExists, alignment)
        actuatorNameID = entry->ID;
        ParameterFileSymbolTableEntry  pointerEntryCls;
        ParameterFileSymbolTableEntry* const pointerEntry = &pointerEntryCls;
        if (result)
        {
            result = entry->Table->ReadPointerEntry(pointerEntryCls, entry, alignment);
        }
        if (result && actuatorNameExists)
        {

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

    // Reading Optional parameter actuatorSlaveAddress from symbol table
    {
        SYMBOL_TABLE_ENTRY_READ(entry, result, actuatorSlaveAddressExists, alignment)
        actuatorSlaveAddressID = entry->ID;
        ParameterFileSymbolTableEntry  pointerEntryCls;
        ParameterFileSymbolTableEntry* const pointerEntry = &pointerEntryCls;
        if (result)
        {
            result = entry->Table->ReadPointerEntry(pointerEntryCls, entry, alignment);
        }
        if (result && actuatorSlaveAddressExists)
        {
            SYMBOL_TABLE_ENTRY_READ(pointerEntry, result, actuatorSlaveAddress, alignment)
        }
        else
        {
            PARAMETER_INITIALIZE(actuatorSlaveAddress);
        }
    }

    // Reading Optional parameter oisName from symbol table
    {
        SYMBOL_TABLE_ENTRY_READ(entry, result, oisNameExists, alignment)
        oisNameID = entry->ID;
        ParameterFileSymbolTableEntry  pointerEntryCls;
        ParameterFileSymbolTableEntry* const pointerEntry = &pointerEntryCls;
        if (result)
        {
            result = entry->Table->ReadPointerEntry(pointerEntryCls, entry, alignment);
        }
        if (result && oisNameExists)
        {

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

    // Reading Optional parameter eepromName from symbol table
    {
        SYMBOL_TABLE_ENTRY_READ(entry, result, eepromNameExists, alignment)
        eepromNameID = entry->ID;
        ParameterFileSymbolTableEntry  pointerEntryCls;
        ParameterFileSymbolTableEntry* const pointerEntry = &pointerEntryCls;
        if (result)
        {
            result = entry->Table->ReadPointerEntry(pointerEntryCls, entry, alignment);
        }
        if (result && eepromNameExists)
        {

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

    // Reading Optional parameter eepromSlaveAddress from symbol table
    {
        SYMBOL_TABLE_ENTRY_READ(entry, result, eepromSlaveAddressExists, alignment)
        eepromSlaveAddressID = entry->ID;
        ParameterFileSymbolTableEntry  pointerEntryCls;
        ParameterFileSymbolTableEntry* const pointerEntry = &pointerEntryCls;
        if (result)
        {
            result = entry->Table->ReadPointerEntry(pointerEntryCls, entry, alignment);
        }
        if (result && eepromSlaveAddressExists)
        {
            SYMBOL_TABLE_ENTRY_READ(pointerEntry, result, eepromSlaveAddress, alignment)
        }
        else
        {
            PARAMETER_INITIALIZE(eepromSlaveAddress);
        }
    }

    // Reading Optional parameter flashName from symbol table
    {
        SYMBOL_TABLE_ENTRY_READ(entry, result, flashNameExists, alignment)
        flashNameID = entry->ID;
        ParameterFileSymbolTableEntry  pointerEntryCls;
        ParameterFileSymbolTableEntry* const pointerEntry = &pointerEntryCls;
        if (result)
        {
            result = entry->Table->ReadPointerEntry(pointerEntryCls, entry, alignment);
        }
        if (result && flashNameExists)
        {

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

    // Reading Optional parameter flashNameSecondary from symbol table
    {
        SYMBOL_TABLE_ENTRY_READ(entry, result, flashNameSecondaryExists, alignment)
        flashNameSecondaryID = entry->ID;
        ParameterFileSymbolTableEntry  pointerEntryCls;
        ParameterFileSymbolTableEntry* const pointerEntry = &pointerEntryCls;
        if (result)
        {
            result = entry->Table->ReadPointerEntry(pointerEntryCls, entry, alignment);
        }
        if (result && flashNameSecondaryExists)
        {

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

    // Reading Optional parameter chromatixName from symbol table
    {
        SYMBOL_TABLE_ENTRY_READ(entry, result, chromatixNameExists, alignment)
        chromatixNameID = entry->ID;
        ParameterFileSymbolTableEntry  pointerEntryCls;
        ParameterFileSymbolTableEntry* const pointerEntry = &pointerEntryCls;
        if (result)
        {
            result = entry->Table->ReadPointerEntry(pointerEntryCls, entry, alignment);
        }
        if (result && chromatixNameExists)
        {

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

    // Reading Optional parameter i2cFrequencyMode from symbol table
    {
        SYMBOL_TABLE_ENTRY_READ(entry, result, i2cFrequencyModeExists, alignment)
        i2cFrequencyModeID = entry->ID;
        ParameterFileSymbolTableEntry  pointerEntryCls;
        ParameterFileSymbolTableEntry* const pointerEntry = &pointerEntryCls;
        if (result)
        {
            result = entry->Table->ReadPointerEntry(pointerEntryCls, entry, alignment);
        }
        if (result && i2cFrequencyModeExists)
        {
            if (result)
            {
                result = ReadEnum_I2CFrequencyMode(pointerEntry, i2cFrequencyMode, alignment);
            }
        }
        else
        {
            PARAMETER_INITIALIZE(i2cFrequencyMode);
        }
    }

    // Reading Optional parameter aonCamInfo from symbol table
    {
        SYMBOL_TABLE_ENTRY_READ(entry, result, aonCamInfoExists, alignment)
        aonCamInfoID = entry->ID;
        ParameterFileSymbolTableEntry  pointerEntryCls;
        ParameterFileSymbolTableEntry* const pointerEntry = &pointerEntryCls;
        if (result)
        {
            result = entry->Table->ReadPointerEntry(pointerEntryCls, entry, alignment);
        }
        if (result && aonCamInfoExists)
        {
            if (result)
            {
                result = aonCamInfo.Load(pointerEntry, alignment);
            }
        }
        else
        {
            PARAMETER_INITIALIZE(aonCamInfo);
        }
    }
    if (result)
    {
        result = ReadEnum_CameraPosition(entry, position, alignment);
    }
    if (result)
    {
        result = CSIInfo.Load(entry, alignment);
    }
    if (result)
    {
        result = lensInfo.Load(entry, alignment);
    }

    // Reading Optional parameter pdafName from symbol table
    {
        SYMBOL_TABLE_ENTRY_READ(entry, result, pdafNameExists, alignment)
        pdafNameID = entry->ID;
        ParameterFileSymbolTableEntry  pointerEntryCls;
        ParameterFileSymbolTableEntry* const pointerEntry = &pointerEntryCls;
        if (result)
        {
            result = entry->Table->ReadPointerEntry(pointerEntryCls, entry, alignment);
        }
        if (result && pdafNameExists)
        {

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

    // Reading Optional parameter depthConversionLibInfo from symbol table
    {
        SYMBOL_TABLE_ENTRY_READ(entry, result, depthConversionLibInfoExists, alignment)
        depthConversionLibInfoID = entry->ID;
        ParameterFileSymbolTableEntry  pointerEntryCls;
        ParameterFileSymbolTableEntry* const pointerEntry = &pointerEntryCls;
        if (result)
        {
            result = entry->Table->ReadPointerEntry(pointerEntryCls, entry, alignment);
        }
        if (result && depthConversionLibInfoExists)
        {
            if (result)
            {
                result = depthConversionLibInfo.Load(pointerEntry, alignment);
            }
        }
        else
        {
            PARAMETER_INITIALIZE(depthConversionLibInfo);
        }
    }

    // Reading Optional parameter sensorBroadcastName from symbol table
    {
        SYMBOL_TABLE_ENTRY_READ(entry, result, sensorBroadcastNameExists, alignment)
        sensorBroadcastNameID = entry->ID;
        ParameterFileSymbolTableEntry  pointerEntryCls;
        ParameterFileSymbolTableEntry* const pointerEntry = &pointerEntryCls;
        if (result)
        {
            result = entry->Table->ReadPointerEntry(pointerEntryCls, entry, alignment);
        }
        if (result && sensorBroadcastNameExists)
        {

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

    // Reading Optional parameter numSensorsInBroadcast from symbol table
    {
        SYMBOL_TABLE_ENTRY_READ(entry, result, numSensorsInBroadcastExists, alignment)
        numSensorsInBroadcastID = entry->ID;
        ParameterFileSymbolTableEntry  pointerEntryCls;
        ParameterFileSymbolTableEntry* const pointerEntry = &pointerEntryCls;
        if (result)
        {
            result = entry->Table->ReadPointerEntry(pointerEntryCls, entry, alignment);
        }
        if (result && numSensorsInBroadcastExists)
        {
            SYMBOL_TABLE_ENTRY_READ(pointerEntry, result, numSensorsInBroadcast, alignment)
        }
        else
        {
            PARAMETER_INITIALIZE(numSensorsInBroadcast);
        }
    }

    return result;
}

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

    PARAMETER_INITIALIZE(moduleConfiguration);


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

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

    return result;
}

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

    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(moduleGroup);

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

    return result;
}

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

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload ModuleConfiguration
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void ModuleConfiguration::Unload(ParameterFileSymbolTable* const __table)
{
    if (__table != nullptr && __table->ReleaseDupObject(moduleName))
    {
        PARAMETER_DELETE[] moduleName;
    }
    moduleName = nullptr;
    if (__table != nullptr && __table->ReleaseDupObject(sensorName))
    {
        PARAMETER_DELETE[] sensorName;
    }
    sensorName = nullptr;
    if (__table != nullptr && __table->ReleaseDupObject(actuatorName))
    {
        PARAMETER_DELETE[] actuatorName;
    }
    actuatorName = nullptr;
    if (__table != nullptr && __table->ReleaseDupObject(oisName))
    {
        PARAMETER_DELETE[] oisName;
    }
    oisName = nullptr;
    if (__table != nullptr && __table->ReleaseDupObject(eepromName))
    {
        PARAMETER_DELETE[] eepromName;
    }
    eepromName = nullptr;
    if (__table != nullptr && __table->ReleaseDupObject(flashName))
    {
        PARAMETER_DELETE[] flashName;
    }
    flashName = nullptr;
    if (__table != nullptr && __table->ReleaseDupObject(flashNameSecondary))
    {
        PARAMETER_DELETE[] flashNameSecondary;
    }
    flashNameSecondary = nullptr;
    if (__table != nullptr && __table->ReleaseDupObject(chromatixName))
    {
        PARAMETER_DELETE[] chromatixName;
    }
    chromatixName = nullptr;
    if (__table != nullptr && __table->ReleaseDupObject(pdafName))
    {
        PARAMETER_DELETE[] pdafName;
    }
    pdafName = nullptr;
    depthConversionLibInfo.Unload(__table);
    if (__table != nullptr && __table->ReleaseDupObject(sensorBroadcastName))
    {
        PARAMETER_DELETE[] sensorBroadcastName;
    }
    sensorBroadcastName = nullptr;
}

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

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload CameraModuleData
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CameraModuleData::Unload(ParameterFileSymbolTable* const __table)
{
    moduleGroup.Unload(__table);
}

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

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

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

    return (ParameterModule*)cls;
}

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

    if (!Loaded)
    {
        BYTE const alignment = table->Alignment;
        CameraModuleDataClass* const cls = this;

        ParameterFileSymbolTableEntry  entryObj;
        ParameterFileSymbolTableEntry* const entry = &entryObj;
        result = table->Find(entryObj, SymbolTableID);

        if (!result)
        {
            PARAMETER_LOG_ERROR(entry->SetManager, "CameraModuleDataClass::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 CameraModuleDataClass::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 CameraModuleDataClass::Release()
{
    ParameterModule::Release();
}

CAMX_NAMESPACE_END
