summaryrefslogtreecommitdiff
path: root/TAO/tao/Pseudo_VarOut_T.h
blob: 761414716cb5152221a31d95c12dfc53193b724a (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
// -*- C++ -*-

//=============================================================================
/**
 *  @file    Pseudo_VarOut_T.h
 *
 * @note This header should be included after all types to be passed
 * as template parameters to the TAO_Pseudo_{Var,Out}_T template
 * classes have been declared.  If the types in question are defined
 * in another header, include that header before this one.
 * @par
 * Including other headers like "tao/CORBA_methods.h" here can cause
 * circular dependency related problems when using compilers that
 * lookup and bind non-dependent names in templates at definition time
 * (i.e. while parsing the code) instead of at instantiation time.
 *
 * @todo Look into adding a template parameter to each of the
 *       templates in question that would be a trait containing the
 *       means for releasing references managed by the templates.
 *       Doing so should work around the non-dependent name issues in
 *       g++ 3.4, thus easing the requirement that this header be
 *       parsed last.
 *
 *         -Ossama
 *
 * @author Jeff Parsons
 */
//=============================================================================


#ifndef TAO_PSEUDO_VAROUT_T_H
#define TAO_PSEUDO_VAROUT_T_H

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

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

#include "tao/varbase.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

/**
 * @class TAO_Pseudo_Var_T
 *
 * @brief Parametrized implementation of _var class for
 * TypeCode, Object, AbstractBase, NamedValue, NVList,
 * Principal, Request, Context, ORB, LocalObject,
 * and Environment.
 */
template <typename T>
class TAO_Pseudo_Var_T : private TAO_Base_var
{
public:
  TAO_Pseudo_Var_T ();
  TAO_Pseudo_Var_T (typename T::_ptr_type);
  TAO_Pseudo_Var_T (const TAO_Pseudo_Var_T<T> &);

  ~TAO_Pseudo_Var_T ();

  TAO_Pseudo_Var_T<T> & operator= (typename T::_ptr_type);
  TAO_Pseudo_Var_T<T> & operator= (const TAO_Pseudo_Var_T<T> &);

  typename T::_ptr_type operator-> () const;

  operator typename T::_ptr_type  const & () const;
  operator typename T::_ptr_type & ();

  typedef typename T::_ptr_type    _in_type;
  typedef typename T::_ptr_type &  _inout_type;
  typedef typename T::_ptr_type &  _out_type;
  typedef typename T::_ptr_type    _retn_type;

  _in_type      in () const;
  _inout_type   inout ();
  _out_type     out ();
  _retn_type    _retn ();

  // TAO extension.
  _retn_type    ptr () const;
private:
  // Unimplemented - prevents widening assignment.
  TAO_Pseudo_Var_T (const TAO_Base_var &);
  void operator= (const TAO_Base_var &);

private:
  typename T::_ptr_type ptr_;
};

/**
 * @class TAO_Pseudo_Out_T
 *
 * @brief Parametrized implementation of _out class for
 * TypeCode, Object, AbstractBase, NamedValue, NVList,
 * Principal, Request, Context, ORB, LocalObject,
 * and Environment.
 */
template <typename T>
class TAO_Pseudo_Out_T
{
public:
  TAO_Pseudo_Out_T (typename T::_ptr_type &);
  TAO_Pseudo_Out_T (typename T::_var_type &);
  TAO_Pseudo_Out_T (const TAO_Pseudo_Out_T<T> &);

  TAO_Pseudo_Out_T<T> & operator= (const TAO_Pseudo_Out_T<T> &);
  TAO_Pseudo_Out_T<T> & operator= (typename T::_ptr_type);

  operator typename T::_ptr_type & ();
  typename T::_ptr_type & ptr ();
  typename T::_ptr_type operator-> ();

private:
  typename T::_ptr_type & ptr_;

  /// Assignment from _var not allowed.
  TAO_Pseudo_Out_T<T> & operator= (const typename T::_var_type &);
};

TAO_END_VERSIONED_NAMESPACE_DECL

#if defined (__ACE_INLINE__)
#include "tao/Pseudo_VarOut_T.inl"
#endif /* __ACE_INLINE__ */

#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "tao/Pseudo_VarOut_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */

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

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

#endif /* TAO_PSEUDO_VAROUT_T_H */