00001 /* -*- C++ -*- */ 00002 00003 //============================================================================= 00004 /** 00005 * @file Naming_Client.h 00006 * 00007 * Naming_Client.h,v 1.3 2005/11/14 22:03:48 ossama Exp 00008 * 00009 * Implement wrappers useful to Naming Service clients. 00010 * 00011 * 00012 * @author Nagarajan Surendran (naga@cs.wustl.edu) 00013 * @author Matt Braun <mjb2@cs.wustl.edu> 00014 * @author and Douglas C. Schmidt <schmidt@cs.wustl.edu>. 00015 */ 00016 //============================================================================= 00017 00018 00019 #ifndef TAO_NAMING_CLIENT_H 00020 #define TAO_NAMING_CLIENT_H 00021 #include /**/ "ace/pre.h" 00022 00023 #include "tao/ORB.h" 00024 #include "orbsvcs/CosNamingC.h" 00025 #include "orbsvcs/Naming/naming_export.h" 00026 00027 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00028 00029 /** 00030 * @class TAO_Naming_Client 00031 * 00032 * @brief This class is intended to simplify programs that want to play 00033 * the role of Naming Service clients. 00034 * 00035 * Wrapper class that locates the root Naming Context. It also 00036 * defines the operator-> so that <NamingContext> functions like 00037 * <resolve>, etc. can be directly called on a 00038 * <TAO_Naming_Client> object, and will be forwarded to the root 00039 * Naming Context. 00040 */ 00041 class TAO_Naming_Export TAO_Naming_Client 00042 { 00043 public: 00044 // = Initialization and termination methods. 00045 00046 /// Default constructor. 00047 TAO_Naming_Client (void); 00048 00049 /** 00050 * Look for a Naming Service for a period of <timeout> using 00051 * <resolve_initial_references>. Return 0 if Naming Service is 00052 * successfully located, and -1 on failure. 00053 */ 00054 int init (CORBA::ORB_ptr orb, 00055 ACE_Time_Value *timeout = 0); 00056 00057 /// Destructor. 00058 ~TAO_Naming_Client (void); 00059 00060 /// Returns a pointer to the root Naming Context. 00061 CosNaming::NamingContext_ptr operator-> (void) const; 00062 00063 /** 00064 * Returns a pointer to the root Naming Context. This ptr is 00065 * duplicated via <_duplicate> so that it can be stored into a 00066 * <*_var>. 00067 */ 00068 CosNaming::NamingContext_ptr get_context (void) const; 00069 00070 protected: 00071 /// Reference to the root Naming Context. 00072 CosNaming::NamingContext_var naming_context_; 00073 }; 00074 00075 TAO_END_VERSIONED_NAMESPACE_DECL 00076 00077 #include /**/ "ace/post.h" 00078 #endif /* TAO_NAMING_CLIENT_H */