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 "QmlZactor.h"
9
10
11 ///
12 // Send a zmsg message to the actor, take ownership of the message
13 // and destroy when it has been sent.
send(QmlZmsg * msgP)14 int QmlZactor::send (QmlZmsg *msgP) {
15 return zactor_send (self, &msgP->self);
16 };
17
18 ///
19 // Receive a zmsg message from the actor. Returns NULL if the actor
20 // was interrupted before the message could be received, or if there
21 // was a timeout on the actor.
recv()22 QmlZmsg *QmlZactor::recv () {
23 QmlZmsg *retQ_ = new QmlZmsg ();
24 retQ_->self = zactor_recv (self);
25 return retQ_;
26 };
27
28 ///
29 // Return the actor's zsock handle. Use this when you absolutely need
30 // to work with the zsock instance rather than the actor.
sock()31 QmlZsock *QmlZactor::sock () {
32 QmlZsock *retQ_ = new QmlZsock ();
33 retQ_->self = zactor_sock (self);
34 return retQ_;
35 };
36
37 ///
38 // Change default destructor by custom function. Actor MUST be able to handle new message instead of default $TERM.
setDestructor(zactor_destructor_fn destructor)39 void QmlZactor::setDestructor (zactor_destructor_fn destructor) {
40 zactor_set_destructor (self, destructor);
41 };
42
43
qmlAttachedProperties(QObject * object)44 QObject* QmlZactor::qmlAttachedProperties(QObject* object) {
45 return new QmlZactorAttached(object);
46 }
47
48
49 ///
50 // Probe the supplied object, and report if it looks like a zactor_t.
is(void * self)51 bool QmlZactorAttached::is (void *self) {
52 return zactor_is (self);
53 };
54
55 ///
56 // Probe the supplied reference. If it looks like a zactor_t instance,
57 // return the underlying libzmq actor handle; else if it looks like
58 // a libzmq actor handle, return the supplied value.
resolve(void * self)59 void *QmlZactorAttached::resolve (void *self) {
60 return zactor_resolve (self);
61 };
62
63 ///
64 // Self test of this class.
test(bool verbose)65 void QmlZactorAttached::test (bool verbose) {
66 zactor_test (verbose);
67 };
68
69 ///
70 // Create a new actor passing arbitrary arguments reference.
construct(zactor_fn task,void * args)71 QmlZactor *QmlZactorAttached::construct (zactor_fn task, void *args) {
72 QmlZactor *qmlSelf = new QmlZactor ();
73 qmlSelf->self = zactor_new (task, args);
74 return qmlSelf;
75 };
76
77 ///
78 // Destroy an actor.
destruct(QmlZactor * qmlSelf)79 void QmlZactorAttached::destruct (QmlZactor *qmlSelf) {
80 zactor_destroy (&qmlSelf->self);
81 };
82
83 /*
84 ################################################################################
85 # THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
86 # Read the zproject/README.md for information about making permanent changes. #
87 ################################################################################
88 */
89