summaryrefslogtreecommitdiff
path: root/TAO/tao/Seq_Var_T.h
blob: 9b3e4f38193b2a5e75be4d7f8e7fa5e37e0ec2c3 (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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
// -*- C++ -*-

//=============================================================================
/**
 *  @file    Seq_Var_T.h
 *
 *  $Id$
 *
 *  @author Jeff Parsons
 */
//=============================================================================

#ifndef TAO_SEQ_VAR_T_H
#define TAO_SEQ_VAR_T_H

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

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

#include "tao/Versioned_Namespace.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

/**
 * @class TAO_Seq_Var_Base_T
 *
 * @brief Parametrized implementation of _var base class for sequences
 *
 */
template <typename T, typename T_elem>
class TAO_Seq_Var_Base_T
{
public:
  TAO_Seq_Var_Base_T (void);
  TAO_Seq_Var_Base_T (T *);
  TAO_Seq_Var_Base_T (const TAO_Seq_Var_Base_T<T,T_elem> &);

  ~TAO_Seq_Var_Base_T (void);

  T *operator-> (void);
  const T *operator-> (void) const;

  operator const T & () const;
  operator T & ();
  operator T & () const;

  typedef const T &   _in_type;
  typedef       T &   _inout_type;
  typedef       T *&  _out_type;
  typedef       T *   _retn_type;

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

  // TAO extension.
  _retn_type    ptr (void) const;

protected:
  T * ptr_;
};

/**
 * @class TAO_FixedSeq_Var_T
 *
 * @brief Parametrized implementation of _var class for sequences
 * whose element is of fixed size..
 *
 */
template <typename T, typename T_elem>
class TAO_FixedSeq_Var_T : public TAO_Seq_Var_Base_T<T,T_elem>
{
public:
  TAO_FixedSeq_Var_T (void);
  TAO_FixedSeq_Var_T (T *);
  TAO_FixedSeq_Var_T (const TAO_FixedSeq_Var_T<T,T_elem> &);

  // Fixed-size base types only.
  TAO_FixedSeq_Var_T (const T &);

  TAO_FixedSeq_Var_T & operator= (T *);
  TAO_FixedSeq_Var_T & operator= (const TAO_FixedSeq_Var_T<T,T_elem> &);

  T_elem & operator[] (CORBA::ULong index);
  const T_elem & operator[] (CORBA::ULong index) const;

  // Fixed-size base types only.
  TAO_FixedSeq_Var_T & operator= (const T &);
};

/**
 * @class TAO_VarSeq_Var_T
 *
 * @brief Parametrized implementation of _var class for sequences
 * whose element is of variable size..
 *
 */
template <typename T, typename T_elem>
class TAO_VarSeq_Var_T : public TAO_Seq_Var_Base_T<T,T_elem>
{
public:
  TAO_VarSeq_Var_T (void);
  TAO_VarSeq_Var_T (T *);
  TAO_VarSeq_Var_T (const TAO_VarSeq_Var_T<T,T_elem> &);

  TAO_VarSeq_Var_T & operator= (T *);
  TAO_VarSeq_Var_T & operator= (const TAO_VarSeq_Var_T<T,T_elem> &);

  T_elem & operator[] (CORBA::ULong index);
  const T_elem & operator[] (CORBA::ULong index) const;

  // Variable-size base types only.
  operator T *& ();
};

/**
 * @class TAO_MngSeq_Var_T
 *
 * @brief Parametrized implementation of _var class for sequences
 * whose element is of a managed type - string, wstring, valuetype,
 * interface, abstract interface and pseudo object.
 *
 */
template <typename T, typename T_elem>
class TAO_MngSeq_Var_T : public TAO_Seq_Var_Base_T<T,T_elem>
{
public:
  TAO_MngSeq_Var_T (void);
  TAO_MngSeq_Var_T (T *);
  TAO_MngSeq_Var_T (const TAO_MngSeq_Var_T<T,T_elem> &);

  TAO_MngSeq_Var_T & operator= (T *);
  TAO_MngSeq_Var_T & operator= (const TAO_MngSeq_Var_T<T,T_elem> &);

  // Variable-size base types only.
  operator T *& ();

  // Managed base types only.
  T_elem operator[] (CORBA::ULong index);
};

TAO_END_VERSIONED_NAMESPACE_DECL

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

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

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

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

#endif /* TAO_SEQ_VAROUT_T_H */