OpenDDS  Snapshot(2023/04/28-20:55)
LocalObject.h
Go to the documentation of this file.
1 /*
2  *
3  *
4  * Distributed under the OpenDDS License.
5  * See: http://www.opendds.org/license.html
6  */
7 
8 #ifndef OPENDDS_DCPS_LOCALOBJECT_H
9 #define OPENDDS_DCPS_LOCALOBJECT_H
10 
11 #include "tao/LocalObject.h"
12 #include "tao/Version.h"
13 #include "PoolAllocationBase.h"
14 #include "RcObject.h"
15 
17 
18 namespace OpenDDS {
19 namespace DCPS {
20 
21 // support TAO-style _ptr and _var
24 
25 
27  : public virtual CORBA::LocalObject
28  , public virtual RcObject
29 {
30 public:
31  virtual void _add_ref()
32  {
34  }
35  virtual void _remove_ref()
36  {
38  }
39  virtual CORBA::ULong _refcount_value() const
40  {
41  return static_cast<CORBA::ULong>(RcObject::ref_count());
42  }
43 };
44 
45 /// OpenDDS::DCPS::LocalObject resolves ambiguously-inherited members like
46 /// _narrow and _ptr_type. It is used from client code like so:
47 /// class MyReaderListener
48 /// : public virtual OpenDDS::DCPS::LocalObject<OpenDDS::DCPS::DataReaderListener> {...};
49 template <class Stub>
51  : public virtual Stub
52  , public virtual LocalObjectBase
53 {
54 public:
55  typedef typename Stub::_ptr_type _ptr_type;
56  typedef typename Stub::_var_type _var_type;
57  static _ptr_type _narrow(CORBA::Object_ptr obj) {
58  return Stub::_narrow(obj);
59  }
60 };
61 
62 } // namespace DCPS
63 } // namespace OpenDDS
64 
66 
67 #endif /* OPENDDS_DCPS_LOCALOBJECT_H */
CORBA::LocalObject_ptr LocalObject_ptr
Definition: LocalObject.h:22
Stub::_var_type _var_type
Definition: LocalObject.h:56
long ref_count() const
Definition: RcObject.h:81
virtual void _add_ref()
Definition: RcObject.h:69
static _ptr_type _narrow(CORBA::Object_ptr obj)
Definition: LocalObject.h:57
ACE_CDR::ULong ULong
virtual void _remove_ref()
Definition: RcObject.h:74
CORBA::LocalObject_var LocalObject_var
Definition: LocalObject.h:23
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
virtual CORBA::ULong _refcount_value() const
Definition: LocalObject.h:39
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28
Stub::_ptr_type _ptr_type
Definition: LocalObject.h:55