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 #ifndef QML_ZPOLLER_H
9 #define QML_ZPOLLER_H
10 
11 #include <QtQml>
12 
13 #include <czmq.h>
14 #include "qml_czmq_plugin.h"
15 
16 
17 class QmlZpoller : public QObject
18 {
19     Q_OBJECT
20     Q_PROPERTY(bool isNULL READ isNULL)
21 
22 public:
23     zpoller_t *self;
24 
QmlZpoller()25     QmlZpoller() { self = NULL; }
isNULL()26     bool isNULL() { return self == NULL; }
27 
28     static QObject* qmlAttachedProperties(QObject* object); // defined in QmlZpoller.cpp
29 
30 public slots:
31     //  Add a reader to be polled. Returns 0 if OK, -1 on failure. The reader may
32     //  be a libzmq void * socket, a zsock_t instance, or a zactor_t instance.
33     int add (void *reader);
34 
35     //  Remove a reader from the poller; returns 0 if OK, -1 on failure. The reader
36     //  must have been passed during construction, or in an zpoller_add () call.
37     int remove (void *reader);
38 
39     //  By default the poller stops if the process receives a SIGINT or SIGTERM
40     //  signal. This makes it impossible to shut-down message based architectures
41     //  like zactors. This method lets you switch off break handling. The default
42     //  nonstop setting is off (false).
43     void setNonstop (bool nonstop);
44 
45     //  Poll the registered readers for I/O, return first reader that has input.
46     //  The reader will be a libzmq void * socket, or a zsock_t or zactor_t
47     //  instance as specified in zpoller_new/zpoller_add. The timeout should be
48     //  zero or greater, or -1 to wait indefinitely. Socket priority is defined
49     //  by their order in the poll list. If you need a balanced poll, use the low
50     //  level zmq_poll method directly. If the poll call was interrupted (SIGINT),
51     //  or the ZMQ context was destroyed, or the timeout expired, returns NULL.
52     //  You can test the actual exit condition by calling zpoller_expired () and
53     //  zpoller_terminated (). The timeout is in msec.
54     void *wait (int timeout);
55 
56     //  Return true if the last zpoller_wait () call ended because the timeout
57     //  expired, without any error.
58     bool expired ();
59 
60     //  Return true if the last zpoller_wait () call ended because the process
61     //  was interrupted, or the parent context was destroyed.
62     bool terminated ();
63 };
64 
65 class QmlZpollerAttached : public QObject
66 {
67     Q_OBJECT
68     QObject* m_attached;
69 
70 public:
QmlZpollerAttached(QObject * attached)71     QmlZpollerAttached (QObject* attached) {
72         Q_UNUSED (attached);
73     };
74 
75 public slots:
76     //  Self test of this class.
77     void test (bool verbose);
78 
79     //  Create new poller, specifying zero or more readers. The list of
80     //  readers ends in a NULL. Each reader can be a zsock_t instance, a
81     //  zactor_t instance, a libzmq socket (void *), or a file handle.
82     QmlZpoller *construct (void *reader);
83 
84     //  Destroy a poller
85     void destruct (QmlZpoller *qmlSelf);
86 };
87 
88 
89 QML_DECLARE_TYPEINFO(QmlZpoller, QML_HAS_ATTACHED_PROPERTIES)
90 
91 #endif
92 /*
93 ################################################################################
94 #  THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY  #
95 #  Read the zproject/README.md for information about making permanent changes. #
96 ################################################################################
97 */
98