[omniORB] PingPong - Callback - Problem

Bernd Varga bernd.varga@hartter.com
Wed, 31 Jan 2001 11:05:10 +0100


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_000_01C08B6D.4D160B10
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_001_01C08B6D.4D160B10"


------_=_NextPart_001_01C08B6D.4D160B10
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hiho!

I'm new in CORBA-developing. For tests I want realise a Ping-Pong -
program in C++ which is running in JAVA. But in C++ I have a problem.
I start the Ping (Server) with the max-pings-amount of twelve.
Then I start the Pong and get following output:
Ping:
C++ ping: 1 / 12
C++ ping; weiterer Aufruf: 1
C++ ping: 3 / 12
C++ ping; weiterer Aufruf: 3
C++ ping: 5 / 12
C++ ping; weiterer Aufruf: 5
C++ ping: 7 / 12
C++ ping; weiterer Aufruf: 7
C++ ping: 9 / 12
C++ ping; weiterer Aufruf: 9

Pong:
C++ pong: 2
C++ pong: 4
C++ pong: 6
C++ pong: 8
C++ pong: 10

Why does the program stop after the "C++ pong: 10"? Is any thing
wrong in the source - code? Or has CORBA a maximum sum of
callback - functions?

If the max-pings-amount is lower then nine, the program will be
executed correctly!

I have no idea!

Thanks for your help!

Bernd


-----------------------------------------------------------------
Bernd VARGA                    Tel.:  +43-3352-33440-363
SOFTWAREHAUS HARTTER           Fax.:  +43-3352-33440-111
A-7400 Oberwart, Raimundg. 25  Email: bernd.varga@hartter.com
Unser Zeichen: 0000.18         Web:   www.hartter.com
-----------------------------------------------------------------

  Unm=F6gliches wird sofort erledigt, ...=20
    ... Wunder brauchen ein bisschen!=20


------_=_NextPart_001_01C08B6D.4D160B10
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2650.12">
<TITLE>PingPong - Callback - Problem</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2>Hiho!</FONT>
</P>

<P><FONT SIZE=3D2>I'm new in CORBA-developing. For tests I want realise =
a Ping-Pong -</FONT>
<BR><FONT SIZE=3D2>program in C++ which is running in JAVA. But in C++ =
I have a problem.</FONT>
<BR><FONT SIZE=3D2>I start the Ping (Server) with the max-pings-amount =
of twelve.</FONT>
<BR><FONT SIZE=3D2>Then I start the Pong and get following =
output:</FONT>
<BR><FONT SIZE=3D2>Ping:</FONT>
<BR><FONT SIZE=3D2>C++ ping: 1 / 12</FONT>
<BR><FONT SIZE=3D2>C++ ping; weiterer Aufruf: 1</FONT>
<BR><FONT SIZE=3D2>C++ ping: 3 / 12</FONT>
<BR><FONT SIZE=3D2>C++ ping; weiterer Aufruf: 3</FONT>
<BR><FONT SIZE=3D2>C++ ping: 5 / 12</FONT>
<BR><FONT SIZE=3D2>C++ ping; weiterer Aufruf: 5</FONT>
<BR><FONT SIZE=3D2>C++ ping: 7 / 12</FONT>
<BR><FONT SIZE=3D2>C++ ping; weiterer Aufruf: 7</FONT>
<BR><FONT SIZE=3D2>C++ ping: 9 / 12</FONT>
<BR><FONT SIZE=3D2>C++ ping; weiterer Aufruf: 9</FONT>
</P>

<P><FONT SIZE=3D2>Pong:</FONT>
<BR><FONT SIZE=3D2>C++ pong: 2</FONT>
<BR><FONT SIZE=3D2>C++ pong: 4</FONT>
<BR><FONT SIZE=3D2>C++ pong: 6</FONT>
<BR><FONT SIZE=3D2>C++ pong: 8</FONT>
<BR><FONT SIZE=3D2>C++ pong: 10</FONT>
</P>

<P><FONT SIZE=3D2>Why does the program stop after the &quot;C++ pong: =
10&quot;? Is any thing</FONT>
<BR><FONT SIZE=3D2>wrong in the source - code? Or has CORBA a maximum =
sum of</FONT>
<BR><FONT SIZE=3D2>callback - functions?</FONT>
</P>

<P><FONT SIZE=3D2>If the max-pings-amount is lower then nine, the =
program will be</FONT>
<BR><FONT SIZE=3D2>executed correctly!</FONT>
</P>

<P><FONT SIZE=3D2>I have no idea!</FONT>
</P>

<P><FONT SIZE=3D2>Thanks for your help!</FONT>
</P>

<P><FONT SIZE=3D2>Bernd</FONT>
</P>
<BR>

<P><FONT =
SIZE=3D2>---------------------------------------------------------------=
--</FONT>
<BR><FONT SIZE=3D2>Bernd =
VARGA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Tel.:&nbsp; =
+43-3352-33440-363</FONT>
<BR><FONT SIZE=3D2>SOFTWAREHAUS =
HARTTER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
Fax.:&nbsp; +43-3352-33440-111</FONT>
<BR><FONT SIZE=3D2>A-7400 Oberwart, Raimundg. 25&nbsp; Email: =
bernd.varga@hartter.com</FONT>
<BR><FONT SIZE=3D2>Unser Zeichen: =
0000.18&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
Web:&nbsp;&nbsp; www.hartter.com</FONT>
<BR><FONT =
SIZE=3D2>---------------------------------------------------------------=
--</FONT>
</P>

<P><FONT SIZE=3D2>&nbsp; Unm=F6gliches wird sofort erledigt, ... =
</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; ... Wunder brauchen ein bisschen! =
</FONT>
</P>

<P><FONT FACE=3D"Arial" SIZE=3D2 COLOR=3D"#000000"></FONT><FONT =
FACE=3D"Arial" SIZE=3D2 COLOR=3D"#000000"></FONT><FONT FACE=3D"Arial" =
SIZE=3D2 COLOR=3D"#000000"></FONT><FONT FACE=3D"Arial" SIZE=3D2 =
COLOR=3D"#000000"></FONT><FONT FACE=3D"Arial" SIZE=3D2 =
COLOR=3D"#000000"></FONT>&nbsp;

</BODY>
</HTML>
------_=_NextPart_001_01C08B6D.4D160B10--

------_=_NextPart_000_01C08B6D.4D160B10
Content-Type: application/octet-stream;
	name="ping_i.cpp"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="ping_i.cpp"

//
// Example code for implementing IDL interfaces in file pingpong.idl
//

#include <iostream.h>
#include "pingpong.h"


CORBA::Object_ptr getObjectReference(CosNaming::NamingContext_var =
rootContext);

CosNaming::NamingContext_var getObjectNameService(CORBA::ORB_ptr orb);

CORBA::Boolean bindObjectToName(CosNaming::NamingContext_var =
rootContext,=20
										  const char *,=20
										  CORBA::Object_ptr);


//
// Example class implementing IDL interface PPModule::PingObject
//
class PPModule_PingObject_i: public POA_PPModule::PingObject,
	public PortableServer::RefCountServantBase=20
{
	private:
		// Make sure all instances are built on the heap by making the
		// destructor non-public
		//virtual ~PPModule_PingObject_i();
	protected:
		int _maxPings;
	public:
		// standard constructor
		PPModule_PingObject_i();
		virtual ~PPModule_PingObject_i();

		// methods corresponding to defined IDL attributes and operations
		void maxPings(CORBA::Long);
		CORBA::Long maxPings();
		CORBA::Long ping(PPModule::PongObject_ptr po, CORBA::Long count);
 =20
};

//
// Example implementational code for IDL interface PPModule::PingObject
//
PPModule_PingObject_i::PPModule_PingObject_i()
{
	// add extra constructor code here
	_maxPings =3D 1;
}
PPModule_PingObject_i::~PPModule_PingObject_i()
{
	// add extra destructor code here
}
//   Methods corresponding to IDL attributes and operations
void PPModule_PingObject_i::maxPings(CORBA::Long maxPings)
{
	// insert code here and remove the warning
	//#warning "Code missing in function <void =
PPModule_PingObject_i::maxPings(CORBA::Long)>"
	_maxPings =3D maxPings;
}

