/* This file is automatically generated. Any changes made here will be lost. */

/* This header defines simple perlapi-ish macros for creating SV wrappers
 * and extracting the GPerl value from SV wrappers.  These macros are used
 * by the autogenerated typemaps, and are defined here so that you can use
 * the same logic anywhere in your code (e.g., if you handle the argument
 * stack by hand instead of using the typemap). */

#ifdef UNIQUE_TYPE_APP
  /* GObject derivative UniqueApp */
# define SvUniqueApp(sv)	((UniqueApp*)gperl_get_object_check (sv, UNIQUE_TYPE_APP))
# define newSVUniqueApp(val)	(gperl_new_object (G_OBJECT (val), FALSE))
  typedef UniqueApp UniqueApp_ornull;
# define SvUniqueApp_ornull(sv)	(gperl_sv_is_defined (sv) ? SvUniqueApp(sv) : NULL)
# define newSVUniqueApp_ornull(val)	(((val) == NULL) ? &PL_sv_undef : gperl_new_object (G_OBJECT (val), FALSE))
typedef UniqueApp UniqueApp_noinc;
#define newSVUniqueApp_noinc(val)	(gperl_new_object (G_OBJECT (val), TRUE))
typedef UniqueApp UniqueApp_noinc_ornull;
#define newSVUniqueApp_noinc_ornull(val)	((val) ? newSVUniqueApp_noinc(val) : &PL_sv_undef)
#endif /* UNIQUE_TYPE_APP */

#ifdef UNIQUE_TYPE_BACKEND
  /* GObject derivative UniqueBackend */
# define SvUniqueBackend(sv)	((UniqueBackend*)gperl_get_object_check (sv, UNIQUE_TYPE_BACKEND))
# define newSVUniqueBackend(val)	(gperl_new_object (G_OBJECT (val), FALSE))
  typedef UniqueBackend UniqueBackend_ornull;
# define SvUniqueBackend_ornull(sv)	(gperl_sv_is_defined (sv) ? SvUniqueBackend(sv) : NULL)
# define newSVUniqueBackend_ornull(val)	(((val) == NULL) ? &PL_sv_undef : gperl_new_object (G_OBJECT (val), FALSE))
typedef UniqueBackend UniqueBackend_noinc;
#define newSVUniqueBackend_noinc(val)	(gperl_new_object (G_OBJECT (val), TRUE))
typedef UniqueBackend UniqueBackend_noinc_ornull;
#define newSVUniqueBackend_noinc_ornull(val)	((val) ? newSVUniqueBackend_noinc(val) : &PL_sv_undef)
#endif /* UNIQUE_TYPE_BACKEND */

#ifdef UNIQUE_TYPE_COMMAND
  /* GEnum UniqueCommand */
# define SvUniqueCommand(sv)	((UniqueCommand)gperl_convert_enum (UNIQUE_TYPE_COMMAND, sv))
# define newSVUniqueCommand(val)	(gperl_convert_back_enum (UNIQUE_TYPE_COMMAND, val))
#endif /* UNIQUE_TYPE_COMMAND */

#ifdef UNIQUE_TYPE_RESPONSE
  /* GEnum UniqueResponse */
# define SvUniqueResponse(sv)	((UniqueResponse)gperl_convert_enum (UNIQUE_TYPE_RESPONSE, sv))
# define newSVUniqueResponse(val)	(gperl_convert_back_enum (UNIQUE_TYPE_RESPONSE, val))
#endif /* UNIQUE_TYPE_RESPONSE */

#ifdef UNIQUE_TYPE_MESSAGE_DATA
  /* GBoxed UniqueMessageData */
  typedef UniqueMessageData UniqueMessageData_ornull;
# define SvUniqueMessageData(sv)	((UniqueMessageData *) gperl_get_boxed_check ((sv), UNIQUE_TYPE_MESSAGE_DATA))
# define SvUniqueMessageData_ornull(sv)	(gperl_sv_is_defined (sv) ? SvUniqueMessageData (sv) : NULL)
  typedef UniqueMessageData UniqueMessageData_own;
  typedef UniqueMessageData UniqueMessageData_copy;
  typedef UniqueMessageData UniqueMessageData_own_ornull;
# define newSVUniqueMessageData(val)	(gperl_new_boxed ((gpointer) (val), UNIQUE_TYPE_MESSAGE_DATA, FALSE))
# define newSVUniqueMessageData_ornull(val)	((val) ? newSVUniqueMessageData(val) : &PL_sv_undef)
# define newSVUniqueMessageData_own(val)	(gperl_new_boxed ((gpointer) (val), UNIQUE_TYPE_MESSAGE_DATA, TRUE))
# define newSVUniqueMessageData_copy(val)	(gperl_new_boxed_copy ((gpointer) (val), UNIQUE_TYPE_MESSAGE_DATA))
# define newSVUniqueMessageData_own_ornull(val)	((val) ? newSVUniqueMessageData_own(val) : &PL_sv_undef)
#endif /* UNIQUE_TYPE_MESSAGE_DATA */
