Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / tao / Refcounted_ObjectKey.h
blob96142a512d69ea9be3e4ab5be499ad674098757f
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Refcounted_ObjectKey.h
7 * @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
8 */
9 //=============================================================================
11 #ifndef TAO_REFCOUNTED_OBJECTKEY_H
12 #define TAO_REFCOUNTED_OBJECTKEY_H
14 #include /**/ "ace/pre.h"
16 #include /**/ "tao/TAO_Export.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 # pragma once
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include "tao/Object_KeyC.h"
24 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
26 namespace TAO
28 /**
29 * @class Refcounted_ObjectKey
31 * @brief A wrapper class that ties together a refcount to an
32 * ObjectKey.
34 * The refcount in this class is manipulated within the context of
35 * the lock in the TAO::ObjectKey_Table. Manipulating the refcount
36 * from anywhere else is strictly forbidden.
38 class TAO_Export Refcounted_ObjectKey
40 public:
41 /// Constructor
42 Refcounted_ObjectKey (const ObjectKey &ref);
44 /// Accessor for the underlying ObjectKey.
45 const ObjectKey &object_key (void) const;
47 protected:
48 friend class ObjectKey_Table;
50 /// Protected destructor
51 ~Refcounted_ObjectKey (void);
53 /// Methods for incrementing refcount.
54 void incr_refcount (void);
56 /// Methods for decrementing refcount. Return the refcount, used by the
57 /// ObjectKey table.
58 CORBA::ULong decr_refcount (void);
60 private:
61 /// The object key
62 ObjectKey object_key_;
64 /// The refcount on the object key..
65 CORBA::ULong refcount_;
69 TAO_END_VERSIONED_NAMESPACE_DECL
71 #if defined (__ACE_INLINE__)
72 #include "tao/Refcounted_ObjectKey.inl"
73 #endif /* defined INLINE */
75 #include /**/ "ace/post.h"
77 #endif /*TAO_REFCOUNTED_OBJECTKEY_H*/