// Generated by gmmproc 2.42.0 -- DO NOT MODIFY!


#include <glibmm.h>

#include <gstreamermm/object.h>
#include <gstreamermm/private/object_p.h>


/* gstreamermm - a C++ wrapper for gstreamer
 *
 * Copyright 2008 The gstreamermm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <gst/gst.h>
#include <glibmm/threads.h>


namespace Gst
{

Object::Object(const Glib::ConstructParams& construct_params)
:
  Glib::Object(construct_params)
{
  // Get rid of the floating reference for newly constructed Gst::Objects.
  gst_object_ref_sink(gobj());
}

Object::Object(GstObject* castitem)
:
  Glib::Object(reinterpret_cast<GObject*>(castitem))
{
  if(G_LIKELY(g_object_is_floating(castitem)))
  {
    //The floating reference is convenience for C,
    //but is useless and difficult for us:
    gst_object_ref_sink(gobj());
  }
}

bool Object::is_element() const
{
  return GST_IS_ELEMENT(gobj());
}

bool Object::is_element_factory() const
{
  return GST_IS_ELEMENT_FACTORY(gobj());
}

bool Object::is_pad() const
{
  return GST_IS_PAD(gobj());
}

bool Object::is_pad_template() const
{
  return GST_IS_PAD_TEMPLATE(gobj());
}

bool Object::is_bin() const
{
  return GST_IS_BIN(gobj());
}

int Object::get_refcount() const
{
  return GST_OBJECT_REFCOUNT(gobj());
}

} // namespace Gst

namespace
{


static void Object_signal_deep_notify_callback(GstObject* self, GstObject* p0,GParamSpec* p1,void* data)
{
  using namespace Gst;
  typedef sigc::slot< void,const Glib::RefPtr<Object>&,GParamSpec* > SlotType;

  Object* obj = dynamic_cast<Object*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
  // Do not try to call a signal on a disassociated wrapper.
  if(obj)
  {
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    try
    {
    #endif //GLIBMM_EXCEPTIONS_ENABLED
      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
, p1);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
       Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
}

static const Glib::SignalProxyInfo Object_signal_deep_notify_info =
{
  "deep-notify",
  (GCallback) &Object_signal_deep_notify_callback,
  (GCallback) &Object_signal_deep_notify_callback
};


} // anonymous namespace

// static
GType Glib::Value<Gst::ObjectFlags>::value_type()
{
  return gst_object_flags_get_type();
}


namespace Glib
{

Glib::RefPtr<Gst::Object> wrap(GstObject* object, bool take_copy)
{
  return Glib::RefPtr<Gst::Object>( dynamic_cast<Gst::Object*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
  //We use dynamic_cast<> in case of multiple inheritance.
}

} /* namespace Glib */


namespace Gst
{


/* The *_Class implementation: */

const Glib::Class& Object_Class::init()
{
  if(!gtype_) // create the GType if necessary
  {
    // Glib::Class has to know the class init function to clone custom types.
    class_init_func_ = &Object_Class::class_init_function;

    // This is actually just optimized away, apparently with no harm.
    // Make sure that the parent type has been created.
    //CppClassParent::CppObjectType::get_type();

    // Create the wrapper type, with the same class/instance size as the base type.
    register_derived_type(gst_object_get_type());

    // Add derived versions of interfaces, if the C type implements any interfaces:

  }

  return *this;
}


void Object_Class::class_init_function(void* g_class, void* class_data)
{
  BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
  CppClassParent::class_init_function(klass, class_data);


  klass->deep_notify = &deep_notify_callback;
}


void Object_Class::deep_notify_callback(GstObject* self, GstObject* p0, GParamSpec* p1)
{
  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.
        obj->on_deep_notify(Glib::wrap(p0, true)
, p1);
        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->deep_notify)
    (*base->deep_notify)(self, p0, p1);
}


Glib::ObjectBase* Object_Class::wrap_new(GObject* object)
{
  return new Object((GstObject*)object);
}


/* The implementation: */

GstObject* Object::gobj_copy()
{
  reference();
  return gobj();
}


Object::~Object()
{}


Object::CppClassType Object::object_class_; // initialize static member

GType Object::get_type()
{
  return object_class_.init().get_type();
}


GType Object::get_base_type()
{
  return gst_object_get_type();
}


 guint32 Object::get_flags() const
{
  return gobj()->flags;
}
 
bool Object::set_name(const Glib::ustring& name)
{
  return gst_object_set_name(gobj(), name.c_str());
}

Glib::ustring Object::get_name() const
{
  return Glib::convert_return_gchar_ptr_to_ustring(gst_object_get_name(const_cast<GstObject*>(gobj())));
}

bool Object::set_parent(const Glib::RefPtr<Gst::Object>& parent)
{
  return gst_object_set_parent(gobj(), Glib::unwrap(parent));
}

Glib::RefPtr<Gst::Object> Object::get_parent()
{
  return Glib::wrap(gst_object_get_parent(gobj()));
}

Glib::RefPtr<const Gst::Object> Object::get_parent() const
{
  return const_cast<Object*>(this)->get_parent();
}

void Object::unparent()
{
  gst_object_unparent(gobj());
}

bool Object::check_uniqueness(const Glib::ListHandle<const Gst::Object>& list, const Glib::ustring& name)
{
  return gst_object_check_uniqueness((list).data(), name.c_str());
}


bool Object::has_ancestor(const Glib::RefPtr<const Gst::Object>& ancestor) const
{
  return gst_object_has_ancestor(const_cast<GstObject*>(gobj()), const_cast<GstObject*>(Glib::unwrap(ancestor)));
}

Glib::ustring Object::get_path_string()
{
  return Glib::convert_return_gchar_ptr_to_ustring(gst_object_get_path_string(gobj()));
}


Glib::SignalProxy2< void,const Glib::RefPtr<Object>&,GParamSpec* > Object::signal_deep_notify()
{
  return Glib::SignalProxy2< void,const Glib::RefPtr<Object>&,GParamSpec* >(this, &Object_signal_deep_notify_info);
}


#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy< Glib::ustring > Object::property_name() 
{
  return Glib::PropertyProxy< Glib::ustring >(this, "name");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly< Glib::ustring > Object::property_name() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::ustring >(this, "name");
}
#endif //GLIBMM_PROPERTIES_ENABLED


void Gst::Object::on_deep_notify(const Glib::RefPtr<Object>& prop_object, GParamSpec* prop)
{
  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->deep_notify)
    (*base->deep_notify)(gobj(),Glib::unwrap(prop_object),prop);
}


} // namespace Gst


