summaryrefslogtreecommitdiff
path: root/ace/CORBA_Ref.h
blob: 9010c8c82fd457750512e4005c1f9843c26cbbbf (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
71
72
73
74
75
76
77
78
79
80
81
82
83
/* -*- C++ -*- */

//=============================================================================
/**
 *  @file    CORBA_Ref.h
 *
 *  $Id$
 *
 *  @author Irfan Pyarali (irfan@wuerl.wustl.edu)
 *  @author Tim Harrison (harrison@cs.wustl.edu)
 *
 *  A wrapper for helping with Orbix object references.
 *
 *
 */
//=============================================================================


#ifndef ACE_CORBA_REF_H
#define ACE_CORBA_REF_H
#include "ace/pre.h"

#include "ace/ACE.h"

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

/**
 * @class ACE_CORBA_Ref
 *
 * @brief A wrapper for helping with Orbix object references.
 *
 * <ACE_CORBA_Ref> is parameterized by the type of orbix object
 * reference to be used.  The construtor, operator=, and the
 * destructor of <ACE_CORBA_Ref> perform implicit duplicates and
 * releases in order to help make the use of Orbix object
 * references transparent.
 */
template <class CORBA_REF>
class ACE_CORBA_Ref
{
public:
  /// Null construction.
  ACE_CORBA_Ref (void);

  /// Contruction with an orbix ref.
  /// performs a <CORBA_REF::_duplicate>.
  ACE_CORBA_Ref (CORBA_REF *ref);

  /// Assignment performs a <CORBA_REF::_duplicate>.
  CORBA_REF *operator= (CORBA_REF *ref);

  /// Type operator
  operator CORBA_REF *(void) const;

  /// Smart pointer to forward all CORBA_REF calls to the underlying
  /// Orbix reference.
  CORBA_REF *operator-> (void) const;

  /// Pointer comparison.
  int operator== (CORBA_REF *) const;

  /// Pointer comparison.
  int operator!= (CORBA_REF *) const;

  /// Destruction: calls <CORBA_REF::_release>.
  ~ACE_CORBA_Ref (void);

private:
  CORBA_REF *ref_;
};

#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/CORBA_Ref.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */

#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("CORBA_Ref.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */

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