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

#include "aftofelements.h"
#include "parametersetmanager.h"

AFTOFELEMENTS_NAMESPACE_BEGIN

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

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

    if (PARAMETER_STRCMP(__name, "num_near_steps_near_direction") == 0)
    {
        ParameterUtils::DoubleToString((double)num_near_steps_near_direction, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "num_far_steps_near_direction") == 0)
    {
        ParameterUtils::DoubleToString((double)num_far_steps_near_direction, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "num_near_steps_far_direction") == 0)
    {
        ParameterUtils::DoubleToString((double)num_near_steps_far_direction, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "num_far_steps_far_direction") == 0)
    {
        ParameterUtils::DoubleToString((double)num_far_steps_far_direction, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "num_near_steps_far_converge_point") == 0)
    {
        ParameterUtils::DoubleToString((double)num_near_steps_far_converge_point, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "num_far_steps_far_converge_point") == 0)
    {
        ParameterUtils::DoubleToString((double)num_far_steps_far_converge_point, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "near_steps_far_direction_tof_conf") == 0)
    {
        ParameterUtils::DoubleToString((double)near_steps_far_direction_tof_conf, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "tof_step_size") == 0)
    {
        ParameterUtils::DoubleToString((double)tof_step_size, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "tof_step_size_low_light") == 0)
    {
        ParameterUtils::DoubleToString((double)tof_step_size_low_light, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "far_distance_fine_step_size") == 0)
    {
        ParameterUtils::DoubleToString((double)far_distance_fine_step_size, __value, __size, 0);
        __result = true;
    }

    return __result;
}

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

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

    if (PARAMETER_STRCMP(__name, "num_near_steps_near_direction") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            num_near_steps_near_direction = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "num_far_steps_near_direction") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            num_far_steps_near_direction = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "num_near_steps_far_direction") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            num_near_steps_far_direction = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "num_far_steps_far_direction") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            num_far_steps_far_direction = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "num_near_steps_far_converge_point") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            num_near_steps_far_converge_point = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "num_far_steps_far_converge_point") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            num_far_steps_far_converge_point = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "near_steps_far_direction_tof_conf") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            near_steps_far_direction_tof_conf = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "tof_step_size") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            tof_step_size = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "tof_step_size_low_light") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            tof_step_size_low_light = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "far_distance_fine_step_size") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            far_distance_fine_step_size = (INT32)dblValue; 
        }
    }

    return __result;
}

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

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

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

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

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

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

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

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

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

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

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

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

    return __result;
}

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

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

    if (PARAMETER_STRCMP(__name, "jump_to_start_limit") == 0)
    {
        ParameterUtils::DoubleToString((double)jump_to_start_limit, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "jump_to_start_limit_low_light") == 0)
    {
        ParameterUtils::DoubleToString((double)jump_to_start_limit_low_light, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "start_pos_for_tof") == 0)
    {
        ParameterUtils::DoubleToString((double)start_pos_for_tof, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "far_converge_point") == 0)
    {
        ParameterUtils::DoubleToString((double)far_converge_point, __value, __size, 0);
        __result = true;
    }

    return __result;
}

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

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

    if (PARAMETER_STRCMP(__name, "jump_to_start_limit") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            jump_to_start_limit = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "jump_to_start_limit_low_light") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            jump_to_start_limit_low_light = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "start_pos_for_tof") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            start_pos_for_tof = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "far_converge_point") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            far_converge_point = (INT32)dblValue; 
        }
    }

    return __result;
}

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

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

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

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

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

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

    return __result;
}

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

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

    if (PARAMETER_STRCMP(__name, "scene_change_distance_std_dev_thres") == 0)
    {
        ParameterUtils::DoubleToString((double)scene_change_distance_std_dev_thres, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "far_distance_unstable_cnt_factor") == 0)
    {
        ParameterUtils::DoubleToString((double)far_distance_unstable_cnt_factor, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "panning_stable_cnt") == 0)
    {
        ParameterUtils::DoubleToString((double)panning_stable_cnt, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "panning_stable_thres") == 0)
    {
        ParameterUtils::DoubleToString((double)panning_stable_thres, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "normal_light_cnt") == 0)
    {
        ParameterUtils::DoubleToString((double)normal_light_cnt, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "lowlight_cnt") == 0)
    {
        ParameterUtils::DoubleToString((double)lowlight_cnt, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "num_monitor_samples") == 0)
    {
        ParameterUtils::DoubleToString((double)num_monitor_samples, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "scene_change_distance_thres") == 0)
    {
        if (__index < scene_change_distance_thresCount)
        {
            ParameterUtils::DoubleToString((double)scene_change_distance_thres[__index], __value, __size, 0);
            __result = true;
        }
        else
        {
            SIZE_T __valuePos = 0;
            for (UINT32 i = 0; i < scene_change_distance_thresCount; i++)
            {
                if (i > 0)
                {
                    PARAMETER_STRCAT(__value, __size, ",");
                    __valuePos = PARAMETER_STRLEN(__value);
                }
                ParameterUtils::DoubleToString((double)scene_change_distance_thres[i], &__value[__valuePos], (INT32)(__size - __valuePos), 0);
            }
            __result = true;
        }
    }
    else if (PARAMETER_STRCMP(__name, "distance_region") == 0)
    {
        if (__index < distance_regionCount)
        {
            ParameterUtils::DoubleToString((double)distance_region[__index], __value, __size, 0);
            __result = true;
        }
        else
        {
            SIZE_T __valuePos = 0;
            for (UINT32 i = 0; i < distance_regionCount; i++)
            {
                if (i > 0)
                {
                    PARAMETER_STRCAT(__value, __size, ",");
                    __valuePos = PARAMETER_STRLEN(__value);
                }
                ParameterUtils::DoubleToString((double)distance_region[i], &__value[__valuePos], (INT32)(__size - __valuePos), 0);
            }
            __result = true;
        }
    }

    return __result;
}

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

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

    if (PARAMETER_STRCMP(__name, "scene_change_distance_std_dev_thres") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            scene_change_distance_std_dev_thres = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "far_distance_unstable_cnt_factor") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            far_distance_unstable_cnt_factor = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "panning_stable_cnt") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            panning_stable_cnt = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "panning_stable_thres") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            panning_stable_thres = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "normal_light_cnt") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            normal_light_cnt = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "lowlight_cnt") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            lowlight_cnt = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "num_monitor_samples") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            num_monitor_samples = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "scene_change_distance_thres") == 0)
    {
        if (__index < scene_change_distance_thresCount)
        {
            const double dblValue = ParameterUtils::StringToDouble(__value, __result);
            if (__result)
            {
                scene_change_distance_thres[__index] = (INT32)dblValue; 
            }
        }
        else
        {
            SIZE_T __valueLen = PARAMETER_STRLEN(__value);
            UINT32 __pos = 0;

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

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

                const double dblValue = ParameterUtils::StringToDouble(__valueStr, __result);
                if (__result)
                {
                    scene_change_distance_thres[__index] = (INT32)dblValue; 
                }
                __index++;
            }
            __result = true;
        }
    }
    else if (PARAMETER_STRCMP(__name, "distance_region") == 0)
    {
        if (__index < distance_regionCount)
        {
            const double dblValue = ParameterUtils::StringToDouble(__value, __result);
            if (__result)
            {
                distance_region[__index] = (INT32)dblValue; 
            }
        }
        else
        {
            SIZE_T __valueLen = PARAMETER_STRLEN(__value);
            UINT32 __pos = 0;

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

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

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

    return __result;
}

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

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

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

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

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

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

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

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

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

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

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

    return __result;
}

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

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

    if (PARAMETER_STRCMP(__name, "frame_delay_focus_converge_bright_light") == 0)
    {
        ParameterUtils::DoubleToString((double)frame_delay_focus_converge_bright_light, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "frame_delay_focus_converge_low_light") == 0)
    {
        ParameterUtils::DoubleToString((double)frame_delay_focus_converge_low_light, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "frame_delay_fine_search_bright_light") == 0)
    {
        ParameterUtils::DoubleToString((double)frame_delay_fine_search_bright_light, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "frame_delay_fine_search_low_light") == 0)
    {
        ParameterUtils::DoubleToString((double)frame_delay_fine_search_low_light, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "frame_delay_outdoor_light") == 0)
    {
        ParameterUtils::DoubleToString((double)frame_delay_outdoor_light, __value, __size, 0);
        __result = true;
    }

    return __result;
}

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

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

    if (PARAMETER_STRCMP(__name, "frame_delay_focus_converge_bright_light") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            frame_delay_focus_converge_bright_light = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "frame_delay_focus_converge_low_light") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            frame_delay_focus_converge_low_light = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "frame_delay_fine_search_bright_light") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            frame_delay_fine_search_bright_light = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "frame_delay_fine_search_low_light") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            frame_delay_fine_search_low_light = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "frame_delay_outdoor_light") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            frame_delay_outdoor_light = (INT32)dblValue; 
        }
    }

    return __result;
}

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

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

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

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

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

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

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

    return __result;
}

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

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

    if (PARAMETER_STRCMP(__name, "median_filter_enable") == 0)
    {
        ParameterUtils::DoubleToString((double)median_filter_enable, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "median_filter_num_of_samples") == 0)
    {
        ParameterUtils::DoubleToString((double)median_filter_num_of_samples, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "average_filter_enable") == 0)
    {
        ParameterUtils::DoubleToString((double)average_filter_enable, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "average_filter_num_of_samples") == 0)
    {
        ParameterUtils::DoubleToString((double)average_filter_num_of_samples, __value, __size, 0);
        __result = true;
    }

    return __result;
}

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

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

    if (PARAMETER_STRCMP(__name, "median_filter_enable") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            median_filter_enable = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "median_filter_num_of_samples") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            median_filter_num_of_samples = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "average_filter_enable") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            average_filter_enable = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "average_filter_num_of_samples") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            average_filter_num_of_samples = (INT32)dblValue; 
        }
    }

    return __result;
}

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

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

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

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

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

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

    return __result;
}

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

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

    if (PARAMETER_STRCMP(__name, "use_custom_sensitivity") == 0)
    {
        ParameterUtils::DoubleToString((double)use_custom_sensitivity, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "enable_sad_when_tof_is_conf") == 0)
    {
        ParameterUtils::DoubleToString((double)enable_sad_when_tof_is_conf, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "run_tof_in_outdoor_light_flag") == 0)
    {
        ParameterUtils::DoubleToString((double)run_tof_in_outdoor_light_flag, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "aec_wait_check_flag_enable") == 0)
    {
        ParameterUtils::DoubleToString((double)aec_wait_check_flag_enable, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "far_scene_coarse_srch_enable") == 0)
    {
        ParameterUtils::DoubleToString((double)far_scene_coarse_srch_enable, __value, __size, 0);
        __result = true;
    }

    return __result;
}

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

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

    if (PARAMETER_STRCMP(__name, "use_custom_sensitivity") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            use_custom_sensitivity = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "enable_sad_when_tof_is_conf") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            enable_sad_when_tof_is_conf = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "run_tof_in_outdoor_light_flag") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            run_tof_in_outdoor_light_flag = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "aec_wait_check_flag_enable") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            aec_wait_check_flag_enable = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "far_scene_coarse_srch_enable") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            far_scene_coarse_srch_enable = (INT32)dblValue; 
        }
    }

    return __result;
}

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

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

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

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

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

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

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

    return __result;
}

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

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

    if (PARAMETER_STRCMP(__name, "module_version") == 0)
    {
        __result = module_version.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "parameter_version") == 0)
    {
        __result = parameter_version.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "sensitivity") == 0)
    {
        ParameterUtils::DoubleToString((double)sensitivity, __value, __size);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "outdoorLuxIdx") == 0)
    {
        ParameterUtils::DoubleToString((double)outdoorLuxIdx, __value, __size, 0);
        __result = true;
    }
    else if (PARAMETER_STRCMP(__name, "TOFFlag") == 0)
    {
        __result = TOFFlag.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "Filter") == 0)
    {
        __result = Filter.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "FrameDelay") == 0)
    {
        __result = FrameDelay.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "SceneChange") == 0)
    {
        __result = SceneChange.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "FocusConverge") == 0)
    {
        __result = FocusConverge.GetValue(&__path[__pos], __value, __size);
    }
    else if (PARAMETER_STRCMP(__name, "FineScan") == 0)
    {
        __result = FineScan.GetValue(&__path[__pos], __value, __size);
    }

    return __result;
}

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

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

    if (PARAMETER_STRCMP(__name, "module_version") == 0)
    {
        __result = module_version.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "parameter_version") == 0)
    {
        __result = parameter_version.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "sensitivity") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            sensitivity = (float)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "outdoorLuxIdx") == 0)
    {
        const double dblValue = ParameterUtils::StringToDouble(__value, __result);
        if (__result)
        {
            outdoorLuxIdx = (INT32)dblValue; 
        }
    }
    else if (PARAMETER_STRCMP(__name, "TOFFlag") == 0)
    {
        __result = TOFFlag.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "Filter") == 0)
    {
        __result = Filter.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "FrameDelay") == 0)
    {
        __result = FrameDelay.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "SceneChange") == 0)
    {
        __result = SceneChange.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "FocusConverge") == 0)
    {
        __result = FocusConverge.SetValue(&__path[__pos], __value);
    }
    else if (PARAMETER_STRCMP(__name, "FineScan") == 0)
    {
        __result = FineScan.SetValue(&__path[__pos], __value);
    }

    return __result;
}

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

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

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

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

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

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

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

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

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

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

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

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

    return __result;
}

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

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

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

    return __result;
}

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

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

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

    return __result;
}

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

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

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

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

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

    return __result;
}

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

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

    if (PARAMETER_STRCMP(__name, "revision") == 0)
    {
        PARAMETER_STRCPY(__value, __size, revision);
        __result = true;
    }

    return __result;
}

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

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

    if (PARAMETER_STRCMP(__name, "revision") == 0)
    {
        // Cannot modify strings, risk of memory leaks or corruption
    }

    return __result;
}

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

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

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

    return __result;
}


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Default Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
chromatixTOFTypeClass::chromatixTOFTypeClass(
    const CHAR* const name)
    : ParameterModule(name, MAJOR, MINOR, PATCH, nullptr)
{
    PARAMETER_INITIALIZE(SymbolTableID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(parameter_version);
    PARAMETER_INITIALIZE(sensitivity);
    PARAMETER_INITIALIZE(outdoorLuxIdx);
    PARAMETER_INITIALIZE(TOFFlag);
    PARAMETER_INITIALIZE(Filter);
    PARAMETER_INITIALIZE(FrameDelay);
    PARAMETER_INITIALIZE(SceneChange);
    PARAMETER_INITIALIZE(FocusConverge);
    PARAMETER_INITIALIZE(FineScan);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
chromatixTOFTypeClass::chromatixTOFTypeClass(
    const CHAR* const name,
    ModuleData* const moduleData)
    : ParameterModule(name, MAJOR, MINOR, PATCH, moduleData)
{
    PARAMETER_INITIALIZE(SymbolTableID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(parameter_version);
    PARAMETER_INITIALIZE(sensitivity);
    PARAMETER_INITIALIZE(outdoorLuxIdx);
    PARAMETER_INITIALIZE(TOFFlag);
    PARAMETER_INITIALIZE(Filter);
    PARAMETER_INITIALIZE(FrameDelay);
    PARAMETER_INITIALIZE(SceneChange);
    PARAMETER_INITIALIZE(FocusConverge);
    PARAMETER_INITIALIZE(FineScan);
}

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

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

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

    PARAMETER_INITIALIZE(num_near_steps_near_direction);
    PARAMETER_INITIALIZE(num_far_steps_near_direction);
    PARAMETER_INITIALIZE(num_near_steps_far_direction);
    PARAMETER_INITIALIZE(num_far_steps_far_direction);
    PARAMETER_INITIALIZE(num_near_steps_far_converge_point);
    PARAMETER_INITIALIZE(num_far_steps_far_converge_point);
    PARAMETER_INITIALIZE(near_steps_far_direction_tof_conf);
    PARAMETER_INITIALIZE(tof_step_size);
    PARAMETER_INITIALIZE(tof_step_size_low_light);
    PARAMETER_INITIALIZE(far_distance_fine_step_size);

    SYMBOL_TABLE_ENTRY_READ(entry, result, num_near_steps_near_direction, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, num_far_steps_near_direction, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, num_near_steps_far_direction, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, num_far_steps_far_direction, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, num_near_steps_far_converge_point, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, num_far_steps_far_converge_point, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, near_steps_far_direction_tof_conf, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, tof_step_size, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, tof_step_size_low_light, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, far_distance_fine_step_size, alignment)

    return result;
}

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

    PARAMETER_INITIALIZE(jump_to_start_limit);
    PARAMETER_INITIALIZE(jump_to_start_limit_low_light);
    PARAMETER_INITIALIZE(start_pos_for_tof);
    PARAMETER_INITIALIZE(far_converge_point);

    SYMBOL_TABLE_ENTRY_READ(entry, result, jump_to_start_limit, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, jump_to_start_limit_low_light, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, start_pos_for_tof, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, far_converge_point, alignment)

    return result;
}

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

    PARAMETER_INITIALIZE(scene_change_distance_std_dev_thres);
    PARAMETER_INITIALIZE(far_distance_unstable_cnt_factor);
    PARAMETER_INITIALIZE(panning_stable_cnt);
    PARAMETER_INITIALIZE(panning_stable_thres);
    PARAMETER_INITIALIZE(normal_light_cnt);
    PARAMETER_INITIALIZE(lowlight_cnt);
    PARAMETER_INITIALIZE(num_monitor_samples);
    PARAMETER_INITIALIZE(scene_change_distance_thres);
    PARAMETER_INITIALIZE(distance_region);

    SYMBOL_TABLE_ENTRY_READ(entry, result, scene_change_distance_std_dev_thres, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, far_distance_unstable_cnt_factor, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, panning_stable_cnt, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, panning_stable_thres, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, normal_light_cnt, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, lowlight_cnt, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, num_monitor_samples, alignment)

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

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

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

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

    return result;
}

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

    PARAMETER_INITIALIZE(frame_delay_focus_converge_bright_light);
    PARAMETER_INITIALIZE(frame_delay_focus_converge_low_light);
    PARAMETER_INITIALIZE(frame_delay_fine_search_bright_light);
    PARAMETER_INITIALIZE(frame_delay_fine_search_low_light);
    PARAMETER_INITIALIZE(frame_delay_outdoor_light);

    SYMBOL_TABLE_ENTRY_READ(entry, result, frame_delay_focus_converge_bright_light, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, frame_delay_focus_converge_low_light, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, frame_delay_fine_search_bright_light, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, frame_delay_fine_search_low_light, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, frame_delay_outdoor_light, alignment)

    return result;
}

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

    PARAMETER_INITIALIZE(median_filter_enable);
    PARAMETER_INITIALIZE(median_filter_num_of_samples);
    PARAMETER_INITIALIZE(average_filter_enable);
    PARAMETER_INITIALIZE(average_filter_num_of_samples);

    SYMBOL_TABLE_ENTRY_READ(entry, result, median_filter_enable, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, median_filter_num_of_samples, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, average_filter_enable, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, average_filter_num_of_samples, alignment)

    return result;
}

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

    PARAMETER_INITIALIZE(use_custom_sensitivity);
    PARAMETER_INITIALIZE(enable_sad_when_tof_is_conf);
    PARAMETER_INITIALIZE(run_tof_in_outdoor_light_flag);
    PARAMETER_INITIALIZE(aec_wait_check_flag_enable);
    PARAMETER_INITIALIZE(far_scene_coarse_srch_enable);

    SYMBOL_TABLE_ENTRY_READ(entry, result, use_custom_sensitivity, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, enable_sad_when_tof_is_conf, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, run_tof_in_outdoor_light_flag, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, aec_wait_check_flag_enable, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, far_scene_coarse_srch_enable, alignment)

    return result;
}

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

    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(parameter_version);
    PARAMETER_INITIALIZE(sensitivity);
    PARAMETER_INITIALIZE(outdoorLuxIdx);
    PARAMETER_INITIALIZE(TOFFlag);
    PARAMETER_INITIALIZE(Filter);
    PARAMETER_INITIALIZE(FrameDelay);
    PARAMETER_INITIALIZE(SceneChange);
    PARAMETER_INITIALIZE(FocusConverge);
    PARAMETER_INITIALIZE(FineScan);

    result = module_version.Load(entry, alignment);
    if (result)
    {
        result = parameter_version.Load(entry, alignment);
    }
    SYMBOL_TABLE_ENTRY_READ(entry, result, sensitivity, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, outdoorLuxIdx, alignment)
    if (result)
    {
        result = TOFFlag.Load(entry, alignment);
    }
    if (result)
    {
        result = Filter.Load(entry, alignment);
    }
    if (result)
    {
        result = FrameDelay.Load(entry, alignment);
    }
    if (result)
    {
        result = SceneChange.Load(entry, alignment);
    }
    if (result)
    {
        result = FocusConverge.Load(entry, alignment);
    }
    if (result)
    {
        result = FineScan.Load(entry, alignment);
    }

    return result;
}

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

    PARAMETER_INITIALIZE(major_revision);
    PARAMETER_INITIALIZE(minor_revision);
    PARAMETER_INITIALIZE(incr_revision);

    SYMBOL_TABLE_ENTRY_READ(entry, result, major_revision, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, minor_revision, alignment)
    SYMBOL_TABLE_ENTRY_READ(entry, result, incr_revision, alignment)

    return result;
}

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

    PARAMETER_INITIALIZE(revision);


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

    return result;
}

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

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload chromatixTOFType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void chromatixTOFType::Unload(ParameterFileSymbolTable* const __table)
{
    parameter_version.Unload(__table);
    SceneChange.Unload(__table);
}

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

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

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

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

    return (ParameterModule*)cls;
}

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

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

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

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

AFTOFELEMENTS_NAMESPACE_END
