object.h

Go to the documentation of this file.
00001 /* gstreamermm - a C++ wrapper for gstreamer
00002  *
00003  * Copyright 2008 The gstreamermm Development Team
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Library General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Library General Public
00016  * License along with this library; if not, write to the Free
00017  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018  */
00019 
00020 #ifndef _GSTREAMERMM_OBJECT_H
00021 #define _GSTREAMERMM_OBJECT_H
00022 
00023 
00024 #include <glibmm.h>
00025 #include <glibmm/object.h>
00026 
00027 
00028 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00029 typedef struct _GstObject GstObject;
00030 typedef struct _GstObjectClass GstObjectClass;
00031 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00032 
00033 
00034 namespace Gst
00035 {
00036 class Object_Class;
00037 } // namespace Gst
00038 
00039 namespace Gst
00040 {
00041 
00042 //Note that this is hand-coded (instead of using .hg and .ccg files with gmmproc),
00043 //so that we can add code to the Object(GObject*) constructor.
00044 //(If this becomes difficult then we might add a _CUSTOM_CAST_CTOR() macro to gmmproc).
00045 
00049 class Object : public Glib::Object 
00050 {
00051   
00052 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00053 
00054 public:
00055   typedef Object CppObjectType;
00056   typedef Object_Class CppClassType;
00057   typedef GstObject BaseObjectType;
00058   typedef GstObjectClass BaseClassType;
00059 
00060 private:  friend class Object_Class;
00061   static CppClassType object_class_;
00062 
00063 private:
00064   // noncopyable
00065   Object(const Object&);
00066   Object& operator=(const Object&);
00067 
00068 protected:
00069   explicit Object(const Glib::ConstructParams& construct_params);
00070   explicit Object(GstObject* castitem);
00071 
00072 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00073 
00074 public:
00075   virtual ~Object();
00076 
00077 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00078   static GType get_type()      G_GNUC_CONST;
00079   static GType get_base_type() G_GNUC_CONST;
00080 #endif
00081 
00083   GstObject*       gobj()       { return reinterpret_cast<GstObject*>(gobject_); }
00084 
00086   const GstObject* gobj() const { return reinterpret_cast<GstObject*>(gobject_); }
00087 
00089   GstObject* gobj_copy();
00090 
00091 protected:
00092   Object();
00093 
00094 public:
00095 
00096   //Note that gst_object_ref() and gst_object_unref() just call the GObject functions, with some extra debug logging.
00097   void reference() const;
00098   void unreference() const;
00099 
00100   
00101   bool set_name(const Glib::ustring& name);
00102   Glib::ustring get_name() const;
00103   
00104   bool set_parent(const Glib::RefPtr<Object>& parent);
00105   Glib::RefPtr<Object> get_parent();
00106   Glib::RefPtr<const Object> get_parent() const;
00107 
00108   
00109   void unparent();
00110   
00111   Glib::ustring get_name_prefix() const;
00112   void set_name_prefix(const Glib::ustring& prefix);
00113 
00114   //TODO: Is this useful? (Note that the .def needs to be fixed by hand): _WRAP_SIGNAL(void deep_notify(Glib::RefPtr<Object> prop_object, GParamSpec* prop), "deep-notify")
00115   //TODO: Is this useful? _WRAP_SIGNAL(void object_saved(xmlNodePtr xml_node), "object-saved")  
00116   //TODO: When the C signal registration has been fixed: _WRAP_SIGNAL(void parent_set(Glib::RefPtr<Object> parent), "parent-set")
00117   //TODO: When the C signal registration has been fixed: _WRAP_SIGNAL(void parent_unset(Glib::RefPtr<Object> parent), "parent-unset")
00118 
00119   #ifdef GLIBMM_PROPERTIES_ENABLED
00120 
00126   Glib::PropertyProxy<Glib::ustring> property_name() ;
00127 #endif //#GLIBMM_PROPERTIES_ENABLED
00128 
00129 #ifdef GLIBMM_PROPERTIES_ENABLED
00130 
00136   Glib::PropertyProxy_ReadOnly<Glib::ustring> property_name() const;
00137 #endif //#GLIBMM_PROPERTIES_ENABLED
00138 
00139 };
00140 
00141 } // namespace Gst
00142 
00143 
00144 namespace Glib
00145 {
00154   Glib::RefPtr<Gst::Object> wrap(GstObject* object, bool take_copy = false);
00155 }
00156 
00157 
00158 #endif /* _GSTREAMERMM_OBJECT_H */
00159 

Generated on Sun Jul 27 17:07:20 2008 for gstreamermm by  doxygen 1.5.4