TAO_Naming_Client Class Reference

This class is intended to simplify programs that want to play the role of Naming Service clients. More...

#include <Naming_Client.h>

List of all members.

Public Member Functions

 TAO_Naming_Client (void)
 Default constructor.

int init (CORBA::ORB_ptr orb, ACE_Time_Value *timeout=0)
 ~TAO_Naming_Client (void)
 Destructor.

CosNaming::NamingContext_ptr operator-> (void) const
 Returns a pointer to the root Naming Context.

CosNaming::NamingContext_ptr get_context (void) const

Protected Attributes

CosNaming::NamingContext_var naming_context_
 Reference to the root Naming Context.


Detailed Description

This class is intended to simplify programs that want to play the role of Naming Service clients.

Wrapper class that locates the root Naming Context. It also defines the operator-> so that functions like , etc. can be directly called on a object, and will be forwarded to the root Naming Context.

Definition at line 41 of file Naming_Client.h.


Constructor & Destructor Documentation

TAO_Naming_Client::TAO_Naming_Client void   ) 
 

Default constructor.

Definition at line 57 of file Naming_Client.cpp.

00058 {
00059   // Do nothing
00060 }

TAO_Naming_Client::~TAO_Naming_Client void   ) 
 

Destructor.

Definition at line 62 of file Naming_Client.cpp.

00063 {
00064   // Do nothing
00065 }


Member Function Documentation

CosNaming::NamingContext_ptr TAO_Naming_Client::get_context void   )  const
 

Returns a pointer to the root Naming Context. This ptr is duplicated via so that it can be stored into a <*_var>.

Definition at line 20 of file Naming_Client.cpp.

00021 {
00022   // Must duplicate this pointer so it can be stored in a _var.
00023   return CosNaming::NamingContext::_duplicate (this->naming_context_.in ());
00024 }

int TAO_Naming_Client::init CORBA::ORB_ptr  orb,
ACE_Time_Value timeout = 0
 

Look for a Naming Service for a period of using . Return 0 if Naming Service is successfully located, and -1 on failure.

Definition at line 27 of file Naming_Client.cpp.

References ACE_ANY_EXCEPTION, ACE_CATCHANY, ACE_CHECK_RETURN, ACE_DECLARE_NEW_CORBA_ENV, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_ERROR_RETURN, ACE_PRINT_EXCEPTION, ACE_TRY, ACE_TRY_CHECK, CORBA::is_nil(), and LM_ERROR.

00029 {
00030   ACE_DECLARE_NEW_CORBA_ENV;
00031   ACE_TRY
00032     {
00033       CORBA::Object_var naming_obj =
00034         orb->resolve_initial_references ("NameService", timeout ACE_ENV_ARG_PARAMETER);
00035       ACE_TRY_CHECK;
00036 
00037       if (CORBA::is_nil (naming_obj.in ()))
00038         ACE_ERROR_RETURN ((LM_ERROR,
00039                            " (%P|%t) Unable to initialize the NameService.\n"),
00040                           -1);
00041       this->naming_context_ =
00042         CosNaming::NamingContext::_narrow (naming_obj.in ()
00043                                            ACE_ENV_ARG_PARAMETER);
00044       ACE_TRY_CHECK;
00045     }
00046   ACE_CATCHANY
00047     {
00048       ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "TAO_Naming_Client::init");
00049       return -1;
00050     }
00051   ACE_ENDTRY;
00052   ACE_CHECK_RETURN (-1);
00053 
00054   return 0;
00055 }

TAO_BEGIN_VERSIONED_NAMESPACE_DECL CosNaming::NamingContext_ptr TAO_Naming_Client::operator-> void   )  const
 

Returns a pointer to the root Naming Context.

Definition at line 14 of file Naming_Client.cpp.

00015 {
00016   return this->naming_context_.ptr ();
00017 }


Member Data Documentation

CosNaming::NamingContext_var TAO_Naming_Client::naming_context_ [protected]
 

Reference to the root Naming Context.

Definition at line 72 of file Naming_Client.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 13:57:37 2006 for TAO_CosNaming by doxygen 1.3.6