00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Intrusive_Ref_Count_Object_T.h 00006 * 00007 * $Id: Intrusive_Ref_Count_Object_T.h 87943 2009-12-06 02:02:35Z dai_y $ 00008 * 00009 * @authors Yan Dai <dai_y@ociweb.com> 00010 */ 00011 //============================================================================= 00012 00013 #ifndef TAO_INTRUSIVE_REF_COUNT_OBJECT_T_H 00014 #define TAO_INTRUSIVE_REF_COUNT_OBJECT_T_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00019 # pragma once 00020 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00021 00022 #include /**/ "tao/Versioned_Namespace.h" 00023 #include /**/ "tao/Intrusive_Ref_Count_Base_T.h" 00024 00025 #include "ace/Atomic_Op.h" 00026 00027 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00028 00029 /** 00030 * @class TAO_Intrusive_Ref_Count_Object<ACE_LOCK> 00031 * 00032 * @brief Template class as wrapper of a non reference counted data type but provide 00033 * intrusive reference-counting feature by inherited from TAO_Intrusive_Ref_Count_Base. 00034 * This makes the parameterized type data be smart pointer by using a 00035 * TAO_Intrusive_Ref_Count_Handle<X> to an this wrapper object. 00036 */ 00037 template <class OBJ, class ACE_LOCK> 00038 class TAO_Intrusive_Ref_Count_Object : public TAO_Intrusive_Ref_Count_Base <ACE_LOCK> 00039 { 00040 public: 00041 00042 /// take ownership of obj. 00043 TAO_Intrusive_Ref_Count_Object (OBJ* obj); 00044 virtual ~TAO_Intrusive_Ref_Count_Object (void); 00045 00046 OBJ* get () const; 00047 00048 private: 00049 00050 // Prevent default constructor used. 00051 TAO_Intrusive_Ref_Count_Object (void); 00052 00053 // Prevent copying/assignment. 00054 TAO_Intrusive_Ref_Count_Object (const TAO_Intrusive_Ref_Count_Object&); 00055 TAO_Intrusive_Ref_Count_Object& operator= (const TAO_Intrusive_Ref_Count_Object&); 00056 00057 OBJ* obj_; 00058 }; 00059 00060 TAO_END_VERSIONED_NAMESPACE_DECL 00061 00062 #if defined (__ACE_INLINE__) 00063 #include "tao/Intrusive_Ref_Count_Object_T.inl" 00064 #endif /* __ACE_INLINE__ */ 00065 00066 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) 00067 #include "tao/Intrusive_Ref_Count_Object_T.cpp" 00068 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ 00069 00070 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) 00071 #pragma implementation ("Intrusive_Ref_Count_Object_T.cpp") 00072 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ 00073 00074 #include /**/ "ace/post.h" 00075 00076 #endif /* TAO_INTRUSIVE_REF_COUNT_OBJECT_T_H */