Naming_Client.cpp

Go to the documentation of this file.
00001 // $Id: Naming_Client.cpp 76880 2007-02-02 16:22:17Z johnnyw $
00002 
00003 #include "orbsvcs/Naming/Naming_Client.h"
00004 #include "orbsvcs/CosNamingC.h"
00005 #include "ace/Log_Msg.h"
00006 
00007 ACE_RCSID (Naming,
00008            Naming_Client,
00009            "$Id: Naming_Client.cpp 76880 2007-02-02 16:22:17Z johnnyw $")
00010 
00011 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00012 
00013 CosNaming::NamingContext_ptr
00014 TAO_Naming_Client::operator -> (void) const
00015 {
00016   return this->naming_context_.ptr ();
00017 }
00018 
00019 CosNaming::NamingContext_ptr
00020 TAO_Naming_Client::get_context (void) const
00021 {
00022   // Must duplicate this pointer so it can be stored in a _var.
00023   return CosNaming::NamingContext::_duplicate (this->naming_context_.in ());
00024 }
00025 
00026 int
00027 TAO_Naming_Client::init (CORBA::ORB_ptr orb, ACE_Time_Value *timeout)
00028 {
00029   try
00030     {
00031       CORBA::Object_var naming_obj =
00032         orb->resolve_initial_references ("NameService", timeout);
00033 
00034       if (CORBA::is_nil (naming_obj.in ()))
00035         ACE_ERROR_RETURN ((LM_ERROR,
00036                            " (%P|%t) Unable to initialize the NameService.\n"),
00037                           -1);
00038       this->naming_context_ =
00039         CosNaming::NamingContext::_narrow (naming_obj.in ());
00040     }
00041   catch (const CORBA::Exception& ex)
00042     {
00043       ex._tao_print_exception ("TAO_Naming_Client::init");
00044       return -1;
00045     }
00046 
00047   return 0;
00048 }
00049 
00050 TAO_Naming_Client::TAO_Naming_Client (void)
00051 {
00052   // Do nothing
00053 }
00054 
00055 TAO_Naming_Client::~TAO_Naming_Client (void)
00056 {
00057   // Do nothing
00058 }
00059 
00060 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Sun Jan 27 16:15:29 2008 for TAO_CosNaming by doxygen 1.3.6