def set_one_var_from_string(name, param_type, checks):
    """Construct code for auto config file for one param value.

    Parameters
    ----------
    name : string
        Name of the parameter.
    param_type : string
        Type of the parameter.
    checks : list
        Constraints of the parameter.

    Returns
    -------
    ret : string
        Lines of auto config file with getting and checks of one parameter value.
    """
    ret = ''
    univar_mapper = {'int': 'GetInt', 'double': 'GetDouble', 'bool':
        'GetBool', 'std::string': 'GetString'}
    if 'vector' not in param_type:
        ret += '  %s(params, "%s", &%s);\n' % (univar_mapper[param_type],
            name, name)
        if len(checks) > 0:
            for check in checks:
                ret += '  CHECK(%s %s);\n' % (name, check)
        ret += '\n'
    else:
        ret += '  if (GetString(params, "%s", &tmp_str)) {\n' % name
        type2 = param_type.split('<')[1][:-1]
        if type2 == 'std::string':
            ret += "    %s = Common::Split(tmp_str.c_str(), ',');\n" % name
        else:
            ret += "    %s = Common::StringToArray<%s>(tmp_str, ',');\n" % (
                name, type2)
        ret += '  }\n\n'
    return ret