CORBA::Long PPModule_PingObject_i::maxPings()
{
// insert code here and remove the warning
//#warning "Code missing in function <CORBA::Long =
PPModule_PingObject_i::maxPings()>"
	return _maxPings;
}

CORBA::Long PPModule_PingObject_i::ping(PPModule::PongObject_ptr po,=20
													 CORBA::Long count)
{
	// insert code here and remove the warning
	//#warning "Code missing in function <CORBA::Long =
PPModule_PingObject_i::ping(PPModule::PongObject_ptr po, CORBA::Long =
count)>"

	int hilf =3D count;

	cout << "C++ ping: " << hilf << " / " << maxPings() << endl;

	if(count < maxPings())
	{
		cout << "C++ ping; weiterer Aufruf: " << hilf << endl;
		count =3D po->pong(_this(), count + 1);
	}
	else
	{
		cout << "C++ ping; kein Aufruf: " << hilf << endl;
	}
=09
	cout << "C++ ping nach Aufruf: " << hilf << endl;

	return count;
}

// End of example implementational code


int main(int argc, char** argv)
{
	try=20
	{
			// Initialise the ORB.
		CORBA::ORB_var orb =3D CORBA::ORB_init(argc, argv, "omniORB3");

			// Obtain a reference to the root POA.
		CORBA::Object_var obj =3D orb->resolve_initial_references("RootPOA");
		PortableServer::POA_var poa =3D PortableServer::POA::_narrow(obj);

			// We allocate the objects on the heap.  Since these are reference
			// counted objects, they will be deleted by the POA when they are no
			// longer needed.
		PPModule_PingObject_i* myPPModule_PingObject_i =3D new =
PPModule_PingObject_i();
   =20
			// Activate the objects.  This tells the POA that the objects are
			// ready to accept requests.
		PortableServer::ObjectId_var myPPModule_PingObject_iid =3D =
poa->activate_object(myPPModule_PingObject_i);
   =20
			// Obtain a reference to each object and output the stringified
			// IOR to stdout
			// IDL interface: PPModule::PingObject
		CORBA::Object_var ref =3D myPPModule_PingObject_i->_this();
		CORBA::String_var sior(orb->object_to_string(ref));
		cout << "IDL object PPModule::PingObject IOR =3D '" << (char*)sior << =
"'" << endl;

		myPPModule_PingObject_i->maxPings(12);


		CosNaming::NamingContext_var rootContext =3D =
getObjectNameService(orb);

		if (!bindObjectToName(rootContext, "Ping", ref))
			return 1;
	=09

			// Obtain a POAManager, and tell the POA to start accepting
			// requests on its objects.
		PortableServer::POAManager_var pman =3D poa->the_POAManager();
		pman->activate();

	=09
		orb->run();
		orb->destroy();
	}
	catch(CORBA::SystemException&)=20
	{
		cerr << "Caught CORBA::SystemException." << endl;
	}
	catch(CORBA::Exception&)=20
	{
		cerr << "Caught CORBA::Exception." << endl;
	}
	catch(omniORB::fatalException& fe)=20
	{
		cerr << "Caught omniORB::fatalException:" << endl;
		cerr << "  file: " << fe.file() << endl;
		cerr << "  line: " << fe.line() << endl;
		cerr << "  mesg: " << fe.errmsg() << endl;
	}
	catch(...)=20
	{
		cerr << "Caught unknown exception." << endl;
	}

	return 0;
}

CosNaming::NamingContext_var getObjectNameService(CORBA::ORB_ptr orb)
{
	CosNaming::NamingContext_var rootContext;

	try
	{
			// Eine Referenz auf den Stammkontext des Namesdienstes holen:
		CORBA::Object_var obj;
		obj =3D orb->resolve_initial_references("NameService");

			// Narrow the reference returned
		rootContext =3D CosNaming::NamingContext::_narrow(obj);
		if (CORBA::is_nil(rootContext))
		{
			cerr << "Failed to narrow the root naming context." << endl;
			return 0;
		}
	}
	catch (CORBA::ORB::InvalidName&)
	{
			// This should not happen!
		cerr << "Service required is invalid [does not exist]." << endl;
		return 0;//CORBA::Object::_nil();
	}

	return rootContext;
}


CORBA::Object_ptr getObjectReference(CosNaming::NamingContext_var =
rootContext)
{
	CosNaming::Name contextName;
	contextName.length(1);//2);
	contextName[0].id =3D "Pong";
	contextName[0].kind =3D "";
		// Note on kind: The kind field is used to indicate the type of the
		// object. This is to avoid conventions such as that used by files
		// (name.type -- e.g. test.ps =3D postscript etc.)


	try
	{
			// Resolve the name to an object reference
		return rootContext->resolve(contextName);
	}
	catch (CosNaming::NamingContext::NotFound&)
	{
			// This exception is thrown if any of the components of the
			// path [contexts or the object] aren't found:
		cerr << "Context not found." << endl;
	}
	catch (CORBA::COMM_FAILURE&)
	{
		cerr << "Caught system exception COMM_FAILURE -- unable to"
			<< "contact the naming service." << endl;
	}
	catch (CORBA::SystemException&)
	{
		cerr << "Caught a CORBA::SystemException while using the "
			<< "naming service." << endl;
	}
	return CORBA::Object::_nil();

}



CORBA::Boolean bindObjectToName(CosNaming::NamingContext_var =
rootContext,=20
										  const char name[],
										  CORBA::Object_ptr objref)
{
	try
	{
		cout << "Einen Kontext names corejava an den Stammkontext binden" << =
endl;
			// Einen Kontext names "corejava" an den Stammkontext binden:
		CosNaming::Name contextName;
		contextName.length(1);
		contextName[0].id =3D (const char*)name;
		contextName[0].kind =3D (const char*)"";

		CosNaming::NamingContext_var corejavaContext;
	=09
		try
		{
			cout << "Kontext an Stamm binden um ihm testContext zuweisen:" << =
endl;
				// Kontext an Stamm binden um ihm testContext zuweisen:
			rootContext->rebind(contextName, =
objref);//bind_new_context(contextName);
			cout << "Kontext an Stamm binden um ihm testContext zuweisen -Ende" =
<< endl;
		}
		catch (CosNaming::NamingContext::AlreadyBound&)
		{
				// Wenn Kontext bereits vorhanden, wird diese Ausnahme ausgel=F6st.
				// In diesem Fall einfach den Namen aufl=F6sen und testContext
				// an das zur=FCckgegebene Objekt zuweisen:
			CORBA::Object_var contextObj =3D rootContext->resolve(contextName);
			corejavaContext =3D CosNaming::NamingContext::_narrow(contextObj);

			if (CORBA::is_nil(corejavaContext))
			{
				cerr << "Kann Kontext corejava nicht einengen." << endl;
				return 0;
			}
		}
	=09
	}
	catch (CORBA::COMM_FAILURE&)
	{
		cerr << "Caught system exception COMM_FAILURE -- unable to contact =
the naming service." << endl;
		return 0;
	}
	return 1;
}

------_=_NextPart_000_01C08B6D.4D160B10
Content-Type: application/octet-stream;
	name="pingpong.cpp"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="pingpong.cpp"

// This file is generated by omniidl (C++ backend)- omniORB_3_0. Do not =
edit.

#include "pingpong.h"
#include <omniORB3/callDescriptor.h>

static const char* _0RL_library_version =3D omniORB_3_0;

PPModule::PingObject_ptr PPModule::PingObject_Helper::_nil() {
  return PPModule::PingObject::_nil();
}

CORBA::Boolean =
PPModule::PingObject_Helper::is_nil(PPModule::PingObject_ptr p) {
  return CORBA::is_nil(p);

}

