// Generated by gtkmmproc -- DO NOT MODIFY!


#include <gstreamermm/registry.h>
#include <gstreamermm/private/registry_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/gstregistry.h>
#include <gstreamermm/pluginfeature.h>
#include <gstreamermm/plugin.h>


static gboolean Registry_Plugin_Filter_gstreamermm_callback(GstPlugin* plugin, void* data)
{
  Gst::Plugin::SlotFilter* the_slot = static_cast<Gst::Plugin::SlotFilter*>(data);

  #ifdef GLIBMM_EXCEPTIONS_ENABLED
  try
  {
  #endif //GLIBMM_EXCEPTIONS_ENABLED
    bool result = (*the_slot)(Glib::wrap(plugin, true));

    //Delete the once executing slot before returning result
    delete the_slot;

    return result;
  #ifdef GLIBMM_EXCEPTIONS_ENABLED
  }
  catch(...)
  {
    Glib::exception_handlers_invoke();
  }
  #endif //GLIBMM_EXCEPTIONS_ENABLED
}

static gboolean Registry_PluginFeature_Filter_gstreamermm_callback(GstPluginFeature* feature, void* data)
{
  Gst::PluginFeature::SlotFilter* the_slot = static_cast<Gst::PluginFeature::SlotFilter*>(data);

  #ifdef GLIBMM_EXCEPTIONS_ENABLED
  try
  {
  #endif //GLIBMM_EXCEPTIONS_ENABLED
    bool result = (*the_slot)(Glib::wrap(feature, true));

    //Delete the once executing slot before returning result
    delete the_slot;

    return result;
  #ifdef GLIBMM_EXCEPTIONS_ENABLED
  }
  catch(...)
  {
    Glib::exception_handlers_invoke();
  }
  #endif //GLIBMM_EXCEPTIONS_ENABLED
}

namespace Gst
{

Glib::ListHandle< Glib::RefPtr<Gst::Plugin> >
Registry::get_plugin_list(const Plugin::SlotFilter& filter, bool first)
{
  Plugin::SlotFilter* slot_copy = new Plugin::SlotFilter(filter);
  GList* list = gst_registry_plugin_filter(gobj(), &Registry_Plugin_Filter_gstreamermm_callback, first, slot_copy);
  return Glib::ListHandle< Glib::RefPtr<Gst::Plugin> >(list,
    Glib::OWNERSHIP_DEEP);
}

Glib::ListHandle< Glib::RefPtr<const Gst::Plugin> >
Registry::get_plugin_list(const Plugin::SlotFilter& filter, bool first) const
{
  Plugin::SlotFilter* slot_copy = new Plugin::SlotFilter(filter);
  GList* list = gst_registry_plugin_filter(const_cast<GstRegistry*>(gobj()),
    &Registry_Plugin_Filter_gstreamermm_callback, first, slot_copy);
  return Glib::ListHandle< Glib::RefPtr<const Gst::Plugin> >(list,
    Glib::OWNERSHIP_DEEP);
}

Glib::ListHandle< Glib::RefPtr<Gst::PluginFeature> >
Registry::get_feature_list(const PluginFeature::SlotFilter& filter, bool first)
{
  PluginFeature::SlotFilter* slot_copy = new PluginFeature::SlotFilter(filter);
  GList* list = gst_registry_feature_filter(gobj(), &Registry_PluginFeature_Filter_gstreamermm_callback, first, slot_copy);
  return Glib::ListHandle< Glib::RefPtr<Gst::PluginFeature> >(list,
    Glib::OWNERSHIP_DEEP);
}

Glib::ListHandle< Glib::RefPtr<const Gst::PluginFeature> >
Registry::get_feature_list(const PluginFeature::SlotFilter& filter,
  bool first) const
{
  PluginFeature::SlotFilter* slot_copy = new PluginFeature::SlotFilter(filter);
  GList* list = gst_registry_feature_filter(const_cast<GstRegistry*>(gobj()),
    &Registry_PluginFeature_Filter_gstreamermm_callback, first, slot_copy);
  return Glib::ListHandle< Glib::RefPtr<const Gst::PluginFeature> >(list,
    Glib::OWNERSHIP_DEEP);
}

#ifdef USE_BINARY_REGISTRY

bool Registry::binary_read_cache(const Glib::ustring& location)
{
  return gst_registry_binary_read_cache(gobj(), location.c_str());
}

bool Registry::binary_write_cache(const Glib::ustring& location) const
{
  return gst_registry_binary_write_cache(const_cast<GstRegistry*>(gobj()),
    location.c_str());
}

#else

bool Registry::xml_read_cache(const Glib::ustring& location)
{
  return gst_registry_xml_read_cache(gobj(), location.c_str());
}

bool Registry::xml_write_cache(const Glib::ustring& location) const
{
  return gst_registry_xml_write_cache(const_cast<GstRegistry*>(gobj()),
    location.c_str());
}

#endif

} //namespace Gst

