Joost Kraaijeveld
2009-11-25 11:28:43 UTC
Hi,
what is the exact type of the return value of the Server_impl::_this
function?
From the C++ Language Mapping, Version 1.2, page 125:
Assuming A_impl is a class derived from POA_A that implements the A
interface, and assuming that the servant’s POA
was created with the appropriate policies, a servant of type A_impl can
be created and implicitly activated as follows:
// C++
A_impl my_a;
A_var a = my_a._this();
The A_var is (in terms of writing anyway) the same type as I would use
on the client side. Is it actually the same type? If so, does that mean
that I would always have to link the client code to my server code
(which is indeed what lots of examples do)? If not, suppose I have an
application that is both a server and a client for the same interface.
How do I distinguish between the two?
Part of the confusion is 4.41.1 which says, and where it look clear to
me that a A_ptr on the servers is a different type than the "same" A_ptr
on a client, although they both implement the same interface:
4.41.1 Skeleton Derivation From Object
In several existing ORB implementations, each skeleton class derives
from the corresponding interface class. For
example, for interface Mod::A, the skeleton class POA_Mod::A is derived
from class Mod::A. These systems therefore
allow an object reference for a servant to be implicitly obtained via
normal C++ derived-to-base conversion rules:
// C++
MyImplOfA my_a; // declare impl of A
A_ptr a = &my_a; // obtain its object reference
// by C++ derived-to-base
// conversion
Such code can be supported by a conforming ORB implementation, but it is
not required, and is thus not portable.
TIA
Joost
what is the exact type of the return value of the Server_impl::_this
function?
From the C++ Language Mapping, Version 1.2, page 125:
Assuming A_impl is a class derived from POA_A that implements the A
interface, and assuming that the servant’s POA
was created with the appropriate policies, a servant of type A_impl can
be created and implicitly activated as follows:
// C++
A_impl my_a;
A_var a = my_a._this();
The A_var is (in terms of writing anyway) the same type as I would use
on the client side. Is it actually the same type? If so, does that mean
that I would always have to link the client code to my server code
(which is indeed what lots of examples do)? If not, suppose I have an
application that is both a server and a client for the same interface.
How do I distinguish between the two?
Part of the confusion is 4.41.1 which says, and where it look clear to
me that a A_ptr on the servers is a different type than the "same" A_ptr
on a client, although they both implement the same interface:
4.41.1 Skeleton Derivation From Object
In several existing ORB implementations, each skeleton class derives
from the corresponding interface class. For
example, for interface Mod::A, the skeleton class POA_Mod::A is derived
from class Mod::A. These systems therefore
allow an object reference for a servant to be implicitly obtained via
normal C++ derived-to-base conversion rules:
// C++
MyImplOfA my_a; // declare impl of A
A_ptr a = &my_a; // obtain its object reference
// by C++ derived-to-base
// conversion
Such code can be supported by a conforming ORB implementation, but it is
not required, and is thus not portable.
TIA
Joost