void PPModule::PingObject_Helper::release(PPModule::PingObject_ptr p) {
  CORBA::release(p);
}

void PPModule::PingObject_Helper::duplicate(PPModule::PingObject_ptr p) =
{
  if( p && !p->_NP_is_nil() )  omni::duplicateObjRef(p);
}

size_t =
PPModule::PingObject_Helper::NP_alignedSize(PPModule::PingObject_ptr =
obj, size_t offset) {
  return PPModule::PingObject::_alignedSize(obj, offset);
}

void =
PPModule::PingObject_Helper::marshalObjRef(PPModule::PingObject_ptr =
obj, NetBufferedStream& s) {
  PPModule::PingObject::_marshalObjRef(obj, s);
}

PPModule::PingObject_ptr =
PPModule::PingObject_Helper::unmarshalObjRef(NetBufferedStream& s) {
  return PPModule::PingObject::_unmarshalObjRef(s);
}

void =
PPModule::PingObject_Helper::marshalObjRef(PPModule::PingObject_ptr =
obj, MemBufferedStream& s) {
  PPModule::PingObject::_marshalObjRef(obj, s);
}

PPModule::PingObject_ptr =
PPModule::PingObject_Helper::unmarshalObjRef(MemBufferedStream& s) {
  return PPModule::PingObject::_unmarshalObjRef(s);
}

PPModule::PingObject_ptr
PPModule::PingObject::_duplicate(PPModule::PingObject_ptr obj)
{
  if( obj && !obj->_NP_is_nil() )  omni::duplicateObjRef(obj);

  return obj;
}

PPModule::PingObject_ptr
PPModule::PingObject::_narrow(CORBA::Object_ptr obj)
{
  if( !obj || obj->_NP_is_nil() || obj->_NP_is_pseudo() ) return =
_nil();
  _ptr_type e =3D (_ptr_type) =
obj->_PR_getobj()->_realNarrow(_PD_repoId);
  return e ? e : _nil();
}

PPModule::PingObject_ptr
PPModule::PingObject::_nil()
{
  static _objref_PingObject* _the_nil_ptr =3D 0;
  if( !_the_nil_ptr ) {
    omni::nilRefLock().lock();
  if( !_the_nil_ptr )  _the_nil_ptr =3D new _objref_PingObject;
    omni::nilRefLock().unlock();
  }
  return _the_nil_ptr;
}

const char* PPModule::PingObject::_PD_repoId =3D =
"IDL:PPModule/PingObject:1.0";

PPModule::_objref_PingObject::~_objref_PingObject() {}

PPModule::_objref_PingObject::_objref_PingObject(const char* mdri,
   IOP::TaggedProfileList* p, omniIdentity* id, omniLocalIdentity* lid) =
:
  =20
   omniObjRef(PPModule::PingObject::_PD_repoId, mdri, p, id, lid)
{
  _PR_setobj(this);
}

void*
PPModule::_objref_PingObject::_ptrToObjRef(const char* id)
{
  if( !strcmp(id, CORBA::Object::_PD_repoId) )
    return (CORBA::Object_ptr) this;
  if( !strcmp(id, PPModule::PingObject::_PD_repoId) )
    return (PPModule::PingObject_ptr) this;
 =20
  return 0;
}

// Proxy call descriptor class. Mangled signature:
//  _clong_i_cPPModule_mPongObject_i_clong
class _0RL_cd_2c3220a0b42d4471_00000000
  : public omniCallDescriptor
{
public:
  inline _0RL_cd_2c3220a0b42d4471_00000000(LocalCallFn lcfn, const =
char* op, size_t oplen, _CORBA_Boolean oneway, PPModule::PongObject_ptr =
a_0, CORBA::Long a_1):
     omniCallDescriptor(lcfn, op, oplen, oneway),
     arg_0(a_0),
     arg_1(a_1) {}

  virtual CORBA::ULong alignedSize(CORBA::ULong size_in);
  virtual void marshalArguments(GIOP_C&);
 =20
  virtual void unmarshalReturnedValues(GIOP_C&);
   =20
  inline CORBA::Long result() { return pd_result; }
  PPModule::PongObject_ptr arg_0;
  CORBA::Long arg_1;
  CORBA::Long pd_result;
};

CORBA::ULong =
_0RL_cd_2c3220a0b42d4471_00000000::alignedSize(CORBA::ULong msgsize)
{
  msgsize =3D PPModule::PongObject_Helper::NP_alignedSize(arg_0, =
msgsize);
 =20
  msgsize =3D omni::align_to(msgsize, omni::ALIGN_4) + 4;
 =20
  return msgsize;
}

void _0RL_cd_2c3220a0b42d4471_00000000::marshalArguments(GIOP_C& =
giop_client)
{
  PPModule::PongObject_Helper::marshalObjRef(arg_0,giop_client);
  arg_1 >>=3D giop_client;
 =20
}

void _0RL_cd_2c3220a0b42d4471_00000000::unmarshalReturnedValues(GIOP_C& =
giop_client)
{
 =20
  pd_result <<=3D giop_client;
 =20
}

// Local call call-back function.
static void
_0RL_lcfn_2c3220a0b42d4471_10000000(omniCallDescriptor* cd, =
omniServant* svnt)
{
  _0RL_cd_2c3220a0b42d4471_00000000* tcd =3D =
(_0RL_cd_2c3220a0b42d4471_00000000*) cd;
  PPModule::_impl_PingObject* impl =3D (PPModule::_impl_PingObject*) =
svnt->_ptrToInterface(PPModule::PingObject::_PD_repoId);
  tcd->pd_result =3D impl->ping(tcd->arg_0, tcd->arg_1);
}

CORBA::Long PPModule::_objref_PingObject::ping(PongObject_ptr po, =
CORBA::Long count)
{
  _0RL_cd_2c3220a0b42d4471_00000000 =
_call_desc(_0RL_lcfn_2c3220a0b42d4471_10000000, "ping", 5, 0, po, =
count);
 =20
  _invoke(_call_desc);
  return _call_desc.result();
}

// Proxy call descriptor class. Mangled signature:
//  _clong
class _0RL_cd_2c3220a0b42d4471_20000000
  : public omniCallDescriptor
{
public:
  inline _0RL_cd_2c3220a0b42d4471_20000000(LocalCallFn lcfn, const =
char* op, size_t oplen, _CORBA_Boolean oneway):
     omniCallDescriptor(lcfn, op, oplen, oneway) {}

  virtual void unmarshalReturnedValues(GIOP_C&);
   =20
  inline CORBA::Long result() { return pd_result; }
 =20
  CORBA::Long pd_result;
 =20
};

void _0RL_cd_2c3220a0b42d4471_20000000::unmarshalReturnedValues(GIOP_C& =
giop_client)
{
 =20
  pd_result <<=3D giop_client;
 =20
}

// Proxy call descriptor class. Mangled signature:
//  void_i_clong
class _0RL_cd_2c3220a0b42d4471_30000000
  : public omniCallDescriptor
{
public:
  inline _0RL_cd_2c3220a0b42d4471_30000000(LocalCallFn lcfn, const =
char* op, size_t oplen, _CORBA_Boolean oneway, CORBA::Long a_0):
     omniCallDescriptor(lcfn, op, oplen, oneway),
     arg_0(a_0) {}

  virtual CORBA::ULong alignedSize(CORBA::ULong);
  virtual void marshalArguments(GIOP_C&);
 =20
  CORBA::Long arg_0;
 =20
};

CORBA::ULong =
_0RL_cd_2c3220a0b42d4471_30000000::alignedSize(CORBA::ULong msgsize)
{
  msgsize =3D omni::align_to(msgsize, omni::ALIGN_4) + 4;
 =20
  return msgsize;
}

void _0RL_cd_2c3220a0b42d4471_30000000::marshalArguments(GIOP_C& =
giop_client)
{
  arg_0 >>=3D giop_client;
 =20
}

