11.1.3.1 C++ Example of Inheritance from Skeletons
The following is a C++ example, given the IDL:
interface Hospital{ … };
The skeleton generated by the idl command contains
a “skeleton” class, POA_Hospital, that the
user-written class inherits from, as in:
class Hospital_i : public POA_Hospital { ... };
In a server, the skeleton class inherits from the TP Framework
class Tobj_ServantBase, which in turn inherits from
the predefined PortableServer::ServantBase.
The inheritance tree for a callback object implementation in a
joint client/server is different than that in a server. The
skeleton class does not inherit from the TP Framework class
Tobj_ServantBase, but instead inherits directly from
PortableServer::ServantBase. This behavior is achieved
by specifying the -P option in the idl
command.
Not having the Tobj_ServantBase class in the
inheritance tree for a servant means that the servant does not have
activate_object and deactivate_object
methods. In a server, these methods are called by the TP Framework
to dynamically initialize and save a servant’s state before
invoking a method on the servant. For a client that supports
callbacks, you must write code that explicitly creates a servant
and initializes a servant’s state.
Parent topic: Servant Inheritance from Skeletons