Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / Acceptor_Registry.h
blob1c6b55069648e8851836a572ddd241603b10b123
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Acceptor_Registry.h
7 * Interface for the TAO pluggable protocol framework.
9 * @author Fred Kuhns <fredk@cs.wustl.edu>
10 * @author Ossama Othman <ossama@uci.edu>
12 //=============================================================================
14 #ifndef TAO_ACCEPTOR_REGISTRY_H
15 #define TAO_ACCEPTOR_REGISTRY_H
17 #include /**/ "ace/pre.h"
18 #include "ace/Unbounded_Set.h"
20 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 # pragma once
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
24 #include /**/ "tao/TAO_Export.h"
25 #include "tao/Exception.h"
26 #include "tao/params.h"
28 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
29 class ACE_Addr;
30 class ACE_Reactor;
31 ACE_END_VERSIONED_NAMESPACE_DECL
33 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
35 class TAO_ORB_Core;
36 class TAO_Acceptor;
37 class TAO_Acceptor_Filter;
38 class TAO_Stub;
39 class TAO_Profile;
40 class TAO_MProfile;
41 class TAO_Protocol_Factory;
42 class TAO_Protocol_Item;
44 typedef ACE_Unbounded_Set_Iterator<TAO_Protocol_Item *>
45 TAO_ProtocolFactorySetItor;
47 typedef TAO_Acceptor** TAO_AcceptorSetIterator;
49 /**
50 * @class TAO_Acceptor_Registry
52 * @brief Acceptor Registry and Generic Acceptor interface definitions.
53 * All loaded ESIOP or GIOP acceptor bridges must register with
54 * this object.
56 * This class maintains a list of acceptor factories for all loaded ORB
57 * protocols. There is one Acceptor_Registry per ORB_Core.
59 class TAO_Export TAO_Acceptor_Registry
61 public:
62 /// Default constructor.
63 TAO_Acceptor_Registry () = default;
65 /// Default destructor.
66 ~TAO_Acceptor_Registry ();
68 /// Initialize all registered acceptors. Return -1 on error.
69 int open (TAO_ORB_Core *orb_core,
70 ACE_Reactor *reactor,
71 const TAO_EndpointSet &endpoint_set,
72 bool ignore_address);
74 /// Close all open acceptors.
75 int close_all ();
77 /// Returns the total number of endpoints in all of its acceptors.
78 size_t endpoint_count ();
80 /// Check if there is at least one profile in @a mprofile that
81 /// corresponds to a collocated object.
82 bool is_collocated (const TAO_MProfile& mprofile);
84 /// Return the acceptor bridges
85 TAO_Acceptor *get_acceptor (CORBA::ULong tag);
87 // = Iterator.
88 TAO_AcceptorSetIterator begin ();
89 TAO_AcceptorSetIterator end ();
91 private:
92 TAO_Acceptor_Registry (const TAO_Acceptor_Registry &) = delete;
93 TAO_Acceptor_Registry &operator= (const TAO_Acceptor_Registry &) = delete;
95 /// Create a default acceptor for all loaded protocols.
96 int open_default (TAO_ORB_Core *orb_core,
97 ACE_Reactor *reactor,
98 const char *options);
100 /// Create a default acceptor using the specified protocol factory.
101 int open_default (TAO_ORB_Core *orb_core,
102 ACE_Reactor *reactor,
103 int major,
104 int minor,
105 TAO_ProtocolFactorySetItor &factory,
106 const char *options);
108 /// Open a default acceptor.
109 int open_default_i (TAO_ORB_Core *orb_core,
110 ACE_Reactor *reactor,
111 int major,
112 int minor,
113 TAO_ProtocolFactorySetItor &factory,
114 TAO_Acceptor* acceptor,
115 const char *options);
117 /// Extract endpoint-specific options from the endpoint string.
118 void extract_endpoint_options (ACE_CString &addrs,
119 ACE_CString &options,
120 TAO_Protocol_Factory *factory);
122 /// Extract endpoint/address specific version from the endpoint
123 /// string.
124 void extract_endpoint_version (ACE_CString &address,
125 int &major,
126 int &minor);
128 /// Iterator through addrs in the string <iop>, and create an
129 /// acceptor for each one.
130 int open_i (TAO_ORB_Core *orb_core,
131 ACE_Reactor *reactor,
132 ACE_CString &address,
133 TAO_ProtocolFactorySetItor &factory,
134 bool ignore_address);
136 private:
137 /// List of acceptors that are currently open.
138 TAO_Acceptor **acceptors_ {};
140 /// Number of acceptors that are currently open.
141 size_t size_ {};
144 TAO_END_VERSIONED_NAMESPACE_DECL
146 #if defined(__ACE_INLINE__)
147 #include "tao/Acceptor_Registry.inl"
148 #endif /* __ACE_INLINE__ */
150 #include /**/ "ace/post.h"
152 #endif /* TAO_ACCEPTOR_REGISTRY_H */