当前位置: 首页>>代码示例>>C++>>正文


C++ IRegistry::GetString方法代码示例

本文整理汇总了C++中IRegistry::GetString方法的典型用法代码示例。如果您正苦于以下问题:C++ IRegistry::GetString方法的具体用法?C++ IRegistry::GetString怎么用?C++ IRegistry::GetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IRegistry的用法示例。


在下文中一共展示了IRegistry::GetString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Read

void SQueueParameters::Read(const IRegistry& reg, const string& sname)
{
    qclass = reg.GetString(sname, "class", kEmptyStr);

    timeout = ReadTimeout(reg, sname);
    notif_hifreq_interval = ReadNotifHifreqInterval(reg, sname);
    notif_hifreq_period = ReadNotifHifreqPeriod(reg, sname);
    notif_lofreq_mult = ReadNotifLofreqMult(reg, sname);
    notif_handicap = ReadNotifHandicap(reg, sname);
    dump_buffer_size = ReadDumpBufferSize(reg, sname);
    run_timeout = ReadRunTimeout(reg, sname);
    program_name = ReadProgram(reg, sname);
    failed_retries = ReadFailedRetries(reg, sname);
    blacklist_time = ReadBlacklistTime(reg, sname);
    max_input_size = ReadMaxInputSize(reg, sname);
    max_output_size = ReadMaxOutputSize(reg, sname);
    subm_hosts = ReadSubmHosts(reg, sname);
    wnode_hosts = ReadWnodeHosts(reg, sname);
    wnode_timeout = ReadWnodeTimeout(reg, sname);
    pending_timeout = ReadPendingTimeout(reg, sname);
    max_pending_wait_timeout = ReadMaxPendingWaitTimeout(reg, sname);
    description = ReadDescription(reg, sname);
    run_timeout_precision = ReadRunTimeoutPrecision(reg, sname);
    return;
}
开发者ID:jackgopack4,项目名称:pico-blast,代码行数:25,代码来源:ns_queue_parameters.cpp

示例2: ReadErrorEmulatorSection

void SNS_Parameters::ReadErrorEmulatorSection(const IRegistry &  reg)
{
    debug_fd_count.ReadInt(reg, "error_emulator", "fd_report");
    if (!debug_fd_count.value.empty() && debug_fd_count.as_int < -1)
        NCBI_THROW(CNetScheduleException, eInvalidParameter,
                   "Unexpected value of the [error_emulator]/fd_report "
                   " parameter. It must be >= 0");
    debug_mem_count.ReadInt(reg, "error_emulator", "mem_report");
    if (!debug_mem_count.value.empty() && debug_mem_count.as_int < -1)
        NCBI_THROW(CNetScheduleException, eInvalidParameter,
                   "Unexpected value of the [error_emulator]/mem_report "
                   " parameter. It must be >= 0");
    debug_write_delay.ReadDouble(reg, "error_emulator", "delay");
    if (!debug_write_delay.value.empty() && debug_write_delay.as_double < 0.0)
        NCBI_THROW(CNetScheduleException, eInvalidParameter,
                   "Unexpected value of the [error_emulator]/delay "
                   " parameter. It must be >= 0");
    debug_conn_drop_before_write.ReadBool(reg, "error_emulator",
                                          "drop_before_reply");
    debug_conn_drop_after_write.ReadBool(reg, "error_emulator",
                                         "drop_after_reply");
    debug_reply_with_garbage.ReadBool(reg, "error_emulator",
                                      "reply_with_garbage");

    debug_garbage = reg.GetString("error_emulator", "garbage_data",
                                  "please define [error_emulator]/garbage_data "
                                  "parameter value");
}
开发者ID:DmitrySigaev,项目名称:ncbi,代码行数:28,代码来源:ns_server_params.cpp

示例3: x_ReadCommon

