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

#include "rertuning.h"
#include "parametersetmanager.h"

RERTUNING_NAMESPACE_BEGIN

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// SetValue/GetValue Functions
/// Gets or sets the requested value
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool ChromatixRedEyeReduction::GetValue(
    const CHAR* const __path,
    CHAR* const       __value,
    UINT32 const      __size)
{
    constexpr SIZE_T MAX_SIZE = 129;
    CHAR   __name[MAX_SIZE] = "";
    UINT32 __index          = MAX_UINT;
    bool   __result         = false;

    const UINT32 __pos = ParameterUtils::GetVariable(__path, __name, __index, MAX_SIZE);

    if (PARAMETER_STRCMP(__name, "module_version") == 0)
    {
        __result = module_version.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "enableRedEyeReductionXenonStrobe") == 0)
    {
        ParameterUtils::DoubleToString((double)enableRedEyeReductionXenonStrobe, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "enableRedEyeReductionFlashStrobe") == 0)
    {
        ParameterUtils::DoubleToString((double)enableRedEyeReductionFlashStrobe, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "preflashCyclesCount") == 0)
    {
        ParameterUtils::DoubleToString((double)preflashCyclesCount, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "msIntervalBetweenPulses") == 0)
    {
        ParameterUtils::DoubleToString((double)msIntervalBetweenPulses, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "usXenonPulsesDuration") == 0)
    {
        ParameterUtils::DoubleToString((double)usXenonPulsesDuration, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "msLEDPulsesDuration") == 0)
    {
        ParameterUtils::DoubleToString((double)msLEDPulsesDuration, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "preflashLEDCurrent") == 0)
    {
        ParameterUtils::DoubleToString((double)preflashLEDCurrent, __value, __size, 0);
        __result = true;
    }

    return __result;
}

bool ChromatixRedEyeReduction::SetValue(
    const CHAR* const __path,
    const CHAR* const __value)
{
    constexpr SIZE_T MAX_SIZE = 129;
    CHAR   __name[MAX_SIZE] = "";
    UINT32 __index          = MAX_UINT;
    bool   __result         = false;

    const UINT32 __pos = ParameterUtils::GetVariable(__path, __name, __index, MAX_SIZE);

    if (PARAMETER_STRCMP(__name, "module_version") == 0)
    {
        __result = module_version.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "enableRedEyeReductionXenonStrobe") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            enableRedEyeReductionXenonStrobe = (BOOL)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "enableRedEyeReductionFlashStrobe") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            enableRedEyeReductionFlashStrobe = (BOOL)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "preflashCyclesCount") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            preflashCyclesCount = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "msIntervalBetweenPulses") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            msIntervalBetweenPulses = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "usXenonPulsesDuration") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            usXenonPulsesDuration = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "msLEDPulsesDuration") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            msLEDPulsesDuration = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "preflashLEDCurrent") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            preflashLEDCurrent = (INT32)dblValue; 
        }
    }

    return __result;
}

bool ChromatixRedEyeReduction::GetInfo(
    const CHAR* const           __path,
    PList<ParameterParserInfo>& __info)
{
    constexpr SIZE_T MAX_SIZE = 129;
    CHAR   __name[MAX_SIZE] = "";
    UINT32 __index          = MAX_UINT;
    bool   __result         = false;

    const UINT32 __pos = ParameterUtils::GetVariable(__path, __name, __index, MAX_SIZE);

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

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

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

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

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

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

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

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

    return __result;
}

bool ChromatixRedEyeReduction::module_versionStruct::GetValue(
    const CHAR* const __path,
    CHAR* const       __value,
    UINT32 const      __size)
{
    constexpr SIZE_T MAX_SIZE = 129;
    CHAR   __name[MAX_SIZE] = "";
    UINT32 __index          = MAX_UINT;
    bool   __result         = false;

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

    if (PARAMETER_STRCMP(__name, "major_revision") == 0)
    {
        ParameterUtils::DoubleToString((double)major_revision, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "minor_revision") == 0)
    {
        ParameterUtils::DoubleToString((double)minor_revision, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "incr_revision") == 0)
    {
        ParameterUtils::DoubleToString((double)incr_revision, __value, __size, 0);
        __result = true;
    }

    return __result;
}

bool ChromatixRedEyeReduction::module_versionStruct::SetValue(
    const CHAR* const __path,
    const CHAR* const __value)
{
    constexpr SIZE_T MAX_SIZE = 129;
    CHAR   __name[MAX_SIZE] = "";
    UINT32 __index          = MAX_UINT;
    bool   __result         = false;

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

    if (PARAMETER_STRCMP(__name, "major_revision") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            major_revision = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "minor_revision") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            minor_revision = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "incr_revision") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            incr_revision = (INT32)dblValue; 
        }
    }

    return __result;
}

