1 /*
2 ################################################################################
3 # THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
4 # Read the zproject/README.md for information about making permanent changes. #
5 ################################################################################
6 */
7
8 #include "qczmq.h"
9
10 ///
11 // Copy-construct to return the proper wrapped c types
QZframe(zframe_t * self,QObject * qObjParent)12 QZframe::QZframe (zframe_t *self, QObject *qObjParent) : QObject (qObjParent)
13 {
14 this->self = self;
15 }
16
17
18 ///
19 // Create a new frame. If size is not null, allocates the frame data
20 // to the specified size. If additionally, data is not null, copies
21 // size octets from the specified data into the frame body.
QZframe(const void * data,size_t size,QObject * qObjParent)22 QZframe::QZframe (const void *data, size_t size, QObject *qObjParent) : QObject (qObjParent)
23 {
24 this->self = zframe_new (data, size);
25 }
26
27 ///
28 // Create an empty (zero-sized) frame
newEmpty(QObject * qObjParent)29 QZframe* QZframe::newEmpty (QObject *qObjParent)
30 {
31 return new QZframe (zframe_new_empty (), qObjParent);
32 }
33
34 ///
35 // Create a frame with a specified string content.
from(const QString & string,QObject * qObjParent)36 QZframe* QZframe::from (const QString &string, QObject *qObjParent)
37 {
38 return new QZframe (zframe_from (string.toUtf8().data()), qObjParent);
39 }
40
41 ///
42 // Receive frame from socket, returns zframe_t object or NULL if the recv
43 // was interrupted. Does a blocking recv, if you want to not block then use
44 // zpoller or zloop.
recv(void * source,QObject * qObjParent)45 QZframe* QZframe::recv (void *source, QObject *qObjParent)
46 {
47 return new QZframe (zframe_recv (source), qObjParent);
48 }
49
50 ///
51 // Destroy a frame
~QZframe()52 QZframe::~QZframe ()
53 {
54 zframe_destroy (&self);
55 }
56
57 ///
58 // Send a frame to a socket, destroy frame after sending.
59 // Return -1 on error, 0 on success.
send(void * dest,int flags)60 int QZframe::send (void *dest, int flags)
61 {
62 int rv = zframe_send (&self, dest, flags);
63 return rv;
64 }
65
66 ///
67 // Return number of bytes in frame data
size()68 size_t QZframe::size ()
69 {
70 size_t rv = zframe_size (self);
71 return rv;
72 }
73
74 ///
75 // Return address of frame data
data()76 byte * QZframe::data ()
77 {
78 byte * rv = zframe_data (self);
79 return rv;
80 }
81
82 ///
83 // Return meta data property for frame
84 // The caller shall not modify or free the returned value, which shall be
85 // owned by the message.
meta(const QString & property)86 const QString QZframe::meta (const QString &property)
87 {
88 const QString rv = QString (zframe_meta (self, property.toUtf8().data()));
89 return rv;
90 }
91
92 ///
93 // Create a new frame that duplicates an existing frame. If frame is null,
94 // or memory was exhausted, returns null.
dup()95 QZframe * QZframe::dup ()
96 {
97 QZframe *rv = new QZframe (zframe_dup (self));
98 return rv;
99 }
100
101 ///
102 // Return frame data encoded as printable hex string, useful for 0MQ UUIDs.
103 // Caller must free string when finished with it.
strhex()104 QString QZframe::strhex ()
105 {
106 char *retStr_ = zframe_strhex (self);
107 QString rv = QString (retStr_);
108 zstr_free (&retStr_);
109 return rv;
110 }
111
112 ///
113 // Return frame data copied into freshly allocated string
114 // Caller must free string when finished with it.
strdup()115 QString QZframe::strdup ()
116 {
117 char *retStr_ = zframe_strdup (self);
118 QString rv = QString (retStr_);
119 zstr_free (&retStr_);
120 return rv;
121 }
122
123 ///
124 // Return TRUE if frame body is equal to string, excluding terminator
streqNoConflict(const QString & string)125 bool QZframe::streqNoConflict (const QString &string)
126 {
127 bool rv = zframe_streq (self, string.toUtf8().data());
128 return rv;
129 }
130
131 ///
132 // Return frame MORE indicator (1 or 0), set when reading frame from socket
133 // or by the zframe_set_more() method
more()134 int QZframe::more ()
135 {
136 int rv = zframe_more (self);
137 return rv;
138 }
139
140 ///
141 // Set frame MORE indicator (1 or 0). Note this is NOT used when sending
142 // frame to socket, you have to specify flag explicitly.
setMore(int more)143 void QZframe::setMore (int more)
144 {
145 zframe_set_more (self, more);
146
147 }
148
149 ///
150 // Return frame routing ID, if the frame came from a ZMQ_SERVER socket.
151 // Else returns zero.
routingId()152 quint32 QZframe::routingId ()
153 {
154 uint32_t rv = zframe_routing_id (self);
155 return rv;
156 }
157
158 ///
159 // Set routing ID on frame. This is used if/when the frame is sent to a
160 // ZMQ_SERVER socket.
setRoutingId(quint32 routingId)161 void QZframe::setRoutingId (quint32 routingId)
162 {
163 zframe_set_routing_id (self, (uint32_t) routingId);
164
165 }
166
167 ///
168 // Return frame group of radio-dish pattern.
group()169 const QString QZframe::group ()
170 {
171 const QString rv = QString (zframe_group (self));
172 return rv;
173 }
174
175 ///
176 // Set group on frame. This is used if/when the frame is sent to a
177 // ZMQ_RADIO socket.
178 // Return -1 on error, 0 on success.
setGroup(const QString & group)179 int QZframe::setGroup (const QString &group)
180 {
181 int rv = zframe_set_group (self, group.toUtf8().data());
182 return rv;
183 }
184
185 ///
186 // Return TRUE if two frames have identical size and data
187 // If either frame is NULL, equality is always false.
eq(QZframe * other)188 bool QZframe::eq (QZframe *other)
189 {
190 bool rv = zframe_eq (self, other->self);
191 return rv;
192 }
193
194 ///
195 // Set new contents for frame
reset(const void * data,size_t size)196 void QZframe::reset (const void *data, size_t size)
197 {
198 zframe_reset (self, data, size);
199
200 }
201
202 ///
203 // Send message to zsys log sink (may be stdout, or system facility as
204 // configured by zsys_set_logstream). Prefix shows before frame, if not null.
print(const QString & prefix)205 void QZframe::print (const QString &prefix)
206 {
207 zframe_print (self, prefix.toUtf8().data());
208
209 }
210
211 ///
212 // Probe the supplied object, and report if it looks like a zframe_t.
is(void * self)213 bool QZframe::is (void *self)
214 {
215 bool rv = zframe_is (self);
216 return rv;
217 }
218
219 ///
220 // Self test of this class.
test(bool verbose)221 void QZframe::test (bool verbose)
222 {
223 zframe_test (verbose);
224
225 }
226 /*
227 ################################################################################
228 # THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
229 # Read the zproject/README.md for information about making permanent changes. #
230 ################################################################################
231 */
232