// Local call call-back function.
static void
_0RL_lcfn_2c3220a0b42d4471_40000000(omniCallDescriptor* cd, =
omniServant* svnt)
{
  _0RL_cd_2c3220a0b42d4471_20000000* tcd =3D =
(_0RL_cd_2c3220a0b42d4471_20000000*) cd;
  PPModule::_impl_PingObject* impl =3D (PPModule::_impl_PingObject*) =
svnt->_ptrToInterface(PPModule::PingObject::_PD_repoId);
  tcd->pd_result =3D impl->maxPings();
}

CORBA::Long PPModule::_objref_PingObject::maxPings()
{
  _0RL_cd_2c3220a0b42d4471_20000000 =
_call_desc(_0RL_lcfn_2c3220a0b42d4471_40000000, "_get_maxPings", 14, =
0);
 =20
  _invoke(_call_desc);
  return _call_desc.result();
}

// Local call call-back function.
static void
_0RL_lcfn_2c3220a0b42d4471_50000000(omniCallDescriptor* cd, =
omniServant* svnt)
{
  _0RL_cd_2c3220a0b42d4471_30000000* tcd =3D =
(_0RL_cd_2c3220a0b42d4471_30000000*) cd;
  PPModule::_impl_PingObject* impl =3D (PPModule::_impl_PingObject*) =
svnt->_ptrToInterface(PPModule::PingObject::_PD_repoId);
  impl->maxPings(tcd->arg_0);
}

void PPModule::_objref_PingObject::maxPings(CORBA::Long arg_0)
{
  _0RL_cd_2c3220a0b42d4471_30000000 =
_call_desc(_0RL_lcfn_2c3220a0b42d4471_50000000, "_set_maxPings", 14, 0, =
arg_0);
 =20
  _invoke(_call_desc);
 =20
}

PPModule::_pof_PingObject::~_pof_PingObject() {}

omniObjRef*
PPModule::_pof_PingObject::newObjRef(const char* mdri, =
IOP::TaggedProfileList* p,
               omniIdentity* id, omniLocalIdentity* lid)
{
  return new PPModule::_objref_PingObject(mdri, p, id, lid);
}

CORBA::Boolean
PPModule::_pof_PingObject::is_a(const char* id) const
{
  if( !strcmp(id, PPModule::PingObject::_PD_repoId) )
    return 1;
 =20
  return 0;
}

const PPModule::_pof_PingObject _the_pof_PPModule_mPingObject;

PPModule::_impl_PingObject::~_impl_PingObject() {}

CORBA::Boolean
PPModule::_impl_PingObject::_dispatch(GIOP_S& giop_s)
{
  if( !strcmp(giop_s.operation(), "_get_maxPings") ) {   =20
    giop_s.RequestReceived();
    CORBA::Long result =3D this->maxPings();
    if( giop_s.response_expected() ) {
      size_t msgsize =3D (size_t) GIOP_S::ReplyHeaderSize();
      msgsize =3D omni::align_to(msgsize, omni::ALIGN_4) + 4;
     =20
      giop_s.InitialiseReply(GIOP::NO_EXCEPTION, (CORBA::ULong) =
msgsize);
      result >>=3D giop_s;
     =20
    }
    giop_s.ReplyCompleted();
    return 1;
  }

  if( !strcmp(giop_s.operation(), "_set_maxPings") ) {
    CORBA::Long value;
    value <<=3D giop_s;
   =20
    giop_s.RequestReceived();
    this->maxPings(value);
    if( giop_s.response_expected() ) {
      size_t msgsize =3D (size_t) GIOP_S::ReplyHeaderSize();
      giop_s.InitialiseReply(GIOP::NO_EXCEPTION, (CORBA::ULong) =
msgsize);
    }
    giop_s.ReplyCompleted();
    return 1;
  }

  if( !strcmp(giop_s.operation(), "ping") ) {
   =20
    PongObject_var arg_po;
   =20
    arg_po =3D PongObject_Helper::unmarshalObjRef(giop_s);
    CORBA::Long arg_count;
   =20
    arg_count <<=3D giop_s;
   =20
    giop_s.RequestReceived();
    CORBA::Long result;
   =20
    result =3D this->ping(arg_po.in(), arg_count);
   =20
    if( giop_s.response_expected() ) {
      size_t msgsize =3D (size_t) GIOP_S::ReplyHeaderSize();
      msgsize =3D omni::align_to(msgsize, omni::ALIGN_4) + 4;
     =20
      giop_s.InitialiseReply(GIOP::NO_EXCEPTION, (CORBA::ULong) =
msgsize);
      result >>=3D giop_s;
     =20
    }
    giop_s.ReplyCompleted();
    return 1;
  }

  return 0;
}

void*
PPModule::_impl_PingObject::_ptrToInterface(const char* id)
{
  if( !strcmp(id, CORBA::Object::_PD_repoId) )
    return (void*) 1;
  if( !strcmp(id, PPModule::PingObject::_PD_repoId) )
    return (_impl_PingObject*) this;
 =20
  return 0;
}

const char*
PPModule::_impl_PingObject::_mostDerivedRepoId()
{
  return PPModule::PingObject::_PD_repoId;
}

PPModule::PongObject_ptr PPModule::PongObject_Helper::_nil() {
  return PPModule::PongObject::_nil();
}

CORBA::Boolean =
PPModule::PongObject_Helper::is_nil(PPModule::PongObject_ptr p) {
  return CORBA::is_nil(p);

}

void PPModule::PongObject_Helper::release(PPModule::PongObject_ptr p) {
  CORBA::release(p);
}

void PPModule::PongObject_Helper::duplicate(PPModule::PongObject_ptr p) =
{
  if( p && !p->_NP_is_nil() )  omni::duplicateObjRef(p);
}

size_t =
PPModule::PongObject_Helper::NP_alignedSize(PPModule::PongObject_ptr =
obj, size_t offset) {
  return PPModule::PongObject::_alignedSize(obj, offset);
}

void =
PPModule::PongObject_Helper::marshalObjRef(PPModule::PongObject_ptr =
obj, NetBufferedStream& s) {
  PPModule::PongObject::_marshalObjRef(obj, s);
}

PPModule::PongObject_ptr =
PPModule::PongObject_Helper::unmarshalObjRef(NetBufferedStream& s) {
  return PPModule::PongObject::_unmarshalObjRef(s);
}

void =
PPModule::PongObject_Helper::marshalObjRef(PPModule::PongObject_ptr =
obj, MemBufferedStream& s) {
  PPModule::PongObject::_marshalObjRef(obj, s);
}

PPModule::PongObject_ptr =
PPModule::PongObject_Helper::unmarshalObjRef(MemBufferedStream& s) {
  return PPModule::PongObject::_unmarshalObjRef(s);
}

PPModule::PongObject_ptr
PPModule::PongObject::_duplicate(PPModule::PongObject_ptr obj)
{
  if( obj && !obj->_NP_is_nil() )  omni::duplicateObjRef(obj);

  return obj;
}

PPModule::PongObject_ptr
PPModule::PongObject::_narrow(CORBA::Object_ptr obj)
{
  if( !obj || obj->_NP_is_nil() || obj->_NP_is_pseudo() ) return =
_nil();
  _ptr_type e =3D (_ptr_type) =
obj->_PR_getobj()->_realNarrow(_PD_repoId);
  return e ? e : _nil();
}

PPModule::PongObject_ptr
PPModule::PongObject::_nil()
{
  static _objref_PongObject* _the_nil_ptr =3D 0;
  if( !_the_nil_ptr ) {
    omni::nilRefLock().lock();
  if( !_the_nil_ptr )  _the_nil_ptr =3D new _objref_PongObject;
    omni::nilRefLock().unlock();
  }
  return _the_nil_ptr;
}

const char* PPModule::PongObject::_PD_repoId =3D =
"IDL:PPModule/PongObject:1.0";

PPModule::_objref_PongObject::~_objref_PongObject() {}

PPModule::_objref_PongObject::_objref_PongObject(const char* mdri,
   IOP::TaggedProfileList* p, omniIdentity* id, omniLocalIdentity* lid) =
