LCOV - code coverage report
Current view: top level - DCPS - LocalObject.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 6 8 75.0 %
Date: 2023-04-30 01:32:43 Functions: 2 3 66.7 %

          Line data    Source code
       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             : 
      16             : OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
      17             : 
      18             : namespace OpenDDS {
      19             : namespace DCPS {
      20             : 
      21             : // support TAO-style _ptr and _var
      22             : typedef CORBA::LocalObject_ptr LocalObject_ptr;
      23             : typedef CORBA::LocalObject_var LocalObject_var;
      24             : 
      25             : 
      26             : class LocalObjectBase
      27             :   : public virtual CORBA::LocalObject
      28             :   , public virtual RcObject
      29             : {
      30             : public:
      31        4846 :   virtual void _add_ref()
      32             :   {
      33        4846 :     RcObject::_add_ref();
      34        4846 :   }
      35        5566 :   virtual void _remove_ref()
      36             :   {
      37        5566 :     RcObject::_remove_ref();
      38        5566 :   }
      39           0 :   virtual CORBA::ULong _refcount_value() const
      40             :   {
      41           0 :     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>
      50             : class LocalObject
      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             : 
      65             : OPENDDS_END_VERSIONED_NAMESPACE_DECL
      66             : 
      67             : #endif /* OPENDDS_DCPS_LOCALOBJECT_H */

Generated by: LCOV version 1.16