00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 #ifndef OPENDDS_DCPS_LOCALOBJECT_H 00009 #define OPENDDS_DCPS_LOCALOBJECT_H 00010 00011 #include "tao/LocalObject.h" 00012 #include "tao/Version.h" 00013 #include "dds/DCPS/PoolAllocationBase.h" 00014 #include "dds/DCPS/RcObject.h" 00015 00016 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 00017 00018 namespace OpenDDS { 00019 namespace DCPS { 00020 00021 // support TAO-style _ptr and _var 00022 typedef CORBA::LocalObject_ptr LocalObject_ptr; 00023 typedef CORBA::LocalObject_var LocalObject_var; 00024 00025 00026 class LocalObjectBase 00027 : public virtual CORBA::LocalObject 00028 , public virtual RcObject 00029 { 00030 public: 00031 virtual void _add_ref() { 00032 RcObject::_add_ref(); 00033 } 00034 virtual void _remove_ref() { 00035 RcObject::_remove_ref(); 00036 } 00037 }; 00038 00039 /// OpenDDS::DCPS::LocalObject resolves ambigously-inherited members like 00040 /// _narrow and _ptr_type. It is used from client code like so: 00041 /// class MyReaderListener 00042 /// : public OpenDDS::DCPS::LocalObject<OpenDDS::DCPS::DataReaderListener> {...}; 00043 template <class Stub> 00044 class LocalObject 00045 : public virtual Stub 00046 , public virtual LocalObjectBase 00047 { 00048 public: 00049 typedef typename Stub::_ptr_type _ptr_type; 00050 typedef typename Stub::_var_type _var_type; 00051 static _ptr_type _narrow(CORBA::Object_ptr obj) { 00052 return Stub::_narrow(obj); 00053 } 00054 }; 00055 00056 } // namespace DCPS 00057 } // namespace OpenDDS 00058 00059 OPENDDS_END_VERSIONED_NAMESPACE_DECL 00060 00061 #endif /* OPENDDS_DCPS_LOCALOBJECT_H */