:
  =20
   omniObjRef(PPModule::PongObject::_PD_repoId, mdri, p, id, lid)
{
  _PR_setobj(this);
}

void*
PPModule::_objref_PongObject::_ptrToObjRef(const char* id)
{
  if( !strcmp(id, CORBA::Object::_PD_repoId) )
    return (CORBA::Object_ptr) this;
  if( !strcmp(id, PPModule::PongObject::_PD_repoId) )
    return (PPModule::PongObject_ptr) this;
 =20
  return 0;
}

// Proxy call descriptor class. Mangled signature:
//  _clong_i_cPPModule_mPingObject_i_clong
class _0RL_cd_2c3220a0b42d4471_60000000
  : public omniCallDescriptor
{
public:
  inline _0RL_cd_2c3220a0b42d4471_60000000(LocalCallFn lcfn, const =
char* op, size_t oplen, _CORBA_Boolean oneway, PPModule::PingObject_ptr =
a_0, CORBA::Long a_1):
     omniCallDescriptor(lcfn, op, oplen, oneway),
     arg_0(a_0),
     arg_1(a_1) {}

  virtual CORBA::ULong alignedSize(CORBA::ULong size_in);
  virtual void marshalArguments(GIOP_C&);
 =20
  virtual void unmarshalReturnedValues(GIOP_C&);
   =20
  inline CORBA::Long result() { return pd_result; }
  PPModule::PingObject_ptr arg_0;
  CORBA::Long arg_1;
  CORBA::Long pd_result;
};

CORBA::ULong =
_0RL_cd_2c3220a0b42d4471_60000000::alignedSize(CORBA::ULong msgsize)
{
  msgsize =3D PPModule::PingObject_Helper::NP_alignedSize(arg_0, =
msgsize);
 =20
  msgsize =3D omni::align_to(msgsize, omni::ALIGN_4) + 4;
 =20
  return msgsize;
}

void _0RL_cd_2c3220a0b42d4471_60000000::marshalArguments(GIOP_C& =
giop_client)
{
  PPModule::PingObject_Helper::marshalObjRef(arg_0,giop_client);
  arg_1 >>=3D giop_client;
 =20
}

void _0RL_cd_2c3220a0b42d4471_60000000::unmarshalReturnedValues(GIOP_C& =
giop_client)
{
 =20
  pd_result <<=3D giop_client;
 =20
}

// Local call call-back function.
static void
_0RL_lcfn_2c3220a0b42d4471_70000000(omniCallDescriptor* cd, =
omniServant* svnt)
{
  _0RL_cd_2c3220a0b42d4471_60000000* tcd =3D =
(_0RL_cd_2c3220a0b42d4471_60000000*) cd;
  PPModule::_impl_PongObject* impl =3D (PPModule::_impl_PongObject*) =
svnt->_ptrToInterface(PPModule::PongObject::_PD_repoId);
  tcd->pd_result =3D impl->pong(tcd->arg_0, tcd->arg_1);
}

CORBA::Long PPModule::_objref_PongObject::pong(PingObject_ptr po, =
CORBA::Long count)
{
  _0RL_cd_2c3220a0b42d4471_60000000 =
_call_desc(_0RL_lcfn_2c3220a0b42d4471_70000000, "pong", 5, 0, po, =
count);
 =20
  _invoke(_call_desc);
  return _call_desc.result();
}

PPModule::_pof_PongObject::~_pof_PongObject() {}

omniObjRef*
PPModule::_pof_PongObject::newObjRef(const char* mdri, =
IOP::TaggedProfileList* p,
               omniIdentity* id, omniLocalIdentity* lid)
{
  return new PPModule::_objref_PongObject(mdri, p, id, lid);
}

CORBA::Boolean
PPModule::_pof_PongObject::is_a(const char* id) const
{
  if( !strcmp(id, PPModule::PongObject::_PD_repoId) )
    return 1;
 =20
  return 0;
}

const PPModule::_pof_PongObject _the_pof_PPModule_mPongObject;

PPModule::_impl_PongObject::~_impl_PongObject() {}

CORBA::Boolean
PPModule::_impl_PongObject::_dispatch(GIOP_S& giop_s)
{
  if( !strcmp(giop_s.operation(), "pong") ) {
   =20
    PingObject_var arg_po;
   =20
    arg_po =3D PingObject_Helper::unmarshalObjRef(giop_s);
    CORBA::Long arg_count;
   =20
    arg_count <<=3D giop_s;
   =20
    giop_s.RequestReceived();
    CORBA::Long result;
   =20
    result =3D this->pong(arg_po.in(), arg_count);
   =20
    if( giop_s.response_expected() ) {
      size_t msgsize =3D (size_t) GIOP_S::ReplyHeaderSize();
      msgsize =3D omni::align_to(msgsize, omni::ALIGN_4) + 4;
     =20
      giop_s.InitialiseReply(GIOP::NO_EXCEPTION, (CORBA::ULong) =
msgsize);
      result >>=3D giop_s;
     =20
    }
    giop_s.ReplyCompleted();
    return 1;
  }

  return 0;
}

void*
PPModule::_impl_PongObject::_ptrToInterface(const char* id)
{
  if( !strcmp(id, CORBA::Object::_PD_repoId) )
    return (void*) 1;
  if( !strcmp(id, PPModule::PongObject::_PD_repoId) )
    return (_impl_PongObject*) this;
 =20
  return 0;
}

const char*
PPModule::_impl_PongObject::_mostDerivedRepoId()
{
  return PPModule::PongObject::_PD_repoId;
}

POA_PPModule::PingObject::~PingObject() {}

POA_PPModule::PongObject::~PongObject() {}


------_=_NextPart_000_01C08B6D.4D160B10
Content-Type: application/octet-stream;
	name="pingpong.h"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="pingpong.h"

// This file is generated by omniidl (C++ backend)- omniORB_3_0. Do not =
edit.
#ifndef __pingpong_hh__
#define __pingpong_hh__

#ifndef USE_omniORB_logStream
#define USE_omniORB_logStream
#endif

#ifndef __CORBA_H_EXTERNAL_GUARD__
#include <omniORB3/CORBA.h>
#endif

#ifndef  USE_core_stub_in_nt_dll
# define USE_core_stub_in_nt_dll_NOT_DEFINED_pingpong
#endif
#ifndef  USE_dyn_stub_in_nt_dll
# define USE_dyn_stub_in_nt_dll_NOT_DEFINED_pingpong
#endif

#ifdef USE_stub_in_nt_dll
#ifndef USE_core_stub_in_nt_dll
#define USE_core_stub_in_nt_dll
#endif
#ifndef USE_dyn_stub_in_nt_dll
#define USE_dyn_stub_in_nt_dll
#endif
#endif

#ifdef _core_attr
# error "A local CPP macro _core_attr has already been defined."
#else
# ifdef  USE_core_stub_in_nt_dll
#  define _core_attr _OMNIORB_NTDLL_IMPORT
# else
#  define _core_attr
# endif
#endif

#ifdef _dyn_attr
# error "A local CPP macro _dyn_attr has already been defined."
#else
# ifdef  USE_dyn_stub_in_nt_dll
#  define _dyn_attr _OMNIORB_NTDLL_IMPORT
# else
#  define _dyn_attr
# endif
#endif

_CORBA_MODULE PPModule

_CORBA_MODULE_BEG

#ifndef __PPModule_mPongObject__
#define __PPModule_mPongObject__

  class PongObject;
  class _objref_PongObject;
  class _impl_PongObject;
 =20
  typedef _objref_PongObject* PongObject_ptr;
  typedef PongObject_ptr PongObjectRef;

  class PongObject_Helper {
  public:
    typedef PongObject_ptr _ptr_type;

    static _ptr_type _nil();
    static _CORBA_Boolean is_nil(_ptr_type);
    static void release(_ptr_type);
    static void duplicate(_ptr_type);
    static size_t NP_alignedSize(_ptr_type, size_t);
    static void marshalObjRef(_ptr_type, NetBufferedStream&);
    static _ptr_type unmarshalObjRef(NetBufferedStream&);
    static void marshalObjRef(_ptr_type, MemBufferedStream&);
    static _ptr_type unmarshalObjRef(MemBufferedStream&);
  };

  typedef _CORBA_ObjRef_Var<_objref_PongObject, PongObject_Helper> =
