////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 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 V7.4.1 (8cca6579792b9fcef3bc725ff070c5ec453c7c85)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @file  camxmoduleconfig.cpp
/// @brief Auto-generated Chromatix parameter file
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

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

CAMX_NAMESPACE_BEGIN

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

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
CameraModuleDataClass::CameraModuleDataClass(
    const CHAR*       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();
    }
}


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load CSIInformation
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CSIInformation::Load(
    ParameterLoadParameters& parentParams)
{
    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);

    ParameterFileSymbolTableEntry* const entry = parentParams.Entry;
    ParameterLoadParameters localParams(parentParams);
    localParams.Element   = nullptr;
    localParams.UseParent = false;
    localParams.Index     = 0;

    if (parentParams.Element != nullptr)
    {
        bool _posChanged = false;
        localParams.Element = entry->AdjustPositionAndGetElement(parentParams, true, _posChanged);
    }

    // If parentParams.Element != null && localParams.Element == null, then this element is not defined in the binary file.
    // If parentParams.Element == null then this binary file does not contain a definition table or
    // the full backwards compatibility feature is disabled (for memory or performance reasons)
    if (parentParams.Element == nullptr || parentParams.Element->Verified || localParams.Element != nullptr)
    {
        localParams.Position      = entry->Position;
        localParams.LoadDataLimit = entry->ReadLoadDataLimit(parentParams.LoadDataLimit);

        localParams.NameHash = 0xb8a842f2c5a37a43;
        entry->ReadOptionalSimpleType(laneAssign, laneAssignExists, laneAssignID, localParams);
        localParams.NameHash = 0xec86ddf1595fb524;
        entry->ReadOptionalSimpleType(isComboMode, isComboModeExists, isComboModeID, localParams);
        localParams.NameHash = 0xc86c5af589a5f346;
        entry->ReadOptionalSimpleType(isSharedMode, isSharedModeExists, isSharedModeID, localParams);
        localParams.NameHash = 0x99c23b3986a26b38;
        entry->ReadOptionalSimpleType(cphyDphyComboMode, cphyDphyComboModeExists, cphyDphyComboModeID, localParams);
        localParams.NameHash = 0x9cc7d571db19ba27;
        entry->ReadOptionalEnum(channelType, channelTypeExists, channelTypeID, localParams);

        entry->UpdatePosition(localParams.LoadDataLimit);
    }
    else
    {
        PARAMETER_LOG_ERROR(entry->Table->SetManager, "%s: 0x%llx entry not found in the binary file, all values will be 0\n",
            __FUNCTION__, parentParams.NameHash);
    }
}

void CSIInformation::LoadArray(
    ParameterLoadParameters& __params,
    void*                    __array,
    UINT32                   __count)
{
    if (__array != nullptr)
    {
        CSIInformation* arrayPtr = (CSIInformation*)__array;
        for (UINT32 i = 0; i < __count; i++)
        {
            __params.Index = i;
            arrayPtr[i].Load(__params);
        }
    }
}

