本文整理汇总了C++中zmsg_is函数的典型用法代码示例。如果您正苦于以下问题:C++ zmsg_is函数的具体用法?C++ zmsg_is怎么用?C++ zmsg_is使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zmsg_is函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: zmsg_send
int
zmsg_send (zmsg_t **self_p, void *dest)
{
assert (self_p);
assert (dest);
zmsg_t *self = *self_p;
int rc = 0;
void *handle = zsock_resolve (dest);
if (self) {
assert (zmsg_is (self));
if (zlist_size (self->frames) == 0)
return -1; // Sending an empty message is an error
zframe_t *frame = (zframe_t *) zlist_pop (self->frames);
while (frame) {
rc = zframe_send (&frame, handle,
zlist_size (self->frames)? ZFRAME_MORE: 0);
if (rc != 0)
break;
frame = (zframe_t *) zlist_pop (self->frames);
}
zmsg_destroy (self_p);
}
return rc;
}
示例2: zmsg_last
zframe_t *
zmsg_last (zmsg_t *self)
{
assert (self);
assert (zmsg_is (self));
return (zframe_t *) zlist_last (self->frames);
}
示例3: zmsg_sendm
int
zmsg_sendm (zmsg_t **self_p, void *dest)
{
assert (self_p);
assert (dest);
zmsg_t *self = *self_p;
int rc = 0;
if (self) {
assert (zmsg_is (self));
bool sent_some = false;
zframe_t *frame;
while ((frame = (zframe_t *) zlist_head (self->frames))) {
rc = zframe_send (&frame, dest, ZFRAME_MORE);
if (rc != 0) {
if (errno == EINTR && sent_some)
continue;
else
break;
}
sent_some = true;
(void) zlist_pop (self->frames);
}
if (rc == 0)
zmsg_destroy (self_p);
}
return rc;
}
示例4: zmsg_content_size
size_t
zmsg_content_size (zmsg_t *self)
{
assert (self);
assert (zmsg_is (self));
return self->content_size;
}
示例5: get_message_to_deliver
static void
get_message_to_deliver (client_t *self)
{
assert (zmsg_is (self->msg));
if (self->callee)
xrap_traffic_set_sender (self->message, self->callee->id);
xrap_traffic_set_content (self->message, &self->msg);
}
示例6: zmsg_size
size_t
zmsg_size (zmsg_t *self)
{
assert (self);
assert (zmsg_is (self));
return zlist_size (self->frames);
}
示例7: zmsg_remove
void
zmsg_remove (zmsg_t *self, zframe_t *frame)
{
assert (self);
assert (zmsg_is (self));
self->content_size -= zframe_size (frame);
zlist_remove (self->frames, frame);
}
示例8: zmsg_addstr
int
zmsg_addstr (zmsg_t *self, const char *string)
{
assert (self);
assert (zmsg_is (self));
assert (string);
self->content_size += strlen (string);
zlist_append (self->frames, zframe_new (string, strlen (string)));
return 0;
}
示例9: zmsg_append
int
zmsg_append (zmsg_t *self, zframe_t **frame_p)
{
assert (self);
assert (zmsg_is (self));
assert (frame_p);
zframe_t *frame = *frame_p;
*frame_p = NULL; // We now own frame
self->content_size += zframe_size (frame);
return zlist_append (self->frames, frame);
}
示例10: zmsg_pop
zframe_t *
zmsg_pop (zmsg_t *self)
{
assert (self);
assert (zmsg_is (self));
zframe_t *frame = (zframe_t *) zlist_pop (self->frames);
if (frame)
self->content_size -= zframe_size (frame);
return frame;
}
示例11: zmsg_addmem
int
zmsg_addmem (zmsg_t *self, const void *src, size_t size)
{
assert (self);
assert (zmsg_is (self));
zframe_t *frame = zframe_new (src, size);
if (frame) {
self->content_size += size;
return zlist_append (self->frames, frame);
}
else
return -1;
}
示例12: zmsg_popstr
char *
zmsg_popstr (zmsg_t *self)
{
assert (self);
assert (zmsg_is (self));
zframe_t *frame = (zframe_t *) zlist_pop (self->frames);
char *string = NULL;
if (frame) {
self->content_size -= zframe_size (frame);
string = zframe_strdup (frame);
zframe_destroy (&frame);
}
return string;
}
示例13: zmsg_addstr
int
zmsg_addstr (zmsg_t *self, const char *string)
{
assert (self);
assert (zmsg_is (self));
assert (string);
size_t len = strlen (string);
zframe_t *frame = zframe_new (string, len);
if (frame) {
self->content_size += len;
return zlist_append (self->frames, frame);
}
else
return -1;
}
示例14: zmsg_destroy
void
zmsg_destroy (zmsg_t **self_p)
{
assert (self_p);
if (*self_p) {
zmsg_t *self = *self_p;
assert (zmsg_is (self));
zframe_t *frame;
while ((frame = (zframe_t *) zlist_pop (self->frames)))
zframe_destroy (&frame);
zlist_destroy (&self->frames);
self->tag = 0xDeadBeef;
free (self);
*self_p = NULL;
}
}
示例15: zmsg_print
void
zmsg_print (zmsg_t *self)
{
assert (self);
assert (zmsg_is (self));
if (!self) {
zsys_debug ("(NULL)");
return;
}
zframe_t *frame = zmsg_first (self);
while (frame) {
zframe_print (frame, NULL);
frame = zmsg_next (self);
}
}