PongObject_var;
  typedef _CORBA_ObjRef_OUT_arg<_objref_PongObject,PongObject_Helper > =
PongObject_out;

#endif

#ifndef __PPModule_mPingObject__
#define __PPModule_mPingObject__

  class PingObject;
  class _objref_PingObject;
  class _impl_PingObject;
 =20
  typedef _objref_PingObject* PingObject_ptr;
  typedef PingObject_ptr PingObjectRef;

  class PingObject_Helper {
  public:
    typedef PingObject_ptr _ptr_type;

    static _ptr_type _nil();
    static _CORBA_Boolean is_nil(_ptr_type);
    static void release(_ptr_type);
    static void duplicate(_ptr_type);
    static size_t NP_alignedSize(_ptr_type, size_t);
    static void marshalObjRef(_ptr_type, NetBufferedStream&);
    static _ptr_type unmarshalObjRef(NetBufferedStream&);
    static void marshalObjRef(_ptr_type, MemBufferedStream&);
    static _ptr_type unmarshalObjRef(MemBufferedStream&);
  };

  typedef _CORBA_ObjRef_Var<_objref_PingObject, PingObject_Helper> =
PingObject_var;
  typedef _CORBA_ObjRef_OUT_arg<_objref_PingObject,PingObject_Helper > =
PingObject_out;

#endif

  class PingObject {
  public:
    // Declarations for this interface type.
    typedef PingObject_ptr _ptr_type;
    typedef PingObject_var _var_type;

    static _ptr_type _duplicate(_ptr_type);
    static _ptr_type _narrow(CORBA::Object_ptr);
    static _ptr_type _nil();

    static inline size_t _alignedSize(_ptr_type, size_t);
    static inline void _marshalObjRef(_ptr_type, NetBufferedStream&);
    static inline void _marshalObjRef(_ptr_type, MemBufferedStream&);

    static inline _ptr_type _unmarshalObjRef(NetBufferedStream& s) {
      CORBA::Object_ptr obj =3D CORBA::UnMarshalObjRef(_PD_repoId, s);
      _ptr_type result =3D _narrow(obj);
      CORBA::release(obj);
      return result;
    }

    static inline _ptr_type _unmarshalObjRef(MemBufferedStream& s) {
      CORBA::Object_ptr obj =3D CORBA::UnMarshalObjRef(_PD_repoId, s);
      _ptr_type result =3D _narrow(obj);
      CORBA::release(obj);
      return result;
    }

    static _core_attr const char* _PD_repoId;

    // Other IDL defined within this scope.
   =20
  };

  class _objref_PingObject :
    public virtual CORBA::Object, public virtual omniObjRef
  {
  public:
    CORBA::Long ping(PongObject_ptr po, CORBA::Long count);
   =20
    CORBA::Long maxPings();
    void maxPings(CORBA::Long);
   =20
    inline _objref_PingObject() { _PR_setobj(0); }  // nil
    _objref_PingObject(const char*, IOP::TaggedProfileList*, =
omniIdentity*, omniLocalIdentity*);

  protected:
    virtual ~_objref_PingObject();

  private:
    virtual void* _ptrToObjRef(const char*);

    _objref_PingObject(const _objref_PingObject&);
    _objref_PingObject& operator =3D (const _objref_PingObject&);
    // not implemented
  };

  class _pof_PingObject : public proxyObjectFactory {
  public:
    inline _pof_PingObject() : =
proxyObjectFactory(PingObject::_PD_repoId) {}
    virtual ~_pof_PingObject();

    virtual omniObjRef* newObjRef(const char*, IOP::TaggedProfileList*,
                                  omniIdentity*, omniLocalIdentity*);
    virtual _CORBA_Boolean is_a(const char*) const;
  };

  class _impl_PingObject :
    public virtual omniServant
  {
  public:
    virtual ~_impl_PingObject();

    virtual CORBA::Long ping(PongObject_ptr po, CORBA::Long count) =3D =
0;
   =20
    virtual CORBA::Long maxPings() =3D 0;
    virtual void maxPings(CORBA::Long) =3D 0;
   =20
  public:  // Really protected, workaround for xlC
    virtual _CORBA_Boolean _dispatch(GIOP_S&);

  private:
    virtual void* _ptrToInterface(const char*);
    virtual const char* _mostDerivedRepoId();
  };

#ifndef __PPModule_mPongObject__
#define __PPModule_mPongObject__

  class PongObject;
  class _objref_PongObject;
  class _impl_PongObject;
 =20
  typedef _objref_PongObject* PongObject_ptr;
  typedef PongObject_ptr PongObjectRef;

  class PongObject_Helper {
  public:
    typedef PongObject_ptr _ptr_type;

    static _ptr_type _nil();
    static _CORBA_Boolean is_nil(_ptr_type);
    static void release(_ptr_type);
    static void duplicate(_ptr_type);
    static size_t NP_alignedSize(_ptr_type, size_t);
    static void marshalObjRef(_ptr_type, NetBufferedStream&);
    static _ptr_type unmarshalObjRef(NetBufferedStream&);
    static void marshalObjRef(_ptr_type, MemBufferedStream&);
    static _ptr_type unmarshalObjRef(MemBufferedStream&);
  };

  typedef _CORBA_ObjRef_Var<_objref_PongObject, PongObject_Helper> =
PongObject_var;
  typedef _CORBA_ObjRef_OUT_arg<_objref_PongObject,PongObject_Helper > =
PongObject_out;

#endif

  class PongObject {
  public:
    // Declarations for this interface type.
    typedef PongObject_ptr _ptr_type;
    typedef PongObject_var _var_type;

    static _ptr_type _duplicate(_ptr_type);
    static _ptr_type _narrow(CORBA::Object_ptr);
    static _ptr_type _nil();

    static inline size_t _alignedSize(_ptr_type, size_t);
    static inline void _marshalObjRef(_ptr_type, NetBufferedStream&);
    static inline void _marshalObjRef(_ptr_type, MemBufferedStream&);

    static inline _ptr_type _unmarshalObjRef(NetBufferedStream& s) {
      CORBA::Object_ptr obj =3D CORBA::UnMarshalObjRef(_PD_repoId, s);
      _ptr_type result =3D _narrow(obj);
      CORBA::release(obj);
      return result;
    }

    static inline _ptr_type _unmarshalObjRef(MemBufferedStream& s) {
      CORBA::Object_ptr obj =3D CORBA::UnMarshalObjRef(_PD_repoId, s);
      _ptr_type result =3D _narrow(obj);
      CORBA::release(obj);
      return result;
    }

    static _core_attr const char* _PD_repoId;

    // Other IDL defined within this scope.
   =20
  };

  class _objref_PongObject :
    public virtual CORBA::Object, public virtual omniObjRef
  {
  public:
    CORBA::Long pong(PingObject_ptr po, CORBA::Long count);
   =20
    inline _objref_PongObject() { _PR_setobj(0); }  // nil
    _objref_PongObject(const char*, IOP::TaggedProfileList*, =
omniIdentity*, omniLocalIdentity*);

  protected:
    virtual ~_objref_PongObject();

  private:
    virtual void* _ptrToObjRef(const char*);

    _objref_PongObject(const _objref_PongObject&);
    _objref_PongObject& operator =3D (const _objref_PongObject&);
    // not implemented
  };

  class _pof_PongObject : public proxyObjectFactory {
  public:
    inline _pof_PongObject() : =
proxyObjectFactory(PongObject::_PD_repoId) {}
    virtual ~_pof_PongObject();

    virtual omniObjRef* newObjRef(const char*, IOP::TaggedProfileList*,
                                  omniIdentity*, omniLocalIdentity*);
    virtual _CORBA_Boolean is_a(const char*) const;
  };

  class _impl_PongObject :
    public virtual omniServant
  {
  public:
    virtual ~_impl_PongObject();

    virtual CORBA::Long pong(PingObject_ptr po, CORBA::Long count) =3D =
0;
   =20
  public:  // Really protected, workaround for xlC
    virtual _CORBA_Boolean _dispatch(GIOP_S&);

  private:
    virtual void* _ptrToInterface(const char*);
    virtual const char* _mostDerivedRepoId();
  };

