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

#include <string.h>
#include "test-any.h"

void 
_ORBIT_skel_TestAny_print(POA_TestAny * _ORBIT_servant, GIOPRecvBuffer * _ORBIT_recv_buffer, CORBA_Environment * ev, CORBA_any * (*_impl_print) (PortableServer_Servant _servant, const CORBA_any * what, CORBA_Environment * ev))
{
   CORBA_any *_ORBIT_retval;
   CORBA_any what = {NULL, NULL, CORBA_FALSE};
   {				/* demarshalling */
      guchar *_ORBIT_curptr;
      _ORBIT_curptr = GIOP_RECV_BUFFER(_ORBIT_recv_buffer)->cur;
      if (giop_msg_conversion_needed(GIOP_MESSAGE_BUFFER(_ORBIT_recv_buffer))) {
	 GIOP_RECV_BUFFER(_ORBIT_recv_buffer)->cur = _ORBIT_curptr;
	 ORBit_demarshal_any(_ORBIT_recv_buffer, &(what), CORBA_TRUE, (((ORBit_ObjectKey *) _ORBIT_servant->_private)->object->orb));
	 _ORBIT_curptr = GIOP_RECV_BUFFER(_ORBIT_recv_buffer)->cur;
      } else {
	 GIOP_RECV_BUFFER(_ORBIT_recv_buffer)->cur = _ORBIT_curptr;
	 ORBit_demarshal_any(_ORBIT_recv_buffer, &(what), CORBA_TRUE, (((ORBit_ObjectKey *) _ORBIT_servant->_private)->object->orb));
	 _ORBIT_curptr = GIOP_RECV_BUFFER(_ORBIT_recv_buffer)->cur;
      }
   }
   _ORBIT_retval = _impl_print(_ORBIT_servant, &(what), 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_any(_ORBIT_send_buffer, &((*_ORBIT_retval)));
	 } 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_free(_ORBIT_retval);
      CORBA_any__free(&what, NULL, CORBA_FALSE);
   }
}
static ORBitSkeleton 
get_skel_TestAny(POA_TestAny * servant,
		 GIOPRecvBuffer * _ORBIT_recv_buffer,
		 gpointer * impl)
{
   gchar *opname = _ORBIT_recv_buffer->message.u.request.operation;
   switch (opname[0]) {
	 case 'p':
	    if (strcmp((opname + 1), "rint"))
	       break;
	    *impl = (gpointer) servant->vepv->TestAny_epv->print;
	    return (ORBitSkeleton) _ORBIT_skel_TestAny_print;
	    break;
	 default:
	    break;
   }
   return NULL;
}

static void 
init_local_objref_TestAny(CORBA_Object obj, POA_TestAny * servant)
{
   obj->vepv[TestAny__classid] = servant->vepv->TestAny_epv;
}
void 
POA_TestAny__init(PortableServer_Servant servant,
		  CORBA_Environment * env)
{
   static const PortableServer_ClassInfo class_info = {(ORBit_impl_finder) & get_skel_TestAny, "IDL:TestAny:1.0", (ORBit_local_objref_init) & init_local_objref_TestAny};
   PortableServer_ServantBase__init(((PortableServer_ServantBase *) servant), env);
   ORBIT_OBJECT_KEY(((PortableServer_ServantBase *) servant)->_private)->class_info = (PortableServer_ClassInfo *) & class_info;
   if (!TestAny__classid)
      TestAny__classid = ORBit_register_class(&class_info);
}

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