summaryrefslogtreecommitdiff
path: root/TAO
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2005-05-26 10:18:05 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2005-05-26 10:18:05 +0000
commit39c2bab9eb1dc7bda795e50445d3c0fcb2666682 (patch)
treee325be97e5ec2b5218fc340ac62d7dd0e2717bb1 /TAO
parentd1120eb47e8c8d3592b22321b729537fe806e9ce (diff)
downloadATCD-39c2bab9eb1dc7bda795e50445d3c0fcb2666682.tar.gz
ChangeLogTag: Thu May 26 10:17:12 UTC 2005 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'TAO')
-rw-r--r--TAO/ChangeLog21
-rw-r--r--TAO/tao/Abstract_Servant_Base.cpp11
-rw-r--r--TAO/tao/Abstract_Servant_Base.h32
-rw-r--r--TAO/tao/PortableServer/PS_ForwardC.h19
-rw-r--r--TAO/tao/PortableServer/Servant_Base.cpp35
-rw-r--r--TAO/tao/PortableServer/Servant_Base.h112
-rw-r--r--TAO/tao/PortableServer/diffs/PS_Forward.diff45
7 files changed, 136 insertions, 139 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 22f0d4fdbd1..1a2e5a90f20 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,24 @@
+Thu May 26 10:17:12 UTC 2005 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ According to the latest C++ mapping, reference counting is mandatory;
+ the RefCountServantBase class is now a legacy artifact. Thanks to
+ Frank Pilhofer <fpilhofe at mc dot com> for reporting this.
+ This fixes bugzilla [1952].
+
+ * tao/Abstract_Servant_Base.{h,cpp}:
+ Made the add_ref/remove_ref methods pure virtual and added
+ _refcount_value
+
+ * tao/PortableServer/Servant_Base.{h,cpp}:
+ Added reference counting to TAO_ServantBase and removed
+ TAO_RefCountServantBase
+
+ * tao/PortableServer/PS_ForwardC.h:
+ Make RefCountServantBase a noop struct
+
+ * tao/PortableServer/diffs/PS_Forward.diff:
+ Updated
+
Thu May 26 09:23:12 UTC 2005 Johnny Willemsen <jwillemsen@remedy.nl>
* tao/Profile.h:
diff --git a/TAO/tao/Abstract_Servant_Base.cpp b/TAO/tao/Abstract_Servant_Base.cpp
index fc29a7d3fb4..adc1b27ec4a 100644
--- a/TAO/tao/Abstract_Servant_Base.cpp
+++ b/TAO/tao/Abstract_Servant_Base.cpp
@@ -16,17 +16,6 @@ TAO_Abstract_ServantBase::~TAO_Abstract_ServantBase (void)
// No-Op.
}
-void
-TAO_Abstract_ServantBase::_add_ref (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
-{
-}
-
-void
-TAO_Abstract_ServantBase::_remove_ref (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
-{
-}
-
-
TAO_Abstract_ServantBase::TAO_Abstract_ServantBase (const TAO_Abstract_ServantBase &)
{
// No-Op
diff --git a/TAO/tao/Abstract_Servant_Base.h b/TAO/tao/Abstract_Servant_Base.h
index d58be951cc0..cc90e58c7c7 100644
--- a/TAO/tao/Abstract_Servant_Base.h
+++ b/TAO/tao/Abstract_Servant_Base.h
@@ -82,7 +82,7 @@ public:
virtual CORBA::Boolean _is_a (const char* logical_type_id
ACE_ENV_ARG_DECL) = 0;
- /// Default <_non_existent>: always returns false.
+ /// Default @c _non_existent: always returns false.
virtual CORBA::Boolean _non_existent (
ACE_ENV_SINGLE_ARG_DECL) = 0;
@@ -91,18 +91,29 @@ public:
ACE_ENV_SINGLE_ARG_DECL
) = 0;
- /// Default <_get_component>: always returns nil.
+ /// Default @c_get_component: always returns nil.
virtual CORBA::Object_ptr _get_component (
ACE_ENV_SINGLE_ARG_DECL) = 0;
//@{
/**
- * @name Reference Counting Hooks
- *
- * Reference counting hooks are no-ops by default.
+ * @name Reference Counting Operations
*/
- virtual void _add_ref (ACE_ENV_SINGLE_ARG_DECL);
- virtual void _remove_ref (ACE_ENV_SINGLE_ARG_DECL);
+ /// Increase reference count by one.
+ virtual void _add_ref (
+ ACE_ENV_SINGLE_ARG_DECL) = 0;
+
+ /**
+ * Decreases reference count by one; if the resulting reference
+ * count equals zero, _remove_ref invokes delete on its this pointer
+ * in order to destroy the servant.
+ */
+ virtual void _remove_ref (
+ ACE_ENV_SINGLE_ARG_DECL) = 0;
+
+ /// Returns the current reference count value.
+ virtual CORBA::ULong _refcount_value (
+ ACE_ENV_SINGLE_ARG_DECL) const = 0;
//@}
/// This is an auxiliary method for _this() and _narrow().
@@ -130,7 +141,7 @@ protected:
/// Copy constructor, protected so no instances can be created.
TAO_Abstract_ServantBase (const TAO_Abstract_ServantBase &);
- /// assignment operator.
+ /// Assignment operator.
TAO_Abstract_ServantBase &operator= (const TAO_Abstract_ServantBase &);
/// Dispatches a request to the object
@@ -149,11 +160,6 @@ protected:
void *derived_this
ACE_ENV_ARG_DECL) = 0;
- /*
- /// Register a CORBA IDL operation name.
- virtual int _bind (const char *opname,
- const TAO_Skeleton skel_ptr) = 0;
- */
/// Get this interface's repository id (TAO specific).
virtual const char *_interface_repository_id (void) const = 0;
diff --git a/TAO/tao/PortableServer/PS_ForwardC.h b/TAO/tao/PortableServer/PS_ForwardC.h
index f9df9f862e0..6bc80ec6676 100644
--- a/TAO/tao/PortableServer/PS_ForwardC.h
+++ b/TAO/tao/PortableServer/PS_ForwardC.h
@@ -63,7 +63,6 @@
class TAO_ServantBase;
class TAO_ServantBase_var;
-class TAO_RefCountServantBase;
class TAO_Local_ServantBase;
class TAO_Root_POA;
class TAO_DynamicImplementation;
@@ -74,40 +73,40 @@ class TAO_DynamicImplementation;
namespace PortableServer
{
typedef TAO_ServantBase ServantBase;
+ struct RefCountServantBase {};
typedef TAO_ServantBase_var ServantBase_var;
- typedef TAO_RefCountServantBase RefCountServantBase;
typedef ServantBase *Servant;
typedef TAO_Local_ServantBase LocalServantBase;
typedef TAO_DynamicImplementation DynamicImplementation;
-
+
// TAO_IDL - Generated from
// be\be_visitor_typedef/typedef_ch.cpp:472
-
+
typedef CORBA::OctetSeq ObjectId;
typedef CORBA::OctetSeq_var ObjectId_var;
typedef CORBA::OctetSeq_out ObjectId_out;
-
+
// TAO_IDL - Generated from
// be\be_visitor_typecode/typecode_decl.cpp:44
-
+
extern TAO_PortableServer_Export ::CORBA::TypeCode_ptr const _tc_ObjectId;
-
+
// TAO_IDL - Generated from
// be\be_interface.cpp:598
#if !defined (_PORTABLESERVER_POA__VAR_OUT_CH_)
#define _PORTABLESERVER_POA__VAR_OUT_CH_
-
+
class POA;
typedef POA *POA_ptr;
-
+
typedef
TAO_Objref_Var_T<
POA
>
POA_var;
-
+
typedef
TAO_Objref_Out_T<
POA
diff --git a/TAO/tao/PortableServer/Servant_Base.cpp b/TAO/tao/PortableServer/Servant_Base.cpp
index 98efa9b1ed6..c7e5afe8c0b 100644
--- a/TAO/tao/PortableServer/Servant_Base.cpp
+++ b/TAO/tao/PortableServer/Servant_Base.cpp
@@ -46,12 +46,14 @@ ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_Servant_Base_Timeprobe_Description,
TAO_ServantBase::TAO_ServantBase (void)
: TAO_Abstract_ServantBase ()
+ , ref_count_ (1)
, optable_ (0)
{
}
TAO_ServantBase::TAO_ServantBase (const TAO_ServantBase &rhs)
: TAO_Abstract_ServantBase ()
+ , ref_count_ (1)
, optable_ (rhs.optable_)
{
}
@@ -319,19 +321,14 @@ void TAO_ServantBase::asynchronous_upcall_dispatch (TAO_ServerRequest & req,
return;
}
-
-TAO_RefCountServantBase::~TAO_RefCountServantBase (void)
-{
-}
-
void
-TAO_RefCountServantBase::_add_ref (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+TAO_ServantBase::_add_ref (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
{
++this->ref_count_;
}
void
-TAO_RefCountServantBase::_remove_ref (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+TAO_ServantBase::_remove_ref (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
{
const CORBA::ULong new_count = --this->ref_count_;
@@ -340,33 +337,11 @@ TAO_RefCountServantBase::_remove_ref (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
}
CORBA::ULong
-TAO_RefCountServantBase::_refcount_value (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
+TAO_ServantBase::_refcount_value (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
{
return this->ref_count_.value ();
}
-TAO_RefCountServantBase::TAO_RefCountServantBase (void)
- : TAO_Abstract_ServantBase ()
- , TAO_ServantBase ()
- , ref_count_ (1)
-{
-}
-
-TAO_RefCountServantBase::TAO_RefCountServantBase (
- const TAO_RefCountServantBase &
- )
- : TAO_Abstract_ServantBase ()
- , TAO_ServantBase ()
- , ref_count_ (1)
-{
-}
-
-TAO_RefCountServantBase &
-TAO_RefCountServantBase::operator= (const TAO_RefCountServantBase &)
-{
- return *this;
-}
-
TAO_ServantBase_var::TAO_ServantBase_var (void)
: ptr_ (0)
{
diff --git a/TAO/tao/PortableServer/Servant_Base.h b/TAO/tao/PortableServer/Servant_Base.h
index b6c714f8e10..3b1366ee9a4 100644
--- a/TAO/tao/PortableServer/Servant_Base.h
+++ b/TAO/tao/PortableServer/Servant_Base.h
@@ -34,6 +34,26 @@ class TAO_Operation_Table;
*
* The POA spec requires that all servants inherit from this class'
* base class.
+ *
+ * An instance of a servant class derived from
+ * ServantBase initially has a reference count of
+ * one. Invoking _add_ref on the servant instance increases its
+ * reference count by one. Invoking _remove_ref on the servant
+ * instance decreases its reference count by one; if the
+ * resulting reference count equals zero, _remove_ref invokes
+ * delete on its this pointer in order to destroy the
+ * servant. For ORBs that operate in multi-threaded
+ * environments, the implementations of _add_ref and _remove_ref
+ * that the ServantBase class provides shall be
+ * thread-safe.
+ *
+ * Like ServantBase supports copy
+ * construction and the default assignment operation. Copy
+ * construction always sets the reference count of the new
+ * servant instance to one. The default assignment
+ * implementation merely returns *this and does not affect the
+ * reference count.
+ *
*/
class TAO_PortableServer_Export TAO_ServantBase
: public virtual TAO_Abstract_ServantBase
@@ -95,6 +115,26 @@ public:
/// Get this interface's repository id (TAO specific).
virtual const char *_interface_repository_id (void) const = 0;
+ //@{
+ /**
+ * @name Reference Counting Operations
+ */
+ /// Increase reference count by one.
+ virtual void _add_ref (ACE_ENV_SINGLE_ARG_DECL);
+
+ /**
+ * Decreases reference count by one; if the resulting reference
+ * count equals zero, _remove_ref invokes delete on its this pointer
+ * in order to destroy the servant.
+ */
+ virtual void _remove_ref (ACE_ENV_SINGLE_ARG_DECL);
+
+ /**
+ * Returns the current reference count value.
+ */
+ virtual CORBA::ULong _refcount_value (ACE_ENV_SINGLE_ARG_DECL) const;
+ //@}
+
protected:
/// Default constructor, only derived classes can be created.
@@ -117,80 +157,12 @@ protected:
ACE_ENV_ARG_DECL);
protected:
+ /// Reference counter.
+ ACE_Atomic_Op<TAO_SYNCH_MUTEX, CORBA::ULong> ref_count_;
/// The operation table for this servant. It is initialized by the
/// most derived class.
TAO_Operation_Table * optable_;
-
-};
-
-/**
- * @class TAO_RefCountServantBase
- *
- * @brief Reference counting mix-in class.
- *
- * The RefCountServantBase mix-in class overrides the inherited
- * _add_ref and _remove_ref functions it inherits from
- * ServantBase, implementing them to provide true reference
- * counting. An instance of a servant class derived from
- * RefCountServantBase initially has a reference count of
- * one. Invoking _add_ref on the servant instance increases its
- * reference count by one. Invoking _remove_ref on the servant
- * instance decreases its reference count by one; if the
- * resulting reference count equals zero, _remove_ref invokes
- * delete on its this pointer in order to destroy the
- * servant. For ORBs that operate in multi-threaded
- * environments, the implementations of _add_ref and _remove_ref
- * that the RefCountServantBase class provides shall be
- * thread-safe.
- *
- * Like ServantBase, RefCountServantBase supports copy
- * construction and the default assignment operation. Copy
- * construction always sets the reference count of the new
- * servant instance to one. The default assignment
- * implementation merely returns *this and does not affect the
- * reference count.
- */
-class TAO_PortableServer_Export TAO_RefCountServantBase
- : public virtual TAO_ServantBase
-{
-public:
-
- /// Destructor.
- ~TAO_RefCountServantBase (void);
-
- /// Increase reference count by one.
- virtual void _add_ref (ACE_ENV_SINGLE_ARG_DECL);
-
- /**
- * Decreases reference count by one; if the resulting reference
- * count equals zero, _remove_ref invokes delete on its this pointer
- * in order to destroy the servant.
- */
- virtual void _remove_ref (ACE_ENV_SINGLE_ARG_DECL);
-
- /**
- * Returns the current reference count value.
- */
- virtual CORBA::ULong _refcount_value (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) const;
-
-protected:
-
- /// Constructor: initial reference count is one.
- TAO_RefCountServantBase (void);
-
- /// Copy Constructor: Always sets the reference count of the new
- /// servant instance to one.
- TAO_RefCountServantBase (const TAO_RefCountServantBase &);
-
- /// The default assignment implementation merely returns *this and
- /// does not affect the reference count.
- TAO_RefCountServantBase &operator= (const TAO_RefCountServantBase &);
-
-private:
-
- /// Reference counter.
- ACE_Atomic_Op<TAO_SYNCH_MUTEX, CORBA::ULong> ref_count_;
};
class TAO_PortableServer_Export TAO_Servant_Hash
diff --git a/TAO/tao/PortableServer/diffs/PS_Forward.diff b/TAO/tao/PortableServer/diffs/PS_Forward.diff
index a4ddf6b142b..db64ebb520b 100644
--- a/TAO/tao/PortableServer/diffs/PS_Forward.diff
+++ b/TAO/tao/PortableServer/diffs/PS_Forward.diff
@@ -1,12 +1,19 @@
---- orig/PS_ForwardC.h 2005-04-11 16:44:01.493011200 +0200
-+++ PS_ForwardC.h 2005-04-11 16:44:04.427230400 +0200
-@@ -61,11 +61,25 @@
+--- orig/PS_ForwardC.h 2005-04-29 12:01:04.396555200 +0200
++++ PS_ForwardC.h 2005-05-25 15:19:21.321457600 +0200
+@@ -1,6 +1,6 @@
+ // -*- C++ -*-
+ //
+-// $Id$
++// $Id$
+
+ // **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+ // TAO and the TAO IDL Compiler have been developed by:
+@@ -61,11 +61,24 @@
#pragma option push -w-rvl -w-rch -w-ccc -w-inl
#endif /* __BORLANDC__ */
+class TAO_ServantBase;
+class TAO_ServantBase_var;
-+class TAO_RefCountServantBase;
+class TAO_Local_ServantBase;
+class TAO_Root_POA;
+class TAO_DynamicImplementation;
@@ -17,8 +24,8 @@
namespace PortableServer
{
+ typedef TAO_ServantBase ServantBase;
++ struct RefCountServantBase {};
+ typedef TAO_ServantBase_var ServantBase_var;
-+ typedef TAO_RefCountServantBase RefCountServantBase;
+ typedef ServantBase *Servant;
+
+ typedef TAO_Local_ServantBase LocalServantBase;
@@ -26,3 +33,31 @@
// TAO_IDL - Generated from
// be\be_visitor_typedef/typedef_ch.cpp:472
+@@ -113,27 +126,6 @@
+ // Traits specializations.
+ namespace TAO
+ {
+-
+-#if !defined (_PORTABLESERVER_POA__TRAITS_CH_)
+-#define _PORTABLESERVER_POA__TRAITS_CH_
+-
+- template<>
+- struct TAO_PortableServer_Export Objref_Traits< ::PortableServer::POA>
+- {
+- static ::PortableServer::POA_ptr duplicate (
+- ::PortableServer::POA_ptr
+- );
+- static void release (
+- ::PortableServer::POA_ptr
+- );
+- static ::PortableServer::POA_ptr nil (void);
+- static CORBA::Boolean marshal (
+- ::PortableServer::POA_ptr p,
+- TAO_OutputCDR & cdr
+- );
+- };
+-
+-#endif /* end #if !defined */
+ }
+
+ // TAO_IDL - Generated from