void SErrorEmulatorParameter::x_ReadCommon(const IRegistry &  reg,
                                           const string &     section,
                                           const string &     param_name)
{
    string      reg_value = reg.GetString(section, param_name, "");
    reg_value = NStr::TruncateSpaces(reg_value);
    if (reg_value.empty())
        return;

    list<string>    parts;
    NStr::Split(reg_value, " ", parts,
                NStr::fSplit_MergeDelimiters | NStr::fSplit_Truncate);
    size_t          parts_count = parts.size();

    if (parts_count != 1 && parts_count != 2)
        NCBI_THROW(CNetScheduleException, eInvalidParameter,
                   "Unexpected format of the [" + section + "]/" +
                   param_name + " parameter. Expected: F:Ff [Fb-Fe]");

    if (parts_count == 2) {
        // Need to read the range
        list<string>    range_parts;
        NStr::Split(parts.back(), "-", range_parts,
                    NStr::fSplit_MergeDelimiters | NStr::fSplit_Truncate);

        if (range_parts.size() != 2)
            NCBI_THROW(CNetScheduleException, eInvalidParameter,
                       "Unexpected range format of the [" + section + "]/" +
                       param_name + " parameter. Expected: Fb-Fe");
        range_begin = NStr::StringToULong(range_parts.front());
        range_end = NStr::StringToULong(range_parts.back());

        if (range_end < range_begin)
            NCBI_THROW(CNetScheduleException, eInvalidParameter,
                       "Incorrect range specification for [" + section + "]/" +
                       param_name + " parameter. "
                       "End value must be >= begin value.");
    }

    // Read frequency
    list<string>    val_freq_parts;
    NStr::Split(parts.front(), ":", val_freq_parts,
                NStr::fSplit_MergeDelimiters | NStr::fSplit_Truncate);
    if (val_freq_parts.size() != 1 && val_freq_parts.size() != 2)
        NCBI_THROW(CNetScheduleException, eInvalidParameter,
                   "Unexpected value and frequence format of the [" +
                   section + "]/" + param_name + " parameter. Expected: F:Ff");
    else if (val_freq_parts.size() == 1)
        frequency = 1;  // default
    else
        frequency = NStr::StringToUInt(val_freq_parts.back());
    value = val_freq_parts.front();
}
开发者ID:DmitrySigaev,项目名称:ncbi,代码行数:53,代码来源:ns_server_params.cpp

示例4: catch

unsigned int
SQueueParameters::ReadMaxOutputSize(const IRegistry &  reg,
                                    const string &     sname)
{
    string        s = reg.GetString(sname, "max_output_size", kEmptyStr);
    unsigned int  val = kNetScheduleMaxDBDataSize;

    try {
        val = (unsigned) NStr::StringToUInt8_DataSize(s);
    }
    catch (CStringException&)
    {}

    val = min(kNetScheduleMaxOverflowSize, val);
    return val;
}
开发者ID:jackgopack4,项目名称:pico-blast,代码行数:16,代码来源:ns_queue_parameters.cpp

示例5: if

static void
s_ReadSpecificParams(const IRegistry& reg,
                     const string& section,
                     SNCSpecificParams* params)
{
    if (reg.HasEntry(section, kNCReg_DisableClient, IRegistry::fCountCleared)) {
        params->disable = reg.GetBool(section, kNCReg_DisableClient, false);
    }
    if (reg.HasEntry(section, kNCReg_BlobTTL, IRegistry::fCountCleared)) {
        params->blob_ttl = reg.GetInt(section, kNCReg_BlobTTL, 3600);
    }
    if (reg.HasEntry(section, kNCReg_VerTTL, IRegistry::fCountCleared)) {
        params->ver_ttl = reg.GetInt(section, kNCReg_VerTTL, 3600);
    }
    if (reg.HasEntry(section, kNCReg_TTLUnit, IRegistry::fCountCleared)) {
        params->ttl_unit = reg.GetInt(section, kNCReg_TTLUnit, 300);
    }
    if (reg.HasEntry(section, kNCReg_ProlongOnRead, IRegistry::fCountCleared)) {
        params->prolong_on_read = reg.GetBool(section, kNCReg_ProlongOnRead, true);
    }
    if (reg.HasEntry(section, kNCReg_SearchOnRead, IRegistry::fCountCleared)) {
        params->srch_on_read = reg.GetBool(section, kNCReg_SearchOnRead, true);
    }
    if (reg.HasEntry(section, kNCReg_Quorum, IRegistry::fCountCleared)) {
        params->quorum = reg.GetInt(section, kNCReg_Quorum, 2);
    }
    if (reg.HasEntry(section, kNCReg_FastOnMain, IRegistry::fCountCleared)) {
        params->fast_on_main = reg.GetBool(section, kNCReg_FastOnMain, true);
    }
    if (reg.HasEntry(section, kNCReg_PassPolicy, IRegistry::fCountCleared)) {
        string pass_policy = reg.GetString(section, kNCReg_PassPolicy, "any");
        if (pass_policy == "no_password") {
            params->pass_policy = eNCOnlyWithoutPass;
        }
        else if (pass_policy == "with_password") {
            params->pass_policy = eNCOnlyWithPass;
        }
        else {
            if (pass_policy != "any") {
                SRV_LOG(Error, "Incorrect value of '" << kNCReg_PassPolicy
                               << "' parameter: '" << pass_policy
                               << "', assuming 'any'");
            }
            params->pass_policy = eNCBlobPassAny;
        }
    }
}
开发者ID:jackgopack4,项目名称:pico-blast,代码行数:47,代码来源:netcached.cpp

