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


#include <glibmm.h>

#include <gstreamermm/memory.h>
#include <gstreamermm/private/memory_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.
 */


namespace Gst
{

Glib::RefPtr<Gst::Memory> Memory::create(Gst::MemoryFlags flags, gpointer data, gsize maxsize, gsize offset, gsize size)
{
    return Glib::RefPtr<Memory>(reinterpret_cast<Memory*>(gst_memory_new_wrapped(GstMemoryFlags(flags), data, maxsize, offset, size, 0, 0)));
}

}

namespace
{
} // anonymous namespace

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


/* Why reinterpret_cast<Memory*>(gobject) is needed:
 *
 * A Memory instance is in fact always a GstMemory instance.
 * Unfortunately, GstMemory cannot be a member of Memory,
 * because it is an opaque struct.  Also, the C interface does not provide
 * any hooks to install a destroy notification handler, thus we cannot
 * wrap it dynamically either.
 *
 * The cast works because Memory does not have any member data, and
 * it is impossible to derive from it.  This is ensured by not implementing
 * the (protected) default constructor.  The ctor is protected rather than
 * private just to avoid a compile warning.
 */

namespace Glib
{

Glib::RefPtr<Gst::Memory> wrap(GstMemory* object, bool take_copy)
{
  if(take_copy && object)
    gst_memory_ref(object);

  // See the comment at the top of this file, if you want to know why the cast works.
  return Glib::RefPtr<Gst::Memory>(reinterpret_cast<Gst::Memory*>(object));
}

} // namespace Glib


namespace Gst
{


void Memory::reference() const
{
  // See the comment at the top of this file, if you want to know why the cast works.
  gst_memory_ref(reinterpret_cast<GstMemory*>(const_cast<Memory*>(this)));
}

void Memory::unreference() const
{
  // See the comment at the top of this file, if you want to know why the cast works.
  gst_memory_unref(reinterpret_cast<GstMemory*>(const_cast<Memory*>(this)));
}

GstMemory* Memory::gobj()
{
  // See the comment at the top of this file, if you want to know why the cast works.
  return reinterpret_cast<GstMemory*>(this);
}

const GstMemory* Memory::gobj() const
{
  // See the comment at the top of this file, if you want to know why the cast works.
  return reinterpret_cast<const GstMemory*>(this);
}

GstMemory* Memory::gobj_copy() const
{
  // See the comment at the top of this file, if you want to know why the cast works.
  GstMemory *const gobject = reinterpret_cast<GstMemory*>(const_cast<Memory*>(this));
  gst_memory_ref(gobject);
  return gobject;
}


 gsize Memory::get_maxsize() const
{
  return gobj()->maxsize;
}
 
 gsize Memory::get_align() const
{
  return gobj()->align;
}
 
 gsize Memory::get_offset() const
{
  return gobj()->offset;
}
 
 gsize Memory::get_size() const
{
  return gobj()->size;
}
 

} // namespace Gst


