summaryrefslogtreecommitdiff
path: root/TAO/tao/Connector_Registry.cpp
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1999-06-06 05:31:12 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1999-06-06 05:31:12 +0000
commit04083db794bd12b187bfda4dfcaa009256fd823a (patch)
tree1ffe7ee6c6ad40b2c91c430489d3de24b2a4bbf8 /TAO/tao/Connector_Registry.cpp
parent083a2168714bdbb769436248370f6f9b607cc17b (diff)
downloadATCD-04083db794bd12b187bfda4dfcaa009256fd823a.tar.gz
.
Diffstat (limited to 'TAO/tao/Connector_Registry.cpp')
-rw-r--r--TAO/tao/Connector_Registry.cpp110
1 files changed, 61 insertions, 49 deletions
diff --git a/TAO/tao/Connector_Registry.cpp b/TAO/tao/Connector_Registry.cpp
index fdf346a9589..fdb041e5d2e 100644
--- a/TAO/tao/Connector_Registry.cpp
+++ b/TAO/tao/Connector_Registry.cpp
@@ -20,18 +20,17 @@ TAO_Connector_Registry::~TAO_Connector_Registry (void)
TAO_Connector *
TAO_Connector_Registry::get_connector (CORBA::ULong tag)
{
-
TAO_ConnectorSetItor end =
- this->connectors_.end ();
+ this->connectors_.end ();
TAO_ConnectorSetItor connector =
- this->connectors_.begin ();
+ this->connectors_.begin ();
for (;
connector != end ;
connector++)
{
if ((*connector)->tag () == tag)
- return (*connector);
+ return *connector;
}
return 0;
}
@@ -41,11 +40,12 @@ TAO_Connector_Registry::open (TAO_ORB_Core *orb_core)
{
// Open one connector for each loaded protocol!
TAO_ProtocolFactorySetItor end =
- orb_core->protocol_factories ()->end ();
+ orb_core->protocol_factories ()->end ();
TAO_ProtocolFactorySetItor factory =
- orb_core->protocol_factories ()->begin ();
+ orb_core->protocol_factories ()->begin ();
TAO_Connector *connector = 0;
+
for ( ;
factory != end;
++factory)
@@ -68,15 +68,20 @@ int
TAO_Connector_Registry::close_all (void)
{
TAO_ConnectorSetItor end =
- this->connectors_.end ();
- for (TAO_ConnectorSetItor i = this->connectors_.begin (); i != end; ++i)
+ this->connectors_.end ();
+
+ for (TAO_ConnectorSetItor i = this->connectors_.begin ();
+ i != end;
+ ++i)
{
if (*i == 0)
continue;
+
(*i)->close ();
delete *i;
}
+
this->connectors_.reset ();
return 0;
}
@@ -84,23 +89,25 @@ TAO_Connector_Registry::close_all (void)
int
TAO_Connector_Registry::preconnect (TAO_EndpointSet &preconnections)
{
- TAO_EndpointSetIterator first_endpoint_set = preconnections.begin ();
- TAO_EndpointSetIterator last_endpoint_set = preconnections.end ();
+ TAO_EndpointSetIterator first_endpoint_set =
+ preconnections.begin ();
+ TAO_EndpointSetIterator last_endpoint_set =
+ preconnections.end ();
for (TAO_EndpointSetIterator i = first_endpoint_set;
i != last_endpoint_set;
++i)
{
- TAO_ConnectorSetItor first_connector = this->connectors_.begin ();
- TAO_ConnectorSetItor last_connector = this->connectors_.end ();
+ TAO_ConnectorSetItor first_connector =
+ this->connectors_.begin ();
+ TAO_ConnectorSetItor last_connector =
+ this->connectors_.end ();
for (TAO_ConnectorSetItor connector = first_connector;
- connector != last_connector ;
+ connector != last_connector;
++connector)
- {
- if (*connector)
- (*connector)->preconnect ((*i).c_str ());
- }
+ if (*connector)
+ (*connector)->preconnect ((*i).c_str ());
}
return 0; // Success
@@ -112,9 +119,10 @@ TAO_Connector_Registry::connect (TAO_Stub *&obj,
{
TAO_Profile *profile = obj->profile_in_use ();
- // here is where we get the appropriate connector object but we are
+ // Here is where we get the appropriate connector object but we are
// the Connector Registry so call get_connector(tag)
- TAO_Connector *connector = this->get_connector (profile->tag ());
+ TAO_Connector *connector =
+ this->get_connector (profile->tag ());
return connector->connect (profile, transport);
}
@@ -125,13 +133,14 @@ TAO_Connector_Registry::make_mprofile (const char *ior,
CORBA::Environment &ACE_TRY_ENV)
{
if (!ior)
- {
- ACE_THROW_RETURN (CORBA::MARSHAL (), -1);
- // Failure: Null IOR string pointer
- }
+ // Failure: Null IOR string pointer
+ ACE_THROW_RETURN (CORBA::MARSHAL (),
+ -1);
- TAO_ConnectorSetItor first_connector = this->connectors_.begin ();
- TAO_ConnectorSetItor last_connector = this->connectors_.end ();
+ TAO_ConnectorSetItor first_connector =
+ this->connectors_.begin ();
+ TAO_ConnectorSetItor last_connector =
+ this->connectors_.end ();
for (TAO_ConnectorSetItor connector = first_connector;
connector != last_connector;
@@ -139,27 +148,30 @@ TAO_Connector_Registry::make_mprofile (const char *ior,
{
if (*connector)
{
- if ((*connector)->make_mprofile (ior, mprofile, ACE_TRY_ENV) == 0)
- return 0; // Success
+ if ((*connector)->make_mprofile (ior,
+ mprofile,
+ ACE_TRY_ENV) == 0)
+ // Success.
+ return 0;
}
else
- {
- ACE_THROW_RETURN (CORBA::MARSHAL (), -1);
- // Failure: Null pointer to connector in connector registry
- }
+ // Failure: Null pointer to connector in connector registry.
+ ACE_THROW_RETURN (CORBA::MARSHAL (),
+ -1);
}
- ACE_THROW_RETURN (CORBA::MARSHAL (), -1);
- // Failure: None of the connectors were able to parse the
- // URL style IOR into an MProfile.
+ // Failure: None of the connectors were able to parse the URL style
+ // IOR into an MProfile.
+ ACE_THROW_RETURN (CORBA::MARSHAL (),
+ -1);
}
-TAO_Profile*
-TAO_Connector_Registry::create_profile (TAO_InputCDR& cdr)
+TAO_Profile *
+TAO_Connector_Registry::create_profile (TAO_InputCDR &cdr)
{
CORBA::ULong tag;
- // If there is an error we abort
+ // If there is an error we abort.
if ((cdr >> tag) == 0)
return 0;
@@ -176,9 +188,10 @@ TAO_Connector_Registry::create_profile (TAO_InputCDR& cdr)
tag));
}
- TAO_Profile* pfile;
- ACE_NEW_RETURN (pfile, TAO_Unknown_Profile (tag), 0);
-
+ TAO_Profile *pfile;
+ ACE_NEW_RETURN (pfile,
+ TAO_Unknown_Profile (tag),
+ 0);
if (pfile->decode (cdr) == -1)
{
pfile->_decr_refcnt ();
@@ -187,19 +200,18 @@ TAO_Connector_Registry::create_profile (TAO_InputCDR& cdr)
return pfile;
}
- // OK, we've got known profile.
- // It's going to be encapsulated ProfileData.
- // Create a new decoding stream and context for it, and skip the
- // data in the parent stream
+ // OK, we've got known profile. It's going to be encapsulated
+ // ProfileData. Create a new decoding stream and context for it,
+ // and skip the data in the parent stream
- // ProfileData is encoded as a sequence of octet. So first get
- // the length of the sequence.
+ // ProfileData is encoded as a sequence of octet. So first get the
+ // length of the sequence.
CORBA::ULong encap_len;
if ((cdr >> encap_len) == 0)
return 0;
- // Create the decoding stream from the encapsulation in the
- // buffer, and skip the encapsulation.
+ // Create the decoding stream from the encapsulation in the buffer,
+ // and skip the encapsulation.
TAO_InputCDR str (cdr, encap_len);
if (str.good_bit () == 0
@@ -221,4 +233,4 @@ template class ACE_Unbounded_Set_Iterator<TAO_Connector*>;
#pragma instantiate ACE_Unbounded_Set<TAO_Connector*>
#pragma instantiate ACE_Unbounded_Set_Iterator<TAO_Connector*>
-#endif
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */