summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-03-30 01:11:58 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-03-30 01:11:58 +0000
commit05d0ae9686ed8cc2ec6502352f4b5b90049ad713 (patch)
tree6403dda108f9ce718bfe1c6a641d459fad0bf38f
parent25375f67eb4b821475b9cdb9583cfa438cc67a9d (diff)
downloadATCD-05d0ae9686ed8cc2ec6502352f4b5b90049ad713.tar.gz
ChangeLogTag:Mon Mar 29 19:10:09 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
-rw-r--r--TAO/ChangeLog-99c38
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp2
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.cpp26
-rw-r--r--TAO/tao/CDR.cpp70
-rw-r--r--TAO/tao/CDR.h24
-rw-r--r--TAO/tao/CDR.i113
-rw-r--r--TAO/tao/Invocation.i7
-rw-r--r--TAO/tao/ORB.cpp72
-rw-r--r--TAO/tao/Object.cpp11
-rw-r--r--TAO/tao/Stub.cpp89
-rw-r--r--TAO/tao/Stub.h45
-rw-r--r--TAO/tao/Stub.i6
12 files changed, 299 insertions, 204 deletions
diff --git a/TAO/ChangeLog-99c b/TAO/ChangeLog-99c
index 39bd4b7a5c2..adeeb976ed7 100644
--- a/TAO/ChangeLog-99c
+++ b/TAO/ChangeLog-99c
@@ -1,3 +1,41 @@
+Mon Mar 29 19:10:09 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
+
+ * tao/Stub.h:
+ * tao/Stub.i:
+ * tao/Stub.cpp:
+ The Stub carries the ORB_Core around, this reduces the number of
+ calls to TAO_ORB_Core_instance(), at least on the client-side.
+ It is also the first step to be able to get to the policy list
+ effective for an object, because we needed some way to map from
+ the CORBA::Object to the ORB that it belongs to.
+
+ * tao/CDR.h:
+ * tao/CDR.i:
+ * tao/CDR.cpp:
+ The InputCDR class can carry the ORB_Core around to initialize
+ the TAO_Stub's appropiately. Unfortunately we cannot use this
+ feature everywhere.
+
+ * tao/Invocation.i:
+ Initialize the InputCDR with the right ORB_Core.
+
+ * tao/ORB.cpp:
+ Changed the code to create TAO_Stub's to use the new
+ constructor and pass it the ORB_Core.
+ Use the right ORB_Core when extracting an object reference from
+ a string.
+
+ * tao/Object.cpp:
+ When extracting an Object from a CDR stream we use the right
+ ORB_Core.
+
+ * TAO_IDL/be/be_visitor_operation/operation_cs.cpp:
+ Use the ORB_Core in the stub instead TAO_ORB_Core_instance() to
+ make a request.
+
+ * orbsvcs/ImplRepo_Service/ImplRepo_i.cpp:
+ Migrated to the new TAO_Stub constructors.
+
Mon Mar 29 15:55:23 1999 Balachandran Natarajan <bala@cs.wustl.edu>
* tao/Request.h (CORBA_Request): Put a default argument for calls
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp
index 44f61d79be4..d3d8de1f0cf 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp
@@ -677,7 +677,7 @@ be_compiled_visitor_operation_cs::gen_marshal_and_invoke (be_operation
}
*os << "\"" << node->local_name ()
<< "\"," << be_nl
- << "TAO_ORB_Core_instance ()" << be_uidt_nl
+ << "istub->orb_core ()" << be_uidt_nl
<< ");" << be_uidt_nl;
*os << "\n" << be_nl
diff --git a/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.cpp b/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.cpp
index 9701a5a0682..1def42b6cf9 100644
--- a/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.cpp
+++ b/TAO/orbsvcs/ImplRepo_Service/ImplRepo_i.cpp
@@ -39,27 +39,35 @@ ImplRepo_i::activate_object (CORBA::Object_ptr obj,
new_addr = this->activate_server (0, ACE_TRY_ENV);
ACE_TRY_CHECK;
- TAO_Stub *stub_obj = ACE_dynamic_cast (TAO_Stub *,
- obj->_stubobj ());
+ // @@ Use auto_ptr<> to avoid memory leaks!
+ TAO_Stub *stub_obj = obj->_stubobj ();
TAO_IIOP_Profile *iiop_pfile =
ACE_dynamic_cast (TAO_IIOP_Profile *,
stub_obj->profile_in_use ());
- TAO_IIOP_Profile *new_pfile;
+ TAO_MProfile *mp;
+ ACE_NEW_THROW_EX (mp,
+ TAO_MProfile (1),
+ CORBA::NO_MEMORY (CORBA::COMPLETED_MAYBE));
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
+
+ TAO_Profile *new_pfile;
// @@ Would new_addr->host_ be different from object_addr()?
// if so I will add another ctor fred
ACE_NEW_RETURN (new_pfile,
TAO_IIOP_Profile (iiop_pfile->object_addr (),
iiop_pfile->object_key ()),
- 0);
+ CORBA::Object::_nil ());
+
+ mp->give_profile (new_pfile);
// create new obj, pfile will be copied!
- new_stub_obj = new TAO_Stub (stub_obj->type_id, new_pfile);
-
- delete new_pfile;
+ new_stub_obj = new TAO_Stub (stub_obj->type_id,
+ mp,
+ stub_obj->orb_core ());
if (new_stub_obj == 0)
- return 0;
+ return CORBA::Object::_nil ();
}
ACE_CATCHANY
{
@@ -67,7 +75,7 @@ ImplRepo_i::activate_object (CORBA::Object_ptr obj,
}
ACE_ENDTRY;
- ACE_CHECK_RETURN (0);
+ ACE_CHECK_RETURN (CORBA::Object::_nil ());
return new CORBA_Object (new_stub_obj,
obj->_servant ());
diff --git a/TAO/tao/CDR.cpp b/TAO/tao/CDR.cpp
index 552c7d3f170..cff14316911 100644
--- a/TAO/tao/CDR.cpp
+++ b/TAO/tao/CDR.cpp
@@ -78,8 +78,8 @@ ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_CDR_Timeprobe_Description,
TAO_OutputCDR::TAO_OutputCDR (size_t size,
int byte_order,
- ACE_Allocator *buffer_allocator,
- ACE_Allocator *data_block_allocator,
+ ACE_Allocator *buffer_allocator,
+ ACE_Allocator *data_block_allocator,
size_t memcpy_tradeoff)
: ACE_OutputCDR (size,
byte_order,
@@ -99,8 +99,8 @@ TAO_OutputCDR::TAO_OutputCDR (size_t size,
TAO_OutputCDR::TAO_OutputCDR (char *data,
size_t size,
int byte_order,
- ACE_Allocator *buffer_allocator,
- ACE_Allocator *data_block_allocator,
+ ACE_Allocator *buffer_allocator,
+ ACE_Allocator *data_block_allocator,
size_t memcpy_tradeoff)
: ACE_OutputCDR (data,
size,
@@ -130,10 +130,6 @@ TAO_OutputCDR::TAO_OutputCDR (ACE_Message_Block *data,
ACE_FUNCTION_TIMEPROBE (TAO_OUTPUT_CDR_CTOR3_ENTER);
}
-TAO_OutputCDR::~TAO_OutputCDR (void)
-{
-}
-
CORBA::TypeCode::traverse_status
TAO_OutputCDR::encode (CORBA::TypeCode_ptr tc,
const void *data,
@@ -223,60 +219,10 @@ TAO_OutputCDR::append (CORBA::TypeCode_ptr tc,
// ****************************************************************
-TAO_InputCDR::TAO_InputCDR (const char *buf,
- size_t bufsiz,
- int byte_order)
- : ACE_InputCDR (buf,
- bufsiz,
- byte_order)
-{
-}
-
-TAO_InputCDR::TAO_InputCDR (size_t bufsiz,
- int byte_order)
- : ACE_InputCDR (bufsiz,
- byte_order)
-{
-}
-
-TAO_InputCDR::TAO_InputCDR (const ACE_Message_Block *data,
- int byte_order)
- : ACE_InputCDR (data,
- byte_order)
-{
-}
-
-TAO_InputCDR::TAO_InputCDR (ACE_Data_Block *data,
- int byte_order)
- : ACE_InputCDR (data,
- byte_order)
-{
-}
-
-TAO_InputCDR::TAO_InputCDR (const TAO_InputCDR& rhs,
- size_t size,
- ACE_CDR::Long offset)
- : ACE_InputCDR (rhs,
- size,
- offset)
-{
-}
-
-TAO_InputCDR::TAO_InputCDR (const TAO_InputCDR& rhs,
- size_t size)
- : ACE_InputCDR (rhs,
- size)
-{
-}
-
-TAO_InputCDR::TAO_InputCDR (const TAO_InputCDR& rhs)
- : ACE_InputCDR (rhs)
-{
-}
-
TAO_InputCDR::TAO_InputCDR (const TAO_OutputCDR& rhs,
ACE_Allocator* buffer_allocator,
- ACE_Allocator* data_block_allocator)
+ ACE_Allocator* data_block_allocator,
+ TAO_ORB_Core* orb_core)
: ACE_InputCDR (rhs,
buffer_allocator
? buffer_allocator
@@ -287,10 +233,6 @@ TAO_InputCDR::TAO_InputCDR (const TAO_OutputCDR& rhs,
{
}
-TAO_InputCDR::~TAO_InputCDR (void)
-{
-}
-
CORBA::TypeCode::traverse_status
TAO_InputCDR::decode (CORBA::TypeCode_ptr tc,
const void *data,
diff --git a/TAO/tao/CDR.h b/TAO/tao/CDR.h
index f51a406525a..0a100768379 100644
--- a/TAO/tao/CDR.h
+++ b/TAO/tao/CDR.h
@@ -47,6 +47,8 @@
#include "tao/corbafwd.h"
#include "tao/Typecode.h"
+class TAO_ORB_Core;
+
class TAO_Export TAO_OutputCDR : public ACE_OutputCDR
{
//
@@ -157,22 +159,26 @@ public:
TAO_InputCDR (const char* buf,
size_t bufsiz,
- int byte_order = ACE_CDR_BYTE_ORDER);
+ int byte_order = ACE_CDR_BYTE_ORDER,
+ TAO_ORB_Core* orb_core = 0);
// Create an input stream from an arbitrary buffer, care must be
// exercised wrt alignment, because this contructor will *not* work
// if the buffer is unproperly aligned.
TAO_InputCDR (size_t bufsiz,
- int byte_order = ACE_CDR_BYTE_ORDER);
+ int byte_order = ACE_CDR_BYTE_ORDER,
+ TAO_ORB_Core* orb_core = 0);
// Create an empty input stream. The caller is responsible for
// putting the right data and providing the right alignment.
TAO_InputCDR (const ACE_Message_Block *data,
- int byte_order = ACE_CDR_BYTE_ORDER);
+ int byte_order = ACE_CDR_BYTE_ORDER,
+ TAO_ORB_Core* orb_core = 0);
// Create an input stream from an ACE_Message_Block
TAO_InputCDR (ACE_Data_Block *data,
- int byte_order = ACE_CDR_BYTE_ORDER);
+ int byte_order = ACE_CDR_BYTE_ORDER,
+ TAO_ORB_Core* orb_core = 0);
// Create an input stream from an ACE_Data_Block
TAO_InputCDR (const TAO_InputCDR& rhs);
@@ -198,7 +204,8 @@ public:
TAO_InputCDR (const TAO_OutputCDR& rhs,
ACE_Allocator* buffer_allocator = 0,
- ACE_Allocator* data_block_allocator = 0);
+ ACE_Allocator* data_block_allocator = 0,
+ TAO_ORB_Core* orb_core = 0);
// Create an input CDR from an output CDR.
~TAO_InputCDR (void);
@@ -221,6 +228,13 @@ public:
CORBA::default_environment ());
// Skip the contents of the CDR stream based on information
// described by <tc>; returning any errors in <TAO_IN_ENV>.
+
+ TAO_ORB_Core* orb_core (void) const;
+ // Accessor
+
+private:
+ TAO_ORB_Core* orb_core_;
+ // The ORB_Core, required to extract object references.
};
// This operators are too complex to be inline....
diff --git a/TAO/tao/CDR.i b/TAO/tao/CDR.i
index 832d27cfec0..4b65cc2478f 100644
--- a/TAO/tao/CDR.i
+++ b/TAO/tao/CDR.i
@@ -1,29 +1,114 @@
// This may look like C, but it's really -*- C++ -*-
// $Id$
+ACE_INLINE
+TAO_OutputCDR::~TAO_OutputCDR (void)
+{
+}
+
// ****************************************************************
+ACE_INLINE
+TAO_InputCDR::TAO_InputCDR (const char *buf,
+ size_t bufsiz,
+ int byte_order,
+ TAO_ORB_Core* orb_core)
+ : ACE_InputCDR (buf,
+ bufsiz,
+ byte_order),
+ orb_core_ (orb_core)
+{
+}
+
+ACE_INLINE
+TAO_InputCDR::TAO_InputCDR (size_t bufsiz,
+ int byte_order,
+ TAO_ORB_Core* orb_core)
+ : ACE_InputCDR (bufsiz,
+ byte_order),
+ orb_core_ (orb_core)
+{
+}
+
+ACE_INLINE
+TAO_InputCDR::TAO_InputCDR (const ACE_Message_Block *data,
+ int byte_order,
+ TAO_ORB_Core* orb_core)
+ : ACE_InputCDR (data,
+ byte_order),
+ orb_core_ (orb_core)
+{
+}
+
+ACE_INLINE
+TAO_InputCDR::TAO_InputCDR (ACE_Data_Block *data,
+ int byte_order,
+ TAO_ORB_Core* orb_core)
+ : ACE_InputCDR (data,
+ byte_order),
+ orb_core_ (orb_core)
+{
+}
+
+ACE_INLINE
+TAO_InputCDR::TAO_InputCDR (const TAO_InputCDR& rhs,
+ size_t size,
+ ACE_CDR::Long offset)
+ : ACE_InputCDR (rhs,
+ size,
+ offset),
+ orb_core_ (rhs.orb_core_)
+{
+}
+
+ACE_INLINE
+TAO_InputCDR::TAO_InputCDR (const TAO_InputCDR& rhs,
+ size_t size)
+ : ACE_InputCDR (rhs,
+ size),
+ orb_core_ (rhs.orb_core_)
+{
+}
+
+ACE_INLINE
+TAO_InputCDR::TAO_InputCDR (const TAO_InputCDR& rhs)
+ : ACE_InputCDR (rhs),
+ orb_core_ (rhs.orb_core_)
+{
+}
+
+ACE_INLINE
+TAO_InputCDR::~TAO_InputCDR (void)
+{
+}
+
+ACE_INLINE TAO_ORB_Core*
+TAO_InputCDR::orb_core (void) const
+{
+ return this->orb_core_;
+}
+
// ****************************************************************
-ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
+ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
CORBA::Short x)
{
return ACE_static_cast(ACE_OutputCDR&,os) << x;
}
-ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
+ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
CORBA::UShort x)
{
return ACE_static_cast(ACE_OutputCDR&,os) << x;
}
-ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
+ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
CORBA::Long x)
{
return ACE_static_cast(ACE_OutputCDR&,os) << x;
}
-ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
+ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
CORBA::ULong x)
{
return ACE_static_cast(ACE_OutputCDR&,os) << x;
@@ -47,19 +132,19 @@ ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR& os,
return ACE_static_cast(ACE_OutputCDR&,os) << x;
}
-ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
+ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
CORBA::Float x)
{
return ACE_static_cast(ACE_OutputCDR&,os) << x;
}
-ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
+ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
CORBA::Double x)
{
return ACE_static_cast(ACE_OutputCDR&,os) << x;
}
-ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
+ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
const CORBA::Char* x)
{
return ACE_static_cast(ACE_OutputCDR&,os) << x;
@@ -67,25 +152,25 @@ ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os,
// ****************************************************************
-ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
+ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
CORBA::Short &x)
{
return ACE_static_cast(ACE_InputCDR&,is) >> x;
}
-ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
+ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
CORBA::UShort &x)
{
return ACE_static_cast(ACE_InputCDR&,is) >> x;
}
-ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
+ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
CORBA::Long &x)
{
return ACE_static_cast(ACE_InputCDR&,is) >> x;
}
-ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
+ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
CORBA::ULong &x)
{
return ACE_static_cast(ACE_InputCDR&,is) >> x;
@@ -109,19 +194,19 @@ ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
return ACE_static_cast(ACE_InputCDR&,is) >> x;
}
-ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
+ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
CORBA::Float &x)
{
return ACE_static_cast(ACE_InputCDR&,is) >> x;
}
-ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
+ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
CORBA::Double &x)
{
return ACE_static_cast(ACE_InputCDR&,is) >> x;
}
-ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
+ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is,
CORBA::Char* &x)
{
return ACE_static_cast(ACE_InputCDR&,is) >> x;
diff --git a/TAO/tao/Invocation.i b/TAO/tao/Invocation.i
index 2005ef3d04e..93d9a9ca9d6 100644
--- a/TAO/tao/Invocation.i
+++ b/TAO/tao/Invocation.i
@@ -26,7 +26,8 @@ TAO_GIOP_Twoway_Invocation (TAO_Stub *stub,
TAO_ORB_Core *orb_core)
: TAO_GIOP_Invocation (stub, operation, orb_core),
inp_stream_ (orb_core->create_input_cdr_data_block (ACE_CDR::DEFAULT_BUFSIZE),
- TAO_ENCAP_BYTE_ORDER)
+ TAO_ENCAP_BYTE_ORDER,
+ orb_core)
{
}
@@ -83,7 +84,9 @@ TAO_GIOP_Locate_Request_Invocation::
TAO_GIOP_Locate_Request_Invocation (TAO_Stub *stub,
TAO_ORB_Core *orb_core)
: TAO_GIOP_Invocation (stub, 0, orb_core),
- inp_stream_ (orb_core->create_input_cdr_data_block (ACE_CDR::DEFAULT_BUFSIZE))
+ inp_stream_ (orb_core->create_input_cdr_data_block(ACE_CDR::DEFAULT_BUFSIZE),
+ TAO_ENCAP_BYTE_ORDER,
+ orb_core)
{
}
diff --git a/TAO/tao/ORB.cpp b/TAO/tao/ORB.cpp
index 1b1adc18b3c..1ff1b693b4e 100644
--- a/TAO/tao/ORB.cpp
+++ b/TAO/tao/ORB.cpp
@@ -906,59 +906,51 @@ CORBA_ORB::resolve_initial_references (CORBA::String name,
TAO_Stub *
CORBA_ORB::create_stub_object (const TAO_ObjectKey &key,
const char *type_id,
- CORBA::Environment &env)
+ CORBA::Environment &ACE_TRY_ENV)
{
if (this->open () == -1)
- {
- env.exception (new CORBA::INTERNAL (CORBA::COMPLETED_NO));
- return 0;
- }
+ ACE_THROW_RETURN (CORBA::INTERNAL (CORBA::COMPLETED_NO), 0);
- CORBA::String id;
+ CORBA::String id = 0;
if (type_id)
id = CORBA::string_copy (type_id);
- else
- id = 0;
+
+ TAO_Stub *stub = 0;
// First we create a profile list, well actually a list of one!
// @@ should go to the acceptor for this, the orb delegates to the acceptor
// to create Profiles!
- // We do not use ACE_NEW cause we want to return an exception if this
- // fails.
- // @@ Fred, please use ACE_NEW_THROW_EX and ACE_CHECK instead!
- TAO_IIOP_Profile *pfile =
- new TAO_IIOP_Profile (this->orb_core_->orb_params ()->host (),
- this->orb_core_->orb_params ()->addr ().get_port_number (),
- key,
- this->orb_core_->orb_params ()->addr ());
-
- TAO_Stub *data = 0;
- // @@ replace IIOP::Profile with something more appropriate!!
- data = new TAO_Stub (id, pfile);
+ // @@ Fred, please change this code to use auto_ptr<> and
+ // automatically deallocate the temporary objects. Alternatively
+ // consider about using references ;-)
+ TAO_MProfile *mp;
+ ACE_NEW_THROW_EX (mp,
+ TAO_MProfile (1),
+ CORBA::NO_MEMORY (CORBA::COMPLETED_MAYBE));
+ ACE_CHECK_RETURN (stub);
- if (pfile == 0)
- {
- env.exception (new CORBA::NO_MEMORY (CORBA::COMPLETED_NO));
- return 0;
- }
- else
- {
- // We do not use ACE_NEW_RETURN or ACE_NEW since we need to
- // deallocate pfile.
- // @@ Fred, but you don't do this...
+ TAO_ORB_Parameters *orb_params =
+ this->orb_core_->orb_params ();
- // Plus we want to return an exception. @@ If that's the only
- // reason, then you can use ACE_NEW_THROW_EX and ACE_CHECK.
- data = new TAO_Stub (id, pfile);
- // pfile is given to TAO_Stub!
+ TAO_IIOP_Profile *pfile;
+ ACE_NEW_THROW_EX (pfile,
+ TAO_IIOP_Profile (orb_params->host (),
+ orb_params->addr ().get_port_number (),
+ key,
+ orb_params->addr ()),
+ CORBA::NO_MEMORY (CORBA::COMPLETED_MAYBE));
+ ACE_CHECK_RETURN (stub);
- if (data == 0)
- env.exception (new CORBA::NO_MEMORY (CORBA::COMPLETED_NO));
- }
+ mp->give_profile (pfile);
+
+ ACE_NEW_THROW_EX (stub,
+ TAO_Stub (id, mp, this->orb_core_),
+ CORBA::NO_MEMORY (CORBA::COMPLETED_MAYBE));
+ ACE_CHECK_RETURN (stub);
- return data;
+ return stub;
}
// Create an objref
@@ -1461,7 +1453,7 @@ CORBA_ORB::iiop_string_to_object (const char *string,
// Now make the TAO_Stub ...
TAO_Stub *data;
ACE_NEW_RETURN (data,
- TAO_Stub ((char *) 0, mp),
+ TAO_Stub ((char *) 0, mp, this->orb_core_),
obj);
// pfile refcount == 2
@@ -1542,7 +1534,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),
+ TAO_Stub ((char *) 0, mp, this->orb_core_),
CORBA::Object::_nil ());
// Create the CORBA level proxy.
diff --git a/TAO/tao/Object.cpp b/TAO/tao/Object.cpp
index 55099af9124..479f77266fa 100644
--- a/TAO/tao/Object.cpp
+++ b/TAO/tao/Object.cpp
@@ -88,7 +88,7 @@ CORBA_Object::_is_a (const CORBA::Char *type_id,
TAO_GIOP_Twoway_Invocation _tao_call (
istub,
"_is_a",
- TAO_ORB_Core_instance ()
+ istub->orb_core ()
);
@@ -163,7 +163,7 @@ CORBA_Object::_non_existent (CORBA::Environment &ACE_TRY_ENV)
TAO_GIOP_Twoway_Invocation _tao_call (
istub,
"_non_existent",
- TAO_ORB_Core_instance ()
+ istub->orb_core ()
);
@@ -295,7 +295,7 @@ CORBA_Object::_get_interface (CORBA::Environment &ACE_TRY_ENV)
TAO_GIOP_Twoway_Invocation _tao_call (
istub,
"_interface",
- TAO_ORB_Core_instance ()
+ istub->orb_core ()
);
for (;;)
@@ -506,7 +506,8 @@ operator>> (TAO_InputCDR& cdr, CORBA_Object*& x)
// TAO_Stub will make a copy of mp!
TAO_Stub *objdata;
ACE_NEW_RETURN (objdata, TAO_Stub (type_hint._retn (),
- mp.get ()), 0);
+ mp.get (),
+ cdr.orb_core ()), 0);
if (objdata == 0)
return 0;
@@ -514,7 +515,7 @@ operator>> (TAO_InputCDR& cdr, CORBA_Object*& x)
// Create a new CORBA_Object and give it the TAO_Stub just
// created.
TAO_ServantBase *servant =
- TAO_ORB_Core_instance ()->orb ()->_get_collocated_servant (objdata);
+ objdata->orb_core ()->orb ()->_get_collocated_servant (objdata);
ACE_NEW_RETURN (x, CORBA_Object (objdata, servant, servant != 0), 0);
diff --git a/TAO/tao/Stub.cpp b/TAO/tao/Stub.cpp
index 8f6dfe5059e..abb3c3306a1 100644
--- a/TAO/tao/Stub.cpp
+++ b/TAO/tao/Stub.cpp
@@ -60,7 +60,8 @@ ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_TAO_Stub_Timeprobe_Description,
#endif /* ACE_ENABLE_TIMEPROBES */
TAO_Stub::TAO_Stub (char *repository_id,
- TAO_MProfile &profiles)
+ TAO_MProfile &profiles,
+ TAO_ORB_Core* orb_core)
: type_id (repository_id),
base_profiles_ ((CORBA::ULong) 0),
forward_profiles_ (0),
@@ -70,17 +71,29 @@ TAO_Stub::TAO_Stub (char *repository_id,
// what about ACE_SYNCH_MUTEX refcount_lock_
refcount_ (1),
use_locate_request_ (0),
- first_locate_request_ (0)
+ first_locate_request_ (0),
+ orb_core_ (orb_core)
{
+ if (this->orb_core_ == 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO: (%P|%t) TAO_Stub created with default "
+ "ORB core\n"));
+ }
+ this->orb_core_ = TAO_ORB_Core_instance ();
+ }
this->profile_lock_ptr_ =
- TAO_ORB_Core_instance ()->client_factory ()->create_iiop_profile_lock ();
+ this->orb_core_->client_factory ()->create_iiop_profile_lock ();
- set_base_profiles (&profiles);
+ this->set_base_profiles (&profiles);
}
TAO_Stub::TAO_Stub (char *repository_id,
- TAO_Profile *profile)
+ TAO_MProfile *profiles,
+ TAO_ORB_Core* orb_core)
: type_id (repository_id),
base_profiles_ ((CORBA::ULong) 0),
forward_profiles_ (0),
@@ -90,23 +103,30 @@ TAO_Stub::TAO_Stub (char *repository_id,
// what about ACE_SYNCH_MUTEX refcount_lock_
refcount_ (1),
use_locate_request_ (0),
- first_locate_request_ (0)
+ first_locate_request_ (0),
+ orb_core_ (orb_core)
{
- // @@ XXX need to verify type and deal with wrong types
+ if (this->orb_core_ == 0)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO: (%P|%t) TAO_Stub created with default "
+ "ORB core\n"));
+ }
+ this->orb_core_ = TAO_ORB_Core_instance ();
+ }
+ // @@ does this need to be freed?
this->profile_lock_ptr_ =
- TAO_ORB_Core_instance ()->client_factory ()->create_iiop_profile_lock ();
-
- base_profiles_.set (1);
-
- base_profiles_.give_profile (profile);
-
- reset_base ();
+ this->orb_core_->client_factory ()->create_iiop_profile_lock ();
+ this->set_base_profiles (profiles);
}
+#if 0
TAO_Stub::TAO_Stub (char *repository_id,
- TAO_MProfile *profiles)
+ TAO_Profile *profile)
: type_id (repository_id),
base_profiles_ ((CORBA::ULong) 0),
forward_profiles_ (0),
@@ -120,11 +140,14 @@ TAO_Stub::TAO_Stub (char *repository_id,
{
// @@ XXX need to verify type and deal with wrong types
- // @@ does this need to be freed?
this->profile_lock_ptr_ =
- TAO_ORB_Core_instance ()->client_factory ()->create_iiop_profile_lock ();
+ this->orb_core_->client_factory ()->create_iiop_profile_lock ();
- set_base_profiles (profiles);
+ base_profiles_.set (1);
+
+ base_profiles_.give_profile (profile);
+
+ reset_base ();
}
@@ -141,8 +164,9 @@ TAO_Stub::TAO_Stub (char *repository_id)
first_locate_request_ (0)
{
this->profile_lock_ptr_ =
- TAO_ORB_Core_instance ()->client_factory ()->create_iiop_profile_lock ();
+ this->orb_core_->client_factory ()->create_iiop_profile_lock ();
}
+#endif /* 0 */
// Quick'n'dirty hash of objref data, for partitioning objrefs into
// sets.
@@ -305,8 +329,6 @@ TAO_Stub::do_static_call (CORBA::Environment &ACE_TRY_ENV,
ACE_TIMEPROBE (TAO_STUB_OBJECT_DO_STATIC_CALL_SET_CANCEL);
- TAO_ORB_Core* orb_core = TAO_ORB_Core_instance ();
-
ACE_TIMEPROBE (TAO_STUB_OBJECT_DO_STATIC_CALL_GRAB_ORB_CORE);
// Do a locate_request if necessary/wanted.
@@ -315,7 +337,8 @@ TAO_Stub::do_static_call (CORBA::Environment &ACE_TRY_ENV,
// be forwarded. No standard way now to know.
if (this->use_locate_request_ && this->first_locate_request_)
{
- TAO_GIOP_Locate_Request_Invocation call (this, orb_core);
+ TAO_GIOP_Locate_Request_Invocation call (this,
+ this->orb_core_);
// Simply let these exceptions propagate up
// (if any of them occurs.)
@@ -330,7 +353,8 @@ TAO_Stub::do_static_call (CORBA::Environment &ACE_TRY_ENV,
if (info->is_roundtrip)
{
- TAO_GIOP_Twoway_Invocation call (this, info->opname, orb_core);
+ TAO_GIOP_Twoway_Invocation call (this, info->opname,
+ this->orb_core_);
ACE_TIMEPROBE (TAO_STUB_OBJECT_DO_STATIC_CALL_INVOCATION_CTOR);
// We may need to loop through here more than once if we're
@@ -452,7 +476,8 @@ TAO_Stub::do_static_call (CORBA::Environment &ACE_TRY_ENV,
} // if (two way)
else
{
- TAO_GIOP_Oneway_Invocation call (this, info->opname, orb_core);
+ TAO_GIOP_Oneway_Invocation call (this, info->opname,
+ this->orb_core_);
ACE_TIMEPROBE (TAO_STUB_OBJECT_DO_STATIC_CALL_INVOCATION_CTOR);
for (;;)
@@ -533,15 +558,13 @@ TAO_Stub::do_dynamic_call (const char *opname,
{
TAO_Synchronous_Cancellation_Required NOT_USED;
- TAO_ORB_Core *orb_core = TAO_ORB_Core_instance ();
-
// Do a locate_request if necessary/wanted.
// Suspect that you will be forwarded, so be proactive!
// strategy for reducing overhead when you think a request will
// be forwarded. No standard way now to know.
if (this->use_locate_request_ && this->first_locate_request_)
{
- TAO_GIOP_Locate_Request_Invocation call (this, orb_core);
+ TAO_GIOP_Locate_Request_Invocation call (this, this->orb_core_);
// Simply let these exceptions propagate up
// (if any of them occurs.)
@@ -556,7 +579,7 @@ TAO_Stub::do_dynamic_call (const char *opname,
if (is_roundtrip)
{
- TAO_GIOP_Twoway_Invocation call (this, opname, orb_core);
+ TAO_GIOP_Twoway_Invocation call (this, opname, this->orb_core_);
// Loop as needed for forwarding; see above.
@@ -744,7 +767,7 @@ TAO_Stub::do_dynamic_call (const char *opname,
}
else
{
- TAO_GIOP_Oneway_Invocation call (this, opname, orb_core);
+ TAO_GIOP_Oneway_Invocation call (this, opname, this->orb_core_);
for (;;)
{
@@ -773,8 +796,8 @@ TAO_Stub::do_dynamic_call (const char *opname,
void
TAO_Stub::put_params (TAO_GIOP_Invocation &call,
- CORBA::NVList_ptr args,
- CORBA::Environment &ACE_TRY_ENV)
+ CORBA::NVList_ptr args,
+ CORBA::Environment &ACE_TRY_ENV)
{
// Now, put all "in" and "inout" parameters into the request
// message body.
@@ -797,7 +820,9 @@ TAO_Stub::put_params (TAO_GIOP_Invocation &call,
else
{
TAO_OutputCDR &cdr = call.out_stream ();
- TAO_InputCDR in (value->value ()->cdr_);
+ TAO_InputCDR in (value->value ()->cdr_,
+ TAO_ENCAP_BYTE_ORDER,
+ this->orb_core_);
cdr.append (value->value ()->type_, &in, ACE_TRY_ENV);
ACE_CHECK;
}
diff --git a/TAO/tao/Stub.h b/TAO/tao/Stub.h
index e60e2954a32..e3866ddbdbc 100644
--- a/TAO/tao/Stub.h
+++ b/TAO/tao/Stub.h
@@ -270,46 +270,21 @@ public:
CORBA::Boolean is_equivalent (CORBA::Object_ptr other_obj,
CORBA_Environment &TAO_IN_ENV =
CORBA::default_environment ());
- // XXX All objref representations should know how to marshal
- // themselves. That will involve ensuring that the IOR that gets
- // marshaled talks a specific protocol, otherwise the target of a
- // message would not be invoke using the objref it receives
- // (compromising functionality in a very basic and mysterious
- // mannter). So for example an objref might need to create a proxy
- // for itself rather than marshaling its own representation. [ The
- // IIOP engine does not need to worry about such issues since it
- // only supports one protocol -- the problem won't show up.
- // "Multiprotocol ORBs" will need to solve that problem though. ]
+ // Implement the is_equivalent() method for the CORBA::Object
// Our Constructors ...
- TAO_Stub (char * repository_id);
- // XXX All objref representations should know how to marshal
- // themselves. That will involve ensuring that the IOR that gets
- // marshaled talks a specific protocol, otherwise the target of a
- // message would not be invoke using the objref it receives
- // (compromising functionality in a very basic and mysterious
- // manner). So for example an objref might need to create a proxy
- // for itself rather than marshaling its own representation. [ The
- // IIOP engine does not need to worry about such issues since it
- // only supports one protocol -- the problem won't show up.
- // "Multiprotocol ORBs" will need to solve that problem though. ]
-
TAO_Stub (char *repository_id,
- TAO_Profile *profile);
- // degenerate case where only one profile is wanted. This method
- // is depricated and is here ONLY for compatibility with multiple
- // profile unfriendly code! The profile is given to the MProfile
- // object.
+ TAO_MProfile *profiles,
+ TAO_ORB_Core *orb_core);
+ // Construct from a repository ID and a pointer to list of
+ // profiles. Assumes ownership of the profiles.
TAO_Stub (char *repository_id,
- TAO_MProfile *profiles);
+ TAO_MProfile &profiles,
+ TAO_ORB_Core *orb_core);
// Construct from a repository ID and a list of profiles.
- TAO_Stub (char *repository_id,
- TAO_MProfile &profiles);
- // Construct from a repository ID and a profile ID.profile ID.
-
// = Memory management.
CORBA::ULong _incr_refcnt (void);
CORBA::ULong _decr_refcnt (void);
@@ -377,6 +352,9 @@ public:
// used to get the next profile after the one being used has
// failed during the initial connect or send of the message!
+ TAO_ORB_Core* orb_core (void) const;
+ // Accessor
+
protected:
void put_params (CORBA_Environment &TAO_IN_ENV,
const TAO_Call_Data *info,
@@ -453,6 +431,9 @@ private:
CORBA::Boolean first_locate_request_;
// distinguishes the first from following calls
+ TAO_ORB_Core* orb_core_;
+ // The ORB
+
// = Disallow copy constructor and assignment operator
ACE_UNIMPLEMENTED_FUNC (TAO_Stub (const TAO_Stub &))
ACE_UNIMPLEMENTED_FUNC (TAO_Stub &operator = (const TAO_Stub &))
diff --git a/TAO/tao/Stub.i b/TAO/tao/Stub.i
index df03f76195f..fff7c3cc209 100644
--- a/TAO/tao/Stub.i
+++ b/TAO/tao/Stub.i
@@ -290,3 +290,9 @@ TAO_Stub::get_base_profiles (void) const
{
return this->base_profiles_;
}
+
+ACE_INLINE TAO_ORB_Core*
+TAO_Stub::orb_core (void) const
+{
+ return this->orb_core_;
+}