From 41a387ca4bfacbb196f6bb85d9c8cbeee02f8af5 Mon Sep 17 00:00:00 2001 From: coryan Date: Wed, 26 May 1999 21:10:11 +0000 Subject: Added public interface to iterate in the Acceptor Registry Added public accessor for the address in the IIOP acceptor --- TAO/tao/Acceptor_Registry.cpp | 50 ++++++++++++------------------------------- TAO/tao/Acceptor_Registry.h | 13 ++++++++--- TAO/tao/Acceptor_Registry.i | 13 +++++++++++ TAO/tao/GIOP.h | 2 +- TAO/tao/IIOP_Acceptor.cpp | 4 ++++ TAO/tao/IIOP_Acceptor.h | 14 +++++++++--- TAO/tao/IIOP_Acceptor.i | 7 ++++++ 7 files changed, 60 insertions(+), 43 deletions(-) create mode 100644 TAO/tao/Acceptor_Registry.i create mode 100644 TAO/tao/IIOP_Acceptor.i diff --git a/TAO/tao/Acceptor_Registry.cpp b/TAO/tao/Acceptor_Registry.cpp index 4f334dd60b4..111117d7320 100644 --- a/TAO/tao/Acceptor_Registry.cpp +++ b/TAO/tao/Acceptor_Registry.cpp @@ -14,8 +14,11 @@ #include "ace/Auto_Ptr.h" -typedef ACE_Unbounded_Set_Iterator - TAO_AcceptorSetItor; +#if !defined(__ACE_INLINE__) +#include "tao/Acceptor_Registry.i" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(tao, Acceptor_Registry, "$Id$") TAO_Acceptor_Registry::TAO_Acceptor_Registry (void) { @@ -29,14 +32,12 @@ size_t TAO_Acceptor_Registry::endpoint_count (void) { int count = 0; - TAO_AcceptorSetItor end = - this->acceptors_.end (); - TAO_AcceptorSetItor acceptor = - this->acceptors_.begin (); + TAO_AcceptorSetItor end = this->end (); + - for (; acceptor != end; acceptor++) + for (TAO_AcceptorSetItor i = this->begin (); i != end; ++i) { - count += (*acceptor)->endpoint_count (); + count += (*i)->endpoint_count (); } return count; @@ -46,40 +47,17 @@ int TAO_Acceptor_Registry::make_mprofile (const TAO_ObjectKey &object_key, TAO_MProfile &mprofile) { - TAO_AcceptorSetItor end = - this->acceptors_.end (); - TAO_AcceptorSetItor acceptor = - this->acceptors_.begin (); + TAO_AcceptorSetItor end = this->end (); - for (; acceptor != end; ++acceptor) + for (TAO_AcceptorSetItor i = this->begin (); i != end; ++i) { - if ((*acceptor)->create_mprofile (object_key, mprofile) == -1) + if ((*i)->create_mprofile (object_key, mprofile) == -1) return -1; } return 0; } -TAO_Acceptor * -TAO_Acceptor_Registry::get_acceptor (CORBA::ULong tag) -{ - // @@ Fred&Ossama: Since this is going to be a common operation you - // may want to consider using a Hash_Map_Manager, or even a - // simple Map_Manager. - - TAO_AcceptorSetItor end = - this->acceptors_.end (); - TAO_AcceptorSetItor acceptor = - this->acceptors_.begin (); - - for (; acceptor != end; ++acceptor) - { - if ((*acceptor)->tag () == tag) - return (*acceptor); - } - return 0; -} - int TAO_Acceptor_Registry::is_collocated (const TAO_MProfile &mprofile) { @@ -89,9 +67,9 @@ TAO_Acceptor_Registry::is_collocated (const TAO_MProfile &mprofile) // What happens if the address matches but the object key does // not? Should we keep on searching in the ORB loop? - TAO_AcceptorSetItor end = this->acceptors_.end (); + TAO_AcceptorSetItor end = this->end (); - for (TAO_AcceptorSetItor i = this->acceptors_.begin (); i != end; ++i) + for (TAO_AcceptorSetItor i = this->begin (); i != end; ++i) { for (TAO_PHandle j = 0; j != mprofile.profile_count (); diff --git a/TAO/tao/Acceptor_Registry.h b/TAO/tao/Acceptor_Registry.h index 9506116d46c..aed5fef2161 100644 --- a/TAO/tao/Acceptor_Registry.h +++ b/TAO/tao/Acceptor_Registry.h @@ -37,6 +37,8 @@ class TAO_Resource_Factory; typedef ACE_Unbounded_Set TAO_AcceptorSet; +typedef ACE_Unbounded_Set_Iterator + TAO_AcceptorSetItor; class TAO_Export TAO_Acceptor_Registry { @@ -70,9 +72,6 @@ public: // "rtiiop:macarena:0,15" - real-time IIOP, host, port, prio. // - TAO_Acceptor *get_acceptor (CORBA::ULong tag); - // Return the acceptor bridge corresponding to tag (IOP). - int open (TAO_ORB_Core *orb_core); // Initialize all registered acceptors. Return -1 on error. // @@ Fred&Ossama: What is the relationship between the ORB_Core and @@ -91,10 +90,18 @@ public: // Check if there is at least one profile in that // corresponds to a collocated object. + TAO_AcceptorSetItor begin (void); + TAO_AcceptorSetItor end (void); + // Iteration + private: TAO_AcceptorSet acceptors_; // list of acceptors currently open. }; +#if defined(__ACE_INLINE__) +#include "tao/Acceptor_Registry.i" +#endif /* __ACE_INLINE__ */ + #endif /* TAO_ACCEPTOR_REGISTRY_H */ diff --git a/TAO/tao/Acceptor_Registry.i b/TAO/tao/Acceptor_Registry.i new file mode 100644 index 00000000000..de27ebba1e0 --- /dev/null +++ b/TAO/tao/Acceptor_Registry.i @@ -0,0 +1,13 @@ +// $Id$ + +ACE_INLINE TAO_AcceptorSetItor +TAO_Acceptor_Registry::begin (void) +{ + return this->acceptors_.begin (); +} + +ACE_INLINE TAO_AcceptorSetItor +TAO_Acceptor_Registry::end (void) +{ + return this->acceptors_.end (); +} diff --git a/TAO/tao/GIOP.h b/TAO/tao/GIOP.h index 2de6aa99144..903c7c3ce16 100644 --- a/TAO/tao/GIOP.h +++ b/TAO/tao/GIOP.h @@ -53,7 +53,7 @@ typedef CORBA::ULong TAO_IOP_Profile_ID; enum { - TAO_IOP_TAG_INVALID = -1, // + TAO_IOP_TAG_INVALID = -1, // TAO_IOP_TAG_INTERNET_IOP = 0, // IIOP TAO_IOP_TAG_MULTIPLE_COMPONENTS = 1, // DCE-CIOP TAO_IOP_TAG_UNIX_IOP = 1000, // @@ Temporary hack for UIOP! diff --git a/TAO/tao/IIOP_Acceptor.cpp b/TAO/tao/IIOP_Acceptor.cpp index 0e8331fec28..7ab0a4a1fdc 100644 --- a/TAO/tao/IIOP_Acceptor.cpp +++ b/TAO/tao/IIOP_Acceptor.cpp @@ -21,6 +21,10 @@ #include "tao/GIOP.h" #include "tao/debug.h" +#if !defined(__ACE_INLINE__) +#include "tao/IIOP_Acceptor.i" +#endif /* __ACE_INLINE__ */ + ACE_RCSID(tao, IIOP_Acceptor, "$Id$") // **************************************************************** diff --git a/TAO/tao/IIOP_Acceptor.h b/TAO/tao/IIOP_Acceptor.h index 70e2dfdfb98..d2136d6f0d8 100644 --- a/TAO/tao/IIOP_Acceptor.h +++ b/TAO/tao/IIOP_Acceptor.h @@ -20,12 +20,13 @@ #ifndef TAO_IIOP_ACCEPTOR_H #define TAO_IIOP_ACCEPTOR_H -#include "ace/Acceptor.h" -#include "ace/SOCK_Acceptor.h" #include "tao/Pluggable.h" #include "tao/Connect.h" #include "tao/Acceptor_Impl.h" +#include "ace/Acceptor.h" +#include "ace/SOCK_Acceptor.h" + // TAO IIOP_Acceptor concrete call defination class TAO_Export TAO_IIOP_Acceptor : public TAO_Acceptor @@ -63,6 +64,10 @@ public: CORBA::ULong endpoint_count (void); // return the number of profiles this will generate + const ACE_INET_Addr& address (void) const; + // @@ Helper method for the implementation repository, should go + // away + typedef TAO_Acceptor_Impl TAO_IIOP_BASE_ACCEPTOR; private: @@ -76,7 +81,6 @@ private: ACE_INET_Addr address_; ACE_CString host_; - u_short port_; // Cache the information about the endpoint serviced by this // acceptor. // @@ TODO there may in fact be multiple hostnames for this @@ -85,4 +89,8 @@ private: // each interface. }; +#if defined(__ACE_INLINE__) +#include "tao/IIOP_Acceptor.i" +#endif /* __ACE_INLINE__ */ + #endif /* TAO_IIOP_ACCEPTOR_H */ diff --git a/TAO/tao/IIOP_Acceptor.i b/TAO/tao/IIOP_Acceptor.i new file mode 100644 index 00000000000..d8d4b96d83e --- /dev/null +++ b/TAO/tao/IIOP_Acceptor.i @@ -0,0 +1,7 @@ +// $Id$ + +ACE_INLINE const ACE_INET_Addr& +TAO_IIOP_Acceptor::address (void) const +{ + return this->address_; +} -- cgit v1.2.1