示例6: Read

void SNS_Parameters::Read(const IRegistry& reg, const string& sname)
{
    reinit          = GetBoolNoErr("reinit", false);
    max_connections = GetIntNoErr("max_connections", default_max_connections);
    max_threads     = GetIntNoErr("max_threads", default_max_threads);

    init_threads = GetIntNoErr("init_threads", default_init_threads);
    if (init_threads > max_threads) {
        LOG_POST(Message << Warning <<
                 "INI file sets init_threads > max_threads. "
                 "Assume init_threads = max_threads(" << max_threads <<
                 ") instead of given " << init_threads);
        init_threads = max_threads;
    }

    port = (unsigned short) GetIntNoErr("port", default_port);

    use_hostname    = GetBoolNoErr("use_hostname", default_use_hostname);
    network_timeout = GetIntNoErr("network_timeout", default_network_timeout);
    if (network_timeout == 0) {
        LOG_POST(Message << Warning <<
                 "INI file sets 0 sec. network timeout. Assume " <<
                 default_network_timeout << " seconds.");
        network_timeout = default_network_timeout;
    }

    // Logging parameters
    is_log                       = GetBoolNoErr("log",
                                   default_is_log);
    log_batch_each_job           = GetBoolNoErr("log_batch_each_job",
                                   default_log_batch_each_job);
    log_notification_thread      = GetBoolNoErr("log_notification_thread",
                                   default_log_notification_thread);
    log_cleaning_thread          = GetBoolNoErr("log_cleaning_thread",
                                   default_log_cleaning_thread);
    log_execution_watcher_thread = GetBoolNoErr("log_execution_watcher_thread",
                                   default_log_execution_watcher_thread);
    log_statistics_thread        = GetBoolNoErr("log_statistics_thread",
                                   default_log_statistics_thread);

    // Job deleting parameters
    del_batch_size = GetIntNoErr("del_batch_size", default_del_batch_size);
    markdel_batch_size = GetIntNoErr("markdel_batch_size", default_markdel_batch_size);
    scan_batch_size = GetIntNoErr("scan_batch_size", default_scan_batch_size);
    purge_timeout = GetDoubleNoErr("purge_timeout", default_purge_timeout);
    CheckGarbageCollectorSettings();

    // Affinity GC settings
    affinity_high_mark_percentage = GetIntNoErr("affinity_high_mark_percentage",
                                    default_affinity_high_mark_percentage);
    affinity_low_mark_percentage = GetIntNoErr("affinity_low_mark_percentage",
                                   default_affinity_low_mark_percentage);
    affinity_high_removal = GetIntNoErr("affinity_high_removal",
                                        default_affinity_high_removal);
    affinity_low_removal = GetIntNoErr("affinity_low_removal",
                                       default_affinity_low_removal);
    affinity_dirt_percentage = GetIntNoErr("affinity_dirt_percentage",
                                           default_affinity_dirt_percentage);
    CheckAffinityGarbageCollectorSettings();

    // Max affinities
    max_affinities = GetIntNoErr("max_affinities", default_max_affinities);
    if (max_affinities <= 0) {
        LOG_POST(Message << Warning <<
                 "INI file sets the max number of preferred affinities <= 0."
                 " Assume " << default_max_affinities << " instead.");
        max_affinities = default_max_affinities;
    }

    admin_hosts        = reg.GetString(sname, "admin_host", kEmptyStr);
    admin_client_names = reg.GetString(sname, "admin_client_name", kEmptyStr);

    return;
}
开发者ID:jackgopack4,项目名称:pico-blast,代码行数:74,代码来源:ns_server_params.cpp

示例7:

string
SQueueParameters::ReadDescription(const IRegistry &  reg,
                                  const string &     sname)
{
    return reg.GetString(sname, "description", kEmptyStr);
}
开发者ID:jackgopack4,项目名称:pico-blast,代码行数:6,代码来源:ns_queue_parameters.cpp

