/*
 * This file was generated by orbit-idl - DO NOT EDIT!
 */

#include <string.h>
#include "echo.h"

void 
_ORBIT_skel_Echo_echoString(POA_Echo * _ORBIT_servant, GIOPRecvBuffer * _ORBIT_recv_buffer, CORBA_Environment * ev, Echo(*_impl_echoString) (PortableServer_Servant _servant, const CORBA_char * astring, CORBA_double * anum, CORBA_Environment * ev))
{
   Echo _ORBIT_retval;
   CORBA_char *astring;
   CORBA_double anum;
   {				/* demarshalling */
      guchar *_ORBIT_curptr;
      register CORBA_unsigned_long _ORBIT_tmpvar_2;
      CORBA_unsigned_long _ORBIT_tmpvar_3;
      _ORBIT_curptr = GIOP_RECV_BUFFER(_ORBIT_recv_buffer)->cur;
      if (giop_msg_conversion_needed(GIOP_MESSAGE_BUFFER(_ORBIT_recv_buffer))) {
	 _ORBIT_curptr = ALIGN_ADDRESS(_ORBIT_curptr, 4);
	 (*((guint32 *) & (_ORBIT_tmpvar_3))) = GUINT32_SWAP_LE_BE(*((guint32 *) _ORBIT_curptr));
	 _ORBIT_curptr += 4;
	 astring = (void *) _ORBIT_curptr;
	 _ORBIT_curptr += sizeof(astring[_ORBIT_tmpvar_2]) * _ORBIT_tmpvar_3;
      } else {
	 _ORBIT_curptr = ALIGN_ADDRESS(_ORBIT_curptr, 4);
	 _ORBIT_tmpvar_3 = *((CORBA_unsigned_long *) _ORBIT_curptr);
	 _ORBIT_curptr += 4;
	 astring = (void *) _ORBIT_curptr;
	 _ORBIT_curptr += sizeof(astring[_ORBIT_tmpvar_2]) * _ORBIT_tmpvar_3;
      }
   }
   _ORBIT_retval = _impl_echoString(_ORBIT_servant, astring, &(anum), ev);
   {				/* marshalling */
      register GIOPSendBuffer *_ORBIT_send_buffer;
      _ORBIT_send_buffer = giop_send_reply_buffer_use(GIOP_MESSAGE_BUFFER(_ORBIT_recv_buffer)->connection, NULL, _ORBIT_recv_buffer->message.u.request.request_id, ev->_major);
      if (_ORBIT_send_buffer) {
	 if (ev->_major == CORBA_NO_EXCEPTION) {
	    ORBit_marshal_object(_ORBIT_send_buffer, _ORBIT_retval);
	    giop_message_buffer_do_alignment(GIOP_MESSAGE_BUFFER(_ORBIT_send_buffer), 8);
	    giop_message_buffer_append_mem(GIOP_MESSAGE_BUFFER(_ORBIT_send_buffer), &(anum), sizeof(anum));
	 } else
	    ORBit_send_system_exception(_ORBIT_send_buffer, ev);
	 giop_send_buffer_write(_ORBIT_send_buffer);
	 giop_send_buffer_unuse(_ORBIT_send_buffer);
      }
      if (ev->_major == CORBA_NO_EXCEPTION)
	 CORBA_Object_release(_ORBIT_retval, ev);
   }
}
static ORBitSkeleton 
get_skel_Echo(POA_Echo * servant,
	      GIOPRecvBuffer * _ORBIT_recv_buffer,
	      gpointer * impl)
{
   gchar *opname = _ORBIT_recv_buffer->message.u.request.operation;
   switch (opname[0]) {
	 case 'e':
	    if (strcmp((opname + 1), "choString"))
	       break;
	    *impl = (gpointer) servant->vepv->Echo_epv->echoString;
	    return (ORBitSkeleton) _ORBIT_skel_Echo_echoString;
	    break;
	 default:
	    break;
   }
   return NULL;
}

static void 
init_local_objref_Echo(CORBA_Object obj, POA_Echo * servant)
{
   obj->vepv[Echo__classid] = servant->vepv->Echo_epv;
}
void 
POA_Echo__init(PortableServer_Servant servant,
	       CORBA_Environment * env)
{
   static const PortableServer_ClassInfo class_info = {(ORBit_impl_finder) & get_skel_Echo, "IDL:Echo:1.0", (ORBit_local_objref_init) & init_local_objref_Echo};
   PortableServer_ServantBase__init(((PortableServer_ServantBase *) servant), env);
   ORBIT_OBJECT_KEY(((PortableServer_ServantBase *) servant)->_private)->class_info = (PortableServer_ClassInfo *) & class_info;
   if (!Echo__classid)
      Echo__classid = ORBit_register_class(&class_info);
}

void 
POA_Echo__fini(PortableServer_Servant servant,
	       CORBA_Environment * env)
{
   PortableServer_ServantBase__fini(servant, env);
}