_CORBA_MODULE_END

_CORBA_MODULE POA_PPModule
_CORBA_MODULE_BEG

  class PingObject :
    public virtual PPModule::_impl_PingObject,
    public virtual PortableServer::ServantBase
  {
  public:
    virtual ~PingObject();

    inline PPModule::PingObject_ptr _this() {
      return (PPModule::PingObject_ptr) =
_do_this(PPModule::PingObject::_PD_repoId);
    }
  };

  template <class _omniT>
  class PingObject_tie : public virtual PingObject
  {
  public:
    PingObject_tie(_omniT& t)
      : pd_obj(&t), pd_poa(0), pd_rel(0) {}
    PingObject_tie(_omniT& t, PortableServer::POA_ptr p)
      : pd_obj(&t), pd_poa(p), pd_rel(0) {}
    PingObject_tie(_omniT* t, CORBA::Boolean r=3D1)
      : pd_obj(t), pd_poa(0), pd_rel(r) {}
    PingObject_tie(_omniT* t, PortableServer::POA_ptr p,CORBA::Boolean =
r=3D1)
      : pd_obj(t), pd_poa(p), pd_rel(r) {}
    ~PingObject_tie() {
      if( pd_poa )  CORBA::release(pd_poa);
      if( pd_rel )  delete pd_obj;
    }

    _omniT* _tied_object() { return pd_obj; }

    void _tied_object(_omniT& t) {
      if( pd_rel )  delete pd_obj;
      pd_obj =3D &t;
      pd_rel =3D 0;
    }

    void _tied_object(_omniT* t, CORBA::Boolean r=3D1) {
      if( pd_rel )  delete pd_obj;
      pd_obj =3D t;
      pd_rel =3D r;
    }

    CORBA::Boolean _is_owner()        { return pd_rel; }
    void _is_owner(CORBA::Boolean io) { pd_rel =3D io;   }

    PortableServer::POA_ptr _default_POA() {
      if( !pd_poa )  return PortableServer::POA::_the_root_poa();
      else           return PortableServer::POA::_duplicate(pd_poa);
    }

    CORBA::Long ping(PPModule::PongObject_ptr po, CORBA::Long count) { =
return pd_obj->ping(po, count); }
    CORBA::Long maxPings() { return pd_obj->maxPings(); }
    void maxPings(CORBA::Long _value) { pd_obj->maxPings(_value); }
   =20
  private:
    _omniT*                      pd_obj;
    PortableServer::POA_ptr pd_poa;
    CORBA::Boolean          pd_rel;
  };

  class PongObject :
    public virtual PPModule::_impl_PongObject,
    public virtual PortableServer::ServantBase
  {
  public:
    virtual ~PongObject();

    inline PPModule::PongObject_ptr _this() {
      return (PPModule::PongObject_ptr) =
_do_this(PPModule::PongObject::_PD_repoId);
    }
  };

  template <class _omniT>
  class PongObject_tie : public virtual PongObject
  {
  public:
    PongObject_tie(_omniT& t)
      : pd_obj(&t), pd_poa(0), pd_rel(0) {}
    PongObject_tie(_omniT& t, PortableServer::POA_ptr p)
      : pd_obj(&t), pd_poa(p), pd_rel(0) {}
    PongObject_tie(_omniT* t, CORBA::Boolean r=3D1)
      : pd_obj(t), pd_poa(0), pd_rel(r) {}
    PongObject_tie(_omniT* t, PortableServer::POA_ptr p,CORBA::Boolean =
r=3D1)
      : pd_obj(t), pd_poa(p), pd_rel(r) {}
    ~PongObject_tie() {
      if( pd_poa )  CORBA::release(pd_poa);
      if( pd_rel )  delete pd_obj;
    }

    _omniT* _tied_object() { return pd_obj; }

    void _tied_object(_omniT& t) {
      if( pd_rel )  delete pd_obj;
      pd_obj =3D &t;
      pd_rel =3D 0;
    }

    void _tied_object(_omniT* t, CORBA::Boolean r=3D1) {
      if( pd_rel )  delete pd_obj;
      pd_obj =3D t;
      pd_rel =3D r;
    }

    CORBA::Boolean _is_owner()        { return pd_rel; }
    void _is_owner(CORBA::Boolean io) { pd_rel =3D io;   }

    PortableServer::POA_ptr _default_POA() {
      if( !pd_poa )  return PortableServer::POA::_the_root_poa();
      else           return PortableServer::POA::_duplicate(pd_poa);
    }

    CORBA::Long pong(PPModule::PingObject_ptr po, CORBA::Long count) { =
return pd_obj->pong(po, count); }
   =20
  private:
    _omniT*                      pd_obj;
    PortableServer::POA_ptr pd_poa;
    CORBA::Boolean          pd_rel;
  };

_CORBA_MODULE_END

#undef _core_attr
#undef _dyn_attr

inline size_t
PPModule::PingObject::_alignedSize(PPModule::PingObject_ptr obj, size_t =
offset) {
  return CORBA::AlignedObjRef(obj, _PD_repoId, 28, offset);
}

inline void
PPModule::PingObject::_marshalObjRef(PPModule::PingObject_ptr obj, =
NetBufferedStream& s) {
  CORBA::MarshalObjRef(obj, _PD_repoId, 28, s);
}

inline void
PPModule::PingObject::_marshalObjRef(PPModule::PingObject_ptr obj, =
MemBufferedStream& s) {
  CORBA::MarshalObjRef(obj, _PD_repoId, 28, s);
}

inline size_t
PPModule::PongObject::_alignedSize(PPModule::PongObject_ptr obj, size_t =
offset) {
  return CORBA::AlignedObjRef(obj, _PD_repoId, 28, offset);
}

inline void
PPModule::PongObject::_marshalObjRef(PPModule::PongObject_ptr obj, =
NetBufferedStream& s) {
  CORBA::MarshalObjRef(obj, _PD_repoId, 28, s);
}

inline void
PPModule::PongObject::_marshalObjRef(PPModule::PongObject_ptr obj, =
MemBufferedStream& s) {
  CORBA::MarshalObjRef(obj, _PD_repoId, 28, s);
}

#ifdef   USE_core_stub_in_nt_dll_NOT_DEFINED_pingpong
# undef  USE_core_stub_in_nt_dll
# undef  USE_core_stub_in_nt_dll_NOT_DEFINED_pingpong
#endif
#ifdef   USE_dyn_stub_in_nt_dll_NOT_DEFINED_pingpong
# undef  USE_dyn_stub_in_nt_dll
# undef  USE_dyn_stub_in_nt_dll_NOT_DEFINED_pingpong
#endif

#endif  // __pingpong_hh__


------_=_NextPart_000_01C08B6D.4D160B10
Content-Type: application/octet-stream;
	name="pingpong.idl"
Content-Disposition: attachment;
	filename="pingpong.idl"

module PPModule
{

  interface PongObject;

  interface PingObject 
  {
    attribute long maxPings;

    long ping(in PongObject po, in long count);
  };


  interface PongObject 
  {
    long pong(in PingObject po, in long count);
  };

};
------_=_NextPart_000_01C08B6D.4D160B10
Content-Type: application/octet-stream;
	name="pong_i.cpp"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="pong_i.cpp"

//
// Example code for implementing IDL interfaces in file pingpong.idl
//

#include <iostream.h>
#include "pingpong.h"


CORBA::Object_ptr getObjectReference(CosNaming::NamingContext_var =
rootContext,
												 const char *);

