Debian Codegraph @

gstreamer/gstreamermm/taskpool.h

raw symbols SCIP
1 // Generated by gmmproc 2.50.1 -- DO NOT MODIFY!
2 #ifndef _GSTREAMERMM_TASKPOOL_H
3 #define _GSTREAMERMM_TASKPOOL_H
4
5
6 #include <glibmm/ustring.h>
7 #include <sigc++/sigc++.h>
8
9 /* gstreamermm - a C++ wrapper for gstreamer
10 *
11 * Copyright 2008-2009 The gstreamermm Development Team
12 *
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public
15 * License as published by the Free Software Foundation; either
16 * version 2.1 of the License, or (at your option) any later version.
17 *
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Lesser General Public License for more details.
22 *
23 * You should have received a copy of the GNU Lesser General Public
24 * License along with this library; if not, write to the Free
25 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 */
27
28 #include <gst/gst.h>
29 #include <gstreamermm/object.h>
30
31
32 #ifndef DOXYGEN_SHOULD_SKIP_THIS
33 using GstTaskPool = struct _GstTaskPool;
34 using GstTaskPoolClass = struct _GstTaskPoolClass;
35 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
36
37
38 #ifndef DOXYGEN_SHOULD_SKIP_THIS
39 namespace Gst
40 { class TaskPool_Class; } // namespace Gst
41 #endif //DOXYGEN_SHOULD_SKIP_THIS
42
43 namespace Gst
44 {
45
46 /** A class representing a pool of GStreamer streaming threads.
47 * This object provides an abstraction for creating threads. The default
48 * implementation uses a regular Glib::ThreadPool to start tasks.
49 *
50 * Subclasses can be made to create custom threads.
51 *
52 * Last reviewed on 2009-04-23 (0.10.24)
53 */
54
55 class TaskPool : public Object
56 {
57
58 #ifndef DOXYGEN_SHOULD_SKIP_THIS
59
60 public:
61 using CppObjectType = TaskPool;
62 using CppClassType = TaskPool_Class;
63 using BaseObjectType = GstTaskPool;
64 using BaseClassType = GstTaskPoolClass;
65
66 // noncopyable
67 TaskPool(const TaskPool&) = delete;
68 TaskPool& operator=(const TaskPool&) = delete;
69
70 private: friend class TaskPool_Class;
71 static CppClassType taskpool_class_;
72
73 protected:
74 explicit TaskPool(const Glib::ConstructParams& construct_params);
75 explicit TaskPool(GstTaskPool* castitem);
76
77 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
78
79 public:
80
81 TaskPool(TaskPool&& src) noexcept;
82 TaskPool& operator=(TaskPool&& src) noexcept;
83
84 ~TaskPool() noexcept override;
85
86 /** Get the GType for this class, for use with the underlying GObject type system.
87 */
88 static GType get_type() G_GNUC_CONST;
89
90 #ifndef DOXYGEN_SHOULD_SKIP_THIS
91
92
93 static GType get_base_type() G_GNUC_CONST;
94 #endif
95
96 ///Provides access to the underlying C GObject.
97 GstTaskPool* gobj() { return reinterpret_cast<GstTaskPool*>(gobject_); }
98
99 ///Provides access to the underlying C GObject.
100 const GstTaskPool* gobj() const { return reinterpret_cast<GstTaskPool*>(gobject_); }
101
102 ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
103 GstTaskPool* gobj_copy();
104
105 private:
106
107
108 protected:
109 TaskPool();
110
111 public:
112 /** For example,
113 * void on_do_push();.
114 */
115 typedef sigc::slot<void> SlotPush;
116
117 public:
118 /** Create a new default task pool. The default task pool will use a regular
119 * Glib::ThreadPool for threads.
120 * @return A new Gst::TaskPool.
121 */
122
123 static Glib::RefPtr<TaskPool> create();
124
125
126 /** @throw Glib::Error.
127 */
128 void prepare();
129
130 /** Start the execution of a new thread from pool.
131 *
132 * @param slot The function to call.
133 * @return A pointer that should be used for the join() method. This pointer
134 * can be 0, you must check error to detect errors.
135 * @throw Glib::Error.
136 */
137 gpointer push(const SlotPush& slot);
138
139
140 /** Join a task and/or return it to the pool. @a id is the id obtained from
141 * push().
142 *
143 * @param id The id.
144 */
145 void join(gpointer id);
146
147 /** Wait for all tasks to be stopped. This is mainly used internally
148 * to ensure proper cleanup of internal data structures in test suites.
149 *
150 * MT safe.
151 */
152 void cleanup();
153
154 /** Virtual function which prepares the thread pool.
155 * @throw Glib::Error.
156 */
157 virtual void prepare_vfunc();
158
159 /** Virtual function to cleanup the thread pool.
160 */
161 virtual void cleanup_vfunc();
162
163
164 /** Virtual function which starts a new thread.
165 * @throw Glib::Error.
166 */
167 virtual gpointer push_vfunc(const SlotPush& slot);
168
169 /** Virtual function to join a thread.
170 */
171 virtual void join_vfunc(gpointer id);
172
173
174 protected:
175
176
177 public:
178
179 public:
180 //C++ methods used to invoke GTK+ virtual functions:
181
182 protected:
183 //GTK+ Virtual Functions (override these to change behaviour):
184
185 //Default Signal Handlers::
186
187
188 };
189
190 } // namespace Gst
191
192
193 namespace Glib
194 {
195 /** A Glib::wrap() method for this object.
196 *
197 * @param object The C instance.
198 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
199 * @result A C++ instance that wraps this C instance.
200 *
201 * @relates Gst::TaskPool
202 */
203 Glib::RefPtr<Gst::TaskPool> wrap(GstTaskPool* object, bool take_copy = false);
204 }
205
206
207 #endif /* _GSTREAMERMM_TASKPOOL_H */
208