[omniORB] Server-side question.
Duncan Grisby
dgrisby@uk.research.att.com
Tue, 15 May 2001 11:07:43 +0100
On Friday 11 May, "Maxim Krylov" wrote:
> Can i get a referense (on the server side) to object-implementation from
> object's ptr, while using tie-implementation?
You can do what you want, as long as your C++ compiler supports
dynamic_cast<>. If you don't have dynamic_cast<>, you're out of luck
I'm afraid.
You need something like the following. The syntax might be slightly
wrong, but you get the idea:
> class A_i {
> public:
> void sendB (B_ptr the_b) {
> B_i* impl = ???
> !!! How can get from B_ptr corresponding B_i?
> !!! Or, that too the most POA_B_tie, or _impl_B
PortableServer::Servant svt = poa->reference_to_servant(the_b);
POA_B_tie<B_i>* tie = dynamic_cast<POA_B_tie<B_i>*>(svt)
if (tie) {
B_i* bimpl = tie->_tied_object();
// Do something with bimpl
}
else {
// Servant isn't the right type
}
Cheers,
Duncan.
--
-- Duncan Grisby \ Research Engineer --
-- AT&T Laboratories Cambridge --
-- http://www.uk.research.att.com/~dpg1 --