/* This is a template file generated by command */
/* matecorba-idl-2 --skeleton-impl timeout.idl */
/* User must edit this file, inserting servant  */
/* specific code between markers. */

#include <unistd.h>
#include "timeout.h"

/*** App-specific servant structures ***/

#if !defined(_typedef_impl_POA_Timeout_)
#define _typedef_impl_POA_Timeout_ 1
typedef struct {
	POA_Timeout servant;
	PortableServer_POA poa;
	/* ------ add private attributes here ------ */
	/* ------ ---------- end ------------ ------ */
} impl_POA_Timeout;
#endif


/*** Implementation stub prototypes ***/

#if !defined(_decl_impl_Timeout__destroy_)
#define _decl_impl_Timeout__destroy_ 1
static void impl_Timeout__destroy(impl_POA_Timeout *servant,
				  CORBA_Environment *ev);
#endif

#if !defined(_decl_impl_Timeout_ping_)
#define _decl_impl_Timeout_ping_ 1
static void
impl_Timeout_ping(impl_POA_Timeout *servant,
		  const CORBA_unsigned_long delay_secs,
		  CORBA_Environment *ev);
#endif


/*** epv structures ***/

#if !defined(_impl_Timeout_base_epv_)
#define _impl_Timeout_base_epv_ 1
static PortableServer_ServantBase__epv impl_Timeout_base_epv = {
	NULL,             /* _private data */
	(gpointer) & impl_Timeout__destroy, /* finalize routine */
	NULL,             /* default_POA routine */
};
#endif

#if !defined(_impl_Timeout_epv_)
#define _impl_Timeout_epv_ 1
static POA_Timeout__epv impl_Timeout_epv = {
	NULL, /* _private */
	(gpointer)&impl_Timeout_ping,
};
#endif


/*** vepv structures ***/

#if !defined(_impl_Timeout_vepv_)
#define _impl_Timeout_vepv_ 1
static POA_Timeout__vepv impl_Timeout_vepv = {
	&impl_Timeout_base_epv,
	&impl_Timeout_epv,
};
#endif


/*** Stub implementations ***/

#if !defined(_impl_Timeout__create_)
#define _impl_Timeout__create_ 1
static Timeout impl_Timeout__create(PortableServer_POA poa, CORBA_Environment *ev)
{
	Timeout retval;
	impl_POA_Timeout *newservant;
	PortableServer_ObjectId *objid;

	newservant = g_new0(impl_POA_Timeout, 1);
	newservant->servant.vepv = &impl_Timeout_vepv;
	newservant->poa = (PortableServer_POA) CORBA_Object_duplicate((CORBA_Object)poa, ev);
	POA_Timeout__init((PortableServer_Servant)newservant, ev);
	/* Before servant is going to be activated all
	 * private attributes must be initialized.  */

	/* ------ init private attributes here ------ */
	/* ------ ---------- end ------------- ------ */

	objid = PortableServer_POA_activate_object(poa, newservant, ev);
	CORBA_free(objid);
	retval = PortableServer_POA_servant_to_reference(poa, newservant, ev);

	return retval;
}
#endif

#if !defined(_impl_Timeout__destroy_)
#define _impl_Timeout__destroy_ 1
static void
impl_Timeout__destroy(impl_POA_Timeout *servant, CORBA_Environment *ev)
{
	CORBA_Object_release ((CORBA_Object) servant->poa, ev);

	/* No further remote method calls are delegated to
	 * servant and you may free your private attributes. */
	/* ------ free private attributes here ------ */
	/* ------ ---------- end ------------- ------ */

	POA_Timeout__fini((PortableServer_Servant)servant, ev);

	g_free (servant);
}
#endif

#if !defined(_impl_Timeout_ping_)
#define _impl_Timeout_ping_ 1
static void
impl_Timeout_ping(impl_POA_Timeout *servant,
		  const CORBA_unsigned_long delay_secs,
		  CORBA_Environment *ev)
{
	/* ------   insert method code here   ------ */
	g_usleep(delay_secs * 1000000);
	/* ------ ---------- end ------------ ------ */
}
#endif