CosNaming::NamingContext_var getObjectNameService(CORBA::ORB_ptr orb);

CORBA::Boolean bindObjectToName(CosNaming::NamingContext_var =
rootContext,=20
										  const char *,=20
										  CORBA::Object_ptr);

//
// Example class implementing IDL interface PPModule::PongObject
//
class PPModule_PongObject_i: public POA_PPModule::PongObject,
	public PortableServer::RefCountServantBase=20
{
	private:
		// Make sure all instances are built on the heap by making the
		// destructor non-public
		//virtual ~PPModule_PongObject_i();
	public:
		// standard constructor
		PPModule_PongObject_i();
		virtual ~PPModule_PongObject_i();

		// methods corresponding to defined IDL attributes and operations
		CORBA::Long pong(PPModule::PingObject_ptr po, CORBA::Long count);
};

	//
	// Example implementational code for IDL interface =
PPModule::PongObject
	//
PPModule_PongObject_i::PPModule_PongObject_i()
{
	// add extra constructor code here
}

PPModule_PongObject_i::~PPModule_PongObject_i()
{
	// add extra destructor code here
}
	//   Methods corresponding to IDL attributes and operations
CORBA::Long PPModule_PongObject_i::pong(PPModule::PingObject_ptr po,=20
													 CORBA::Long count)
{
	int hilf =3D count;
		// insert code here and remove the warning
	cout << endl << "C++ pong: " << hilf << endl;
	count =3D po->ping(_this(), count + 1);
	cout << endl << "C++ pong - Ende: " << hilf << endl;
	return count;
}

	// End of example implementational code

int main(int argc, char** argv)
{
	try=20
	{
			// Initialise the ORB.
		CORBA::ORB_var orb =3D CORBA::ORB_init(argc, argv, "omniORB3");

			// Obtain a reference to the root POA.
		CORBA::Object_var obj =3D orb->resolve_initial_references("RootPOA");
		PortableServer::POA_var poa =3D PortableServer::POA::_narrow(obj);

			// We allocate the objects on the heap.  Since these are reference
			// counted objects, they will be deleted by the POA when they are no
			// longer needed.
		PPModule_PongObject_i* myPPModule_PongObject_i =3D new =
PPModule_PongObject_i();
   =20
			// Activate the objects.  This tells the POA that the objects are
			// ready to accept requests.
		PortableServer::ObjectId_var myPPModule_PongObject_iid =3D =
poa->activate_object(myPPModule_PongObject_i);
   =20
=09
		CosNaming::NamingContext_var rootContext =3D =
getObjectNameService(orb);

		CORBA::Object_var pingobj =3D getObjectReference(rootContext, =
"Ping");

		PPModule::PingObject_var pingref =3D =
PPModule::PingObject::_narrow(pingobj);
   =20
		CORBA::Object_var ref =3D myPPModule_PongObject_i->_this();
		CORBA::String_var sior(orb->object_to_string(ref));
		cout << "IDL object PPModule::PongObject IOR =3D '" << (char*)sior << =
"'" << endl;

		if (!bindObjectToName(rootContext, "Pong", ref))
			return 1;
	=09
			// Obtain a POAManager, and tell the POA to start accepting
			// requests on its objects.
		PortableServer::POAManager_var pman =3D poa->the_POAManager();
		pman->activate();

		PPModule::PongObject_var pong =3D myPPModule_PongObject_i->_this();
		myPPModule_PongObject_i->_remove_ref();

		cout << "C++ vor Ping: orb->run";

		pingref->ping(pong, 1);

		cout << "C++ vor Run: orb->run";

		//orb->run();

		cout << "C++ vor Beenden: orb->destroy";

		orb->destroy();
	}
	catch(CORBA::SystemException&)=20
	{
		cerr << "Caught CORBA::SystemException." << endl;
	}
	catch(CORBA::Exception&)=20
	{
		cerr << "Caught CORBA::Exception." << endl;
	}
	catch(omniORB::fatalException& fe)=20
	{
		cerr << "Caught omniORB::fatalException:" << endl;
		cerr << "  file: " << fe.file() << endl;
		cerr << "  line: " << fe.line() << endl;
		cerr << "  mesg: " << fe.errmsg() << endl;
	}
	catch(...)=20
	{
		cerr << "Caught unknown exception." << endl;
	}

	return 0;
}


CosNaming::NamingContext_var getObjectNameService(CORBA::ORB_ptr orb)
{
	CosNaming::NamingContext_var rootContext;

	try
	{
			// Eine Referenz auf den Stammkontext des Namesdienstes holen:
		CORBA::Object_var obj;
		obj =3D orb->resolve_initial_references("NameService");

			// Narrow the reference returned
		rootContext =3D CosNaming::NamingContext::_narrow(obj);
		if (CORBA::is_nil(rootContext))
		{
			cerr << "Failed to narrow the root naming context." << endl;
			return 0;
		}
	}
	catch (CORBA::ORB::InvalidName&)
	{
			// This should not happen!
		cerr << "Service required is invalid [does not exist]." << endl;
		return 0;
	}

	return rootContext;
}


CORBA::Object_ptr getObjectReference(CosNaming::NamingContext_var =
rootContext,
												 const char * name)
{
=09
	CosNaming::Name contextName;
	contextName.length(1);
	contextName[0].id =3D name;
	contextName[0].kind =3D "";
		// Note on kind: The kind field is used to indicate the type of the
		// object. This is to avoid conventions such as that used by files
		// (name.type -- e.g. test.ps =3D postscript etc.)


	try
	{
			// Resolve the name to an object reference
		return rootContext->resolve(contextName);
	}
	catch (CosNaming::NamingContext::NotFound&)
	{
			// This exception is thrown if any of the components of the
			// path [contexts or the object] aren't found:
		cerr << "Context not found." << endl;
	}
	catch (CORBA::COMM_FAILURE&)
	{
		cerr << "Caught system exception COMM_FAILURE -- unable to"
			<< "contact the naming service." << endl;
	}
	catch (CORBA::SystemException&)
	{
		cerr << "Caught a CORBA::SystemException while using the "
			<< "naming service." << endl;
	}
	return CORBA::Object::_nil();

}



CORBA::Boolean bindObjectToName(CosNaming::NamingContext_var =
rootContext,=20
										  const char name[],
										  CORBA::Object_ptr objref)
{
	try
	{
		cout << "Einen Kontext names corejava an den Stammkontext binden" << =
endl;
			// Einen Kontext names "corejava" an den Stammkontext binden:
		CosNaming::Name contextName;
		contextName.length(1);
		contextName[0].id =3D (const char*)name;
		contextName[0].kind =3D (const char*)"";

		CosNaming::NamingContext_var corejavaContext;
	=09
		try
		{
			cout << "Kontext an Stamm binden um ihm testContext zuweisen:" << =
endl;
				// Kontext an Stamm binden um ihm testContext zuweisen:
			//corejavaContext =3D=20
			rootContext->rebind(contextName, =
objref);//bind_new_context(contextName);
			cout << "Kontext an Stamm binden um ihm testContext zuweisen -Ende" =
<< endl;
		}
		catch (CosNaming::NamingContext::AlreadyBound&)
		{
				// Wenn Kontext bereits vorhanden, wird diese Ausnahme ausgel=F6st.
				// In diesem Fall einfach den Namen aufl=F6sen und testContext
				// an das zur=FCckgegebene Objekt zuweisen:
			CORBA::Object_var contextObj =3D rootContext->resolve(contextName);
			corejavaContext =3D CosNaming::NamingContext::_narrow(contextObj);

			if (CORBA::is_nil(corejavaContext))
			{
				cerr << "Kann Kontext corejava nicht einengen." << endl;
				return 0;
			}
		}
	=09
	}
	catch (CORBA::COMM_FAILURE&)
	{
		cerr << "Caught system exception COMM_FAILURE -- unable to contact =
the naming service." << endl;
		return 0;
	}
	return 1;
}

------_=_NextPart_000_01C08B6D.4D160B10--