Refcountable_Guard_T.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 /**
00004  *  @file Refcountable_Guard_T.h
00005  *
00006  *  Refcountable_Guard_T.h,v 1.11 2006/03/29 15:38:15 jwillemsen Exp
00007  *
00008  *  @author Pradeep Gore <pradeep@oomworks.com>
00009  */
00010 
00011 #ifndef TAO_Notify_REFCOUNTABLE_GUARD_T_H
00012 #define TAO_Notify_REFCOUNTABLE_GUARD_T_H
00013 
00014 #include /**/ "ace/pre.h"
00015 
00016 #include "orbsvcs/Notify/notify_serv_export.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 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00025 
00026 /**
00027  * @class TAO_Notify_Refcountable_Guard_T
00028  *
00029  * @brief Increments the reference count in the constructor, the count is decremented in the destructor.
00030  *        See Refcountable.h for further notes on usage.
00031  *
00032  */
00033 template <class T>
00034 class TAO_Notify_Refcountable_Guard_T
00035 {
00036 public:
00037   /// Constuctor
00038   explicit TAO_Notify_Refcountable_Guard_T (T* t = 0);
00039 
00040   /// Copy constructor
00041   TAO_Notify_Refcountable_Guard_T (const TAO_Notify_Refcountable_Guard_T<T>& rhs);
00042 
00043   /// Destructor
00044   ~TAO_Notify_Refcountable_Guard_T ();
00045 
00046   /// Redirection operator
00047   T* get (void) const;
00048 
00049   /// Boolean test
00050   bool isSet (void) const;
00051 
00052   /// Redirection operator
00053   T* operator -> (void) const;
00054 
00055   /// Dereference operator
00056   T& operator * () const;
00057 
00058   /// Reassignment
00059   void reset (T* t = 0);
00060 
00061   // There is no logical release. Release could return an invalid object.
00062 
00063   /// Assignment
00064   TAO_Notify_Refcountable_Guard_T<T>& operator = (
00065     const TAO_Notify_Refcountable_Guard_T<T>& rhs);
00066 
00067 private:
00068   void swap( TAO_Notify_Refcountable_Guard_T<T>& rhs );
00069 
00070   T* t_;
00071 };
00072 
00073 TAO_END_VERSIONED_NAMESPACE_DECL
00074 
00075 #if defined (__ACE_INLINE__)
00076 #include "orbsvcs/Notify/Refcountable_Guard_T.inl"
00077 #endif /* __ACE_INLINE__ */
00078 
00079 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
00080 #include "orbsvcs/Notify/Refcountable_Guard_T.cpp"
00081 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
00082 
00083 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
00084 #pragma implementation ("Refcountable_Guard_T.cpp")
00085 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
00086 
00087 #include /**/ "ace/post.h"
00088 
00089 #endif /* TAO_Notify_REFCOUNTABLE_GUARD_T_H */

Generated on Thu Nov 9 13:24:15 2006 for TAO_CosNotification by doxygen 1.3.6