示例8: Read

// A configuration file is always already validated so the reading
// must not produce any log output etc.
// See ns_util.cpp NS_ValidateConfigFile(...)
void SNS_Parameters::Read(const IRegistry &  reg)
{
    const string    sname = "server";

    max_connections = GetIntNoErr("max_connections", default_max_connections);
    if (max_connections < max_connections_low_limit)
        max_connections = (max_connections_low_limit +
                           max_connections_high_limit) / 2;
    else if (max_connections > max_connections_high_limit)
        max_connections = max_connections_high_limit;

    max_threads     = GetIntNoErr("max_threads", default_max_threads);

    init_threads = GetIntNoErr("init_threads", default_init_threads);
    if (init_threads > max_threads)
        init_threads = max_threads;

    port = (unsigned short) GetIntNoErr("port", 0);

    use_hostname    = GetBoolNoErr("use_hostname", default_use_hostname);
    network_timeout = GetIntNoErr("network_timeout", default_network_timeout);
    if (network_timeout == 0)
        network_timeout = default_network_timeout;

    // Logging parameters
    is_log = GetBoolNoErr("log", default_is_log);
    log_batch_each_job = GetBoolNoErr("log_batch_each_job",
                                      default_log_batch_each_job);
    log_notification_thread = GetBoolNoErr("log_notification_thread",
                                           default_log_notification_thread);
    log_cleaning_thread = GetBoolNoErr("log_cleaning_thread",
                                        default_log_cleaning_thread);
    log_execution_watcher_thread = GetBoolNoErr("log_execution_watcher_thread",
                                        default_log_execution_watcher_thread);
    log_statistics_thread = GetBoolNoErr("log_statistics_thread",
                                         default_log_statistics_thread);

    // Job deleting parameters
    del_batch_size = GetIntNoErr("del_batch_size", default_del_batch_size);
    markdel_batch_size = GetIntNoErr("markdel_batch_size",
                                     default_markdel_batch_size);
    scan_batch_size = GetIntNoErr("scan_batch_size", default_scan_batch_size);
    purge_timeout = GetDoubleNoErr("purge_timeout", default_purge_timeout);
    x_CheckJobGarbageCollectorSettings();

    stat_interval = GetIntNoErr("stat_interval", default_stat_interval);
    if (stat_interval < 1)
        stat_interval = 1;

    int     val = GetIntNoErr("job_counters_interval",
                              default_job_counters_interval);
    if (val < 0)
        job_counters_interval = 0;
    else
        job_counters_interval = val;

    affinity_reg.Read(reg, sname, "affinity",
                      default_max_affinities,
                      default_affinity_high_mark_percentage,
                      default_affinity_low_mark_percentage,
                      default_affinity_high_removal,
                      default_affinity_low_removal,
                      default_affinity_dirt_percentage);
    group_reg.Read(reg, sname, "group",
                   default_max_groups,
                   default_group_high_mark_percentage,
                   default_group_low_mark_percentage,
                   default_group_high_removal,
                   default_group_low_removal,
                   default_group_dirt_percentage);
    scope_reg.Read(reg, sname, "scope",
                   default_max_scopes,
                   default_scope_high_mark_percentage,
                   default_scope_low_mark_percentage,
                   default_scope_high_removal,
                   default_scope_low_removal,
                   default_scope_dirt_percentage);

    reserve_dump_space = NS_GetDataSize(reg, "server", "reserve_dump_space",
                                        default_reserve_dump_space);
    wst_cache_size = GetIntNoErr("wst_cache_size",
                                 default_wst_cache_size);
    if (wst_cache_size < 0)
        wst_cache_size = default_wst_cache_size;


    max_client_data = GetIntNoErr("max_client_data", default_max_client_data);
    if (max_client_data <= 0)
        max_client_data = default_max_client_data;

    admin_hosts        = reg.GetString(sname, "admin_host", kEmptyStr);
    try {
        admin_client_names = reg.GetEncryptedString(sname, "admin_client_name",
                                                IRegistry::fPlaintextAllowed);
    } catch (...) {
        // All the warnings are collected at the time of validating the
        // configuration file, so here a problem is simply suppressed
//.........这里部分代码省略.........
开发者ID:DmitrySigaev,项目名称:ncbi,代码行数:101,代码来源:ns_server_params.cpp


注:本文中的IRegistry::GetString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。