Object implementation classes normally inherit from a servant class generated by the idl2cpp compiler. The servant class, in turn, inherits from
PortableServer.Servant::Servant. When it is not convenient or possible to alter existing classes to inherit from the VisiBroker servant class, the
tie mechanism offers an attractive alternative.
The tie mechanism provides object servers with a delegator implementation class that inherits from
PortableServer::Servant. The delegator implementation does not provide any semantics of its own. The delegator implementation simply delegates every request it receives to the real implementation class, which can be implemented separately. The real implementation class is not required to inherit from
PortableServer::Servant.
The idl2cpp compiler will automatically generate a
_tie_Account template class, as shown in the code sample below. The
POA_Bank_Account_tie class is instantiated by the object server and initialized with an instance of
AccountImpl. The
POA_Bank_Account_tie class delegates every operation request it receives to
AccountImpl, the real implementation class. In this example, the class
AccountImpl does not inherit from the
POA_Bank::Account class.