00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file PortableGroup_Acceptor_Registry.h 00006 * 00007 * PortableGroup_Acceptor_Registry.h,v 1.13 2006/03/14 06:14:34 jtc Exp 00008 * 00009 * Registry for dynamically created acceptors. 00010 * 00011 * @author Frank Hunleth <fhunleth@cs.wustl.edu> 00012 */ 00013 //============================================================================= 00014 00015 #ifndef TAO_PORTABLEGROUP_ACCEPTOR_REGISTRY_H 00016 #define TAO_PORTABLEGROUP_ACCEPTOR_REGISTRY_H 00017 00018 #include /**/ "ace/pre.h" 00019 00020 #include "ace/Unbounded_Queue.h" 00021 00022 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00023 # pragma once 00024 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00025 00026 #include "ace/CORBA_macros.h" 00027 00028 #include "orbsvcs/PortableGroup/portablegroup_export.h" 00029 00030 #include "tao/Transport_Acceptor.h" 00031 #include "tao/Resource_Factory.h" 00032 00033 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00034 00035 class TAO_Profile; 00036 00037 namespace CORBA 00038 { 00039 class Environment; 00040 } 00041 00042 /** 00043 * @class TAO_PortableGroup_Acceptor_Registry 00044 * 00045 * @brief . 00046 * 00047 * There is one TAO_PortableGroup_Acceptor_Registry per ORB_Core. 00048 */ 00049 class TAO_PortableGroup_Export TAO_PortableGroup_Acceptor_Registry 00050 { 00051 public: 00052 00053 /** 00054 * @struct Entry 00055 * 00056 * @brief Value field of the portable group acceptor registry. 00057 */ 00058 struct Entry 00059 { 00060 /// Pointer to the acceptor for this GroupId. 00061 TAO_Acceptor *acceptor; 00062 00063 /// Cached endpoint that the acceptor is listening on. 00064 TAO_Endpoint *endpoint; 00065 00066 /// Count of times that this GroupId has been opened. 00067 int cnt; 00068 }; 00069 00070 00071 // = Initialization and termination methods. 00072 /// Default constructor. 00073 TAO_PortableGroup_Acceptor_Registry (void); 00074 00075 /// Default destructor. 00076 ~TAO_PortableGroup_Acceptor_Registry (void); 00077 00078 /// Open an acceptor based on a tagged profile. 00079 void open (const TAO_Profile* profile, 00080 TAO_ORB_Core &orb_core 00081 ACE_ENV_ARG_DECL); 00082 00083 /// Close all open acceptors. 00084 int close_all (void); 00085 00086 typedef ACE_Unbounded_Queue<Entry> Acceptor_Registry; 00087 typedef ACE_Unbounded_Queue_Iterator<Entry> Acceptor_Registry_Iterator; 00088 00089 protected: 00090 00091 /// Helper function to open a group acceptor. 00092 void open_i (const TAO_Profile* profile, 00093 TAO_ORB_Core &orb_core, 00094 TAO_ProtocolFactorySetItor &factory 00095 ACE_ENV_ARG_DECL); 00096 00097 /// Find an acceptor by using a profile. 00098 int find (const TAO_Profile* profile, 00099 Entry *&entry); 00100 00101 private: 00102 00103 // The acceptor registry should not be copied. 00104 TAO_PortableGroup_Acceptor_Registry ( 00105 const TAO_PortableGroup_Acceptor_Registry&); 00106 void operator= (const TAO_PortableGroup_Acceptor_Registry&); 00107 00108 private: 00109 /// List of acceptors that are currently open. 00110 Acceptor_Registry registry_; 00111 }; 00112 00113 TAO_END_VERSIONED_NAMESPACE_DECL 00114 00115 #include /**/ "ace/post.h" 00116 00117 #endif /* TAO_PORTABLEGROUP_ACCEPTOR_REGISTRY_H */