summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-08-31 21:08:37 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-08-31 21:08:37 +0000
commit50e537c3e5530f53ed3607b41dc7aa7230e8ad8d (patch)
treed2d1a0102604701ad447759493b782f2fc6c194f
parente3f3dc774a8d55eb5ccb0f91945ccb011bc3ea0a (diff)
downloadATCD-50e537c3e5530f53ed3607b41dc7aa7230e8ad8d.tar.gz
ChangeLogTag: Sun Aug 31 15:49:35 2003 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r--TAO/ChangeLog_ref61
-rw-r--r--TAO/tao/Object_T.cpp139
-rw-r--r--TAO/tao/Object_T.h68
-rw-r--r--TAO/tao/TAO.dsp9
4 files changed, 277 insertions, 0 deletions
diff --git a/TAO/ChangeLog_ref b/TAO/ChangeLog_ref
index dde557aeb56..37792f4d6d5 100644
--- a/TAO/ChangeLog_ref
+++ b/TAO/ChangeLog_ref
@@ -1,3 +1,64 @@
+Sun Aug 31 15:49:35 2003 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * tao/Object_T.h:
+ * tao/Object_T.cpp:
+
+ New template files, for now containing a class to handle
+ _narrow() and _unchecked_narrow() generically.
+
+ * tao/TAO.dsp:
+
+ Added new files to project.
+
+ * TAO_IDL/be_include/be_visitor_arg_traits.h:
+ * TAO_IDL/be/be_visitor_arg_traits.cpp:
+
+ New visitor specializing in the generation of arg traits
+ template class specializations. This functionality was
+ moved here from the be_visitor_traits visitor, which
+ now generates only Objref_Traits and Value_Traits for
+ non-defined forward declared interfaces, components,
+ valuetypes and eventtypes.
+
+ * TAO_IDL/Makefile.BE:
+ * TAO_IDL/TAO_IDL_BE.bor:
+ * TAO_IDL/TAO_IDL_BE_DLL.dsp:
+ * TAO_IDL/TAO_IDL_BE_LIB.dsp:
+
+ Added the above new files to the makefiles and project files.
+
+ * TAO_IDL/be/be_codegen.cpp:
+ * TAO_IDL/be/be_decl.cpp:
+ * TAO_IDL/be/be_sequence.cpp:
+ * TAO_IDL/be/be_visitor_root.cpp:
+ * TAO_IDL/be/be_visitor_traits.cpp:
+ * TAO_IDL/be/be_visitor_exception/exception_cs.cpp:
+ * TAO_IDL/be/be_visitor_interface/cdr_op_cs.cpp:
+ * TAO_IDL/be/be_visitor_interface/interface_ch.cpp:
+ * TAO_IDL/be/be_visitor_interface/interface_cs.cpp:
+ * TAO_IDL/be/be_visitor_interface/interface_ss.cpp:
+ * TAO_IDL/be/be_visitor_root/root.cpp:
+ * TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp:
+ * TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp:
+ * TAO_IDL/be/be_visitor_structure/structure_cs.cpp:
+ * TAO_IDL/be/be_visitor_union/union_cs.cpp:
+ * TAO_IDL/be_include/be_codegen.h:
+ * TAO_IDL/be_include/be_decl.h:
+ * TAO_IDL/be_include/be_visitor_traits.h:
+
+ - Changed generated code to call the appropriate templatized
+ static function for _narrow(), and removed generation of
+ _unchecked_narrow() and _tao_QueryInterface() altogether.
+ A side effect of this change is the removal of the
+ environment/try block/catch block from CDR extraction operators
+ for interfaces.
+
+ - Moved generation of arg traits class specializations, and
+ the includes they need, from *C.h to *C.cpp (and to *S.cpp, if
+ either kind of collocation is supported).
+
+ - Cosmetic changes to the generated _tao_any_destructors.
+
Sat Aug 30 09:53:30 2003 Jeff Parsons <j.parsons@vanderbilt.edu>
* tao/ORB_Core.cpp:
diff --git a/TAO/tao/Object_T.cpp b/TAO/tao/Object_T.cpp
new file mode 100644
index 00000000000..20904814ab4
--- /dev/null
+++ b/TAO/tao/Object_T.cpp
@@ -0,0 +1,139 @@
+// $Id$
+#ifndef TAO_OBJECT_T_C
+#define TAO_OBJECT_T_C
+
+#include "tao/Object_T.h"
+
+ACE_RCSID (tao,
+ Object_T,
+ "$Id$")
+
+namespace TAO
+{
+ template<typename T>
+ T *
+ Narrow_Utils<T>::narrow (CORBA::Object_ptr obj,
+ const char *repo_id,
+ Proxy_Broker_Factory pbf
+ ACE_ENV_ARG_DECL)
+ {
+ if (CORBA::is_nil (obj))
+ {
+ return T::_nil ();
+ }
+
+ CORBA::Boolean is_it = obj->_is_a (repo_id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (T::_nil ());
+
+ if (is_it == 0)
+ {
+ return T::_nil ();
+ }
+
+ return TAO::Narrow_Utils<T>::unchecked_narrow (obj, pbf);
+ }
+
+ template<typename T>
+ T *
+ Narrow_Utils<T>::narrow (CORBA::AbstractBase_ptr obj,
+ const char *repo_id
+ ACE_ENV_ARG_DECL)
+ {
+ if (CORBA::is_nil (obj))
+ {
+ return T::_nil ();
+ }
+
+ CORBA::Boolean is_it =
+ obj->_is_a (
+ repo_id
+ ACE_ENV_ARG_PARAMETER
+ );
+ ACE_CHECK_RETURN (T::_nil ());
+
+ if (is_it == 0)
+ {
+ return T::_nil ();
+ }
+
+ return Narrow_Utils<T>::unchecked_narrow (obj);
+ }
+
+ template<typename T>
+ T *
+ Narrow_Utils<T>::unchecked_narrow (CORBA::Object_ptr obj,
+ Proxy_Broker_Factory pbf)
+ {
+ T_ptr proxy = Narrow_Utils<T>::lazy_evaluation (obj);
+
+ if (!CORBA::is_nil (proxy))
+ {
+ return proxy;
+ }
+
+ TAO_Stub* stub = obj->_stubobj ();
+
+ if (stub != 0)
+ {
+ stub->_incr_refcnt ();
+ }
+
+ bool collocated =
+ !CORBA::is_nil (stub->servant_orb_var ().ptr ())
+ && stub->servant_orb_var ()->orb_core ()->optimize_collocation_objects ()
+ && obj->_is_collocated ()
+ && pbf != 0;
+
+ ACE_NEW_RETURN (proxy,
+ T (stub,
+ collocated ? 1 : 0,
+ obj->_servant ()),
+ T::_nil ());
+
+ return proxy;
+ }
+
+ template<typename T>
+ T *
+ Narrow_Utils<T>::unchecked_narrow (CORBA::AbstractBase_ptr obj)
+ {
+ T_ptr proxy = T::_nil ();
+
+ if (obj->_is_objref ())
+ {
+ ACE_NEW_RETURN (proxy,
+ T (obj->_stubobj (),
+ 0,
+ obj->_servant ()),
+ T::_nil ());
+ }
+ else
+ {
+ proxy = T::_downcast (obj);
+ proxy->_add_ref ();
+ }
+
+ return proxy;
+ }
+
+ template<typename T>
+ T *
+ Narrow_Utils<T>::lazy_evaluation (CORBA::Object_ptr obj)
+ {
+ T_ptr default_proxy = T::_nil ();
+
+ // Code for lazily evaluated IORs.
+ if (!obj->is_evaluated ())
+ {
+ ACE_NEW_RETURN (default_proxy,
+ T (obj->steal_ior (),
+ obj->orb_core ()),
+ T::_nil ());
+ }
+
+ return default_proxy;
+ }
+}
+
+#endif /* TAO_OBJECT_T_C */
diff --git a/TAO/tao/Object_T.h b/TAO/tao/Object_T.h
new file mode 100644
index 00000000000..937e1521578
--- /dev/null
+++ b/TAO/tao/Object_T.h
@@ -0,0 +1,68 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Object_T.h
+ *
+ * $Id$
+ *
+ * Templatized utilities common to all IDL interfaces.
+ *
+ * @author Jeff Parsons <j.parsons@vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_CORBA_OBJECT_T_H
+#define TAO_CORBA_OBJECT_T_H
+
+#include /**/ "ace/pre.h"
+
+namespace CORBA
+{
+ class Object;
+ typedef Object *Object_ptr;
+}
+
+namespace TAO
+{
+ class Collocation_Proxy_Broker;
+
+ typedef
+ Collocation_Proxy_Broker * (* Proxy_Broker_Factory)(CORBA::Object_ptr);
+
+ template<typename T>
+ class Narrow_Utils
+ {
+ public:
+ typedef T *T_ptr;
+
+ static T_ptr narrow (CORBA::Object_ptr,
+ const char *repo_id,
+ Proxy_Broker_Factory
+ ACE_ENV_ARG_DECL);
+
+ static T_ptr narrow (CORBA::AbstractBase_ptr,
+ const char *repo_id
+ ACE_ENV_ARG_DECL);
+
+ static T_ptr unchecked_narrow (CORBA::Object_ptr,
+ Proxy_Broker_Factory);
+
+ static T_ptr unchecked_narrow (CORBA::AbstractBase_ptr);
+ private:
+ // Code for lazily evaluated IORs.
+ static T_ptr lazy_evaluation (CORBA::Object_ptr);
+ };
+}
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "tao/Object_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Object_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_CORBA_OBJECT_T_H */
diff --git a/TAO/tao/TAO.dsp b/TAO/tao/TAO.dsp
index 0c48c2f4255..1c2110bb561 100644
--- a/TAO/tao/TAO.dsp
+++ b/TAO/tao/TAO.dsp
@@ -1689,6 +1689,10 @@ SOURCE=.\Object_SArgument_T.h
# End Source File
# Begin Source File
+SOURCE=.\Object_T.h
+# End Source File
+# Begin Source File
+
SOURCE=.\objectid.h
# End Source File
# Begin Source File
@@ -2929,6 +2933,11 @@ SOURCE=.\Object_SArgument_T.cpp
# End Source File
# Begin Source File
+SOURCE=.\Object_T.cpp
+# PROP Exclude_From_Build 1
+# End Source File
+# Begin Source File
+
SOURCE=.\Objref_VarOut_T.cpp
# PROP Exclude_From_Build 1
# End Source File