summaryrefslogtreecommitdiff
path: root/TAO/tao/ORB.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/tao/ORB.cpp')
-rw-r--r--TAO/tao/ORB.cpp631
1 files changed, 230 insertions, 401 deletions
diff --git a/TAO/tao/ORB.cpp b/TAO/tao/ORB.cpp
index 0be668c7183..271d176232b 100644
--- a/TAO/tao/ORB.cpp
+++ b/TAO/tao/ORB.cpp
@@ -16,6 +16,7 @@
#include "tao/Object.h"
#include "tao/Typecode.h"
+#include "tao/InconsistentTypeCodeC.h"
#include "tao/NVList.h"
#include "tao/Stub.h"
#include "tao/IIOP_Profile.h"
@@ -32,11 +33,6 @@
#include "tao/IIOP_Acceptor.h"
#include "tao/Object_Adapter.h"
#include "tao/POA.h"
-#include "tao/Request.h"
-#ifdef TAO_HAS_VALUETYPE
-# include "tao/ValueFactory_Map.h"
-#endif /* TAO_HAS_VALUETYPE */
-
#if !defined (__ACE_INLINE__)
# include "tao/ORB.i"
@@ -71,6 +67,49 @@ ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_ORB_Timeprobe_Description,
#endif /* ACE_ENABLE_TIMEPROBES */
+#if !defined (TAO_HAS_MINIMUM_CORBA)
+
+// Typecode stuff for the InconsistentTypeCode exception
+static const CORBA::Long _oc_CORBA_ORB_InconsistentTypeCode[] =
+{
+ TAO_ENCAP_BYTE_ORDER, // byte order
+ 47,
+ ACE_NTOHL (0x49444c3a),
+ ACE_NTOHL (0x6f6d672e),
+ ACE_NTOHL (0x6f72672f),
+ ACE_NTOHL (0x434f5242),
+ ACE_NTOHL (0x412f4f52),
+ ACE_NTOHL (0x422f496e),
+ ACE_NTOHL (0x636f6e73),
+ ACE_NTOHL (0x69737465),
+ ACE_NTOHL (0x6e745479),
+ ACE_NTOHL (0x7065436f),
+ ACE_NTOHL (0x64653a31),
+ ACE_NTOHL (0x2e3000fd), // repository ID =
+ // IDL:omg.org/CORBA/ORB/InconsistentTypeCode:1.0
+ 21,
+ ACE_NTOHL (0x496e636f),
+ ACE_NTOHL (0x6e736973),
+ ACE_NTOHL (0x74656e74),
+ ACE_NTOHL (0x54797065),
+ ACE_NTOHL (0x436f6465),
+ ACE_NTOHL (0xfdfdfd), // name = InconsistentTypeCode
+ 0, // member count
+};
+
+static CORBA::TypeCode _tc_TAO_tc_CORBA_ORB_InconsistentTypeCode (
+ CORBA::tk_except,
+ sizeof (_oc_CORBA_ORB_InconsistentTypeCode),
+ (char *) &_oc_CORBA_ORB_InconsistentTypeCode,
+ 0,
+ sizeof (CORBA_ORB_InconsistentTypeCode));
+
+// ORB exception typecode initialization.
+CORBA::TypeCode_ptr CORBA_ORB::_tc_InconsistentTypeCode =
+ &_tc_TAO_tc_CORBA_ORB_InconsistentTypeCode;
+
+#endif /* TAO_HAS_MINIMUM_CORBA */
+
// = Static initialization.
// Count of the number of ORBs.
@@ -79,7 +118,27 @@ int CORBA_ORB::orb_init_count_ = 0;
// Pointer to the "default ORB."
CORBA::ORB_ptr CORBA::instance_ = 0;
-// ****************************************************************
+CORBA_String_var::CORBA_String_var (char *p)
+ : ptr_ (p)
+{
+ // NOTE: According to the CORBA spec this string must *not* be
+ // copied, but it is non-compliant to use it/release it in the
+ // calling code. argument is consumed. p should never be NULL
+}
+
+CORBA_String_var::CORBA_String_var (const CORBA_String_var& r)
+{
+ this->ptr_ = CORBA::string_dup (r.ptr_);
+}
+
+CORBA_String_var::~CORBA_String_var (void)
+{
+ if (this->ptr_ != 0)
+ {
+ CORBA::string_free (this->ptr_);
+ this->ptr_ = 0;
+ }
+}
CORBA_ORB::InvalidName::InvalidName (void)
{
@@ -108,7 +167,7 @@ CORBA_ORB::InvalidName::_is_a (const char* interface_id) const
|| CORBA_UserException::_is_a (interface_id));
}
-CORBA_ORB::CORBA_ORB (TAO_ORB_Core *orb_core)
+CORBA_ORB::CORBA_ORB (TAO_ORB_Core* orb_core)
: refcount_ (1),
open_called_ (0),
shutdown_lock_ (0),
@@ -118,9 +177,6 @@ CORBA_ORB::CORBA_ORB (TAO_ORB_Core *orb_core)
event_service_ (CORBA_Object::_nil ()),
trading_service_ (CORBA_Object::_nil ()),
orb_core_ (orb_core),
-# ifdef TAO_HAS_VALUETYPE
- valuetype_factory_map_ (0),
-# endif /* TAO_HAS_VALUETYPE */
use_omg_ior_format_ (1),
optimize_collocation_objects_ (1)
{
@@ -167,10 +223,6 @@ CORBA_ORB::~CORBA_ORB (void)
CORBA::release (this->event_service_);
if (!CORBA::is_nil (this->trading_service_))
CORBA::release (this->trading_service_);
-# ifdef TAO_HAS_VALUETYPE
- // delete valuetype_factory_map_;
- // not really, its a singleton
-# endif /* TAO_HAS_VALUETYPE */
delete this->cond_become_leader_;
}
@@ -191,8 +243,7 @@ CORBA_ORB::open (void)
this->open_called_ = 1;
- TAO_Server_Strategy_Factory *f =
- this->orb_core_->server_factory ();
+ TAO_Server_Strategy_Factory *f = this->orb_core_->server_factory ();
// @@ For now we simple assume an IIOP handler, in the future
// @@ this has to be more general
@@ -203,8 +254,8 @@ CORBA_ORB::open (void)
// activate the acceptor with the reactor and insert it in the
// Acceptor Registry.
TAO_IIOP_BASE_ACCEPTOR *iiop_acceptor =
- ACE_dynamic_cast (TAO_IIOP_BASE_ACCEPTOR *,
- this->orb_core_->acceptor ()->acceptor ());
+ ACE_dynamic_cast(TAO_IIOP_BASE_ACCEPTOR *,
+ this->orb_core_->acceptor ()->acceptor ());
// Initialize the endpoint ... or try!
@@ -259,23 +310,21 @@ CORBA_ORB::shutdown (CORBA::Boolean wait_for_completion)
void
CORBA_ORB::create_list (CORBA::Long count,
- CORBA::NVList_ptr &new_list,
- CORBA_Environment &)
+ CORBA::NVList_ptr &retval)
{
assert (CORBA::ULong (count) <= UINT_MAX);
- // Create an empty list
- new_list = new CORBA::NVList;
+ // create an empty list
+ retval = new CORBA::NVList;
- // If count is greater than 0, create a list of NamedValues.
+ // if count is greater than 0, create a list of NamedValues
if (count != 0)
{
- new_list->max_ = (CORBA::ULong) count;
-
+ retval->max_ = (CORBA::ULong) count;
for (CORBA::Long i=0; i < count; i++)
{
CORBA::NamedValue_ptr nv = new CORBA::NamedValue;
- new_list->values_.enqueue_tail (nv);
+ retval->values_.enqueue_tail (nv);
}
}
}
@@ -292,7 +341,6 @@ CORBA_ORB::perform_work (const ACE_Time_Value &tv)
r->owner (ACE_Thread::self ());
ACE_Time_Value tmp_tv (tv);
-
return r->handle_events (tmp_tv);
}
@@ -303,89 +351,6 @@ CORBA_ORB::work_pending (void)
return 1;
}
-// The following functions are not implemented - they just throw
-// CORBA::NO_IMPLEMENT.
-
-void
-CORBA_ORB::create_exception_list (CORBA::ExceptionList_ptr &,
- CORBA_Environment &ACE_TRY_ENV)
-{
- ACE_THROW (CORBA::NO_IMPLEMENT (TAO_DEFAULT_MINOR_CODE,
- CORBA::COMPLETED_NO));
-}
-
-void
-CORBA_ORB::create_environment (CORBA::Environment_ptr &,
- CORBA_Environment &ACE_TRY_ENV)
-{
- ACE_THROW (CORBA::NO_IMPLEMENT (TAO_DEFAULT_MINOR_CODE,
- CORBA::COMPLETED_NO));
-}
-
-CORBA::Boolean
-CORBA_ORB::get_service_information (CORBA::ServiceType service_type,
- CORBA::ServiceInformation_out service_information,
- CORBA::Environment &ACE_TRY_ENV)
-{
- return 0;
-}
-
-void
-CORBA_ORB::create_named_value (CORBA::NamedValue_ptr &,
- CORBA_Environment &ACE_TRY_ENV)
-{
- ACE_THROW (CORBA::NO_IMPLEMENT (TAO_DEFAULT_MINOR_CODE,
- CORBA::COMPLETED_NO));
-}
-
-void
-CORBA_ORB::create_context_list (CORBA::ContextList_ptr &,
- CORBA_Environment &ACE_TRY_ENV)
-{
- ACE_THROW (CORBA::NO_IMPLEMENT (TAO_DEFAULT_MINOR_CODE,
- CORBA::COMPLETED_NO));
-}
-
-void
-CORBA_ORB::get_default_context (CORBA::Context_ptr &,
- CORBA_Environment &ACE_TRY_ENV)
-{
- ACE_THROW (CORBA::NO_IMPLEMENT (TAO_DEFAULT_MINOR_CODE,
- CORBA::COMPLETED_NO));
-}
-
-void
-CORBA_ORB::send_multiple_requests_oneway (const CORBA_ORB_RequestSeq,
- CORBA_Environment &ACE_TRY_ENV)
-{
- ACE_THROW (CORBA::NO_IMPLEMENT (TAO_DEFAULT_MINOR_CODE,
- CORBA::COMPLETED_NO));
-}
-
-void
-CORBA_ORB::send_multiple_requests_deferred (const CORBA_ORB_RequestSeq,
- CORBA_Environment &ACE_TRY_ENV)
-{
- ACE_THROW (CORBA::NO_IMPLEMENT (TAO_DEFAULT_MINOR_CODE,
- CORBA::COMPLETED_NO));
-}
-
-void
-CORBA_ORB::get_next_response (CORBA_Request_ptr &,
- CORBA_Environment &ACE_TRY_ENV)
-{
- ACE_THROW (CORBA::NO_IMPLEMENT (TAO_DEFAULT_MINOR_CODE,
- CORBA::COMPLETED_NO));
-}
-
-CORBA::Boolean
-CORBA_ORB::poll_next_response (CORBA_Environment &ACE_TRY_ENV)
-{
- ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (TAO_DEFAULT_MINOR_CODE,
- CORBA::COMPLETED_NO),
- 0);
-}
-
#endif /* TAO_HAS_MINIMUM_CORBA */
int
@@ -434,7 +399,7 @@ CORBA_ORB::run (ACE_Time_Value *tv,
while (this->should_shutdown () == 0)
{
#if 0
- counter++;
+ ^ counter++;
if (counter == max_iterations)
{
ACE_TIMEPROBE_PRINT;
@@ -512,8 +477,13 @@ CORBA_ORB::resolve_root_poa (CORBA::Environment &ACE_TRY_ENV,
CORBA_Object_ptr
CORBA_ORB::resolve_poa_current (CORBA::Environment &ACE_TRY_ENV)
{
- // Return the pointer to the POA Current.
- return this->orb_core_->poa_current ()._this (ACE_TRY_ENV);
+ // Return the pointer to this thread's POACurrent.
+
+ TAO_POA_Current *poa_current = this->orb_core_->poa_current ();
+ if (poa_current == 0)
+ return CORBA_Object::_nil ();
+
+ return poa_current->_this (ACE_TRY_ENV);
}
CORBA_Object_ptr
@@ -547,7 +517,7 @@ CORBA_ORB::resolve_policy_current (CORBA::Environment& ACE_TRY_ENV)
}
CORBA_Object_ptr
-CORBA_ORB::resolve_service (const char *service_name,
+CORBA_ORB::resolve_service (CORBA::String service_name,
ACE_Time_Value *timeout,
CORBA::Environment& ACE_TRY_ENV)
{
@@ -682,133 +652,126 @@ CORBA_ORB::multicast_query (char *buf,
ACE_INET_Addr my_addr;
ACE_SOCK_Acceptor acceptor;
ACE_SOCK_Stream stream;
- ACE_SOCK_Dgram dgram;
-
- ssize_t result = 0;
// Bind listener to any port and then find out what the port was.
if (acceptor.open (ACE_Addr::sap_any) == -1
|| acceptor.get_local_addr (my_addr) == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "acceptor.open () || "
- "acceptor.get_local_addr () failed"));
- result = -1;
- }
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "acceptor.open () || "
+ "acceptor.get_local_addr () failed"),
+ -1);
+
+ // Send a Multicast with service name and a port no.
+ ACE_SOCK_Dgram dgram;
+
+ // This starts out initialized to all zeros!
+ ACE_INET_Addr multicast_addr (port,
+ ACE_DEFAULT_MULTICAST_ADDR);
+
+ // Open the datagram.
+ if (dgram.open (ACE_Addr::sap_any) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to open the Datagram!\n"),
+ -1);
+
+ // Convert the port that we are listening at to Network Byte Order.
+ ACE_UINT16 response_port =
+ ACE_HTONS (my_addr.get_port_number ());
+
+ // Length of data to be sent. This is sent as a header.
+ CORBA::Short data_len =
+ ACE_HTONS (sizeof (ACE_UINT16) + ACE_OS::strlen (service_name));
+
+ // Vector to be sent.
+ const int iovcnt = 3;
+ iovec iovp[iovcnt];
+
+ // The length of data to be sent.
+ iovp[0].iov_base = (char *) &data_len;
+ iovp[0].iov_len = sizeof (CORBA::Short);
+
+ // The port at which we are listening.
+ iovp[1].iov_base = (char *) &response_port;
+ iovp[1].iov_len = sizeof (ACE_UINT16);
+
+ // The service name string.
+ iovp[2].iov_base = (char *) service_name;
+ iovp[2].iov_len = ACE_OS::strlen (service_name);
+
+ // Send the multicast.
+ ssize_t result = dgram.send (iovp,
+ iovcnt,
+ multicast_addr);
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "\nsent multicast request."));
+
+ // Check for errors.
+ if (result == -1)
+ ACE_ERROR ((LM_ERROR,
+ "%p\n",
+ "error sending IIOP multicast"));
else
{
- // This starts out initialized to all zeros!
- ACE_INET_Addr multicast_addr (port,
- ACE_DEFAULT_MULTICAST_ADDR);
- // Open the datagram.
- if (dgram.open (ACE_Addr::sap_any) == -1)
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "\n%s; Sent multicast."
+ "# of bytes sent is %d.\n",
+ __FILE__,
+ result));
+
+ // Wait for response until
+ // TAO_DEFAULT_SERVICE_RESOLUTION_TIMEOUT.
+ ACE_Time_Value tv (timeout == 0
+ ? ACE_Time_Value (TAO_DEFAULT_SERVICE_RESOLUTION_TIMEOUT)
+ : *timeout);
+
+ // Accept reply connection from server.
+ if (acceptor.accept (stream,
+ 0,
+ &tv) == -1)
{
ACE_ERROR ((LM_ERROR,
- "Unable to open the Datagram!\n"));
+ "%p\n",
+ "multicast_query: unable to accept"));
result = -1;
}
else
{
- // Convert the port we're listening on into network byte
- // order.
- ACE_UINT16 response_port =
- ACE_HTONS (my_addr.get_port_number ());
-
- // Length of data to be sent. This is sent as a header.
- CORBA::Short data_len =
- ACE_HTONS (sizeof (ACE_UINT16)
- + ACE_OS::strlen (service_name));
-
- // Vector to be sent.
- const int iovcnt = 3;
- iovec iovp[iovcnt];
-
- // The length of data to be sent.
- iovp[0].iov_base = (char *) &data_len;
- iovp[0].iov_len = sizeof (CORBA::Short);
-
- // The port at which we are listening.
- iovp[1].iov_base = (char *) &response_port;
- iovp[1].iov_len = sizeof (ACE_UINT16);
-
- // The service name string.
- iovp[2].iov_base = (char *) service_name;
- iovp[2].iov_len = ACE_OS::strlen (service_name);
-
- // Send the multicast.
- result = dgram.send (iovp,
- iovcnt,
- multicast_addr);
-
- if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG,
- "\nsent multicast request."));
+ // Receive the IOR.
+ result = stream.recv (buf,
+ BUFSIZ,
+ 0,
+ timeout);
+ // Close socket now.
+ stream.close ();
// Check for errors.
if (result == -1)
ACE_ERROR ((LM_ERROR,
"%p\n",
- "error sending IIOP multicast"));
+ "error reading IIOP multicast response"));
else
{
+ // Null terminate message.
+ buf[result] = 0;
+
if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG,
- "\n%s; Sent multicast."
- "# of bytes sent is %d.\n",
+ "%s: service resolved to IOR <%s>\n",
__FILE__,
- result));
- // Wait for response until
- // TAO_DEFAULT_SERVICE_RESOLUTION_TIMEOUT.
- ACE_Time_Value tv (timeout == 0
- ? ACE_Time_Value (TAO_DEFAULT_SERVICE_RESOLUTION_TIMEOUT)
- : *timeout);
- // Accept reply connection from server.
- if (acceptor.accept (stream,
- 0,
- &tv) == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "%p\n",
- "multicast_query: unable to accept"));
- result = -1;
- }
- else
- {
- // Receive the IOR.
- result = stream.recv (buf,
- BUFSIZ,
- 0,
- timeout);
- // Close socket now.
- stream.close ();
-
- // Check for errors.
- if (result == -1)
- ACE_ERROR ((LM_ERROR,
- "%p\n",
- "error reading IIOP multicast response"));
- else
- {
- // Null terminate message.
- buf[result] = 0;
-
- if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG,
- "%s: service resolved to IOR <%s>\n",
- __FILE__,
- buf));
- }
- }
+ buf));
}
}
}
- // We don't need the dgram or acceptor anymore.
+ // We don't need the dgram anymore. Make sure this is closed way
+ // down here to avoid race conditions...
dgram.close ();
- acceptor.close ();
return result == -1 ? -1 : 0;
}
+
// @@ This will have to be sanitized of transport specific calls
// in order to support pluggable protocols! But, it does use
// UDP and multicast. Not all transport protocols may support
@@ -849,7 +812,7 @@ CORBA_ORB::multicast_to_service (const char * service_name,
}
CORBA_Object_ptr
-CORBA_ORB::resolve_initial_references (const char *name,
+CORBA_ORB::resolve_initial_references (CORBA::String name,
CORBA_Environment &TAO_IN_ENV)
{
return this->resolve_initial_references (name,
@@ -858,7 +821,7 @@ CORBA_ORB::resolve_initial_references (const char *name,
}
CORBA_Object_ptr
-CORBA_ORB::resolve_initial_references (const char *name,
+CORBA_ORB::resolve_initial_references (CORBA::String name,
ACE_Time_Value *timeout,
CORBA_Environment &ACE_TRY_ENV)
{
@@ -939,27 +902,18 @@ CORBA_ORB::resolve_initial_references (const char *name,
return this->resolve_service (name, timeout, ACE_TRY_ENV);
}
-// Unimplemented at this time.
-CORBA_ORB_ObjectIdList_ptr
-CORBA_ORB::list_initial_services (CORBA::Environment &ACE_TRY_ENV)
-{
- ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (TAO_DEFAULT_MINOR_CODE,
- CORBA::COMPLETED_NO),
- 0);
-}
-
TAO_Stub *
CORBA_ORB::create_stub_object (const TAO_ObjectKey &key,
const char *type_id,
CORBA::Environment &ACE_TRY_ENV)
{
if (this->open () == -1)
- ACE_THROW_RETURN (CORBA::INTERNAL (), 0);
+ ACE_THROW_RETURN (CORBA::INTERNAL (CORBA::COMPLETED_NO), 0);
CORBA::String id = 0;
if (type_id)
- id = CORBA::string_dup (type_id);
+ id = CORBA::string_copy (type_id);
TAO_Stub *stub = 0;
@@ -970,7 +924,11 @@ CORBA_ORB::create_stub_object (const TAO_ObjectKey &key,
// @@ Fred, please change this code to use auto_ptr<> and
// automatically deallocate the temporary objects. Alternatively
// consider about using references ;-)
- TAO_MProfile mp (1);
+ TAO_MProfile *mp;
+ ACE_NEW_THROW_EX (mp,
+ TAO_MProfile (1),
+ CORBA::NO_MEMORY (CORBA::COMPLETED_MAYBE));
+ ACE_CHECK_RETURN (stub);
TAO_ORB_Parameters *orb_params =
this->orb_core_->orb_params ();
@@ -981,14 +939,14 @@ CORBA_ORB::create_stub_object (const TAO_ObjectKey &key,
orb_params->addr ().get_port_number (),
key,
orb_params->addr ()),
- CORBA::NO_MEMORY (TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_MAYBE));
+ CORBA::NO_MEMORY (CORBA::COMPLETED_MAYBE));
ACE_CHECK_RETURN (stub);
- mp.give_profile (pfile);
+ mp->give_profile (pfile);
ACE_NEW_THROW_EX (stub,
TAO_Stub (id, mp, this->orb_core_),
- CORBA::NO_MEMORY (TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_MAYBE));
+ CORBA::NO_MEMORY (CORBA::COMPLETED_MAYBE));
ACE_CHECK_RETURN (stub);
return stub;
@@ -1013,7 +971,7 @@ CORBA_ORB::key_to_object (const TAO_ObjectKey &key,
if (CORBA::is_nil (new_obj))
{
data->_decr_refcnt ();
- env.exception (new CORBA::INTERNAL ());
+ env.exception (new CORBA::INTERNAL (CORBA::COMPLETED_NO));
return CORBA::Object::_nil ();
}
@@ -1090,37 +1048,22 @@ CORBA_ORB::create_dyn_enum (CORBA_TypeCode_ptr tc,
#endif /* TAO_HAS_MINIMUM_CORBA */
-// ****************************************************************
-
// String utility support; this needs to be integrated with the ORB's
// own memory allocation subsystem.
-CORBA::Char*
+CORBA::String
CORBA::string_copy (const CORBA::Char *str)
{
- return CORBA::string_dup (str);
-}
+ if (!str)
+ return 0;
-CORBA_String_var::CORBA_String_var (char *p)
- : ptr_ (p)
-{
- // NOTE: According to the CORBA spec this string must *not* be
- // copied, but it is non-compliant to use it/release it in the
- // calling code. argument is consumed. p should never be NULL
-}
+ size_t len = ACE_OS::strlen (str);
-CORBA_String_var::CORBA_String_var (const CORBA_String_var& r)
-{
- this->ptr_ = CORBA::string_dup (r.ptr_);
-}
+ // This allocates an extra byte for the '\0';
+ CORBA::String copy = CORBA::string_alloc (len);
-CORBA_String_var::~CORBA_String_var (void)
-{
- if (this->ptr_ != 0)
- {
- CORBA::string_free (this->ptr_);
- this->ptr_ = 0;
- }
+ ACE_OS::memcpy (copy, str, len + 1);
+ return copy;
}
CORBA_String_var &
@@ -1157,66 +1100,31 @@ CORBA_String_var::operator= (const CORBA_String_var& r)
return *this;
}
-// ****************************************************************
-
-CORBA_WString_var::CORBA_WString_var (CORBA::WChar *p)
- : ptr_ (p)
-{
- // NOTE: According to the CORBA spec this string must *not* be
- // copied, but it is non-compliant to use it/release it in the
- // calling code. argument is consumed. p should never be NULL
-}
-
-CORBA_WString_var::CORBA_WString_var (const CORBA_WString_var& r)
-{
- this->ptr_ = CORBA::wstring_dup (r.ptr_);
-}
-
-CORBA_WString_var::~CORBA_WString_var (void)
-{
- if (this->ptr_ != 0)
- {
- CORBA::wstring_free (this->ptr_);
- this->ptr_ = 0;
- }
-}
+// Wide Character string utility support; this can need to be
+// integrated with the ORB's own memory allocation subsystem.
-CORBA_WString_var &
-CORBA_WString_var::operator= (CORBA::WChar *p)
+CORBA::WString
+CORBA::wstring_alloc (CORBA::ULong len)
{
- if (this->ptr_ != p)
- {
- if (this->ptr_ != 0)
- CORBA::wstring_free (this->ptr_);
- this->ptr_ = p;
- }
- return *this;
+ return new CORBA::WChar [(size_t) (len + 1)];
}
-CORBA_WString_var &
-CORBA_WString_var::operator= (const CORBA::WChar *p)
+CORBA::WString
+CORBA::wstring_copy (const CORBA::WChar *const str)
{
- if (this->ptr_ != 0)
- CORBA::wstring_free (this->ptr_);
+ if (!str)
+ return 0;
- this->ptr_ = CORBA::wstring_dup (p);
- return *this;
+ CORBA::WString retval = CORBA::wstring_alloc (ACE_OS::wslen (str));
+ return ACE_OS::wscpy (retval, str);
}
-CORBA_WString_var &
-CORBA_WString_var::operator= (const CORBA_WString_var& r)
+void
+CORBA::wstring_free (CORBA::WChar *const str)
{
- if (this != &r)
- {
- if (this->ptr_ != 0)
- CORBA::wstring_free (this->ptr_);
- this->ptr_ = CORBA::wstring_dup (r.ptr_);
- }
- return *this;
+ delete [] str;
}
-// ****************************************************************
-
void
CORBA_ORB::init_orb_globals (CORBA::Environment &ACE_TRY_ENV)
{
@@ -1270,7 +1178,7 @@ CORBA_ORB::init_orb_globals (CORBA::Environment &ACE_TRY_ENV)
sizeof (CORBA::WChar),
sizeof (void *)));
- ACE_THROW (CORBA::INITIALIZE ());
+ ACE_THROW (CORBA::INITIALIZE (CORBA::COMPLETED_NO));
}
}
CORBA_ORB::orb_init_count_++;
@@ -1313,7 +1221,7 @@ CORBA::ORB_init (int &argc,
// Check for errors and return 0 if error.
if (result == -1)
{
- ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0);
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::COMPLETED_NO), 0);
}
// This (init_orb_globals) must come *after* ORB Core initialization.
@@ -1488,7 +1396,7 @@ CORBA_ORB::ior_string_to_object (const char *str,
if (tmp [0] && !isspace (tmp [0]))
{
- ACE_THROW_RETURN (CORBA::BAD_PARAM (),
+ ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::COMPLETED_NO),
CORBA::Object::_nil ());
}
@@ -1524,7 +1432,10 @@ CORBA_ORB::iiop_string_to_object (const char *string,
// _narrow will be required to make an expensive remote "is_a" call.
// Allocate a Multiple Profile with the given no. of profiles.
- TAO_MProfile mp (1);
+ TAO_MProfile *mp;
+ ACE_NEW_RETURN (mp,
+ TAO_MProfile (1),
+ obj);
TAO_Profile* pfile;
ACE_NEW_RETURN (pfile,
@@ -1533,7 +1444,7 @@ CORBA_ORB::iiop_string_to_object (const char *string,
ACE_CHECK_RETURN (obj);
// pfile refcount == 1
- mp.give_profile (pfile);
+ mp->give_profile (pfile);
// Now make the TAO_Stub ...
TAO_Stub *data;
@@ -1565,10 +1476,6 @@ CORBA::Object_ptr
CORBA_ORB::iioploc_string_to_object (const char *string,
CORBA::Environment &env)
{
- if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG,
- "TAO (%P|%t) - iioploc_string_to_object <%s>\n",
- string));
CORBA::Object_ptr obj = CORBA::Object::_nil ();
// NIL objref encodes as just "iioploc:" ... which has already been
@@ -1618,7 +1525,7 @@ CORBA_ORB::iioploc_string_to_object (const char *string,
// Now make the TAO_Stub ...
TAO_Stub *data;
ACE_NEW_RETURN (data,
- TAO_Stub ((char *) 0, mp, this->orb_core_),
+ TAO_Stub ((char *) 0, &mp, this->orb_core_),
CORBA::Object::_nil ());
// Create the CORBA level proxy.
@@ -1639,15 +1546,14 @@ CORBA::Object_ptr
CORBA_ORB::file_string_to_object (const char* filename,
CORBA::Environment& ACE_TRY_ENV)
{
- FILE* file = ACE_OS::fopen (filename, "r");
-
- if (file == 0)
+ ACE_HANDLE handle = ACE_OS::open (filename, O_RDONLY);
+ if (handle == ACE_INVALID_HANDLE)
return CORBA::Object::_nil ();
- ACE_Read_Buffer reader (file, 1);
+ ACE_Read_Buffer reader (handle, 1);
char* string = reader.read ();
-
+ ACE_OS::close (handle);
if (string == 0)
return CORBA::Object::_nil ();
@@ -1816,10 +1722,6 @@ int
CORBA_ORB::_tao_find_in_IOR_table (ACE_CString &object_id,
CORBA::Object_ptr &obj)
{
- if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t): lookup service ID <%s>\n",
- object_id.c_str ()));
-
ACE_CString ior;
if (this->lookup_table_.find_ior (object_id, ior) != 0)
@@ -1837,22 +1739,17 @@ CORBA_ORB::_tao_find_in_IOR_table (ACE_CString &object_id,
CORBA::ORB_ptr
CORBA::instance (void)
{
+ ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, guard,
+ *ACE_Static_Object_Lock::instance (), 0));
if (CORBA::instance_ == 0)
{
- ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, guard,
- *ACE_Static_Object_Lock::instance (), 0));
- if (CORBA::instance_ == 0)
- {
- int argc = 0;
- char *const *argv = 0;
-
- // Note that CORBA::ORB_init() will also acquire the static
- // lock, but that's ok since it's a recursive lock.
- CORBA::Environment ACE_TRY_ENV;
- CORBA::instance_ = CORBA::ORB_init (argc, argv, "",
- ACE_TRY_ENV);
- }
+ int argc = 0;
+ char *const *argv = 0;
+ // Note that CORBA::ORB_init() will also acquire the static
+ // lock, but that's ok since it's a recursive lock.
+ CORBA::instance_ = CORBA::ORB_init (argc, argv);
}
+
return CORBA::instance_;
}
@@ -1899,74 +1796,6 @@ operator>>(TAO_InputCDR& cdr, TAO_opaque& x)
return cdr.good_bit ();
}
-// *************************************************************
-// Valuetype factory operations
-// *************************************************************
-
-#ifdef TAO_HAS_VALUETYPE
-
-CORBA::ValueFactory_ptr
-CORBA_ORB::register_value_factory (
- const char *repository_id,
- CORBA::ValueFactory_ptr factory,
- CORBA_Environment &ACE_TRY_ENV)
-{
-// %! guard, and ACE_Null_Mutex in the map
-// do _add_ref here not in map->rebind
-
- if (valuetype_factory_map_ == 0)
- {
- // currently the ValueFactory_Map is a singleton and not per ORB
- // as in the OMG specs
- valuetype_factory_map_ = TAO_VALUEFACTORY_MAP::instance ();
- if (valuetype_factory_map_ == 0)
- ACE_THROW_RETURN (CORBA::INTERNAL (), 0);
- }
-
- int result = valuetype_factory_map_->rebind (repository_id, factory);
- if (result == -1)
- {
- // Error on bind.
- ACE_THROW_RETURN (CORBA::INTERNAL (), 0);
- }
- if (result == 1)
- {
- return factory; // previous factory was found
- }
- return 0;
-}
-
-void
-CORBA_ORB::unregister_value_factory (const char * repository_id,
- CORBA_Environment &ACE_TRY_ENV)
-{
- ACE_ERROR((LM_ERROR, "(%N:%l) function not implemented\n"));
- // %! TODO
-}
-
-CORBA::ValueFactory_ptr
-CORBA_ORB::lookup_value_factory (const char *repository_id,
- CORBA_Environment &ACE_TRY_ENV)
-{
-// %! guard
-// do _add_ref here not in map->find
- if (valuetype_factory_map_)
- {
- CORBA::ValueFactory_ptr factory;
- int result = valuetype_factory_map_->find (repository_id, factory);
- if (result == -1)
- factory = 0; // %! raise exception !
- return factory;
- }
- else
- {
- return 0; // %! raise exception !
- }
-}
-
-#endif /* TAO_HAS_VALUETYPE */
-
-
// ****************************************************************
#define CACHED_CONNECT_STRATEGY ACE_Cached_Connect_Strategy<TAO_Client_Connection_Handler, TAO_SOCK_CONNECTOR, TAO_Cached_Connector_Lock>