namespace
{


static void Registry_signal_feature_added_callback(GstRegistry* self, GstPluginFeature* p0,void* data)
{
  using namespace Gst;
  typedef sigc::slot< void,const Glib::RefPtr<Gst::PluginFeature>& > 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 Registry_signal_feature_added_info =
{
  "feature-added",
  (GCallback) &Registry_signal_feature_added_callback,
  (GCallback) &Registry_signal_feature_added_callback
};


static void Registry_signal_plugin_added_callback(GstRegistry* self, GstPlugin* p0,void* data)
{
  using namespace Gst;
  typedef sigc::slot< void,const Glib::RefPtr<Gst::Plugin>& > 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 Registry_signal_plugin_added_info =
{
  "plugin-added",
  (GCallback) &Registry_signal_plugin_added_callback,
  (GCallback) &Registry_signal_plugin_added_callback
};


} // anonymous namespace


namespace Glib
{

Glib::RefPtr<Gst::Registry> wrap(GstRegistry* object, bool take_copy)
{
  return Glib::RefPtr<Gst::Registry>( dynamic_cast<Gst::Registry*> (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& Registry_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_ = &Registry_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_registry_get_type());

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

  }

  return *this;
}

void Registry_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);

#ifdef GLIBMM_VFUNCS_ENABLED
#endif //GLIBMM_VFUNCS_ENABLED

#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
  klass->feature_added = &feature_added_callback;
  klass->plugin_added = &plugin_added_callback;
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
}

#ifdef GLIBMM_VFUNCS_ENABLED
#endif //GLIBMM_VFUNCS_ENABLED

#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
void Registry_Class::feature_added_callback(GstRegistry* self, GstPluginFeature* 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_feature_added(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->feature_added)
    (*base->feature_added)(self, p0);
}
void Registry_Class::plugin_added_callback(GstRegistry* self, GstPlugin* 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_plugin_added(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->plugin_added)
    (*base->plugin_added)(self, p0);
}
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED


Glib::ObjectBase* Registry_Class::wrap_new(GObject* object)
{
  return new Registry((GstRegistry*)object);
}


/* The implementation: */

GstRegistry* Registry::gobj_copy()
{
  reference();
  return gobj();
}

Registry::Registry(const Glib::ConstructParams& construct_params)
:
  Gst::Object(construct_params)
{

}

Registry::Registry(GstRegistry* castitem)
:
  Gst::Object((GstObject*)(castitem))
{}

Registry::~Registry()
{}


Registry::CppClassType Registry::registry_class_; // initialize static member

GType Registry::get_type()
{
  return registry_class_.init().get_type();
}

GType Registry::get_base_type()
{
  return gst_registry_get_type();
}


Glib::RefPtr<Gst::Registry> Registry::get_default()
{
  return Glib::wrap(gst_registry_get_default());
}


Glib::ListHandle< Glib::RefPtr<Gst::PluginFeature> > Registry::get_feature_list(GType type)
{
  return Glib::ListHandle< Glib::RefPtr<Gst::PluginFeature> >(gst_registry_get_feature_list(gobj(), type), Glib::OWNERSHIP_DEEP);
}

Glib::ListHandle< Glib::RefPtr<const Gst::PluginFeature> > Registry::get_feature_list(GType type) const
{
  return Glib::ListHandle< Glib::RefPtr<const Gst::PluginFeature> >(gst_registry_get_feature_list(const_cast<GstRegistry*>(gobj()), type), Glib::OWNERSHIP_DEEP);
}

Glib::ListHandle< Glib::RefPtr<Gst::PluginFeature> > Registry::get_feature_list(const Glib::ustring& name)
{
  return Glib::ListHandle< Glib::RefPtr<Gst::PluginFeature> >(gst_registry_get_feature_list_by_plugin(gobj(), name.c_str()), Glib::OWNERSHIP_DEEP);
}

Glib::ListHandle< Glib::RefPtr<const Gst::PluginFeature> > Registry::get_feature_list(const Glib::ustring& name) const
{
  return Glib::ListHandle< Glib::RefPtr<const Gst::PluginFeature> >(gst_registry_get_feature_list_by_plugin(const_cast<GstRegistry*>(gobj()), name.c_str()), Glib::OWNERSHIP_DEEP);
}

Glib::ListHandle< Glib::ustring > Registry::get_path_list() const
{
  return Glib::ListHandle< Glib::ustring >(gst_registry_get_path_list(const_cast<GstRegistry*>(gobj())), Glib::OWNERSHIP_DEEP);
}

Glib::ListHandle< Glib::RefPtr<Gst::Plugin> > Registry::get_plugin_list()
{
  return Glib::ListHandle< Glib::RefPtr<Gst::Plugin> >(gst_registry_get_plugin_list(gobj()), Glib::OWNERSHIP_DEEP);
}

Glib::ListHandle< Glib::RefPtr<const Gst::Plugin> > Registry::get_plugin_list() const
{
  return Glib::ListHandle< Glib::RefPtr<const Gst::Plugin> >(gst_registry_get_plugin_list(const_cast<GstRegistry*>(gobj())), Glib::OWNERSHIP_DEEP);
}

bool Registry::add_plugin(const Glib::RefPtr<Gst::Plugin>& plugin)
{
  return gst_registry_add_plugin(gobj(), Glib::unwrap(plugin));
}

void Registry::remove_plugin(const Glib::RefPtr<Gst::Plugin>& plugin)
{
gst_registry_remove_plugin(gobj(), Glib::unwrap(plugin)); 
}

Glib::RefPtr<Gst::Plugin> Registry::find_plugin(const Glib::ustring& name)
{
  return Glib::wrap(gst_registry_find_plugin(gobj(), name.c_str()));
}

Glib::RefPtr<const Gst::Plugin> Registry::find_plugin(const Glib::ustring& name) const
{
  return const_cast<Registry*>(this)->find_plugin(name);
}

Glib::RefPtr<Gst::PluginFeature> Registry::find_feature(const Glib::ustring& name, GType type)
{
  return Glib::wrap(gst_registry_find_feature(gobj(), name.c_str(), type));
}

Glib::RefPtr<const Gst::PluginFeature> Registry::find_feature(const Glib::ustring& name, GType type) const
{
  return const_cast<Registry*>(this)->find_feature(name, type);
}

Glib::RefPtr<Gst::PluginFeature> Registry::lookup_feature(const Glib::ustring& name)
{
  return Glib::wrap(gst_registry_lookup_feature(gobj(), name.c_str()));
}

Glib::RefPtr<const Gst::PluginFeature> Registry::lookup_feature(const Glib::ustring& name) const
{
  return const_cast<Registry*>(this)->lookup_feature(name);
}

void Registry::add_path(const Glib::ustring& path)
{
gst_registry_add_path(gobj(), path.c_str()); 
}

void Registry::scan_path(const Glib::ustring& path)
{
gst_registry_scan_path(gobj(), path.c_str()); 
}

Glib::RefPtr<Gst::Plugin> Registry::lookup(const Glib::ustring& filename)
{
  return Glib::wrap(gst_registry_lookup(gobj(), filename.c_str()));
}

Glib::RefPtr<const Gst::Plugin> Registry::lookup(const Glib::ustring& filename) const
{
  return const_cast<Registry*>(this)->lookup(filename);
}

void Registry::remove_feature(const Glib::RefPtr<Gst::PluginFeature>& feature)
{
gst_registry_remove_feature(gobj(), Glib::unwrap(feature)); 
}

void Registry::add_feature(const Glib::RefPtr<Gst::PluginFeature>& feature)
{
gst_registry_add_feature(gobj(), Glib::unwrap(feature)); 
}

bool Registry::check_feature_version(const Glib::ustring& feature_name, guint min_major, guint min_minor, guint min_micro)
{
  return gst_default_registry_check_feature_version(feature_name.c_str(), min_major, min_minor, min_micro);
}


Glib::SignalProxy1< void,const Glib::RefPtr<Gst::PluginFeature>& > Registry::signal_feature_added()
{
  return Glib::SignalProxy1< void,const Glib::RefPtr<Gst::PluginFeature>& >(this, &Registry_signal_feature_added_info);
}


Glib::SignalProxy1< void,const Glib::RefPtr<Gst::Plugin>& > Registry::signal_plugin_added()
{
  return Glib::SignalProxy1< void,const Glib::RefPtr<Gst::Plugin>& >(this, &Registry_signal_plugin_added_info);
}


#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
void Gst::Registry::on_feature_added(const Glib::RefPtr<Gst::PluginFeature>& feature)
{
  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->feature_added)
    (*base->feature_added)(gobj(),Glib::unwrap(feature));
}
void Gst::Registry::on_plugin_added(const Glib::RefPtr<Gst::Plugin>& plugin)
{
  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->plugin_added)
    (*base->plugin_added)(gobj(),Glib::unwrap(plugin));
}
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED

#ifdef GLIBMM_VFUNCS_ENABLED
#endif //GLIBMM_VFUNCS_ENABLED


} // namespace Gst


