Endpoint.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file   Endpoint.h
00006  *
00007  *  Endpoint.h,v 1.21 2006/04/26 17:12:47 mesnier_p Exp
00008  *
00009  * Endpoint interface, part of TAO pluggable protocol framework.
00010  *
00011  *
00012  *  @author Marina Spivak <marina@cs.wustl.edu>
00013  */
00014 //=============================================================================
00015 
00016 #ifndef TAO_ENDPOINT_H
00017 #define TAO_ENDPOINT_H
00018 
00019 #include /**/ "ace/pre.h"
00020 #include "ace/Thread_Mutex.h"
00021 
00022 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00023 # pragma once
00024 #endif /* ACE_LACKS_PRAGMA_ONCE */
00025 
00026 #include "tao/TAO_Export.h"
00027 #include "tao/Basic_Types.h"
00028 #include "tao/orbconf.h"
00029 
00030 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00031 
00032 class TAO_ORB_Core;
00033 
00034 /*
00035  * Includes and forward decls for specializing TAO's
00036  * endpoint implementation.
00037  */
00038 //@@ TAO_ENDPOINT_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK
00039 
00040 /**
00041  * @class TAO_Endpoint
00042  *
00043  * @brief Defines the Endpoint interface in the Pluggable Protocol
00044  * framework.
00045  *
00046  * Lightweight encapsulation of addressing information for a
00047  * single acceptor endpoint.  In other words, Endpoint represents
00048  * a single point of contact for the server, and is the smallest
00049  * unit of addressing information necessary for a client to connect
00050  * to a server.
00051  * A Profile contains one or more Endpoints, i.e., knows of
00052  * one or more ways to contact server(s).
00053  */
00054 class TAO_Export TAO_Endpoint
00055 {
00056 public:
00057   /// Constructor.
00058   TAO_Endpoint (CORBA::ULong tag,
00059                 CORBA::Short priority = TAO_INVALID_PRIORITY);
00060 
00061   /// Destructor.
00062   virtual ~TAO_Endpoint (void);
00063 
00064   /// IOP protocol tag accessor.
00065   CORBA::ULong tag (void) const;
00066 
00067   /// <priority_> attribute setter.
00068   void priority (CORBA::Short priority);
00069 
00070   /// <priority_> attribute getter.
00071   CORBA::Short priority (void) const;
00072 
00073   /**
00074    * @name TAO_Endpoint Template Methods
00075    *
00076    * Abstract methods to be implemented by concrete subclasses.
00077    */
00078   //@{
00079   /**
00080    * @return true if this endpoint is equivalent to @a other_endpoint.
00081    */
00082   virtual CORBA::Boolean is_equivalent (const TAO_Endpoint *other_endpoint) = 0;
00083 
00084   /// Endpoints can be linked in a list.
00085   /**
00086    * @return The next endpoint in the list, if any.
00087    */
00088   virtual TAO_Endpoint *next (void) = 0;
00089 
00090   /**
00091    * Return the next endpoint in the list, but use protocol-specific
00092    * filtering to constrain the value. The orb core is needed to supply
00093    * any sort of filter arguments, and the root endpoint is needed in case
00094    * the algorithm needs to rewind. If the supplied root is 0, then this
00095    * is assumed to be the candidate next endpoint.
00096    *
00097    * To use this, the caller starts off the change with root == 0. This
00098    * is a bit of a violation in logic, a more correct implementation would
00099    * accept this == 0 and a non-null root.
00100    * To do iteration using next_filtered, do:
00101    *   for (TAO_Endpoint *ep = root_endpoint->next_filtered (orb_core, 0);
00102    *        ep != 0;
00103    *        ep = ep->next_filtered(orb_core, root_endpoint)) { }
00104    */
00105   virtual TAO_Endpoint *next_filtered (TAO_ORB_Core *, TAO_Endpoint *root);
00106 
00107   /// Return a string representation for the address.
00108   /**
00109    * The purpose of this method is to provide a general interface to
00110    * the underlying address object's @c addr_to_string method.  This
00111    * allows the protocol implementor to select the appropriate string
00112    * format.
00113    *
00114    * @return -1 if buffer is too small.
00115    */
00116   virtual int addr_to_string (char *buffer, size_t length) = 0;
00117 
00118   /// This method returns a deep copy of the corresponding endpoints by
00119   /// allocating memory.
00120   virtual TAO_Endpoint *duplicate (void) = 0;
00121 
00122   /// Return a hash value for this object.
00123   virtual CORBA::ULong hash (void)  = 0;
00124 
00125   /*
00126    * Hook to add public methods from derived class onto base
00127    * Endpoint class.
00128    */
00129   //@@ TAO_ENDPOINT_SPL_PUBLIC_METHODS_ADD_HOOK
00130 
00131 protected:
00132 
00133   /// Lock for the address lookup.
00134   /**
00135    * @todo This lock should be strategized so that we dont lock in
00136    *       single threaded configurations.  It is not possible to do
00137    *       this now as most of the information is available in the
00138    *       ORB_Core which is not available here.
00139    */
00140   mutable TAO_SYNCH_MUTEX addr_lookup_lock_;
00141 
00142   /// Cache the hash value
00143   CORBA::ULong hash_val_;
00144 
00145   /// IOP tag, identifying the protocol for which this endpoint
00146   /// contains addressing info.
00147   CORBA::ULong const tag_;
00148 
00149   /**
00150    * CORBA priority of the acceptor this Endpoint is representing.
00151    * This is part of TAO 'prioritized endpoints' architecture, and is
00152    * currently used for RTCORBA only.
00153    */
00154   CORBA::Short priority_;
00155 
00156 private:
00157 
00158   /// Endpoints should not be copied.
00159   TAO_Endpoint (const TAO_Endpoint&);
00160   void operator= (const TAO_Endpoint&);
00161 
00162   /*
00163    * Addition of private members from derived class.
00164    */
00165   //@@ TAO_ENDPOINT_SPL_PRIVATE_DATA_ADD_HOOK
00166 
00167 };
00168 
00169 //@@ TAO_ENDPOINT_SPL_EXTERN_ADD_HOOK
00170 
00171 TAO_END_VERSIONED_NAMESPACE_DECL
00172 
00173 #if defined (__ACE_INLINE__)
00174 # include "tao/Endpoint.i"
00175 #endif /* __ACE_INLINE__ */
00176 
00177 #include /**/ "ace/post.h"
00178 #endif  /* TAO_PROFILE_H */

Generated on Thu Nov 9 11:54:10 2006 for TAO by doxygen 1.3.6