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


C++ set_bool函数代码示例

本文整理汇总了C++中set_bool函数的典型用法代码示例。如果您正苦于以下问题:C++ set_bool函数的具体用法?C++ set_bool怎么用?C++ set_bool使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: test_scavenge

static void test_scavenge(void) {
  gpr_log(GPR_INFO, "** test_scavenge **");
  grpc_resource_quota *q = grpc_resource_quota_create("test_scavenge");
  grpc_resource_quota_resize(q, 1024);
  grpc_resource_user *usr1 = grpc_resource_user_create(q, "usr1");
  grpc_resource_user *usr2 = grpc_resource_user_create(q, "usr2");
  {
    bool done = false;
    grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
    grpc_resource_user_alloc(&exec_ctx, usr1, 1024, set_bool(&done));
    grpc_exec_ctx_finish(&exec_ctx);
    GPR_ASSERT(done);
  }
  {
    grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
    grpc_resource_user_free(&exec_ctx, usr1, 1024);
    grpc_exec_ctx_finish(&exec_ctx);
  }
  {
    bool done = false;
    grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
    grpc_resource_user_alloc(&exec_ctx, usr2, 1024, set_bool(&done));
    grpc_exec_ctx_finish(&exec_ctx);
    GPR_ASSERT(done);
  }
  {
    grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
    grpc_resource_user_free(&exec_ctx, usr2, 1024);
    grpc_exec_ctx_finish(&exec_ctx);
  }
  grpc_resource_quota_unref(q);
  destroy_user(usr1);
  destroy_user(usr2);
}
开发者ID:makdharma,项目名称:grpc,代码行数:34,代码来源:resource_quota_test.c

示例2: test_state_is_reset_when_if_fails2

void test_state_is_reset_when_if_fails2()
{
    // Similar to test_state_is_reset_when_if_fails, but this one doesn't
    // have an 'else' block and it uses test_oracle.
    
    internal_debug_function::oracle_clear();

    Branch branch;
    Term* a = branch.compile("a = true");
    
    branch.compile("if a { state s = test_oracle() }");

    internal_debug_function::oracle_send(1);
    internal_debug_function::oracle_send(2);
    internal_debug_function::oracle_send(3);

    Stack context;
    evaluate_branch(&context, &branch);
    test_equals(&context.state, "{_if_block: [{s: 1}]}");

    evaluate_branch(&context, &branch);
    test_equals(&context.state, "{_if_block: [{s: 1}]}");

    set_bool(a, false);
    evaluate_branch(&context, &branch);
    test_equals(&context.state, "{_if_block: [null, null]}");

    set_bool(a, true);
    evaluate_branch(&context, &branch);
    test_equals(&context.state, "{_if_block: [{s: 2}]}");
}
开发者ID:julianhaslinger,项目名称:circa,代码行数:31,代码来源:if_block_tests.cpp

示例3: test_unused_reclaim_is_cancelled

static void test_unused_reclaim_is_cancelled(void) {
  gpr_log(GPR_INFO, "** test_unused_reclaim_is_cancelled **");
  grpc_resource_quota *q =
      grpc_resource_quota_create("test_unused_reclaim_is_cancelled");
  grpc_resource_quota_resize(q, 1024);
  grpc_resource_user usr;
  grpc_resource_user_init(&usr, q, "usr");
  bool benign_done = false;
  bool destructive_done = false;
  {
    grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
    grpc_resource_user_post_reclaimer(
        &exec_ctx, &usr, false, make_unused_reclaimer(set_bool(&benign_done)));
    grpc_resource_user_post_reclaimer(
        &exec_ctx, &usr, true,
        make_unused_reclaimer(set_bool(&destructive_done)));
    grpc_exec_ctx_finish(&exec_ctx);
    GPR_ASSERT(!benign_done);
    GPR_ASSERT(!destructive_done);
  }
  grpc_resource_quota_unref(q);
  destroy_user(&usr);
  GPR_ASSERT(benign_done);
  GPR_ASSERT(destructive_done);
}
开发者ID:gnirodi,项目名称:grpc,代码行数:25,代码来源:resource_quota_test.c

示例4: test_state_is_reset_when_if_fails

