gnomemm r2124 - in gstreamermm/trunk: . gstreamer/src



Author: jaalburqu
Date: Tue Mar 24 20:10:30 2009
New Revision: 2124
URL: http://svn.gnome.org/viewvc/gnomemm?rev=2124&view=rev

Log:
2009-03-24  Josà Alburquerque  <jaalburqu svn gnome org>

	* gstreamer/src/object.ccg:
	* gstreamer/src/object.hg: Handwrote save_vfunc() and restore_vfunc()
	vfuncs to use xmlpp::Node in return and parameters.

	* AUTHORS:
	* MAINTAINERS: Corrected AUTHORS and MAINTAINERS information.  It can
	always be updated later if necessary.

Modified:
   gstreamermm/trunk/AUTHORS
   gstreamermm/trunk/ChangeLog
   gstreamermm/trunk/MAINTAINERS
   gstreamermm/trunk/gstreamer/src/colorbalance.hg
   gstreamermm/trunk/gstreamer/src/element.hg
   gstreamermm/trunk/gstreamer/src/index.hg
   gstreamermm/trunk/gstreamer/src/mixer.hg
   gstreamermm/trunk/gstreamer/src/object.ccg
   gstreamermm/trunk/gstreamer/src/object.hg

Modified: gstreamermm/trunk/AUTHORS
==============================================================================
--- gstreamermm/trunk/AUTHORS	(original)
+++ gstreamermm/trunk/AUTHORS	Tue Mar 24 20:10:30 2009
@@ -3,7 +3,7 @@
 
 Josà Alburquerque <jaalburqu svn gnome org>
 Murray Cumming <murrayc murrayc com>
-Milosz Derezynski <internalerror gmail com>
-Siavash Safi <siavash safi gmail com>
 
 Some former contributors:
+Milosz Derezynski <internalerror gmail com>
+Siavash Safi <siavash safi gmail com>

Modified: gstreamermm/trunk/MAINTAINERS
==============================================================================
--- gstreamermm/trunk/MAINTAINERS	(original)
+++ gstreamermm/trunk/MAINTAINERS	Tue Mar 24 20:10:30 2009
@@ -0,0 +1,8 @@
+Please use the mailing list (gtkmm-list gnome org) instead of emailing
+developers directly.
+
+Josà Alburquerque
+E-mail: jaalburqu svn gnome org
+
+Murray Cumming
+E-mail: murrayc murrayc com

Modified: gstreamermm/trunk/gstreamer/src/colorbalance.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/colorbalance.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/colorbalance.hg	Tue Mar 24 20:10:30 2009
@@ -72,9 +72,9 @@
 protected:
 #m4begin
   _PUSH(SECTION_PCC_CLASS_INIT_VFUNCS)
-    klass->list_channels = &list_channels_vfunc_callback;
+  klass->list_channels = &list_channels_vfunc_callback;
   _SECTION(SECTION_PH_VFUNCS)
-    static const GList* list_channels_vfunc_callback(GstColorBalance* self);
+  static const GList* list_channels_vfunc_callback(GstColorBalance* self);
   _POP()
 #m4end
 

Modified: gstreamermm/trunk/gstreamer/src/element.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/element.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/element.hg	Tue Mar 24 20:10:30 2009
@@ -362,11 +362,11 @@
 protected:
 #m4begin
   _PUSH(SECTION_PCC_CLASS_INIT_VFUNCS)
-    klass->set_clock = &set_clock_vfunc_callback;
-    klass->get_query_types = &get_query_types_vfunc_callback;
+  klass->set_clock = &set_clock_vfunc_callback;
+  klass->get_query_types = &get_query_types_vfunc_callback;
   _SECTION(SECTION_PH_VFUNCS)
-    static gboolean set_clock_vfunc_callback(GstElement* self, GstClock* clock);
-    static const GstQueryType* get_query_types_vfunc_callback(GstElement* self);
+  static gboolean set_clock_vfunc_callback(GstElement* self, GstClock* clock);
+  static const GstQueryType* get_query_types_vfunc_callback(GstElement* self);
   _POP()
 #m4end
 };

Modified: gstreamermm/trunk/gstreamer/src/index.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/index.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/index.hg	Tue Mar 24 20:10:30 2009
@@ -172,7 +172,7 @@
 protected:
 #m4begin
   _PUSH(SECTION_PCC_CLASS_INIT_VFUNCS)
-    klass->add_entry = &add_entry_vfunc_callback;
+  klass->add_entry = &add_entry_vfunc_callback;
   _SECTION(SECTION_PH_VFUNCS)
   static void add_entry_vfunc_callback(GstIndex* self, GstIndexEntry* entry);
   _POP()

Modified: gstreamermm/trunk/gstreamer/src/mixer.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/mixer.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/mixer.hg	Tue Mar 24 20:10:30 2009
@@ -110,9 +110,9 @@
 dnl// This vfunc callback is handcoded because we want to have the C++ vfunc
 dnl// return the result instead of passing in a pointer in which to store it.
   _PUSH(SECTION_PCC_CLASS_INIT_VFUNCS)
-    klass->get_volume = &get_volume_vfunc_callback;
+  klass->get_volume = &get_volume_vfunc_callback;
   _SECTION(SECTION_PH_VFUNCS)
-    static void get_volume_vfunc_callback(GstMixer* self, GstMixerTrack* track, gint* volumes);
+  static void get_volume_vfunc_callback(GstMixer* self, GstMixerTrack* track, gint* volumes);
   _POP()
 #m4end
 };

