- Main Page
- Modules
- Namespaces
- Classes
- Files

# 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 Lesser General Public
    00007  * License as published by the Free Software Foundation; either
    00008  * version 2.1 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  * Lesser General Public License for more details.
    00014  *
    00015  * You should have received a copy of the GNU Lesser 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 #include <libxml++/nodes/node.h>
    00027
    00028
    00029 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00030 typedef struct _GstObject GstObject;
    00031 typedef struct _GstObjectClass GstObjectClass;
    00032 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
    00033
    00034
    00035 namespace Gst
    00036 {
    00037 class Object_Class;
    00038 } // namespace Gst
    00039
    00040 namespace Gst
    00041 {
    00042
    00043 //Note that this is hand-coded (instead of using .hg and .ccg files with gmmproc),
    00044 //so that we can add code to the Object(GObject*) constructor.
    00045 //(If this becomes difficult then we might add a _CUSTOM_CAST_CTOR() macro to gmmproc).
    00046
    00064 class Object : public Glib::Object
    00065 {
    00066
    00067 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00068
    00069 public:
    00070   typedef Object CppObjectType;
    00071   typedef Object_Class CppClassType;
    00072   typedef GstObject BaseObjectType;
    00073   typedef GstObjectClass BaseClassType;
    00074
    00075 private:  friend class Object_Class;
    00076   static CppClassType object_class_;
    00077
    00078 private:
    00079   // noncopyable
    00080   Object(const Object&);
    00081   Object& operator=(const Object&);
    00082
    00083 protected:
    00084   explicit Object(const Glib::ConstructParams& construct_params);
    00085   explicit Object(GstObject* castitem);
    00086
    00087 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
    00088
    00089 public:
    00090   virtual ~Object();
    00091
    00092 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00093   static GType get_type()      G_GNUC_CONST;
    00094   static GType get_base_type() G_GNUC_CONST;
    00095 #endif
    00096
    00098   GstObject*       gobj()       { return reinterpret_cast<GstObject*>(gobject_); }
    00099
    00101   const GstObject* gobj() const { return reinterpret_cast<GstObject*>(gobject_); }
    00102
    00104   GstObject* gobj_copy();
    00105
    00106 protected:
    00107   Object();
    00108
    00109 public:
    00110
    00111   //Note that gst_object_ref() and gst_object_unref() just call the GObject functions, with some extra debug logging.
    00112   void reference() const;
    00113   void unreference() const;
    00114
    00124   bool set_name(const Glib::ustring& name);
    00125
    00132   bool set_name();
    00133
    00140   Glib::ustring get_name() const;
    00141
    00153   bool set_parent(const Glib::RefPtr<Object>& parent);
    00154
    00160   Glib::RefPtr<Object> get_parent();
    00161
    00167   Glib::RefPtr<const Object> get_parent() const;
    00168
    00174   void unparent();
    00175
    00182   Glib::ustring get_name_prefix() const;
    00183
    00193   void set_name_prefix(const Glib::ustring& prefix);
    00194
    00195   //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")
    00196   //TODO: Is this useful? _WRAP_SIGNAL(void object_saved(xmlNodePtr xml_node), "object-saved")
    00197   //TODO: When the C signal registration has been fixed: _WRAP_SIGNAL(void parent_set(Glib::RefPtr<Object> parent), "parent-set")
    00198   //TODO: When the C signal registration has been fixed: _WRAP_SIGNAL(void parent_unset(Glib::RefPtr<Object> parent), "parent-unset")
    00199
    00204   xmlpp::Node* save(xmlpp::Node* parent) const;
    00205
    00209   void restore(xmlpp::Node* self);
    00210
    00211   #ifdef GLIBMM_PROPERTIES_ENABLED
    00212
    00218   Glib::PropertyProxy<Glib::ustring> property_name() ;
    00219 #endif //#GLIBMM_PROPERTIES_ENABLED
    00220
    00221 #ifdef GLIBMM_PROPERTIES_ENABLED
    00222
    00228   Glib::PropertyProxy_ReadOnly<Glib::ustring> property_name() const;
    00229 #endif //#GLIBMM_PROPERTIES_ENABLED
    00230
    00231   //TODO: Wrap vfuncs. This is quite easy when using gmmproc. murrayc.
    00232 };
    00233
    00234 } // namespace Gst
    00235
    00236
    00237 namespace Glib
    00238 {
    00247   Glib::RefPtr<Gst::Object> wrap(GstObject* object, bool take_copy = false);
    00248 }
    00249
    00250
    00251 #endif /* _GSTREAMERMM_OBJECT_H */