void* CSIInformation::AllocArray(
    UINT32 __count)
{
    CSIInformation* result = nullptr;
    if (__count > 0)
    {
        result = PARAMETER_NEW CSIInformation[__count];
    }
    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load AONCameraInfo
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void AONCameraInfo::Load(
    ParameterLoadParameters& parentParams)
{
    PARAMETER_INITIALIZE(isSharedBusExists);
    PARAMETER_INITIALIZE(isSharedBus);

    ParameterFileSymbolTableEntry* const entry = parentParams.Entry;
    ParameterLoadParameters localParams(parentParams);
    localParams.Element   = nullptr;
    localParams.UseParent = false;
    localParams.Index     = 0;

    if (parentParams.Element != nullptr)
    {
        bool _posChanged = false;
        localParams.Element = entry->AdjustPositionAndGetElement(parentParams, true, _posChanged);
    }

    // If parentParams.Element != null && localParams.Element == null, then this element is not defined in the binary file.
    // If parentParams.Element == null then this binary file does not contain a definition table or
    // the full backwards compatibility feature is disabled (for memory or performance reasons)
    if (parentParams.Element == nullptr || parentParams.Element->Verified || localParams.Element != nullptr)
    {
        localParams.Position      = entry->Position;
        localParams.LoadDataLimit = entry->ReadLoadDataLimit(parentParams.LoadDataLimit);

        localParams.NameHash = 0x81b22ec8c97bd031;
        entry->ReadOptionalSimpleType(isSharedBus, isSharedBusExists, isSharedBusID, localParams);

        entry->UpdatePosition(localParams.LoadDataLimit);
    }
    else
    {
        PARAMETER_LOG_ERROR(entry->Table->SetManager, "%s: 0x%llx entry not found in the binary file, all values will be 0\n",
            __FUNCTION__, parentParams.NameHash);
    }
}

void AONCameraInfo::LoadArray(
    ParameterLoadParameters& __params,
    void*                    __array,
    UINT32                   __count)
{
    if (__array != nullptr)
    {
        AONCameraInfo* arrayPtr = (AONCameraInfo*)__array;
        for (UINT32 i = 0; i < __count; i++)
        {
            __params.Index = i;
            arrayPtr[i].Load(__params);
        }
    }
}

void* AONCameraInfo::AllocArray(
    UINT32 __count)
{
    AONCameraInfo* result = nullptr;
    if (__count > 0)
    {
        result = PARAMETER_NEW AONCameraInfo[__count];
    }
    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load DepthConversionLibInfo
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void DepthConversionLibInfo::Load(
    ParameterLoadParameters& parentParams)
{
    PARAMETER_INITIALIZE(libraryName);
    PARAMETER_INITIALIZE(preprocLibraryName);
    PARAMETER_INITIALIZE(depthOutputFormatCount);
    PARAMETER_INITIALIZE(depthOutputFormat);

    ParameterFileSymbolTableEntry* const entry = parentParams.Entry;
    ParameterLoadParameters localParams(parentParams);
    localParams.Element   = nullptr;
    localParams.UseParent = false;
    localParams.Index     = 0;

    if (parentParams.Element != nullptr)
    {
        bool _posChanged = false;
        localParams.Element = entry->AdjustPositionAndGetElement(parentParams, true, _posChanged);
    }

    // If parentParams.Element != null && localParams.Element == null, then this element is not defined in the binary file.
    // If parentParams.Element == null then this binary file does not contain a definition table or
    // the full backwards compatibility feature is disabled (for memory or performance reasons)
    if (parentParams.Element == nullptr || parentParams.Element->Verified || localParams.Element != nullptr)
    {
        localParams.Position      = entry->Position;
        localParams.LoadDataLimit = entry->ReadLoadDataLimit(parentParams.LoadDataLimit);

        localParams.NameHash = 0x87cab19ddb5fb7c4;
        entry->ReadStringFixedArray(&libraryName, 1, localParams, __COUNTER__);
        localParams.NameHash = 0xe4a44011ed6ddca5;
        entry->ReadStringFixedArray(&preprocLibraryName, 1, localParams, __COUNTER__);
        localParams.NameHash = 0xfae0f8191a878487;
        entry->ReadEnumArray(depthOutputFormat, depthOutputFormatCount, depthOutputFormatID, 1,
            localParams, __COUNTER__);

        entry->UpdatePosition(localParams.LoadDataLimit);
    }
    else
    {
        PARAMETER_LOG_ERROR(entry->Table->SetManager, "%s: 0x%llx entry not found in the binary file, all values will be 0\n",
            __FUNCTION__, parentParams.NameHash);
    }
}

void DepthConversionLibInfo::LoadArray(
    ParameterLoadParameters& __params,
    void*                    __array,
    UINT32                   __count)
{
    if (__array != nullptr)
    {
        DepthConversionLibInfo* arrayPtr = (DepthConversionLibInfo*)__array;
        for (UINT32 i = 0; i < __count; i++)
        {
            __params.Index = i;
            arrayPtr[i].Load(__params);
        }
    }
}

void* DepthConversionLibInfo::AllocArray(
    UINT32 __count)
{
    DepthConversionLibInfo* result = nullptr;
    if (__count > 0)
    {
        result = PARAMETER_NEW DepthConversionLibInfo[__count];
    }
    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load LensInformation
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void LensInformation::Load(
    ParameterLoadParameters& parentParams)
{
    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);

    ParameterFileSymbolTableEntry* const entry = parentParams.Entry;
    ParameterLoadParameters localParams(parentParams);
    localParams.Element   = nullptr;
    localParams.UseParent = false;
    localParams.Index     = 0;

    if (parentParams.Element != nullptr)
    {
        bool _posChanged = false;
        localParams.Element = entry->AdjustPositionAndGetElement(parentParams, true, _posChanged);
    }

    // If parentParams.Element != null && localParams.Element == null, then this element is not defined in the binary file.
    // If parentParams.Element == null then this binary file does not contain a definition table or
    // the full backwards compatibility feature is disabled (for memory or performance reasons)
    if (parentParams.Element == nullptr || parentParams.Element->Verified || localParams.Element != nullptr)
    {
        localParams.Position      = entry->Position;
        localParams.LoadDataLimit = entry->ReadLoadDataLimit(parentParams.LoadDataLimit);

        localParams.NameHash = 0xa63cea7c1d38380f;
        entry->ReadSimpleTypeFixedArray(&focalLength, 1, localParams);
        localParams.NameHash = 0x81e4b6e93496bd45;
        entry->ReadSimpleTypeFixedArray(&fNumber, 1, localParams);
        localParams.NameHash = 0xfc2146ea78c20335;
        entry->ReadSimpleTypeFixedArray(&minFocusDistance, 1, localParams);
        localParams.NameHash = 0xb6bde6470b31c784;
        entry->ReadSimpleTypeFixedArray(&maxFocusDistance, 1, localParams);
        localParams.NameHash = 0xf41a0b38f39026c3;
        entry->ReadSimpleTypeFixedArray(&horizontalViewAngle, 1, localParams);
        localParams.NameHash = 0xd886345623240c67;
        entry->ReadSimpleTypeFixedArray(&verticalViewAngle, 1, localParams);
        localParams.NameHash = 0xdf26df24a0744c2f;
        entry->ReadOptionalSimpleType(maxRollDegree, maxRollDegreeExists, maxRollDegreeID, localParams);
        localParams.NameHash = 0x97b81525d97e72ae;
        entry->ReadOptionalSimpleType(maxPitchDegree, maxPitchDegreeExists, maxPitchDegreeID, localParams);
        localParams.NameHash = 0xdcbaec641d56ee59;
        entry->ReadOptionalSimpleType(maxYawDegree, maxYawDegreeExists, maxYawDegreeID, localParams);

        entry->UpdatePosition(localParams.LoadDataLimit);
    }
    else
    {
        PARAMETER_LOG_ERROR(entry->Table->SetManager, "%s: 0x%llx entry not found in the binary file, all values will be 0\n",
            __FUNCTION__, parentParams.NameHash);
    }
}

void LensInformation::LoadArray(
    ParameterLoadParameters& __params,
    void*                    __array,
    UINT32                   __count)
{
    if (__array != nullptr)
    {
        LensInformation* arrayPtr = (LensInformation*)__array;
        for (UINT32 i = 0; i < __count; i++)
        {
            __params.Index = i;
            arrayPtr[i].Load(__params);
        }
    }
}

void* LensInformation::AllocArray(
    UINT32 __count)
{
    LensInformation* result = nullptr;
    if (__count > 0)
    {
        result = PARAMETER_NEW LensInformation[__count];
    }
    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load ModuleConfiguration
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void ModuleConfiguration::Load(
    ParameterLoadParameters& parentParams)
{
    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);

    ParameterFileSymbolTableEntry* const entry = parentParams.Entry;
    ParameterLoadParameters localParams(parentParams);
    localParams.Element   = nullptr;
    localParams.UseParent = false;
    localParams.Index     = 0;

    if (parentParams.Element != nullptr)
    {
        bool _posChanged = false;
        localParams.Element = entry->AdjustPositionAndGetElement(parentParams, true, _posChanged);
    }

    // If parentParams.Element != null && localParams.Element == null, then this element is not defined in the binary file.
    // If parentParams.Element == null then this binary file does not contain a definition table or
    // the full backwards compatibility feature is disabled (for memory or performance reasons)
    if (parentParams.Element == nullptr || parentParams.Element->Verified || localParams.Element != nullptr)
    {
        localParams.Position      = entry->Position;
        localParams.LoadDataLimit = entry->ReadLoadDataLimit(parentParams.LoadDataLimit);

        localParams.NameHash = 0xadf1880aa2ec7cad;
        entry->ReadSimpleTypeFixedArray(&cameraId, 1, localParams);
        localParams.NameHash = 0xd3bceae82036ad2d;
        entry->ReadOptionalString(moduleName, moduleNameExists, moduleNameID, localParams, __COUNTER__);
        localParams.NameHash = 0xbf04cd23bc54e420;
        entry->ReadStringFixedArray(&sensorName, 1, localParams, __COUNTER__);
        localParams.NameHash = 0xe2a04a1b92932a01;
        entry->ReadSimpleTypeFixedArray(&sensorVersion, 1, localParams);
        localParams.NameHash = 0xe789562a3b5cc775;
        entry->ReadOptionalSimpleType(sensorSlaveAddress, sensorSlaveAddressExists, sensorSlaveAddressID, localParams);
        localParams.NameHash = 0xdc56f3702835af17;
        entry->ReadOptionalEnum(sensorI2CFrequencyMode, sensorI2CFrequencyModeExists, sensorI2CFrequencyModeID, localParams);
        localParams.NameHash = 0x9848abebf23e6e99;
        entry->ReadOptionalString(actuatorName, actuatorNameExists, actuatorNameID, localParams, __COUNTER__);
        localParams.NameHash = 0xca32c49b2e1a1246;
        entry->ReadOptionalSimpleType(actuatorSlaveAddress, actuatorSlaveAddressExists, actuatorSlaveAddressID, localParams);
        localParams.NameHash = 0xbe141018d8b8a31f;
        entry->ReadOptionalString(oisName, oisNameExists, oisNameID, localParams, __COUNTER__);
        localParams.NameHash = 0xf743ea9ff76f9318;
        entry->ReadOptionalString(eepromName, eepromNameExists, eepromNameID, localParams, __COUNTER__);
        localParams.NameHash = 0xca01c3e68646e411;
        entry->ReadOptionalSimpleType(eepromSlaveAddress, eepromSlaveAddressExists, eepromSlaveAddressID, localParams);
        localParams.NameHash = 0xc1073b9a5e002a36;
        entry->ReadOptionalString(flashName, flashNameExists, flashNameID, localParams, __COUNTER__);
        localParams.NameHash = 0xe4902d6fe24c8f3b;
        entry->ReadOptionalString(flashNameSecondary, flashNameSecondaryExists, flashNameSecondaryID, localParams, __COUNTER__);
        localParams.NameHash = 0xb43b83f4331a480a;
        entry->ReadOptionalString(chromatixName, chromatixNameExists, chromatixNameID, localParams, __COUNTER__);
        localParams.NameHash = 0x9a30e6f805a86ac5;
        entry->ReadOptionalEnum(i2cFrequencyMode, i2cFrequencyModeExists, i2cFrequencyModeID, localParams);
        localParams.NameHash = 0xae7fbcd619438d07;
        entry->ReadOptionalStructure(aonCamInfo, aonCamInfoExists, aonCamInfoID, localParams);
        localParams.NameHash = 0x8e16c621c26ae8bd;
        entry->ReadEnumFixedArray(&position, 1, localParams);
        localParams.UseParent       = false;
        localParams.UseParentOffset = true;
        localParams.NameHash        = 0xf86b342f56418279;
        CSIInfo.Load(localParams);
        localParams.NameHash        = 0xa40f09c2c6de66d0;
        lensInfo.Load(localParams);
        localParams.NameHash = 0x81dd24f93a2f4c7b;
        entry->ReadOptionalString(pdafName, pdafNameExists, pdafNameID, localParams, __COUNTER__);
        localParams.NameHash = 0xfe079b9b31ab6c26;
        entry->ReadOptionalStructure(depthConversionLibInfo, depthConversionLibInfoExists, depthConversionLibInfoID, localParams);
        localParams.NameHash = 0x977e7e79d8e13c96;
        entry->ReadOptionalString(sensorBroadcastName, sensorBroadcastNameExists, sensorBroadcastNameID, localParams, __COUNTER__);
        localParams.NameHash = 0xb64e0fad95547983;
        entry->ReadOptionalSimpleType(numSensorsInBroadcast, numSensorsInBroadcastExists, numSensorsInBroadcastID, localParams);

        entry->UpdatePosition(localParams.LoadDataLimit);
    }
    else
    {
        PARAMETER_LOG_ERROR(entry->Table->SetManager, "%s: 0x%llx entry not found in the binary file, all values will be 0\n",
            __FUNCTION__, parentParams.NameHash);
    }
}

void ModuleConfiguration::LoadArray(
    ParameterLoadParameters& __params,
    void*                    __array,
    UINT32                   __count)
{
    if (__array != nullptr)
    {
        ModuleConfiguration* arrayPtr = (ModuleConfiguration*)__array;
        for (UINT32 i = 0; i < __count; i++)
        {
            __params.Index = i;
            arrayPtr[i].Load(__params);
        }
    }
}

void* ModuleConfiguration::AllocArray(
    UINT32 __count)
{
    ModuleConfiguration* result = nullptr;
    if (__count > 0)
    {
        result = PARAMETER_NEW ModuleConfiguration[__count];
    }
    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load ModuleGroup
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void ModuleGroup::Load(
    ParameterLoadParameters& parentParams)
{
    PARAMETER_INITIALIZE(moduleConfigurationCount);
    PARAMETER_INITIALIZE(moduleConfiguration);

    ParameterFileSymbolTableEntry* const entry = parentParams.Entry;
    ParameterLoadParameters localParams(parentParams);
    localParams.Element   = nullptr;
    localParams.UseParent = false;
    localParams.Index     = 0;

    if (parentParams.Element != nullptr)
    {
        bool _posChanged = false;
        localParams.Element = entry->AdjustPositionAndGetElement(parentParams, true, _posChanged);
    }

    // If parentParams.Element != null && localParams.Element == null, then this element is not defined in the binary file.
    // If parentParams.Element == null then this binary file does not contain a definition table or
    // the full backwards compatibility feature is disabled (for memory or performance reasons)
    if (parentParams.Element == nullptr || parentParams.Element->Verified || localParams.Element != nullptr)
    {
        localParams.Position      = entry->Position;
        localParams.LoadDataLimit = entry->ReadLoadDataLimit(parentParams.LoadDataLimit);

        localParams.NameHash = 0x90249a5a76fa03a7;
        entry->ReadStructureArray(moduleConfiguration, moduleConfigurationCount, moduleConfigurationID, 1, localParams, __COUNTER__);

        entry->UpdatePosition(localParams.LoadDataLimit);
    }
    else
    {
        PARAMETER_LOG_ERROR(entry->Table->SetManager, "%s: 0x%llx entry not found in the binary file, all values will be 0\n",
            __FUNCTION__, parentParams.NameHash);
    }
}

void ModuleGroup::LoadArray(
    ParameterLoadParameters& __params,
    void*                    __array,
    UINT32                   __count)
{
    if (__array != nullptr)
    {
        ModuleGroup* arrayPtr = (ModuleGroup*)__array;
        for (UINT32 i = 0; i < __count; i++)
        {
            __params.Index = i;
            arrayPtr[i].Load(__params);
        }
    }
}

void* ModuleGroup::AllocArray(
    UINT32 __count)
{
    ModuleGroup* result = nullptr;
    if (__count > 0)
    {
        result = PARAMETER_NEW ModuleGroup[__count];
    }
    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load CameraModuleData
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CameraModuleData::Load(
    ParameterLoadParameters& parentParams)
{
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(moduleGroup);

    ParameterFileSymbolTableEntry* const entry = parentParams.Entry;
    ParameterLoadParameters localParams(parentParams);
    localParams.Element   = nullptr;
    localParams.UseParent = false;
    localParams.Index     = 0;

    if (parentParams.Element != nullptr)
    {
        bool _posChanged = false;
        localParams.Element = entry->AdjustPositionAndGetElement(parentParams, true, _posChanged);
    }

    // If parentParams.Element != null && localParams.Element == null, then this element is not defined in the binary file.
    // If parentParams.Element == null then this binary file does not contain a definition table or
    // the full backwards compatibility feature is disabled (for memory or performance reasons)
    if (parentParams.Element == nullptr || parentParams.Element->Verified || localParams.Element != nullptr)
    {
        localParams.Position      = entry->Position;
        localParams.LoadDataLimit = entry->ReadLoadDataLimit(parentParams.LoadDataLimit);

        localParams.UseParent       = false;
        localParams.UseParentOffset = true;
        localParams.NameHash        = 0xe11cd9f365a2599f;
        module_version.Load(localParams);
        localParams.NameHash        = 0x8045a4b8c8aaf971;
        moduleGroup.Load(localParams);

        entry->UpdatePosition(localParams.LoadDataLimit);
    }
    else
    {
        PARAMETER_LOG_ERROR(entry->Table->SetManager, "%s: 0x%llx entry not found in the binary file, all values will be 0\n",
            __FUNCTION__, parentParams.NameHash);
    }
}

void CameraModuleData::LoadArray(
    ParameterLoadParameters& __params,
    void*                    __array,
    UINT32                   __count)
{
    if (__array != nullptr)
    {
        CameraModuleData* arrayPtr = (CameraModuleData*)__array;
        for (UINT32 i = 0; i < __count; i++)
        {
            __params.Index = i;
            arrayPtr[i].Load(__params);
        }
    }
}

void* CameraModuleData::AllocArray(
    UINT32 __count)
{
    CameraModuleData* result = nullptr;
    if (__count > 0)
    {
        result = PARAMETER_NEW CameraModuleData[__count];
    }
    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load module_versionStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CameraModuleData::module_versionStruct::Load(
    ParameterLoadParameters& parentParams)
{
    PARAMETER_INITIALIZE(major_revision);
    PARAMETER_INITIALIZE(minor_revision);
    PARAMETER_INITIALIZE(incr_revision);

    ParameterFileSymbolTableEntry* const entry = parentParams.Entry;
    ParameterLoadParameters localParams(parentParams);
    localParams.Element   = nullptr;
    localParams.UseParent = false;
    localParams.Index     = 0;

    if (parentParams.Element != nullptr)
    {
        bool _posChanged = false;
        localParams.Element = entry->AdjustPositionAndGetElement(parentParams, true, _posChanged);
    }

    // If parentParams.Element != null && localParams.Element == null, then this element is not defined in the binary file.
    // If parentParams.Element == null then this binary file does not contain a definition table or
    // the full backwards compatibility feature is disabled (for memory or performance reasons)
    if (parentParams.Element == nullptr || parentParams.Element->Verified || localParams.Element != nullptr)
    {
        localParams.Position      = entry->Position;
        localParams.LoadDataLimit = entry->ReadLoadDataLimit(parentParams.LoadDataLimit);

        localParams.NameHash = 0xcd66249477636693;
        entry->ReadSimpleTypeFixedArray(&major_revision, 1, localParams);
        localParams.NameHash = 0xc5497493137a9c25;
        entry->ReadSimpleTypeFixedArray(&minor_revision, 1, localParams);
        localParams.NameHash = 0xb27b8a668efb2a56;
        entry->ReadSimpleTypeFixedArray(&incr_revision, 1, localParams);

        entry->UpdatePosition(localParams.LoadDataLimit);
    }
    else
    {
        PARAMETER_LOG_ERROR(entry->Table->SetManager, "%s: 0x%llx entry not found in the binary file, all values will be 0\n",
            __FUNCTION__, parentParams.NameHash);
    }
}

void CameraModuleData::module_versionStruct::LoadArray(
    ParameterLoadParameters& __params,
    void*                    __array,
    UINT32                   __count)
{
    if (__array != nullptr)
    {
        module_versionStruct* arrayPtr = (module_versionStruct*)__array;
        for (UINT32 i = 0; i < __count; i++)
        {
            __params.Index = i;
            arrayPtr[i].Load(__params);
        }
    }
}

void* CameraModuleData::module_versionStruct::AllocArray(
    UINT32 __count)
{
    module_versionStruct* result = nullptr;
    if (__count > 0)
    {
        result = PARAMETER_NEW module_versionStruct[__count];
    }
    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload DepthConversionLibInfo
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void DepthConversionLibInfo::Unload(ParameterFileSymbolTable* const __table)
{
    ParameterFileSymbolTable::ReleaseObject(__table, libraryName);
    ParameterFileSymbolTable::ReleaseObject(__table, preprocLibraryName);
    ParameterFileSymbolTable::ReleaseObject(__table, depthOutputFormat);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload ModuleConfiguration
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void ModuleConfiguration::Unload(ParameterFileSymbolTable* const __table)
{
    ParameterFileSymbolTable::ReleaseObject(__table, moduleName);
    ParameterFileSymbolTable::ReleaseObject(__table, sensorName);
    ParameterFileSymbolTable::ReleaseObject(__table, actuatorName);
    ParameterFileSymbolTable::ReleaseObject(__table, oisName);
    ParameterFileSymbolTable::ReleaseObject(__table, eepromName);
    ParameterFileSymbolTable::ReleaseObject(__table, flashName);
    ParameterFileSymbolTable::ReleaseObject(__table, flashNameSecondary);
    ParameterFileSymbolTable::ReleaseObject(__table, chromatixName);
    ParameterFileSymbolTable::ReleaseObject(__table, pdafName);
    depthConversionLibInfo.Unload(__table);
    ParameterFileSymbolTable::ReleaseObject(__table, sensorBroadcastName);
}

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

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

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// GetModuleName: Returns ParameterModule::Name variable
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const CHAR* CameraModuleData::GetModuleName()
{
    return ((CameraModuleDataClass*)this)->Name;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// GetModuleName: Returns ParameterModule::NameHash variable
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
UINT64 CameraModuleData::GetModuleNameHash()
{
    return ((CameraModuleDataClass*)this)->NameHash;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Create module, and return a new object
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ParameterModule* CameraModuleDataClass::Create(
    ModuleData* const    moduleData,
    DefaultModule* const defModule) const
{
    CameraModuleDataClass* cls = nullptr;

    if (IsModuleMatch(moduleData) && 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(Name, 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 hash (0x%016llx) does not match source name hash (0x%016llx)\n",
            moduleData->NameHash, NameHash);
    }

    return (ParameterModule*)cls;
}

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

#ifdef PARAMETER_USE_MUTEX
    ParameterMutexLocker lock(Mutex); // Unique LOCK
#endif

    if (!Loaded)
    {
        CameraModuleDataClass* const cls = this;

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

        if (!result)
        {
            PARAMETER_LOG_ERROR(entry->Table->SetManager, "CameraModuleDataClass::LoadModule Failed to find module ID (%d) in Symbol Table\n", SymbolTableID);
        }


        ParameterDefinitionElement* _element = nullptr;
        if (table->ModuleDefinitions != nullptr && !table->ModuleDefinitions->empty())
        {
            _element = table->BuildModuleElement(NameHash);
        }

        ParameterLoadParameters parentParams(entry, NameHash, true, true, _element, entry->Position, 0, ParameterFileSymbolTableEntry::LOAD_LIMIT_MAX);
        cls->Load(parentParams);
        PARAMETER_DELETE _element;
        Modified++;
        Loaded = true;
    }

    if (!result)
    {
        /// Module failed to fully load, unload it
        UnloadModule();
    }

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload module data
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CameraModuleDataClass::UnloadModule()
{
#ifdef PARAMETER_USE_MUTEX
    ParameterMutexLocker lock(Mutex); // Unique LOCK
#endif

    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
