Qore Programming Language  0.8.9
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
QoreQueue.h
1 /* -*- mode: c++; indent-tabs-mode: nil -*- */
2 /*
3  QoreQueue.h
4 
5  Qore Programming Language
6 
7  Copyright 2003 - 2014 David Nichols
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Lesser General Public
11  License as published by the Free Software Foundation; either
12  version 2.1 of the License, or (at your option) any later version.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public
20  License along with this library; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23 
24 #ifndef _QORE_QOREQUEUE_H
25 
26 #define _QORE_QOREQUEUE_H
27 
28 #include <qore/QoreThreadLock.h>
29 #include <qore/QoreCondition.h>
30 
31 class QoreQueueNode;
32 
33 class qore_queue_private;
34 
35 class QoreQueue {
36  friend class qore_queue_private;
37 protected:
38  // private implementation
39  qore_queue_private* priv;
40 
41 public:
43  DLLEXPORT QoreQueue(int n_max = -1);
44 
46  DLLEXPORT QoreQueue(const QoreQueue &orig);
47 
49 
51  DLLEXPORT ~QoreQueue();
52 
54  DLLEXPORT void pushAndTakeRef(AbstractQoreNode* n);
55 
57  DLLEXPORT void push(ExceptionSink* xsink, const AbstractQoreNode* n, int timeout_ms = 0, bool* to = 0);
58 
60  DLLEXPORT void insert(ExceptionSink* xsink, const AbstractQoreNode* n, int timeout_ms = 0, bool* to = 0);
61 
63  DLLEXPORT AbstractQoreNode* shift(ExceptionSink* xsink, int timeout_ms = 0, bool* to = 0);
64 
66  DLLEXPORT AbstractQoreNode* pop(ExceptionSink* xsink, int timeout_ms = 0, bool* to = 0);
67 
69  DLLEXPORT bool empty() const;
70 
72 
74  DLLEXPORT int size() const;
75 
77  DLLEXPORT int getMax() const;
78 
80  DLLEXPORT unsigned getReadWaiting() const;
81 
83  DLLEXPORT unsigned getWriteWaiting() const;
84 
86  DLLEXPORT void clear(ExceptionSink* xsink);
87 };
88 
89 class Queue : public AbstractPrivateData, public QoreQueue {
90 protected:
91  DLLEXPORT virtual ~Queue();
92 
93 public:
94  DLLEXPORT Queue(int max = -1);
95 
96  DLLEXPORT Queue* eventRefSelf() const;
97 };
98 
99 #endif // _QORE_QOREQUEUE_H
the base class for all data to be used as private data of Qore objects
Definition: AbstractPrivateData.h:36
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:47
container for holding Qore-language exception information and also for registering a &quot;thread_exit&quot; ca...
Definition: ExceptionSink.h:35