/*
* This is a template file generated by command
* orbit-idl-2 --skeleton-impl name-resolve.idl
* User must edit this file, inserting servant
* specific code between markers.
*/
#include "factory.h"
/*** App-specific servant structures ***/
typedef struct
{
POA_Examples_Factory_AbstractService servant;
PortableServer_POA poa;
/* ------ add private attributes here ------ */
CORBA_char *id;
CORBA_long counter;
/* ------ ---------- end ------------ ------ */
} impl_POA_Examples_Factory_AbstractService;
typedef struct
{
POA_Examples_Factory_Producer servant;
PortableServer_POA poa;
/* ------ add private attributes here ------ */
/* ------ ---------- end ------------ ------ */
} impl_POA_Examples_Factory_Producer;
/*** Implementation stub prototypes ***/
static void
impl_Examples_Factory_AbstractService__fini
(impl_POA_Examples_Factory_AbstractService * servant,
CORBA_Environment * ev);
static void
impl_Examples_Factory_AbstractService_doit
(impl_POA_Examples_Factory_AbstractService * servant,
const CORBA_char * mesg, CORBA_Environment * ev);
static void
impl_Examples_Factory_AbstractService_destroy
(impl_POA_Examples_Factory_AbstractService * servant,
CORBA_Environment * ev);
static void
impl_Examples_Factory_Producer__fini
(impl_POA_Examples_Factory_Producer * servant, CORBA_Environment * ev);
static Examples_Factory_AbstractService
impl_Examples_Factory_Producer_produce
(impl_POA_Examples_Factory_Producer * servant, const CORBA_char * id,
CORBA_Environment * ev);
/*** epv structures ***/
static PortableServer_ServantBase__epv
impl_Examples_Factory_AbstractService_base_epv = {
NULL, /* _private data */
(gpointer) & impl_Examples_Factory_AbstractService__fini, /* finalize routine */
NULL, /* default_POA routine */
};
static POA_Examples_Factory_AbstractService__epv
impl_Examples_Factory_AbstractService_epv = {
NULL, /* _private */
(gpointer) & impl_Examples_Factory_AbstractService_doit,
(gpointer) & impl_Examples_Factory_AbstractService_destroy,
};
static PortableServer_ServantBase__epv
impl_Examples_Factory_Producer_base_epv = {
NULL, /* _private data */
(gpointer) & impl_Examples_Factory_Producer__fini, /* finalize routine */
NULL, /* default_POA routine */
};
static POA_Examples_Factory_Producer__epv impl_Examples_Factory_Producer_epv = {
NULL, /* _private */
(gpointer) & impl_Examples_Factory_Producer_produce,
};
/*** vepv structures ***/
static POA_Examples_Factory_AbstractService__vepv
impl_Examples_Factory_AbstractService_vepv = {
&impl_Examples_Factory_AbstractService_base_epv,
&impl_Examples_Factory_AbstractService_epv,
};
static POA_Examples_Factory_Producer__vepv
impl_Examples_Factory_Producer_vepv = {
&impl_Examples_Factory_Producer_base_epv,
&impl_Examples_Factory_Producer_epv,
};
/*** Stub implementations ***/
static Examples_Factory_AbstractService
impl_Examples_Factory_AbstractService__create (PortableServer_POA poa,
const CORBA_char * id,
CORBA_Environment * ev)
{
Examples_Factory_AbstractService retval;
impl_POA_Examples_Factory_AbstractService *newservant;
PortableServer_ObjectId *objid;
newservant = g_new0 (impl_POA_Examples_Factory_AbstractService, 1);
newservant->servant.vepv = &impl_Examples_Factory_AbstractService_vepv;
newservant->poa =
(PortableServer_POA) CORBA_Object_duplicate ((CORBA_Object) poa, ev);
POA_Examples_Factory_AbstractService__init ((PortableServer_Servant)
newservant, ev);
/*
* Before servant is going to be activated all private attributes must
* be initialized.
*/
/* ------ init private attributes here ------ */
newservant->id = CORBA_string_dup (id);
newservant->counter = 0;
/* ------ ---------- end ------------- ------ */
objid = PortableServer_POA_activate_object (poa, newservant, ev);
CORBA_free (objid);
retval = PortableServer_POA_servant_to_reference (poa, newservant, ev);
return retval;
}
/**
* impl_Exampels_Factory_AbstractService__fini
*
* Destructor called after servant has been deactivated finally.
* In case any operation invocation, method invoation is being delayed.
* Note, in former versions of ORBit2 this function would have been
* named impl_Exampels_Factory_AbstractService__destroy.
**/
static void
impl_Examples_Factory_AbstractService__fini
(impl_POA_Examples_Factory_AbstractService * 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 ------ */
CORBA_free (servant->id);
/* ------ ---------- end ------------- ------ */
POA_Examples_Factory_AbstractService__fini ((PortableServer_Servant)
servant, ev);
g_free (servant);
}
static void
impl_Examples_Factory_AbstractService_doit
(impl_POA_Examples_Factory_AbstractService * servant,
const CORBA_char * mesg, CORBA_Environment * ev)
{
/* ------ insert method code here ------ */
g_print ("service-id=\"%s\", nth-call=\"%d\", \n",
servant->id,
servant->counter);
++(servant->counter);
/* ------ ---------- end ------------ ------ */
}
static void
deactivate_servant (PortableServer_POA poa,
PortableServer_Servant servant, CORBA_Environment * ev)
{
PortableServer_ObjectId *id
= PortableServer_POA_servant_to_id (poa, servant, ev);
if (etk_raised_exception (ev))
return;
PortableServer_POA_deactivate_object (poa, id, ev);
/* free id in any case */
g_free (id);
}
static void
impl_Examples_Factory_AbstractService_destroy
(impl_POA_Examples_Factory_AbstractService * servant,
CORBA_Environment * ev)
{
/* ------ insert method code here ------ */
deactivate_servant (servant->poa, servant, ev);
/* ------ ---------- end ------------ ------ */
}
static Examples_Factory_Producer
impl_Examples_Factory_Producer__create (PortableServer_POA poa,
CORBA_Environment * ev)
{
Examples_Factory_Producer retval;
impl_POA_Examples_Factory_Producer *newservant;
PortableServer_ObjectId *objid;
newservant = g_new0 (impl_POA_Examples_Factory_Producer, 1);
newservant->servant.vepv = &impl_Examples_Factory_Producer_vepv;
newservant->poa =
(PortableServer_POA) CORBA_Object_duplicate ((CORBA_Object) poa, ev);
POA_Examples_Factory_Producer__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;
}
/**
* impl_Examples_Factory_Producer__fini
*
* Destructor called after servant has been deactivated finally.
* In case any operation invocation, method invoation is being delayed.
* Note, in former versions of ORBit2 this function would have been
* named impl_Exampels_Factory_Producer__destroy
**/
static void
impl_Examples_Factory_Producer__fini
(impl_POA_Examples_Factory_Producer * 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_Examples_Factory_Producer__fini ((PortableServer_Servant) servant, ev);
g_free (servant);
}
static Examples_Factory_AbstractService
impl_Examples_Factory_Producer_produce
(impl_POA_Examples_Factory_Producer * servant, const CORBA_char * id,
CORBA_Environment * ev)
{
Examples_Factory_AbstractService retval;
/* ------ insert metho