Acceptor_Registry.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file     Acceptor_Registry.h
00006  *
00007  *  $Id: Acceptor_Registry.h 76551 2007-01-24 13:42:44Z johnnyw $
00008  *
00009  *  Interface for the TAO pluggable protocol framework.
00010  *
00011  *  @author Fred Kuhns <fredk@cs.wustl.edu>
00012  *  @author Ossama Othman <ossama@uci.edu>
00013  */
00014 //=============================================================================
00015 
00016 #ifndef TAO_ACCEPTOR_REGISTRY_H
00017 #define TAO_ACCEPTOR_REGISTRY_H
00018 
00019 #include /**/ "ace/pre.h"
00020 #include "ace/Unbounded_Set.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/Exception.h"
00028 #include "tao/params.h"
00029 
00030 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00031 class ACE_Addr;
00032 class ACE_Reactor;
00033 ACE_END_VERSIONED_NAMESPACE_DECL
00034 
00035 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00036 
00037 class TAO_ORB_Core;
00038 class TAO_Acceptor;
00039 class TAO_Acceptor_Filter;
00040 class TAO_Stub;
00041 class TAO_Profile;
00042 class TAO_MProfile;
00043 class TAO_Protocol_Factory;
00044 class TAO_Protocol_Item;
00045 
00046 typedef ACE_Unbounded_Set_Iterator<TAO_Protocol_Item *>
00047         TAO_ProtocolFactorySetItor;
00048 
00049 typedef TAO_Acceptor** TAO_AcceptorSetIterator;
00050 
00051 /**
00052  * @class TAO_Acceptor_Registry
00053  *
00054  * @brief Acceptor Registry and Generic Acceptor interface definitions.
00055  * All loaded ESIOP or GIOP acceptor bridges must register with
00056  * this object.
00057  *
00058  * This class maintains a list os acceptor factories
00059  * for all loaded ORB protocols.
00060  * There is one Acceptor_Registry per ORB_Core.
00061  */
00062 class TAO_Export TAO_Acceptor_Registry
00063 {
00064 public:
00065   // = Initialization and termination methods.
00066   ///  Default constructor.
00067   TAO_Acceptor_Registry (void);
00068 
00069   ///  Default destructor.
00070   ~TAO_Acceptor_Registry (void);
00071 
00072   /// Initialize all registered acceptors.  Return -1 on error.
00073   int open (TAO_ORB_Core *orb_core,
00074             ACE_Reactor *reactor,
00075             const TAO_EndpointSet &endpoint_set,
00076             bool ignore_address);
00077 
00078   /// Close all open acceptors.
00079   int close_all (void);
00080 
00081   /// Returns the total number of endpoints in all of its acceptors.
00082   size_t endpoint_count (void);
00083 
00084   /// Check if there is at least one profile in @a mprofile that
00085   /// corresponds to a collocated object.
00086   int is_collocated (const TAO_MProfile& mprofile);
00087 
00088   /// Return the acceptor bridges
00089   TAO_Acceptor *get_acceptor (CORBA::ULong tag);
00090 
00091   // = Iterator.
00092   TAO_AcceptorSetIterator begin (void);
00093   TAO_AcceptorSetIterator end (void);
00094 
00095 private:
00096 
00097   /// Create a default acceptor for all loaded protocols.
00098   int open_default (TAO_ORB_Core *orb_core,
00099                     ACE_Reactor *reactor,
00100                     const char *options);
00101 
00102   /// Create a default acceptor using the specified protocol factory.
00103   int open_default (TAO_ORB_Core *orb_core,
00104                     ACE_Reactor *reactor,
00105                     int major,
00106                     int minor,
00107                     TAO_ProtocolFactorySetItor &factory,
00108                     const char *options);
00109 
00110   /// Open a default acceptor.
00111   int open_default_i (TAO_ORB_Core *orb_core,
00112                       ACE_Reactor *reactor,
00113                       int major,
00114                       int minor,
00115                       TAO_ProtocolFactorySetItor &factory,
00116                       TAO_Acceptor* acceptor,
00117                       const char *options);
00118 
00119   /// Extract endpoint-specific options from the endpoint string.
00120   void extract_endpoint_options (ACE_CString &addrs,
00121                                  ACE_CString &options,
00122                                  TAO_Protocol_Factory *factory);
00123 
00124   /// Extract endpoint/address specific version from the endpoint
00125   /// string.
00126   void extract_endpoint_version (ACE_CString &address,
00127                                  int &major,
00128                                  int &minor);
00129 
00130   /// Iterator through addrs in the string <iop>, and create an
00131   /// acceptor for each one.
00132   int open_i (TAO_ORB_Core *orb_core,
00133               ACE_Reactor *reactor,
00134               ACE_CString &address,
00135               TAO_ProtocolFactorySetItor &factory,
00136               bool ignore_address);
00137 
00138 private:
00139 
00140   // The acceptor registry should not be copied.
00141   TAO_Acceptor_Registry (const TAO_Acceptor_Registry&);
00142   void operator= (const TAO_Acceptor_Registry&);
00143 
00144 private:
00145   /// List of acceptors that are currently open.
00146   TAO_Acceptor **acceptors_;
00147 
00148   /// Number of acceptors that are currently open.
00149   size_t size_;
00150 };
00151 
00152 TAO_END_VERSIONED_NAMESPACE_DECL
00153 
00154 #if defined(__ACE_INLINE__)
00155 #include "tao/Acceptor_Registry.inl"
00156 #endif /* __ACE_INLINE__ */
00157 
00158 #include /**/ "ace/post.h"
00159 
00160 #endif /* TAO_ACCEPTOR_REGISTRY_H */

Generated on Tue Feb 2 17:37:51 2010 for TAO by  doxygen 1.4.7