summaryrefslogtreecommitdiff
path: root/TAO/tao/params.cpp
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-05-27 00:25:23 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-05-27 00:25:23 +0000
commit6120ebbb2351296f43f6be77ca8d2acede87204a (patch)
tree15d11034396d9c886c7021605705a7f0370f5d98 /TAO/tao/params.cpp
parent457f8b0edf17c7abc57be85dcd78f5974057c01b (diff)
downloadATCD-6120ebbb2351296f43f6be77ca8d2acede87204a.tar.gz
ChangeLogTag:Wed May 26 18:51:39 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
Diffstat (limited to 'TAO/tao/params.cpp')
-rw-r--r--TAO/tao/params.cpp102
1 files changed, 102 insertions, 0 deletions
diff --git a/TAO/tao/params.cpp b/TAO/tao/params.cpp
index fafb7007d57..0c0bf82167a 100644
--- a/TAO/tao/params.cpp
+++ b/TAO/tao/params.cpp
@@ -26,3 +26,105 @@ TAO_ORB_Parameters::~TAO_ORB_Parameters (void)
// Delete the table.
delete this->ior_lookup_table_;
}
+
+int
+TAO_ORB_Parameters::parse_endpoints (ACE_CString &endpoints,
+ TAO_EndpointSet &endpoints_list)
+{
+ // Parse the string into seperate endpoints, where `endpoints' is of
+ // the form:
+ //
+ // protocol1:V.v//addr1,...,addrN/;protocol2:W.w//addr1,...,addrN/;...
+ //
+ // A single endpoint, instead of several, can be added just as well.
+
+ int status = 0;
+ // Return code: 0 = success, 1 = failure
+
+ const char endpoints_delimiter = ';';
+
+ int length = endpoints.length ();
+
+ if (endpoints[0] == endpoints_delimiter ||
+ endpoints[length - 1] == endpoints_delimiter)
+ {
+ return -1;
+ // Failure: endpoints string has an empty endpoint at the beginning
+ // or the end of the string (e.g. ";uiop://foo;iiop:1.3//bar")
+ }
+
+ if (length > 0)
+ {
+ int endpoints_count = 1;
+
+ for (int j = 0; j != length; ++j)
+ {
+ if (endpoints[j] == endpoints_delimiter)
+ endpoints_count++;
+ }
+
+ int begin = 0;
+ int end = endpoints.find (endpoints_delimiter);
+
+ for (int i = 0; i < endpoints_count; ++i)
+ {
+ if (end == 0)
+ {
+ // Handle case where two consecutive endpoints `;;'
+ // delimiters are found within the endpoints set.
+ //
+ // Is it enough to just skip over it or should we return an
+ // error?
+ continue;
+ }
+
+ ACE_CString endpt = endpoints.substring (begin, end);
+ // The substring call will work even if `end' is equal to
+ // ACE_CString::npos since that will just extract the substring
+ // from the offset `begin' to the end of the string.
+
+ // Check for a valid URL style endpoint set
+ int check_offset = endpt.find (':');
+
+ if (check_offset > 0 &&
+ check_offset != endpt.npos &&
+ endpt.find ("//", check_offset + 1) != endpt.npos)
+ {
+ endpoints_list.insert (endpt);
+ // Insert endpoint into list
+ }
+ else
+ status = -1; // Error: invalid URL style endpoint set
+
+ begin += end + 1;
+ end = endpoints.find (endpoints_delimiter, begin);
+ }
+ }
+ else
+ {
+ status = -1;
+ // Failure: Empty string
+ }
+
+ return status;
+}
+
+
+#if defined (ACE_EXPLICIT_TEMPLATE_INSTANTIATION)
+
+template class ACE_Node<ACE_Cstring>;
+
+template class ACE_Unbounded_Set<ACE_CString>;
+
+template class ACE_Unbounded_Set_Iterator<ACE_CString, ACE_Null_Mutex>;
+
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+
+#pragma instantiate ACE_Node<ACE_Cstring>
+
+#pragma instantiate ACE_Unbounded_Set<ACE_CString>
+
+#pragma instantiate ACE_Unbounded_Set_Iterator<ACE_CString, ACE_Null_Mutex>
+
+
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */