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 50 of file Naming_Client.cpp.

00051 {
00052   // Do nothing
00053 }

TAO_Naming_Client::~TAO_Naming_Client void   ) 
 

Destructor.

Definition at line 55 of file Naming_Client.cpp.

00056 {
00057   // Do nothing
00058 }


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 timeout using resolve_initial_references. Return 0 if Naming Service is successfully located, and -1 on failure.

Definition at line 27 of file Naming_Client.cpp.

References ACE_ERROR_RETURN, CORBA::is_nil(), LM_ERROR, and naming_context_.

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 }

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.

References naming_context_.

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 71 of file Naming_Client.h.

Referenced by init(), and operator->().


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 16:16:12 2008 for TAO_CosNaming by doxygen 1.3.6