00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file RefCount_Policy_Traits.h 00006 * 00007 * $Id: RefCount_Policy_Traits.h 72141 2006-04-19 09:45:01Z jwillemsen $ 00008 * 00009 * Header file for TAO's reference count policy (unrelated to CORBA 00010 * policies) traits. 00011 * 00012 * @author Ossama Othman <ossama@dre.vanderbilt.edu> 00013 */ 00014 //============================================================================= 00015 00016 #ifndef TAO_REFCOUNT_POLICY_TRAITS_H 00017 #define TAO_REFCOUNT_POLICY_TRAITS_H 00018 00019 #include /**/ "ace/pre.h" 00020 00021 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00022 # pragma once 00023 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00024 00025 #include "tao/AnyTypeCode/AnyTypeCode_methods.h" 00026 00027 00028 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00029 00030 namespace TAO 00031 { 00032 class Null_RefCount_Policy; 00033 class True_RefCount_Policy; 00034 00035 /** 00036 * @struct RefCount_Policy_Traits 00037 * 00038 * @brief Compile-time selection of RefCount_Policy operations, 00039 * etc. 00040 * 00041 * This primary template is used to select RefCount_Policy 00042 * operations, etc at compile-time based on the reference counting 00043 * policy and type being operated on. 00044 * 00045 * @note This merely a forward declaration since we really only care 00046 * about the partial specializations below. 00047 */ 00048 template<class RefCountPolicy, typename TypePtr> 00049 struct RefCount_Policy_Traits; 00050 00051 /** 00052 * @struct RefCount_Policy_Traits 00053 * 00054 * @brief No-op reference count policy traits. 00055 * 00056 * This partial specialization performs no-op reference counting 00057 * operations on values of type @a TypePtr if the @a RefCountPolicy 00058 * first argument is @c Null_RefCount_Policy. 00059 */ 00060 template<typename TypePtr> 00061 struct RefCount_Policy_Traits<Null_RefCount_Policy, TypePtr> 00062 { 00063 /// No-op "release" operation. 00064 static void release (TypePtr) { } 00065 }; 00066 00067 template<typename TypePtr> 00068 struct RefCount_Policy_Traits<True_RefCount_Policy, TypePtr> 00069 { 00070 /// Call actual "release" operation on @a ptr value. 00071 static void release (TypePtr ptr) 00072 { 00073 CORBA::release (ptr); 00074 } 00075 }; 00076 } // End namespace TAO 00077 00078 TAO_END_VERSIONED_NAMESPACE_DECL 00079 00080 #include /**/ "ace/post.h" 00081 00082 #endif /* TAO_REFCOUNT_POLICY_TRAITS_H */