Modified: gstreamermm/trunk/gstreamer/src/object.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/object.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/object.ccg	Tue Mar 24 20:10:30 2009
@@ -62,4 +62,117 @@
   return parent;
 }
 
+#ifdef GLIBMM_VFUNCS_ENABLED
+GstXmlNodePtr Object_Class::save_thyself_vfunc_callback(GstObject* self, GstXmlNodePtr parent)
+{
+  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
+      Glib::ObjectBase::_get_current_wrapper((GObject*)self));
+
+  // Non-gtkmmproc-generated custom classes implicitly call the default
+  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
+  // generated classes can use this optimisation, which avoids the unnecessary
+  // parameter conversions if there is no possibility of the virtual function
+  // being overridden:
+  if(obj_base && obj_base->is_derived_())
+  {
+    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
+    if(obj) // This can be NULL during destruction.
+    {
+      #ifdef GLIBMM_EXCEPTIONS_ENABLED
+      try // Trap C++ exceptions which would normally be lost because this is a C callback.
+      {
+      #endif //GLIBMM_EXCEPTIONS_ENABLED
+        xmlpp::Node xmlpp_parent(parent);
+        // Call the virtual member method, which derived classes might override.
+        (void) obj->save_vfunc(&xmlpp_parent);
+        return parent;
+      #ifdef GLIBMM_EXCEPTIONS_ENABLED
+      }
+      catch(...)
+      {
+        Glib::exception_handlers_invoke();
+      }
+      #endif //GLIBMM_EXCEPTIONS_ENABLED
+    }
+  }
+  
+  BaseClassType *const base = static_cast<BaseClassType*>(
+      g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
+  );
+
+  // Call the original underlying C function:
+  if(base && base->save_thyself)
+    return (*base->save_thyself)(self, parent);
+
+
+  typedef GstXmlNodePtr RType;
+  return RType();
+}
+void Object_Class::restore_thyself_vfunc_callback(GstObject* self, GstXmlNodePtr self_node)
+{
+  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
+      Glib::ObjectBase::_get_current_wrapper((GObject*)self));
+
+  // Non-gtkmmproc-generated custom classes implicitly call the default
+  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
+  // generated classes can use this optimisation, which avoids the unnecessary
+  // parameter conversions if there is no possibility of the virtual function
+  // being overridden:
+  if(obj_base && obj_base->is_derived_())
+  {
+    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
+    if(obj) // This can be NULL during destruction.
+    {
+      #ifdef GLIBMM_EXCEPTIONS_ENABLED
+      try // Trap C++ exceptions which would normally be lost because this is a C callback.
+      {
+      #endif //GLIBMM_EXCEPTIONS_ENABLED
+        // Call the virtual member method, which derived classes might override.
+        xmlpp::Node xmlpp_node(self_node);
+        obj->restore_vfunc(&xmlpp_node);
+        return;
+      #ifdef GLIBMM_EXCEPTIONS_ENABLED
+      }
+      catch(...)
+      {
+        Glib::exception_handlers_invoke();
+      }
+      #endif //GLIBMM_EXCEPTIONS_ENABLED
+    }
+  }
+  
+  BaseClassType *const base = static_cast<BaseClassType*>(
+      g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
+  );
+
+  // Call the original underlying C function:
+  if(base && base->restore_thyself)
+    (*base->restore_thyself)(self, self_node);
+
+}
+xmlpp::Node* Gst::Object::save_vfunc(xmlpp::Node* parent) 
+{
+  BaseClassType *const base = static_cast<BaseClassType*>(
+      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
+  );
+
+  if(base && base->save_thyself)
+  {
+    (void) (*base->save_thyself)(gobj(),parent->cobj());
+    return parent;
+  }
+
+  return 0;
+}
+void Gst::Object::restore_vfunc(xmlpp::Node* self_node) 
+{
+  BaseClassType *const base = static_cast<BaseClassType*>(
+      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
+  );
+
+  if(base && base->restore_thyself)
+    (*base->restore_thyself)(gobj(),self_node->cobj());
+}
+#endif //GLIBMM_VFUNCS_ENABLED
+
 } // namespace Gst

Modified: gstreamermm/trunk/gstreamer/src/object.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/object.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/object.hg	Tue Mar 24 20:10:30 2009
@@ -117,9 +117,21 @@
    */
   _WRAP_SIGNAL(void parent_unset(const Glib::RefPtr<Object>& parent), "parent-unset")
 
-  //TODO: Use xmlpp::Node as return and params in vfuncs below?
-  _WRAP_VFUNC(GstXmlNodePtr save(GstXmlNodePtr parent), "save_thyself")
-  _WRAP_VFUNC(void restore(GstXmlNodePtr self_node), "restore_thyself")
+#ifdef GLIBMM_VFUNCS_ENABLED
+  virtual xmlpp::Node* save_vfunc(xmlpp::Node* parent);
+  virtual void restore_vfunc(xmlpp::Node* self_node);
+#endif //GLIBMM_VFUNCS_ENABLED
+
+protected:
+#m4begin
+  _PUSH(SECTION_PCC_CLASS_INIT_VFUNCS)
+  klass->save_thyself = &save_thyself_vfunc_callback;
+  klass->restore_thyself = &restore_thyself_vfunc_callback;
+  _SECTION(SECTION_PH_VFUNCS)
+  static GstXmlNodePtr save_thyself_vfunc_callback(GstObject* self, GstXmlNodePtr parent);
+  static void restore_thyself_vfunc_callback(GstObject* self, GstXmlNodePtr self_node);
+  _POP()
+#m4end
 };
 
 } // namespace Gst



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]