summaryrefslogtreecommitdiff
path: root/TAO/tao/Refcounted_ObjectKey.h
blob: a001a56f4b531d91ef95ff263c08bc80fdbd5f49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// -*- C++ -*-

//=============================================================================
/**
 *  @file Refcounted_ObjectKey.h
 *
 *  $Id$
 *
 *  @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
 */
//=============================================================================

#ifndef TAO_REFCOUNTED_OBJECTKEY_H
#define TAO_REFCOUNTED_OBJECTKEY_H

#include /**/ "ace/pre.h"

#include "tao/Object_KeyC.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

namespace TAO
{
  /**
   * @class Refcounted_ObjectKey
   *
   * @brief A wrapper class that ties together a refcount to an
   * ObjectKey.
   *
   * The refounts in this class is manipulated within the context of
   * the lock in the TAO::ObjectKey_Table. Manipulating the refcounts
   * from anywhere else is strictly forbidden.
   */
  class TAO_Export Refcounted_ObjectKey
  {
  public:
    /// Constructor
    Refcounted_ObjectKey (const ObjectKey &ref);

    /// Accessor for the underlying ObjectKey.
    const ObjectKey &object_key (void) const;

  protected:
    friend class ObjectKey_Table;

    /// Protected destructor
    ~Refcounted_ObjectKey (void);

    /// Methods for incrementing and decrementing refcounts.
    long incr_refcount (void);
    long decr_refcount (void);

  private:
    /// The object key
    ObjectKey object_key_;

    /// The refcount on the object key..
    long ref_count_;
  };
}

#if defined (__ACE_INLINE__)
#include "Refcounted_ObjectKey.inl"
#endif /* defined INLINE */

#include /**/ "ace/post.h"

#endif /*TAO_REFCOUNTED_OBJECTKEY_H*/