~ubuntu-branches/ubuntu/maverick/zeromq/maverick

« back to all changes in this revision

Viewing changes to man/man7/zmq_cpp.7

  • Committer: Bazaar Package Importer
  • Author(s): Adrian von Bidder
  • Date: 2010-03-17 10:43:40 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100317104340-un1ne0oqe16w8eaq
Tags: 2.0.6beta.dfsg-1
* New upstream version.
  - Source doesn't include non-C/C++ language bindings anymore.
  - New versioning: 2.0.6 is official upstream version which is a beta.
* Repacked orig tar: removed non-free RFC documents (closes: #567513)
* Improved/corrected description and copyright file, added bzip2 build
  dependency.  Thanks to feedback from zeromq mailing list.
* Disable OpenPGM on non-x86 architectures (closes: #567848)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
.TH zmq_cpp 7 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals"
2
 
.SH NAME
3
 
C++ API for 0MQ lightweight messaging kernel
4
 
.SH SYNOPSIS
5
 
 
6
 
This manual page explains how C++ API maps to underlying C API. To learn about
7
 
individual functions and parameters check appropriate C API manual
8
 
pages.
9
 
 
10
 
For example, to understand
11
 
.IR zmq::socket_t::setsockopt
12
 
function check
13
 
.BR zmq_setsockopt(3) .
14
 
 
15
 
All 0MQ constants defined with C API are available with C++ API.
16
 
 
17
 
.SH zmq::context_t
18
 
 
19
 
This class encapsulates the functions dealing with initialisation and
20
 
termination of 0MQ context. Constructor of the class invokes
21
 
.BR zmq_init(3)
22
 
while destructor calls
23
 
.BR zmq_term(3) .
24
 
 
25
 
.SH zmq::socket_t
26
 
 
27
 
This class encapsulates all the functions to deal with 0MQ sockets. Constructor
28
 
calls
29
 
.BR zmq_socket(3) ,
30
 
destructor calls
31
 
.BR zmq_close(3) .
32
 
Other functions of the class are mapped to C functions with corresponding names.
33
 
.IR zmq::socket_t::bind
34
 
calls
35
 
.BR zmq_bind(3)
36
 
etc.
37
 
 
38
 
.SH zmq::message_t
39
 
 
40
 
This class encapsulates 
41
 
.IR zmq_msg_t
42
 
structure and all the C functions that deal with 0MQ messages.
43
 
Constructors of the class invoke corresponding initialisation functions (
44
 
.BR zmq_msg_init(3) ,
45
 
.BR zmq_msg_init_size(3)
46
 
and
47
 
.BR zmq_msg_init_data(3) ,
48
 
while destructor invokes
49
 
.BR zmq_msg_close(3)
50
 
function.
51
 
 
52
 
Remaining functions are mapped to C functions with corresponding names.
53
 
For instance,
54
 
.IR zmq::message_t::copy
55
 
is mapped to
56
 
.BR zmq_msg_copy(3)
57
 
etc.
58
 
 
59
 
C++ provides an additional function not avialable with C API.
60
 
.IR zmq::message_t::rebuild
61
 
is equivalent to calling
62
 
.BR zmq_close(3)
63
 
followed by
64
 
.BR zmq_msg_init(3) ,
65
 
.BR zmq_msg_init_size (3)
66
 
or
67
 
.BR zmq_msg_init_data(3) .
68
 
It provides a way to reuse existing
69
 
.IR zmq::message_t
70
 
instances to store different message content.
71
 
 
72
 
.SH zmq::error_t
73
 
 
74
 
All the errors reported using
75
 
.IR errno
76
 
mechanism in C API are automatically converted to exceptions in C++ API.
77
 
.IR zmq::error_t
78
 
is derived from
79
 
.IR std::exception
80
 
and uses
81
 
.BR zmq_strerror(3)
82
 
function to convert the error code to human-readable string.
83
 
 
84
 
.SH zmq::poll
85
 
 
86
 
.IR zmq::poll
87
 
function is a namespaced equivalent of raw C
88
 
.BR zmq_poll(3)
89
 
function.
90
 
 
91
 
.SH EXAMPLE
92
 
.nf
93
 
zmq::context_t ctx (1, 1);
94
 
zmq::socket_t s (ctx, ZMQ_PUB);
95
 
s.connect ("tcp://192.168.0.115:5555");
96
 
zmq::message_t msg (100);
97
 
memset (msg.data (), 0, 100);
98
 
s.send (msg);
99
 
.fi
100
 
.SH "SEE ALSO"
101
 
.BR zmq(7)
102
 
.SH AUTHOR
103
 
Martin Sustrik <sustrik at 250bpm dot com>