void test_state_is_reset_when_if_fails()
{
    Branch branch;
    Stack context;

    Term* c = branch.compile("c = true");
    branch.compile("if c { state i = 0; i += 1 } else { 'hi' }");

    evaluate_branch(&context, &branch);
    test_equals(&context.state, "{_if_block: [{i: 1}]}");

    evaluate_branch(&context, &branch);
    test_equals(&context.state, "{_if_block: [{i: 2}]}");

    evaluate_branch(&context, &branch);
    test_equals(&context.state, "{_if_block: [{i: 3}]}");

    set_bool(c, false);

    evaluate_branch(&context, &branch);
    test_equals(&context.state, "{_if_block: [null, null]}");

    set_bool(c, true);

    evaluate_branch(&context, &branch);
    test_equals(&context.state, "{_if_block: [{i: 1}]}");
}
开发者ID:julianhaslinger,项目名称:circa,代码行数:27,代码来源:if_block_tests.cpp

示例5: mpris_tracklist_get_metadata

gboolean mpris_tracklist_get_metadata(MprisTrackList * obj, gint pos, GHashTable * *metadata, GError * *error)
{
    struct MprisMetadataRequest request = {.playlist = -1,.entry = pos };

    get_mpris_metadata(&request);
    *metadata = request.metadata;
    return TRUE;
}

gboolean mpris_tracklist_get_current_track(MprisTrackList * obj, gint * pos, GError * *error)
{
    struct PositionRequest request = {.playlist = -1,.entry = -1 };

    get_position(&request);
    *pos = request.entry;
    return TRUE;
}

gboolean mpris_tracklist_get_length(MprisTrackList * obj, gint * length, GError * *error)
{
    struct PositionRequest request = {.playlist = -1,.entry = -1 };

    get_position(&request);
    *length = request.entry_count;
    return TRUE;
}

gboolean mpris_tracklist_add_track(MprisTrackList * obj, gchar * uri, gboolean play, GError * *error)
{
    struct AddRequest *request = g_malloc(sizeof(struct AddRequest));

    request->position = -1;
    request->filename = g_strdup(uri);
    request->play = play;

    g_timeout_add(0, add_cb, request);
    return TRUE;
}

gboolean mpris_tracklist_del_track(MprisTrackList * obj, gint pos, GError * *error)
{
    g_timeout_add(0, delete_cb, GINT_TO_POINTER(pos));
    return TRUE;
}

gboolean mpris_tracklist_loop (MprisTrackList * obj, gboolean loop, GError * *
 error)
{
    set_bool (NULL, "repeat", loop);
    return TRUE;
}

gboolean mpris_tracklist_random (MprisTrackList * obj, gboolean random,
 GError * * error)
{
    set_bool (NULL, "shuffle", random);
    return TRUE;
}
开发者ID:gnu-andrew,项目名称:audacious.old,代码行数:58,代码来源:dbus.c

示例6: test_resource_user_stays_allocated_and_reclaimers_unrun_until_memory_released

static void
test_resource_user_stays_allocated_and_reclaimers_unrun_until_memory_released(
    void) {
  gpr_log(GPR_INFO,
          "** "
          "test_resource_user_stays_allocated_and_reclaimers_unrun_until_"
          "memory_released **");
  grpc_resource_quota *q = grpc_resource_quota_create(
      "test_resource_user_stays_allocated_and_reclaimers_unrun_until_memory_"
      "released");
  grpc_resource_quota_resize(q, 1024);
  for (int i = 0; i < 10; i++) {
    grpc_resource_user usr;
    grpc_resource_user_init(&usr, q, "usr");
    bool done = false;
    bool reclaimer_cancelled = false;
    {
      grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
      grpc_resource_user_post_reclaimer(
          &exec_ctx, &usr, false,
          make_unused_reclaimer(set_bool(&reclaimer_cancelled)));
      grpc_exec_ctx_finish(&exec_ctx);
      GPR_ASSERT(!reclaimer_cancelled);
    }
    {
      bool allocated = false;
      grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
      grpc_resource_user_alloc(&exec_ctx, &usr, 1024, set_bool(&allocated));
      grpc_exec_ctx_finish(&exec_ctx);
      GPR_ASSERT(allocated);
      GPR_ASSERT(!reclaimer_cancelled);
    }
    {
      grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
      grpc_resource_user_shutdown(&exec_ctx, &usr, set_bool(&done));
      grpc_exec_ctx_finish(&exec_ctx);
      GPR_ASSERT(!done);
      GPR_ASSERT(!reclaimer_cancelled);
    }
    {
      grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
      grpc_resource_user_free(&exec_ctx, &usr, 1024);
      grpc_exec_ctx_finish(&exec_ctx);
      GPR_ASSERT(done);
      GPR_ASSERT(reclaimer_cancelled);
    }
    {
      grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
      grpc_resource_user_destroy(&exec_ctx, &usr);
      grpc_exec_ctx_finish(&exec_ctx);
    }
  }
  grpc_resource_quota_unref(q);
}
开发者ID:gnirodi,项目名称:grpc,代码行数:54,代码来源:resource_quota_test.c

