<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
JHJE (Jan Holst Jensen) wrote:
<blockquote
cite="mid40726A9415C7FA4E985717142CA98064011E1812@EXDKBA022.corp.novocorp.net"
type="cite">
<blockquote type="cite">
<pre wrap="">Is there a way to convert an object reference to its servant?
We are porting this Orbix server application to omniORB. One
</pre>
</blockquote>
<pre wrap=""><!---->
Dear Tuyen.
The POA method id_to_servant() should fit the bill. If you are using a
POA with a proper policy that is...
See e.g. <a class="moz-txt-link-freetext" href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4655385">http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4655385</a> for
more.
Cheers
-- Jan Holst Jensen, Novo Nordisk A/S, Denmark
</pre>
</blockquote>
Thanks for your reply. I tried reference_to_id() and then
id_to_servant(), but didn't get the right object returned. It appeared
to be some random value. I looked in poa.h to understand the functions
a little more, and don't think they are quite what I want to use for.<br>
<br>
Since I didn't make myself very clear in the topic, let me give you an
example this time. Consider this IDL,<br>
<br>
interface Account {<br>
double getBalance();<br>
...<br>
};<br>
<br>
interface BankManager {<br>
Account getAccount( in string name );<br>
<br>
void deleteAccount( in account);<br>
};<br>
<br>
The implementation that I'm having trouble with is deleteAccount().
The C++ code looks something like this,<br>
<br>
void BankManager_I::deleteAccount( Account_ptr account )<br>
{<br>
//<br>
// Here I want to access the "account" implementation. How do I do
it?<br>
// Somehow I will need to convert Account_ptr to (Account_I *)<br>
//<br>
Account_I *account_i;<br>
.....<br>
}<br>
<br>
As you can see in the code above, I would like to be able to get access
to the implementation of the "account" object, passed in from the
client. How do I do that? Orbix provides the _deref() function to do
this, and I'm hoping there is a way to do it in omniORB, but so far I'm
not successful. Is this an unusual case for the IDL, ie. you shouldn't
allow clients to pass in an object reference as a parameter?<br>
<br>
Thanks again for any information that you can provide,<br>
Tuyen<br>
</body>
</html>