00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Refcounted_ObjectKey.h 00006 * 00007 * $Id: Refcounted_ObjectKey.h 74014 2006-08-14 13:52:22Z johnnyw $ 00008 * 00009 * @author Balachandran Natarajan <bala@dre.vanderbilt.edu> 00010 */ 00011 //============================================================================= 00012 00013 #ifndef TAO_REFCOUNTED_OBJECTKEY_H 00014 #define TAO_REFCOUNTED_OBJECTKEY_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #include /**/ "tao/TAO_Export.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 #include "tao/Object_KeyC.h" 00025 00026 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00027 00028 namespace TAO 00029 { 00030 /** 00031 * @class Refcounted_ObjectKey 00032 * 00033 * @brief A wrapper class that ties together a refcount to an 00034 * ObjectKey. 00035 * 00036 * The refcount in this class is manipulated within the context of 00037 * the lock in the TAO::ObjectKey_Table. Manipulating the refcount 00038 * from anywhere else is strictly forbidden. 00039 */ 00040 class TAO_Export Refcounted_ObjectKey 00041 { 00042 public: 00043 /// Constructor 00044 Refcounted_ObjectKey (const ObjectKey &ref); 00045 00046 /// Accessor for the underlying ObjectKey. 00047 const ObjectKey &object_key (void) const; 00048 00049 protected: 00050 friend class ObjectKey_Table; 00051 00052 /// Protected destructor 00053 ~Refcounted_ObjectKey (void); 00054 00055 /// Methods for incrementing refcount. 00056 void incr_refcount (void); 00057 00058 /// Methods for decrementing refcount. Return the refcount, used by the 00059 /// ObjectKey table. 00060 CORBA::ULong decr_refcount (void); 00061 00062 private: 00063 /// The object key 00064 ObjectKey object_key_; 00065 00066 /// The refcount on the object key.. 00067 CORBA::ULong ref_count_; 00068 }; 00069 } 00070 00071 TAO_END_VERSIONED_NAMESPACE_DECL 00072 00073 #if defined (__ACE_INLINE__) 00074 #include "tao/Refcounted_ObjectKey.inl" 00075 #endif /* defined INLINE */ 00076 00077 #include /**/ "ace/post.h" 00078 00079 #endif /*TAO_REFCOUNTED_OBJECTKEY_H*/