示例7: add_arg

void add_arg(node_ptr var, node_ptr qstring, int isbool)
{
    if (!var || !qstring) {
	yyerror("Null node");
	return;
    }
    add_symbol(var, qstring);
    if (isbool) {
	set_bool(var);
	set_bool(qstring);
    }
}
开发者ID:Tojaraliu,项目名称:CSCI2021-Machine-Architecture-and-Organization,代码行数:12,代码来源:node.c

示例8: if

void context_params::set(char const * param, char const * value) {
    std::string p = param;
    unsigned n = static_cast<unsigned>(p.size());
    for (unsigned i = 0; i < n; i++) {
        if (p[i] >= 'A' && p[i] <= 'Z')
            p[i] = p[i] - 'A' + 'a';
        else if (p[i] == '-')
            p[i] = '_';
    }
    if (p == "timeout") {
        long val = strtol(value, 0, 10);
        m_timeout = static_cast<unsigned>(val);
    }
    else if (p == "type_check" || p == "well_sorted_check") {
        set_bool(m_well_sorted_check, param, value);
    }
    else if (p == "auto_config") {
        set_bool(m_auto_config, param, value);
    }
    else if (p == "proof") {
        set_bool(m_proof, param, value);
    }
    else if (p == "model") {
        set_bool(m_model, param, value);
    }
    else if (p == "model_validate") {
        set_bool(m_model_validate, param, value);
    }
    else if (p == "trace") {
        set_bool(m_trace, param, value);
    }
    else if (p == "trace_file_name") {
        m_trace_file_name = value;
    }
    else if (p == "unsat_core") {
        set_bool(m_unsat_core, param, value);
    }
    else if (p == "debug_ref_count") {
        set_bool(m_debug_ref_count, param, value);
    }
    else if (p == "smtlib2_compliant") {
        set_bool(m_smtlib2_compliant, param, value);
    }
    else {
       param_descrs d;
       collect_param_descrs(d);
       std::stringstream strm;
       strm << "unknown parameter '" << p << "'\n";
       strm << "Legal parameters are:\n";
       d.display(strm, 2, false, false);
       throw default_exception(strm.str());        
    }
}
开发者ID:Jornason,项目名称:z3,代码行数:53,代码来源:context_params.cpp

示例9: while

const void *exec_internal_broam(
    const char *arg,
    const struct cfgmenu *menu_root,
    const struct cfgmenu **p_menu,
    const struct cfgmenu**p_item)
{
    const void *v = NULL;
    *p_item = find_cfg_item(arg, menu_root, p_menu);
    if (NULL == *p_item)
        return v;

    v = (*p_item)->pvalue;
    if (v) {
        // scan for a possible argument to the command
        while (!IS_SPC(*arg))
            ++arg;
        skip_spc(&arg);
        // now set the appropriate variable
        if (is_fixed_string(v)) {
            strcpy((char *)v, arg);
        } else if (is_string_item(v)) {
            strcpy((char *)v, arg);
        } else if (get_int_item(v)) {
            if (*arg) *(int*)v = atoi(arg);
        } else {
            set_bool((bool*)v, arg);
        }
        // write to blackbox.rc or extensions.rc (automatic)
        Settings_WriteRCSetting(v);
    }
    return v;
}
开发者ID:BackupTheBerlios,项目名称:bblean,代码行数:32,代码来源:ConfigMenu.cpp

