00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 #ifndef OPENDDS_RCEVENTHANDLER_H 00009 #define OPENDDS_RCEVENTHANDLER_H 00010 00011 #include "ace/Event_Handler.h" 00012 #include "dds/Versioned_Namespace.h" 00013 #include "RcObject.h" 00014 00015 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 00016 00017 namespace OpenDDS { 00018 namespace DCPS { 00019 00020 /// Templated Reference counted handle to a pointer. 00021 /// A non-DDS specific helper class. 00022 class RcEventHandler 00023 : public ACE_Event_Handler 00024 , public virtual RcObject { 00025 public: 00026 00027 RcEventHandler() 00028 { 00029 this->reference_counting_policy().value(ACE_Event_Handler::Reference_Counting_Policy::ENABLED); 00030 00031 } 00032 00033 ACE_Event_Handler::Reference_Count add_reference() 00034 { 00035 RcObject::_add_ref(); 00036 return 1; 00037 } 00038 00039 ACE_Event_Handler::Reference_Count remove_reference() 00040 { 00041 RcObject::_remove_ref(); 00042 return 1; 00043 } 00044 00045 }; 00046 00047 00048 00049 } // namespace DCPS 00050 } // namespace OpenDDS 00051 00052 OPENDDS_END_VERSIONED_NAMESPACE_DECL 00053 00054 #endif /* OPENDDS_RCEVENTHANDLER_H */