这篇教程C++ zlist_next函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中zlist_next函数的典型用法代码示例。如果您正苦于以下问题:C++ zlist_next函数的具体用法?C++ zlist_next怎么用?C++ zlist_next使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了zlist_next函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: zsync_node_newstatic zsync_node_t *zsync_node_new (){ int rc; zsync_node_t *self = (zsync_node_t *) zmalloc (sizeof (zsync_node_t)); self->ctx = zctx_new (); assert (self->ctx); self->zyre = zyre_new (self->ctx); assert (self->zyre); // Obtain permanent UUID self->own_uuid = zuuid_new (); if (zsys_file_exists (UUID_FILE)) { // Read uuid from file zfile_t *uuid_file = zfile_new (".", UUID_FILE); int rc = zfile_input (uuid_file); // open file for reading assert (rc == 0); zchunk_t *uuid_chunk = zfile_read (uuid_file, 16, 0); assert (zchunk_size (uuid_chunk) == 16); // make sure read succeeded zuuid_set (self->own_uuid, zchunk_data (uuid_chunk)); zfile_destroy (&uuid_file); } else { // Write uuid to file zfile_t *uuid_file = zfile_new (".", UUID_FILE); rc = zfile_output (uuid_file); // open file for writing assert (rc == 0); zchunk_t *uuid_bin = zchunk_new ( zuuid_data (self->own_uuid), 16); rc = zfile_write (uuid_file, uuid_bin, 0); assert (rc == 0); zfile_destroy (&uuid_file); } // Obtain peers and states self->peers = zlist_new (); if (zsys_file_exists (PEER_STATES_FILE)) { zhash_t *peer_states = zhash_new (); int rc = zhash_load (peer_states, PEER_STATES_FILE); assert (rc == 0); zlist_t *uuids = zhash_keys (peer_states); char *uuid = zlist_first (uuids); while (uuid) { char * state_str = zhash_lookup (peer_states, uuid); uint64_t state; sscanf (state_str, "%"SCNd64, &state); zlist_append (self->peers, zsync_peer_new (uuid, state)); uuid = zlist_next (uuids); } } self->zyre_peers = zhash_new (); self->terminated = false; return self;}
开发者ID:skyformat99,项目名称:protocol,代码行数:55,
示例2: s_rebuild_pollsetstatic ints_rebuild_pollset (zloop_t *self){ free (self->pollset); free (self->readact); free (self->pollact); self->pollset = NULL; self->readact = NULL; self->pollact = NULL; self->poll_size = zlist_size (self->readers) + zlist_size (self->pollers); self->pollset = (zmq_pollitem_t *) zmalloc (self->poll_size * sizeof (zmq_pollitem_t)); if (!self->pollset) return -1; self->readact = (s_reader_t *) zmalloc (self->poll_size * sizeof (s_reader_t)); if (!self->readact) return -1; self->pollact = (s_poller_t *) zmalloc (self->poll_size * sizeof (s_poller_t)); if (!self->pollact) return -1; s_reader_t *reader = (s_reader_t *) zlist_first (self->readers); uint item_nbr = 0; while (reader) { zmq_pollitem_t poll_item = { zsock_resolve (reader->sock), 0, ZMQ_POLLIN }; self->pollset [item_nbr] = poll_item; self->readact [item_nbr] = *reader; item_nbr++; reader = (s_reader_t *) zlist_next (self->readers); } s_poller_t *poller = (s_poller_t *) zlist_first (self->pollers); while (poller) { self->pollset [item_nbr] = poller->item; self->pollact [item_nbr] = *poller; item_nbr++; poller = (s_poller_t *) zlist_next (self->pollers); } self->need_rebuild = false; return 0;}
开发者ID:TomorrowToday,项目名称:czmq,代码行数:42,
示例3: zlist_firststatic flux_msg_handler_t *find_waiting_handler (struct dispatch *d, const flux_msg_t *msg){ flux_msg_handler_t *w = zlist_first (d->waiters); while (w) { if (flux_msg_cmp (msg, w->wait_match)) break; w = zlist_next (d->waiters); } return w;}
开发者ID:surajpkn,项目名称:flux-core,代码行数:11,
示例4: s_service_enable_commandstatic voids_service_enable_command (service_t *self, const char *command){ char *item = (char *) zlist_first (self->blacklist); while (item && !streq (item, command)) item = (char *) zlist_next (self->blacklist); if (item) { zlist_remove (self->blacklist, item); free (item); }}
开发者ID:mocosun,项目名称:majordomo,代码行数:11,
示例5: HHVM_METHODArray HHVM_METHOD(ZMQCert, getMetaKeys) { auto metaKeys = zcert_meta_keys(Native::data<ZMQCert>(this_)->zcert); auto metaKey = zlist_first(metaKeys); PackedArrayInit ret(4); while (metaKey != nullptr) { ret.append(String((char*)metaKey, CopyString)); metaKey = zlist_next(metaKeys); } return ret.toArray();}
开发者ID:Orvid,项目名称:php-zmq,代码行数:11,
示例6: to_vector std::vector<std::string> to_vector(zlist_t* list) const { std::vector<std::string> ret; void* cursor = zlist_first(list); while (cursor != NULL) { ret.emplace_back(static_cast<char*>(cursor)); cursor = zlist_next(list); } return ret; }
开发者ID:jossgray,项目名称:zyrecpp,代码行数:11,
示例7: match_substatic bool match_sub (module_t *p, const char *topic){ char *s = zlist_first (p->subs); while (s) { if (!strncmp (topic, s, strlen (s))) return true; s = zlist_next (p->subs); } return false;}
开发者ID:surajpkn,项目名称:flux-core,代码行数:11,
示例8: get_next_subscriptionstatic voidget_next_subscription (client_t *self){ sub_t *sub = (sub_t *) zlist_next (self->subs); if (sub) { fmq_msg_path_set (self->request, sub->path); self->next_event = ok_event; } else self->next_event = finished_event; }
开发者ID:zoobab,项目名称:filemq,代码行数:11,
示例9: subprocess_manager_find_pidstatic struct subprocess *subprocess_manager_find_pid (struct subprocess_manager *sm, pid_t pid){ struct subprocess *p = zlist_first (sm->processes); while (p) { if (p->pid == pid) return (p); p = zlist_next (sm->processes); } return (NULL);}
开发者ID:cigolabs,项目名称:flux-core,代码行数:11,
示例10: emit_command_list_categorystatic void emit_command_list_category (zhash_t *zh, const char *cat, FILE *fp){ struct cmdhelp *c; zlist_t *zl = zhash_lookup (zh, cat); fprintf (fp, "Common commands from flux-%s:/n", cat); c = zlist_first (zl); while (c) { fprintf (fp, " %-18s %s/n", c->cmd, c->description); c = zlist_next (zl); }}
开发者ID:flux-framework,项目名称:flux-core,代码行数:12,
示例11: send_event/* Broadcast event using all senders. * Log failure, but don't abort the event at this point. */static void send_event (struct publisher *pub, const flux_msg_t *msg){ struct sender *sender; sender = zlist_first (pub->senders); while (sender != NULL) { if (sender->send (sender->arg, msg) < 0) flux_log_error (pub->h, "%s: sender=%s", __FUNCTION__, sender->name); sender = zlist_next (pub->senders); }}
开发者ID:grondo,项目名称:flux-core,代码行数:15,
示例12: mount_sub_storestatic voidmount_sub_store (mount_t *self, client_t *client, fmq_msg_t *request){ // Store subscription along with any previous ones // Coalesce subscriptions that are on same path char *path = fmq_msg_path (request); sub_t *sub = (sub_t *) zlist_first (self->subs); while (sub) { if (client == sub->client) { // If old subscription is superset/same as new, ignore new if (strncmp (path, sub->path, strlen (sub->path)) == 0) return; else // If new subscription is superset of old one, remove old if (strncmp (sub->path, path, strlen (path)) == 0) { zlist_remove (self->subs, sub); sub_destroy (&sub); sub = (sub_t *) zlist_first (self->subs); } else sub = (sub_t *) zlist_next (self->subs); } else sub = (sub_t *) zlist_next (self->subs); } // New subscription for this client, append to our list sub = sub_new (client, path, fmq_msg_cache (request)); zlist_append (self->subs, sub); // If client requested resync, send full mount contents now if (fmq_msg_options_number (client->request, "RESYNC", 0) == 1) { zlist_t *patches = fmq_dir_resync (self->dir, self->alias); while (zlist_size (patches)) { fmq_patch_t *patch = (fmq_patch_t *) zlist_pop (patches); sub_patch_add (sub, patch); fmq_patch_destroy (&patch); } zlist_destroy (&patches); }}
开发者ID:JuanCerezuela,项目名称:filemq,代码行数:40,
示例13: invoke_cbsstatic int invoke_cbs (flux_t *h, int64_t j, json_object *jcb, int errnum){ int rc = 0; cb_pair_t *c = NULL; jscctx_t *ctx = getctx (h); for (c = zlist_first (ctx->callbacks); c; c = zlist_next (ctx->callbacks)) { if (c->cb (jcb, c->arg, errnum) < 0) { flux_log (h, LOG_ERR, "callback returns an error"); rc = -1; } } return rc;}
开发者ID:trws,项目名称:flux-core,代码行数:13,
示例14: zlist_firststatic subscription_t *subscription_lookup (client_t *c, int type, const char *topic){ subscription_t *sub; sub = zlist_first (c->subscriptions); while (sub) { if (sub->type == type && !strcmp (sub->topic, topic)) return sub; sub = zlist_next (c->subscriptions); } return NULL;}
开发者ID:dinesh121991,项目名称:flux-core,代码行数:13,
示例15: zsync_node_peers_lookupstatic zsync_peer_t *zsync_node_peers_lookup (zsync_node_t *self, char *uuid){ assert (self); zsync_peer_t *peer = zlist_first (self->peers); while (peer) { if (streq (zsync_peer_uuid (peer), uuid)) { return peer; } peer = zlist_next (self->peers); } return NULL;}
开发者ID:skyformat99,项目名称:protocol,代码行数:13,
示例16: monitor_the_serverstatic voidmonitor_the_server (server_t *self, client_t *client){ bool activity = false; mount_t *mount = (mount_t *) zlist_first (self->mounts); while (mount) { if (mount_refresh (mount, self)) activity = true; mount = (mount_t *) zlist_next (self->mounts); } if (activity) zhash_foreach (self->clients, client_dispatch, self);}
开发者ID:JuanCerezuela,项目名称:filemq,代码行数:13,
示例17: zmsg_lastzframe_t *zmsg_last (zmsg_t *self){ assert (self); zframe_t *frame = (zframe_t *) zlist_first (self->frames); while (frame) { zframe_t *next = (zframe_t *) zlist_next (self->frames); if (!next) break; frame = next; } return frame;}
开发者ID:bartuer,项目名称:bew,代码行数:13,
示例18: zloop_reader_set_tolerantvoidzloop_reader_set_tolerant (zloop_t *self, zsock_t *sock){ assert (self); assert (sock); s_reader_t *reader = (s_reader_t *) zlist_first (self->readers); while (reader) { if (reader->sock == sock) reader->tolerant = true; reader = (s_reader_t *) zlist_next (self->readers); }}
开发者ID:TomorrowToday,项目名称:czmq,代码行数:13,
示例19: s_timer_removestatic voids_timer_remove (zloop_t *self, int timer_id){ s_timer_t *timer = (s_timer_t *) zlist_first (self->timers); while (timer) { if (timer->timer_id == timer_id) { zlist_remove (self->timers, timer); free (timer); break; } timer = (s_timer_t *) zlist_next (self->timers); }}
开发者ID:TomorrowToday,项目名称:czmq,代码行数:13,
示例20: pass_updatevoidpass_update (char *sender, zlist_t *fmetadata) { printf ("[ST] PASS_UPDATE from %s: %"PRId64"/n", sender, zlist_size (fmetadata)); uint64_t size = 0; zlist_t *paths = zlist_new (); zs_fmetadata_t *meta = zlist_first (fmetadata); while (meta) { zlist_append (paths, zs_fmetadata_path (meta)); size += zs_fmetadata_size (meta); meta = zlist_next (fmetadata); } zsync_agent_send_request_files (agent, sender, paths, size);}
开发者ID:skyformat99,项目名称:protocol,代码行数:14,
示例21: zlist_firstconst char *flux_kvsitr_next (flux_kvsitr_t *itr){ const char *name = NULL; if (itr) { if (itr->reset) name = zlist_first (itr->keys); else name = zlist_next (itr->keys); if (name) itr->reset = false; } return name;}
开发者ID:flux-framework,项目名称:flux-core,代码行数:14,
示例22: s_worker_readystatic voids_worker_ready (worker_t *self, zlist_t *workers){ worker_t *worker = (worker_t *) zlist_first (workers); while (worker) { if (streq (self->identity, worker->identity)) { zlist_remove (workers, worker); s_worker_destroy (&worker); break; } worker = (worker_t *) zlist_next (workers); } zlist_append (workers, self);}
开发者ID:Carl4,项目名称:zguide,代码行数:14,
示例23: disp_table_remove_allhalutils_err_e disp_table_remove_all (disp_table_t *self){ assert (self); zlist_t *hash_keys = zhash_keys (self->table_h); void * table_item = zlist_first (hash_keys); for (; table_item; table_item = zlist_next (hash_keys)) { zhash_delete (self->table_h, (char *) table_item); } zlist_destroy (&hash_keys); return HALUTILS_SUCCESS;}
开发者ID:julianofjm,项目名称:bpm-software,代码行数:14,
示例24: subprocess_run_hooksstatic int subprocess_run_hooks (struct subprocess *p, zlist_t *hooks){ subprocess_cb_f fn = zlist_first (hooks); int rc = 0; subprocess_ref (p); while (fn) { if ((rc = fn (p)) < 0) goto done; fn = zlist_next (hooks); }done: subprocess_unref (p); return (rc);}
开发者ID:cigolabs,项目名称:flux-core,代码行数:14,
示例25: zcertstore_fprintvoidzcertstore_fprint (zcertstore_t *self, FILE *file){ if (self->location) fprintf (file, "Certificate store at %s:/n", self->location); else fprintf (file, "Certificate store/n"); zcert_t *cert = (zcert_t *) zlist_first (self->cert_list); while (cert) { zcert_fprint (cert, file); cert = (zcert_t *) (zcert_t *) zlist_next (self->cert_list); }}
开发者ID:Prarrot,项目名称:czmq,代码行数:14,
示例26: s_was_pending// If message was already on pending list, remove it and return true,// else return false.static ints_was_pending (clonesrv_t *self, kvmsg_t *kvmsg){ kvmsg_t *held = (kvmsg_t *) zlist_first (self->pending); while (held) { if (memcmp (kvmsg_uuid (kvmsg), kvmsg_uuid (held), sizeof (uuid_t)) == 0) { zlist_remove (self->pending, held); return true; } held = (kvmsg_t *) zlist_next (self->pending); } return false;}
开发者ID:CaiZhongda,项目名称:zguide,代码行数:16,
示例27: zyre_peers void GroupNodeImpl::peers(PeerList& ps) const { ps.clear(); zlist_t* zpeers = zyre_peers(node_); char* uuid; while ((uuid = static_cast<char*>(zlist_next(zpeers))) != NULL) { char* desc = zyre_peer_header_value(node_, uuid, "desc"); PeerPtr p(new Peer(uuid, desc)); ps.push_back(p); free(desc); } zlist_destroy(&zpeers); }
开发者ID:mikegulf,项目名称:quickmsg,代码行数:14,
示例28: subscription_matchstatic bool subscription_match (client_t *c, const flux_msg_t *msg){ subscription_t *sub; const char *topic; if (flux_msg_get_topic (msg, &topic) < 0) return false; sub = zlist_first (c->subscriptions); while (sub) { if (!strncmp (topic, sub->topic, strlen (sub->topic))) return true; sub = zlist_next (c->subscriptions); } return false;}
开发者ID:dinesh121991,项目名称:flux-core,代码行数:15,
示例29: START_TESTEND_TEST// --------------------------------------------------------------------------/// Try to _pop () a zlist_t *START_TEST(test_msg_pop_l){ sam_selftest_introduce ("test_msg_pop_h"); zmsg_t *zmsg = zmsg_new (); if (zmsg_pushstr (zmsg, "value2") || zmsg_pushstr (zmsg, "value1") || zmsg_pushstr (zmsg, "2")) { ck_abort_msg ("could not build zmsg"); } sam_msg_t *msg = sam_msg_new (&zmsg); ck_assert_int_eq (sam_msg_size (msg), 3); zlist_t *list; int rc = sam_msg_pop (msg, "l", &list); ck_assert_int_eq (rc, 0); ck_assert_int_eq (sam_msg_size (msg), 0); ck_assert_int_eq (zlist_size (list), 2); ck_assert_str_eq (zlist_first (list), "value1"); ck_assert_str_eq (zlist_next (list), "value2"); ck_assert (zlist_next (list) == NULL); zlist_destroy (&list); sam_msg_destroy (&msg);}
开发者ID:dreadworks,项目名称:samwise,代码行数:36,
注:本文中的zlist_next函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ zlist_pop函数代码示例 C++ zlist_new函数代码示例 |