[gstreamermm] Make gobj() method definitions in API inline.



commit 5f7f44e278e232c9e70a620bddecc96eedc1b316
Author: José Alburquerque <jaalburqu svn gnome org>
Date:   Wed Dec 23 15:10:47 2009 -0500

    	Make gobj() method definitions in API inline.
    
    	* gstreamer/src/ringbuffer.ccg:
    	* gstreamer/src/ringbuffer.hg (gobj):
    	* gstreamer/src/element.hg (ElementInterfaced<>::gobj)
    	(ElementInterfaced<>::gobj_copy): Define these short methods where
    	they are declared in the header so that they are used inline (as is
    	done generally in *mm projects).
    	(ElementInterfaced<>): Make the class non-copyable like other
    	refcounted classes.  Also add the template class to the group of
    	interfaces in the docs so that it is accessible there because it is
    	related to the use of interfaces.

 ChangeLog                    |   15 +++++++++++
 gstreamer/src/element.hg     |   58 +++++++++++++++--------------------------
 gstreamer/src/ringbuffer.ccg |   10 -------
 gstreamer/src/ringbuffer.hg  |    4 +-
 4 files changed, 38 insertions(+), 49 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index fe49ccb..7ceff02 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2009-12-23  José Alburquerque  <jaalburqu svn gnome org>
+
+	Make gobj() method definitions in API inline.
+
+	* gstreamer/src/ringbuffer.ccg:
+	* gstreamer/src/ringbuffer.hg (gobj):
+	* gstreamer/src/element.hg (ElementInterfaced<>::gobj)
+	(ElementInterfaced<>::gobj_copy): Define these short methods where
+	they are declared in the header so that they are used inline (as is
+	done generally in *mm projects).
+	(ElementInterfaced<>): Make the class non-copyable like other
+	refcounted classes.  Also add the template class to the group of
+	interfaces in the docs so that it is accessible there because it is
+	related to the use of interfaces.
+
 2009-12-22  José Alburquerque  <jaalburqu svn gnome org>
 
 	Mixer: Correct the list_tracks() methods docs.
diff --git a/gstreamer/src/element.hg b/gstreamer/src/element.hg
index 7e6aeab..c700eb6 100644
--- a/gstreamer/src/element.hg
+++ b/gstreamer/src/element.hg
@@ -40,7 +40,7 @@ namespace Gst
  */
 
  /** @defgroup GstInterfaces gstreamermm Interfaces
- *  Wrapped GStreamer interfaces.
+ *  Wrapped GStreamer interfaces and classes related to them.
  */
 
 class Bus;
@@ -461,40 +461,42 @@ protected:
  *     "'." << std::endl;
  * }
  * @endcode
+ * @ingroup GstInterfaces
  */
 template <class T_Interface>
 class ElementInterfaced
 : public Element,
   public T_Interface
 {
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+private:
+  friend class Gst::Interface;
+
+private:
+  // noncopyable
+  ElementInterfaced(const ElementInterfaced&);
+  ElementInterfaced& operator=(const ElementInterfaced&);
+
+protected:
+  explicit ElementInterfaced(GstElement* castitem);
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
 public:
   // The gobj() methods make calls involving access to the underlying gobject
   // unambiguous (specifically, gobj() is ambiguous when called from an
   // ElementInterfaced<..> class).
 
   /// Gets the underlying gobject.
-  GstElement* gobj();
+  GstElement* gobj() { return Element::gobj(); };
 
   /// Gets the underlying gobject.
-  const GstElement* gobj() const;
+  const GstElement* gobj() const { return Element::gobj(); };
 
   /// Gets a copy of the underlying gobject.  The copy should be freed.
-  GstElement* gobj_copy();
-
-  ~ElementInterfaced();
+  GstElement* gobj_copy() { return Element::gobj_copy(); };
 
-protected:
-  /// Cast constructor.
-  explicit ElementInterfaced(GstElement* castitem);
-
-  /// Copy constructor.
-  ElementInterfaced(const ElementInterfaced&);
-
-  /// Assignment operator.
-  ElementInterfaced& operator=(const ElementInterfaced&);
-
-private:
-  friend class Gst::Interface;
+  virtual ~ElementInterfaced();
 };
 
 #ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -507,31 +509,13 @@ ElementInterfaced<T_Interface>::ElementInterfaced(GstElement* castitem)
 {
   gobject_ = (GObject*)castitem;
   if(gobject_) {
-    gst_object_ref(Element::gobj());
+    gst_object_ref(gobj());
     g_object_weak_ref(gobject_,
       &ElementInterfaced_WeakNotify_gstreamermm_callback, this);
   }
 }
 
 template <class T_Interface>
-GstElement* ElementInterfaced<T_Interface>::gobj()
-{
-  return Element::gobj();
-}
-
-template <class T_Interface>
-const GstElement* ElementInterfaced<T_Interface>::gobj() const
-{
-  return Element::gobj();
-}
-
-template <class T_Interface>
-GstElement* ElementInterfaced<T_Interface>::gobj_copy()
-{
-  return Element::gobj_copy();
-}
-
-template <class T_Interface>
 ElementInterfaced<T_Interface>::~ElementInterfaced()
 {
   // Set the gobject_ to null so that when this is deleted, the gobject doesn't
diff --git a/gstreamer/src/ringbuffer.ccg b/gstreamer/src/ringbuffer.ccg
index 7e1aac1..b8a10c2 100644
--- a/gstreamer/src/ringbuffer.ccg
+++ b/gstreamer/src/ringbuffer.ccg
@@ -179,16 +179,6 @@ void RingBufferSpec::swap(RingBufferSpec& other)
   other.take_ownership = take_temp;
 }
 
-GstRingBufferSpec* RingBufferSpec::gobj()
-{
-  return m_spec;
-}
-
-const GstRingBufferSpec* RingBufferSpec::gobj() const
-{
-  return m_spec;
-}
-
 void RingBufferSpec::set_silence_sample(const Glib::ArrayHandle<guint8>& silence_sample)
 {
   std::copy(silence_sample.data(),
diff --git a/gstreamer/src/ringbuffer.hg b/gstreamer/src/ringbuffer.hg
index 8ee69d8..3538515 100644
--- a/gstreamer/src/ringbuffer.hg
+++ b/gstreamer/src/ringbuffer.hg
@@ -100,10 +100,10 @@ public:
   void swap(RingBufferSpec& other);
 
   /// Gets the underlying gobject.
-  GstRingBufferSpec* gobj();
+  GstRingBufferSpec* gobj() { return m_spec; };
 
   /// Gets the underlying gobject.
-  const GstRingBufferSpec* gobj() const;
+  const GstRingBufferSpec* gobj() const { return m_spec; };
 
   /** Get the caps of the buffer (in). */
   _MEMBER_GET_GOBJECT(caps, caps, Gst::Caps, GstCaps*)



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