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_RCEVENTHANDLER_H 9 : #define OPENDDS_DCPS_RCEVENTHANDLER_H 10 : 11 : #include "ace/Event_Handler.h" 12 : #include "dds/Versioned_Namespace.h" 13 : #include "RcObject.h" 14 : 15 : OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 16 : 17 : namespace OpenDDS { 18 : namespace DCPS { 19 : 20 : /// Templated Reference counted handle to a pointer. 21 : /// A non-DDS specific helper class. 22 : class RcEventHandler 23 : : public virtual ACE_Event_Handler 24 : , public virtual RcObject { 25 : public: 26 : 27 54 : RcEventHandler() 28 54 : { 29 54 : this->reference_counting_policy().value(ACE_Event_Handler::Reference_Counting_Policy::ENABLED); 30 54 : } 31 : 32 37 : ACE_Event_Handler::Reference_Count add_reference() 33 : { 34 37 : RcObject::_add_ref(); 35 37 : return 1; 36 : } 37 : 38 37 : ACE_Event_Handler::Reference_Count remove_reference() 39 : { 40 37 : RcObject::_remove_ref(); 41 37 : return 1; 42 : } 43 : 44 : }; 45 : 46 : 47 : 48 : } // namespace DCPS 49 : } // namespace OpenDDS 50 : 51 : OPENDDS_END_VERSIONED_NAMESPACE_DECL 52 : 53 : #endif /* OPENDDS_RCEVENTHANDLER_H */