Intrusive_Ref_Count_Base_T.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Intrusive_Ref_Count_Base_T.h
00006  *
00007  *  Intrusive_Ref_Count_Base_T.h,v 1.3 2006/03/10 07:19:05 jtc Exp
00008  *
00009  *  @authors Tim Bradley  <bradley_t@ociweb.com>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef TAO_INTRUSIVE_REF_COUNT_BASE_T_H
00014 #define TAO_INTRUSIVE_REF_COUNT_BASE_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 
00024 #include "ace/Atomic_Op.h"
00025 
00026 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00027 
00028 /**
00029  * @class TAO_Intrusive_Ref_Count_Base<ACE_LOCK>
00030  *
00031  * @brief Template base class to provide intrusive reference-counting
00032  *        to subclasses.  This makes the subclass capable of using a
00033  *        TAO_Intrusive_Ref_Count_Handle<X> class as a smart-pointer
00034  *        to an X object.  In this case, X is a sub-class of this class,
00035  *        TAO_Intrusive_Ref_Count_Base<ACE_LOCK>.  The ACE_LOCK type is
00036  *        used to protect the atomic reference count data member.
00037  *
00038  */
00039 template <class ACE_LOCK>
00040 class TAO_Intrusive_Ref_Count_Base
00041 {
00042 public:
00043 
00044   virtual ~TAO_Intrusive_Ref_Count_Base (void);
00045 
00046   void _add_ref (void);
00047   void _remove_ref (void);
00048 
00049 
00050 protected:
00051 
00052   TAO_Intrusive_Ref_Count_Base (void);
00053 
00054 
00055 private:
00056 
00057   ACE_Atomic_Op<ACE_LOCK, long> ref_count_;
00058 
00059   // Prevent copying/assignment.
00060   TAO_Intrusive_Ref_Count_Base (const TAO_Intrusive_Ref_Count_Base&);
00061   TAO_Intrusive_Ref_Count_Base& operator= (const TAO_Intrusive_Ref_Count_Base&);
00062 };
00063 
00064 TAO_END_VERSIONED_NAMESPACE_DECL
00065 
00066 #if defined (__ACE_INLINE__)
00067 #include "tao/Intrusive_Ref_Count_Base_T.inl"
00068 #endif /* __ACE_INLINE__ */
00069 
00070 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
00071 #include "tao/Intrusive_Ref_Count_Base_T.cpp"
00072 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
00073 
00074 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
00075 #pragma implementation ("Intrusive_Ref_Count_Base_T.cpp")
00076 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
00077 
00078 #include /**/ "ace/post.h"
00079 
00080 #endif /* TAO_INTRUSIVE_REF_COUNT_BASE_T_H */

Generated on Thu Nov 9 11:54:14 2006 for TAO by doxygen 1.3.6