2 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 #ifndef __GST_OBJECT_H__
22 #define __GST_OBJECT_H__
26 #include <gst/gsttrace.h>
32 #include <asm/atomic.h>
38 #endif /* __cplusplus */
41 #define GST_TYPE_OBJECT \
42 (gst_object_get_type())
43 #define GST_OBJECT(obj) \
44 (GTK_CHECK_CAST((obj),GST_TYPE_OBJECT,GstObject))
45 #define GST_OBJECT_CLASS(klass) \
46 (GTK_CHECK_CLASS_CAST((klass),GST_TYPE_OBJECT,GstObjectClass))
47 #define GST_IS_OBJECT(obj) \
48 (GTK_CHECK_TYPE((obj),GST_TYPE_OBJECT))
49 #define GST_IS_OBJECT_CLASS(obj) \
50 (GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_OBJECT))
52 typedef struct _GstObject GstObject;
53 typedef struct _GstObjectClass GstObjectClass;
58 /* have to have a refcount for the object */
65 /* locking for all sorts of things (like the refcount) */
68 /* this objects parent */
72 struct _GstObjectClass {
73 GtkObjectClass parent_class;
76 void (*parent_set) (GstObject *object,GstObject *parent);
78 /* functions go here */
82 #define GST_FLAGS(obj) GTK_OBJECT_FLAGS(obj)
83 #define GST_FLAG_IS_SET(obj,flag) (GST_FLAGS (obj) & (flag))
84 #define GST_FLAG_SET(obj,flag) G_STMT_START{ (GST_FLAGS (obj) |= (flag)); }G_STMT_END
85 #define GST_FLAG_UNSET(obj,flag) G_STMT_START{ (GST_FLAGS (obj) &= ~(flag)); }G_STMT_END
87 #define GST_LOCK(obj) (g_mutex_lock(GST_OBJECT(obj)->lock))
88 #define GST_TRYLOCK(obj) (g_mutex_trylock(GST_OBJECT(obj)->lock))
89 #define GST_UNLOCK(obj) (g_mutex_unlock(GST_OBJECT(obj)->lock))
92 /* normal GtkObject stuff */
93 GtkType gst_object_get_type(void);
94 GstObject* gst_object_new(void);
96 /* parentage routines */
97 void gst_object_set_parent(GstObject *object,GstObject *parent);
98 GstObject *gst_object_get_parent(GstObject *object);
99 void gst_object_unparent(GstObject *object);
102 //void gst_object_ref(GstObject *object);
103 #define gst_object_ref(object) gtk_object_ref(GTK_OBJECT(object));
104 //void gst_object_unref(GstObject *object);
105 #define gst_object_unref(object) gtk_object_unref(GTK_OBJECT(object));
106 //void gst_object_sink(GstObject *object);
107 #define gst_object_sink(object) gtk_object_sink(GTK_OBJECT(object));
109 /* destroying an object */
110 #define gst_object_destroy(object) gtk_object_destroy(GTK_OBJECT(object))
115 #endif /* __cplusplus */
118 #endif /* __GST_OBJECT_H__ */