示例10: Term__is_value

void Term__is_value(VM* vm)
{
    Term* t = as_term_ref(vm->input(0));

    bool consideredValue = is_value(t) || t->function == FUNCS.require;
    set_bool(vm->output(), consideredValue);
}
开发者ID:ShenTensen,项目名称:circa,代码行数:7,代码来源:reflection.cpp

示例11: Block__has_static_error

void Block__has_static_error(VM* vm)
{
    Block* block = as_block(vm->input(0));
    if (block == NULL)
        return vm->throw_str("NULL block");
    set_bool(vm->output(), has_static_errors_cached(block));
}
开发者ID:ShenTensen,项目名称:circa,代码行数:7,代码来源:reflection.cpp

示例12: list_names_that_must_be_looped

void list_names_that_must_be_looped(Block* contents, Value* names)
{
    // Find all names within 'contents' that must be looped. A name must be looped when
    // a term inside the loop binds a name that was already used outside the loop.

    Value namesMap;
    set_hashtable(&namesMap);

    for (BlockIteratorFlat it(contents); it; ++it) {
        Term* term = it.current();

        if (has_empty_name(term))
            continue;

        Value termVal;
        termVal.set_term(contents->owningTerm);
        Term* outsideName = find_name_at(&termVal, term_name(term));

        // Don't look at names outside the major block.
        if (outsideName != NULL && !is_under_same_major_block(term, outsideName))
            outsideName = NULL;

        if (outsideName != NULL)
            set_bool(hashtable_insert(&namesMap, term_name(term)), true);
    }

    hashtable_get_keys(&namesMap, names);
    list_sort(names, NULL, NULL);
}
开发者ID:andyfischer,项目名称:circa,代码行数:29,代码来源:loops.cpp

示例13: backlight_on_when_charging

static bool backlight_on_when_charging(void)
{
    bool result = set_bool(str(LANG_BACKLIGHT_ON_WHEN_CHARGING),
                           &global_settings.backlight_on_when_charging);
    backlight_set_on_when_charging(global_settings.backlight_on_when_charging);
    return result;
}
开发者ID:BackupTheBerlios,项目名称:bimmerbox,代码行数:7,代码来源:settings_menu.c

示例14: test_resource_user_stays_allocated_until_memory_released

static void test_resource_user_stays_allocated_until_memory_released(void) {
  gpr_log(GPR_INFO,
          "** test_resource_user_stays_allocated_until_memory_released **");
  grpc_resource_quota *q = grpc_resource_quota_create(
      "test_resource_user_stays_allocated_until_memory_released");
  grpc_resource_quota_resize(q, 1024 * 1024);
  grpc_resource_user usr;
  grpc_resource_user_init(&usr, q, "usr");
  bool done = false;
  {
    grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
    grpc_resource_user_alloc(&exec_ctx, &usr, 1024, NULL);
    grpc_exec_ctx_finish(&exec_ctx);
  }
  {
    grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
    grpc_resource_quota_unref(q);
    grpc_resource_user_shutdown(&exec_ctx, &usr, set_bool(&done));
    grpc_exec_ctx_finish(&exec_ctx);
    GPR_ASSERT(!done);
  }
  {
    grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
    grpc_resource_user_free(&exec_ctx, &usr, 1024);
    grpc_exec_ctx_finish(&exec_ctx);
    GPR_ASSERT(done);
  }
  {
    grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
    grpc_resource_user_destroy(&exec_ctx, &usr);
    grpc_exec_ctx_finish(&exec_ctx);
  }
}
开发者ID:gnirodi,项目名称:grpc,代码行数:33,代码来源:resource_quota_test.c

示例15: block_set_evaluation_empty

void block_set_evaluation_empty(Block* block, bool empty)
{
    if (empty)
        set_bool(block_insert_property(block, s_EvaluationEmpty), true);
    else
        block_remove_property(block, s_EvaluationEmpty);
}
开发者ID:ShenTensen,项目名称:circa,代码行数:7,代码来源:block.cpp


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