00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Null_RefCount_Policy.h 00006 * 00007 * $Id: Null_RefCount_Policy.h 69182 2005-11-03 17:38:46Z ossama $ 00008 * 00009 * Header file for TAO's reference count policy (unrelated to CORBA 00010 * policies). 00011 * 00012 * @author Ossama Othman <ossama@dre.vanderbilt.edu> 00013 */ 00014 //============================================================================= 00015 00016 #ifndef TAO_NULL_REFCOUNT_POLICY_H 00017 #define TAO_NULL_REFCOUNT_POLICY_H 00018 00019 #include /**/ "ace/pre.h" 00020 00021 #include "tao/AnyTypeCode/TAO_AnyTypeCode_Export.h" 00022 00023 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00024 # pragma once 00025 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00026 00027 #include "tao/Versioned_Namespace.h" 00028 00029 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00030 00031 namespace TAO 00032 { 00033 00034 /** 00035 * @class Null_RefCount_Policy 00036 * 00037 * @brief No-op reference counting policy. 00038 * 00039 * This class is intended to be used as a "policy" argument to a 00040 * host class template that implements no-op reference counting. 00041 * That class would then inherit privately from it like so: 00042 * 00043 * @code 00044 * template <class RefCountPolicy> 00045 * class MyHostClass : private RefCountPolicy 00046 * { 00047 * public: 00048 * void my_add_ref (void) { this->RefCountPolicy::add_ref (); } 00049 * void my_remove_ref (void) { this->RefCountPolicy::remove_ref (); } 00050 * }; 00051 * @endcode 00052 * 00053 * and use it like so: 00054 * 00055 * @code 00056 * typedef MyHostClass<TAO::Null_RefCount_Policy> MyNonRefCountedClass; 00057 * MyNonRefCountedClass m; 00058 * ... 00059 * @endcode 00060 * 00061 * @note In order to incur no size overhead on the host class due to 00062 * virtual tables, no base class defining an interface is 00063 * defined. This allows C++ compilers to apply the Empty Base 00064 * Class Optimization. 00065 */ 00066 class TAO_AnyTypeCode_Export Null_RefCount_Policy 00067 { 00068 public: 00069 00070 /// No-op reference increment. 00071 void add_ref (void) { } 00072 00073 /// No-op reference decrement. 00074 void remove_ref (void) { } 00075 00076 }; 00077 00078 } // End namespace TAO 00079 00080 TAO_END_VERSIONED_NAMESPACE_DECL 00081 00082 #include /**/ "ace/post.h" 00083 00084 #endif /* TAO_NULL_REFCOUNT_POLICY_H */