diff options
author | naga <naga@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-02-25 18:12:52 +0000 |
---|---|---|
committer | naga <naga@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-02-25 18:12:52 +0000 |
commit | d2cb890590fbc2142fea7d448f5568ea99952b26 (patch) | |
tree | aa7644e94ef9a50a6232080ae0f28af9127e50c0 /TAO/orbsvcs/Naming_Service | |
parent | ffa37c5ecdc05ff2e1c0e5804b065b3c4fa836e6 (diff) | |
download | ATCD-d2cb890590fbc2142fea7d448f5568ea99952b26.tar.gz |
*** empty log message ***
Diffstat (limited to 'TAO/orbsvcs/Naming_Service')
-rw-r--r-- | TAO/orbsvcs/Naming_Service/Naming_Utils.cpp | 85 | ||||
-rw-r--r-- | TAO/orbsvcs/Naming_Service/Naming_Utils.h | 2 |
2 files changed, 52 insertions, 35 deletions
diff --git a/TAO/orbsvcs/Naming_Service/Naming_Utils.cpp b/TAO/orbsvcs/Naming_Service/Naming_Utils.cpp index 35a1e997c88..29a4ad91df9 100644 --- a/TAO/orbsvcs/Naming_Service/Naming_Utils.cpp +++ b/TAO/orbsvcs/Naming_Service/Naming_Utils.cpp @@ -1,14 +1,15 @@ // $Id$ + // ============================================================================ // // = LIBRARY // TAO/orbsvcs/Naming_Service // // = FILENAME -// Naming_Server.cpp +// Naming_Utils.cpp // // = DESCRIPTION -// This class implements a Naming Server wrapper class which holds +// This class implements a Naming Server wrapper class that holds // a Naming Context for TAO NameService. // // = AUTHOR @@ -23,43 +24,48 @@ // Default constructor -TAO_Naming_Server::TAO_Naming_Server () - :ior_multicast_ (0), - naming_context_ptr_ (0) +TAO_Naming_Server::TAO_Naming_Server (void) + : ior_multicast_ (0), + naming_context_ptr_ (0) { } -// Constructor which takes an orb and poa +// Constructor which takes an ORB and POA. -TAO_Naming_Server::TAO_Naming_Server (CORBA::ORB_var& orb,PortableServer::POA_var& good_poa) +TAO_Naming_Server::TAO_Naming_Server (CORBA::ORB_var &orb, + PortableServer::POA_var &child_poa) { - this->init (orb,good_poa); + this->init (orb, child_poa); } // Function to initialize the name server object under the passed orb // and poa int -TAO_Naming_Server::init (CORBA::ORB_var& orb,PortableServer::POA_var& good_poa) +TAO_Naming_Server::init (CORBA::ORB_var &orb, + PortableServer::POA_var &child_poa) { TAO_TRY { - // get the naming context ptr to NameService - naming_context_ptr_ = naming_context_impl_._this (TAO_TRY_ENV); + // Get the naming context ptr to NameService. + naming_context_ptr_ = + naming_context_impl_._this (TAO_TRY_ENV); TAO_CHECK_ENV; PortableServer::ObjectId_var id = PortableServer::string_to_ObjectId ("NameService"); - good_poa->activate_object_with_id (id.in (), - &naming_context_impl_, - TAO_TRY_ENV); + + child_poa->activate_object_with_id (id.in (), + &naming_context_impl_, + TAO_TRY_ENV); TAO_CHECK_ENV; // Stringify the objref we'll be implementing, and print it to // stdout. Someone will take that string and give it to a // client. Then release the object. CORBA::Object_var obj = - good_poa->id_to_reference (id.in (), TAO_TRY_ENV); + child_poa->id_to_reference (id.in (), + TAO_TRY_ENV); TAO_CHECK_ENV; CORBA::String_var str = @@ -67,18 +73,24 @@ TAO_Naming_Server::init (CORBA::ORB_var& orb,PortableServer::POA_var& good_poa) TAO_TRY_ENV); TAO_CHECK_ENV; - ACE_DEBUG ((LM_DEBUG, "listening as object <%s>\n", str.in ())); + ACE_DEBUG ((LM_DEBUG, + "listening as object <%s>\n", + str.in ())); #if defined (ACE_HAS_IP_MULTICAST) - // get reactor instance from TAO - ACE_Reactor *reactor = TAO_ORB_Core_instance ()->reactor (); + // Get reactor instance from TAO. + ACE_Reactor *reactor = + TAO_ORB_Core_instance ()->reactor (); // First, see if the user has given us a multicast port number // for the name service on the command-line; - u_short port = TAO_ORB_Core_instance ()->orb_params ()->name_service_port (); + u_short port = + TAO_ORB_Core_instance ()->orb_params ()->name_service_port (); + if (port == 0) { - const char *port_number = ACE_OS::getenv ("NameServicePort"); + const char *port_number = + ACE_OS::getenv ("NameServicePort"); if (port_number != 0) port = ACE_OS::atoi (port_number); @@ -87,19 +99,23 @@ TAO_Naming_Server::init (CORBA::ORB_var& orb,PortableServer::POA_var& good_poa) if (port == 0) port = TAO_DEFAULT_NAME_SERVER_REQUEST_PORT; - char *naming_ior = ACE_OS::strdup (str.in ()); - // Instantiate a server which will receive requests for an ior - ior_multicast_= new IOR_Multicast (naming_ior , - port, - ACE_DEFAULT_MULTICAST_ADDR); - // register event handler for the ior multicast. + // Instantiate a server which will receive requests for an ior + ACE_NEW_RETURN (ior_multicast_, + IOR_Multicast (naming_ior , + port, + ACE_DEFAULT_MULTICAST_ADDR), + -1); + + // Register event handler for the ior multicast. if (reactor->register_handler (ior_multicast_, ACE_Event_Handler::READ_MASK) == -1) - ACE_DEBUG ((LM_DEBUG, "cannot register Event handler\n")); + ACE_DEBUG ((LM_DEBUG, + "cannot register Event handler\n")); else - ACE_DEBUG ((LM_DEBUG, "The multicast server setup is done.\n")); + ACE_DEBUG ((LM_DEBUG, + "The multicast server setup is done.\n")); #endif /* ACE_HAS_IP_MULTICAST */ } TAO_CATCHANY @@ -110,24 +126,25 @@ TAO_Naming_Server::init (CORBA::ORB_var& orb,PortableServer::POA_var& good_poa) return 0; } -// Returns the "NameService" NamingContext implementation object +// Returns the "NameService" NamingContext implementation object. -NS_NamingContext& TAO_Naming_Server::GetNamingContext () +NS_NamingContext & +TAO_Naming_Server::GetNamingContext (void) { return naming_context_impl_ ; } -// Returns a pointer to the NamingContext +// Returns a pointer to the NamingContext. - CosNaming::NamingContext* +CosNaming::NamingContext* TAO_Naming_Server::operator -> (void) const { return this->naming_context_ptr_; } -//Destructor +// Destructor. -TAO_Naming_Server::~TAO_Naming_Server () +TAO_Naming_Server::~TAO_Naming_Server (void) { delete ior_multicast_; } diff --git a/TAO/orbsvcs/Naming_Service/Naming_Utils.h b/TAO/orbsvcs/Naming_Service/Naming_Utils.h index 003cd49cf26..5e57e7c4082 100644 --- a/TAO/orbsvcs/Naming_Service/Naming_Utils.h +++ b/TAO/orbsvcs/Naming_Service/Naming_Utils.h @@ -7,7 +7,7 @@ // TAO/orbsvcs/Naming_Service // // = FILENAME -// Naming_Server.h +// Naming_Utils.h // // = DESCRIPTION // This class implements a Naming Server wrapper class which holds |