bool ChromatixRedEyeReduction::module_versionStruct::GetInfo(
    const CHAR* const           __path,
    PList<ParameterParserInfo>& __info)
{
    constexpr SIZE_T MAX_SIZE = 129;
    CHAR   __name[MAX_SIZE] = "";
    UINT32 __index          = MAX_UINT;
    bool   __result         = false;

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

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

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

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

    return __result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Default Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ChromatixRedEyeReductionClass::ChromatixRedEyeReductionClass(
    const CHAR* name)
    : ParameterModule(name, MAJOR, MINOR, PATCH, nullptr)
{
    PARAMETER_INITIALIZE(SymbolTableID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(enableRedEyeReductionXenonStrobe);
    PARAMETER_INITIALIZE(enableRedEyeReductionFlashStrobe);
    PARAMETER_INITIALIZE(preflashCyclesCount);
    PARAMETER_INITIALIZE(msIntervalBetweenPulses);
    PARAMETER_INITIALIZE(usXenonPulsesDuration);
    PARAMETER_INITIALIZE(msLEDPulsesDuration);
    PARAMETER_INITIALIZE(preflashLEDCurrent);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ChromatixRedEyeReductionClass::ChromatixRedEyeReductionClass(
    const CHAR*       name,
    ModuleData* const moduleData)
    : ParameterModule(name, MAJOR, MINOR, PATCH, moduleData)
{
    PARAMETER_INITIALIZE(SymbolTableID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(enableRedEyeReductionXenonStrobe);
    PARAMETER_INITIALIZE(enableRedEyeReductionFlashStrobe);
    PARAMETER_INITIALIZE(preflashCyclesCount);
    PARAMETER_INITIALIZE(msIntervalBetweenPulses);
    PARAMETER_INITIALIZE(usXenonPulsesDuration);
    PARAMETER_INITIALIZE(msLEDPulsesDuration);
    PARAMETER_INITIALIZE(preflashLEDCurrent);
}

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


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load ChromatixRedEyeReduction
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void ChromatixRedEyeReduction::Load(
    ParameterLoadParameters& parentParams)
{
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(enableRedEyeReductionXenonStrobe);
    PARAMETER_INITIALIZE(enableRedEyeReductionFlashStrobe);
    PARAMETER_INITIALIZE(preflashCyclesCount);
    PARAMETER_INITIALIZE(msIntervalBetweenPulses);
    PARAMETER_INITIALIZE(usXenonPulsesDuration);
    PARAMETER_INITIALIZE(msLEDPulsesDuration);
    PARAMETER_INITIALIZE(preflashLEDCurrent);

    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 = 0xcdfe1d6ed3c112a7;
        entry->ReadSimpleTypeFixedArray(&enableRedEyeReductionXenonStrobe, 1, localParams);
        localParams.NameHash = 0xb0e989610516544f;
        entry->ReadSimpleTypeFixedArray(&enableRedEyeReductionFlashStrobe, 1, localParams);
        localParams.NameHash = 0x9861ac950135f9f3;
        entry->ReadSimpleTypeFixedArray(&preflashCyclesCount, 1, localParams);
        localParams.NameHash = 0xf9f3d20174cb0bd3;
        entry->ReadSimpleTypeFixedArray(&msIntervalBetweenPulses, 1, localParams);
        localParams.NameHash = 0xe314b4b2da9033f5;
        entry->ReadSimpleTypeFixedArray(&usXenonPulsesDuration, 1, localParams);
        localParams.NameHash = 0x9808a779ec589899;
        entry->ReadSimpleTypeFixedArray(&msLEDPulsesDuration, 1, localParams);
        localParams.NameHash = 0xe029a240688036b5;
        entry->ReadSimpleTypeFixedArray(&preflashLEDCurrent, 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 ChromatixRedEyeReduction::LoadArray(
    ParameterLoadParameters& __params,
    void*                    __array,
    UINT32                   __count)
{
    if (__array != nullptr)
    {
        ChromatixRedEyeReduction* arrayPtr = (ChromatixRedEyeReduction*)__array;
        for (UINT32 i = 0; i < __count; i++)
        {
            __params.Index = i;
            arrayPtr[i].Load(__params);
        }
    }
}

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

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load module_versionStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void ChromatixRedEyeReduction::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 ChromatixRedEyeReduction::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* ChromatixRedEyeReduction::module_versionStruct::AllocArray(
    UINT32 __count)
{
    module_versionStruct* result = nullptr;
    if (__count > 0)
    {
        result = PARAMETER_NEW module_versionStruct[__count];
    }
    return result;
}

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

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

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

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

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Create module, and return a new object
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ParameterModule* ChromatixRedEyeReductionClass::Create(
    ModuleData* const    moduleData,
    DefaultModule* const defModule) const
{
    ChromatixRedEyeReductionClass* 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 = (ChromatixRedEyeReductionClass*)module;
        }
        else
        {
            cls = PARAMETER_NEW ChromatixRedEyeReductionClass(Name, moduleData);
            cls->SymbolTableID = id;
            defModule->AddModule((ParameterModule*)cls);
        }
    }
    else if (Version.Value != moduleData->Version.Value)
    {
        PARAMETER_LOG_ERROR(moduleData->SetManager, "Unable to create ChromatixRedEyeReductionClass, binary version (%lld) does not match source version (%lld)\n",
            moduleData->Version.Value, Version.Value);
    }
    else
    {
        PARAMETER_LOG_ERROR(moduleData->SetManager, "Unable to create ChromatixRedEyeReductionClass, 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 ChromatixRedEyeReductionClass::LoadModule(
    ParameterFileSymbolTable* const table)
{
    bool result = true;

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

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

        ParameterFileSymbolTableEntry  entryObj;
        ParameterFileSymbolTableEntry* const entry = &entryObj;
        // With EzTune enabled, the unused upper byte of SymbolTableID value can change, so clear it
        result = table->Find(entryObj, SymbolTableID & 0x00ffffffU);

        if (!result)
        {
            PARAMETER_LOG_ERROR(entry->Table->SetManager, "ChromatixRedEyeReductionClass::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 ChromatixRedEyeReductionClass::UnloadModule()
{
#ifdef PARAMETER_USE_MUTEX
    ParameterMutexLocker lock(Mutex); // Unique LOCK
#endif

    if (Loaded)
    {
        Loaded = false;
    }
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// /// Release the ParameterModule object
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void ChromatixRedEyeReductionClass::Release()
{
    ParameterModule::Release();
}

RERTUNING_NAMESPACE_END
