// Generated by gtkmmproc -- 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/gstenumtypes.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(gobj());
  gst_object_sink(gobj());
}

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

xmlpp::Node* Object::save(xmlpp::Node* parent)
{
  gst_object_save_thyself(gobj(), parent->cobj());

  // gst_object_save_thyself() returns parent node so do so here also.
  return parent;
}

const xmlpp::Node* Object::save(const xmlpp::Node* parent) const
{
  gst_object_save_thyself(const_cast<GstObject*>(gobj()),
    const_cast<xmlNodePtr>(parent->cobj()));

  // gst_object_save_thyself() returns parent node so do so here also.
  return parent;
}

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.
    {
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
        xmlpp::Node xmlpp_parent(parent);
        // Call the virtual member method, which derived classes might override.
        (void) obj->save_vfunc(&xmlpp_parent);
        return parent;
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
    }
  }
  
  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.
    {
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
        // Call the virtual member method, which derived classes might override.
        xmlpp::Node xmlpp_node(self_node);
        obj->restore_vfunc(&xmlpp_node);
        return;
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
    }
  }
  
  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)
  {
    (*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());
}

} // 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;

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    #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
};


static void Object_signal_object_saved_callback(GstObject* self, GstXmlNodePtr p0,void* data)
{
  using namespace Gst;
  typedef sigc::slot< void,GstXmlNodePtr > SlotType;

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    #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))(p0);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
}

static const Glib::SignalProxyInfo Object_signal_object_saved_info =
{
  "object-saved",
  (GCallback) &Object_signal_object_saved_callback,
  (GCallback) &Object_signal_object_saved_callback
};


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

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    #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)
);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
}

static const Glib::SignalProxyInfo Object_signal_parent_set_info =
{
  "parent-set",
  (GCallback) &Object_signal_parent_set_callback,
  (GCallback) &Object_signal_parent_set_callback
};


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

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    #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)
);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
}

static const Glib::SignalProxyInfo Object_signal_parent_unset_info =
{
  "parent-unset",
  (GCallback) &Object_signal_parent_unset_callback,
  (GCallback) &Object_signal_parent_unset_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->save_thyself = &save_thyself_vfunc_callback;
  klass->restore_thyself = &restore_thyself_vfunc_callback;
  
  klass->deep_notify = &deep_notify_callback;
  klass->object_saved = &object_saved_callback;
  klass->parent_set = &parent_set_callback;
  klass->parent_unset = &parent_unset_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);
}
void Object_Class::object_saved_callback(GstObject* self, GstXmlNodePtr p0)
{
  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_object_saved(p0);
        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->object_saved)
    (*base->object_saved)(self, p0);
}
void Object_Class::parent_set_callback(GstObject* self, GstObject* p0)
{
  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_parent_set(Glib::wrap(p0, true)
);
        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->parent_set)
    (*base->parent_set)(self, p0);
}
void Object_Class::parent_unset_callback(GstObject* self, GstObject* p0)
{
  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_parent_unset(Glib::wrap(p0, true)
);
        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->parent_unset)
    (*base->parent_unset)(self, p0);
}


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;
}
 
 Glib::Threads::Mutex* Object::get_lock()
{
  return Glib::Threads::wrap(gobj()->lock);
}

const Glib::Threads::Mutex* Object::get_lock() const
{
  return Glib::Threads::wrap(gobj()->lock);
}
 
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());
}

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

void Object::set_name_prefix(const Glib::ustring& name_prefix)
{
  gst_object_set_name_prefix(gobj(), name_prefix.c_str());
}

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)));
}

void Object::restore(xmlpp::Node* self)
{
  gst_object_restore_thyself(gobj(), self->cobj());
}

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);
}


Glib::SignalProxy1< void,GstXmlNodePtr > Object::signal_object_saved()
{
  return Glib::SignalProxy1< void,GstXmlNodePtr >(this, &Object_signal_object_saved_info);
}


Glib::SignalProxy1< void,const Glib::RefPtr<Object>& > Object::signal_parent_set()
{
  return Glib::SignalProxy1< void,const Glib::RefPtr<Object>& >(this, &Object_signal_parent_set_info);
}


Glib::SignalProxy1< void,const Glib::RefPtr<Object>& > Object::signal_parent_unset()
{
  return Glib::SignalProxy1< void,const Glib::RefPtr<Object>& >(this, &Object_signal_parent_unset_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);
}
void Gst::Object::on_object_saved(GstXmlNodePtr xml_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->object_saved)
    (*base->object_saved)(gobj(),xml_node);
}
void Gst::Object::on_parent_set(const Glib::RefPtr<Object>& 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->parent_set)
    (*base->parent_set)(gobj(),Glib::unwrap(parent));
}
void Gst::Object::on_parent_unset(const Glib::RefPtr<Object>& 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->parent_unset)
    (*base->parent_unset)(gobj(),Glib::unwrap(parent));
}


} // namespace Gst


