diff options
author | kirthika <kirthika@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-12-31 09:13:08 +0000 |
---|---|---|
committer | kirthika <kirthika@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-12-31 09:13:08 +0000 |
commit | f9e95c533c96377053925203330fdd65b06a9687 (patch) | |
tree | f9e94fb7333ac251d69082eacfd6cf31f7b825f6 /TAO/examples | |
parent | d09d0dbb82a8ea37fdac51270761d467eee53aec (diff) | |
download | ATCD-f9e95c533c96377053925203330fdd65b06a9687.tar.gz |
*** empty log message ***
Diffstat (limited to 'TAO/examples')
-rw-r--r-- | TAO/examples/POA/Generic_Servant/MyFooServant.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/TAO/examples/POA/Generic_Servant/MyFooServant.cpp b/TAO/examples/POA/Generic_Servant/MyFooServant.cpp index 5625916077f..7b29952835a 100644 --- a/TAO/examples/POA/Generic_Servant/MyFooServant.cpp +++ b/TAO/examples/POA/Generic_Servant/MyFooServant.cpp @@ -83,3 +83,45 @@ create_MyFoo (CORBA::ORB_ptr orb, return servant; } + +extern "C" GENERIC_SERVANT_Export PortableServer::Servant supply_servant (const PortableServer::ObjectId &oid, + PortableServer::POA_ptr poa, + CORBA::ORB_ptr orb); + +// The servant pointer is returned which will be of Base class +// type. The binding to the servant will happen at run-time. + +PortableServer::Servant +supply_servant (const PortableServer::ObjectId &oid, + PortableServer::POA_ptr poa, + CORBA::ORB_ptr orb) +{ + PortableServer::Servant servant = 0; + + // Convert ObjectId to String. + CORBA::String_var s = PortableServer::ObjectId_to_string (oid); + + if (ACE_OS::strstr (s.in (), "Foo") != 0) + ACE_NEW_RETURN (servant, + MyFooServant (orb, + poa, + 0), + 0); + return servant; +} + +extern "C" GENERIC_SERVANT_Export void destroy_servant (const PortableServer::ObjectId &oid, + PortableServer::POA_ptr poa, + PortableServer::Servant servant); + +// This function will take care of the destruction of the servant. + +void +destroy_servant (const PortableServer::ObjectId &oid, + PortableServer::POA_ptr poa, + PortableServer::Servant servant) +{ + delete servant; +} + + |