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
|
/* -*- C++ -*- */
// $Id$
// ============================================================================
//
// = LIBRARY
// TAO
//
// = FILENAME
// varout.h
//
// = DESCRIPTION
// Templates for _var and _out types
//
// = AUTHOR
// Aniruddha Gokhale <gokhale@cs.wustl.edu>
//
// ============================================================================
#ifndef TAO_VAROUT_H
#define TAO_VAROUT_H
#include "ace/pre.h"
#include "tao/Object.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
template<class T, class T_var> class TAO_Object_Manager;
template <class T, class T_var>
class TAO_Object_Field_T : public TAO_Object_Field
{
// = TITLE
// Parametric class to implement structure fields corresponding to
// object references.
//
// = DESCRIPTION
// When an object reference appears in a structure the marshaling
// and demarhsaling of the structure gets complicated: the
// interpreter can only marshal CORBA_Object_ptr when it
// dermarshal it creates on of those objects. The downcasting to
// the right type must be executed by classes with compile-time
// knowledge of the object type. The solution addopted in TAO is
// to create a special manager class for that field,
public:
TAO_Object_Field_T (void);
// default constructor
TAO_Object_Field_T (T *object);
// constructor from a T *, assumes ownership of <object> i.e. it
// *will* release it.
TAO_Object_Field_T (const T_var &);
// constructor from a var
TAO_Object_Field_T (const TAO_Object_Field_T<T,T_var> &);
// copy constructor
TAO_Object_Field_T (const TAO_Object_Manager<T,T_var> &);
// constructor from an Object_Manager (sequence var-like class)
virtual ~TAO_Object_Field_T (void);
// destructor
TAO_Object_Field_T<T,T_var> &operator= (T *object);
// Assignment from a T*, it assumes ownership of <object>.
TAO_Object_Field_T<T,T_var> &operator= (const T_var& var);
// Assignment from a T_var, make a duplicate of the object
TAO_Object_Field_T<T,T_var> &operator= (const TAO_Object_Field_T<T,T_var> &);
// Assignment operator, in duplicates the underlying objects.
TAO_Object_Field_T<T,T_var> &operator= (const TAO_Object_Manager<T,T_var>&);
// Assignment from a T_var, make a duplicate of the object
T *operator-> (void) const;
// smart pointer (const)
operator T *const &() const;
// cast operator
operator T *&();
// cast operator
// = operations for parameter passing modes
T *in (void) const;
// for in type parameter
T *&inout (void);
// for inout type parameter
T *&out (void);
// for out parameter
T *_retn (void);
// for return type
T *ptr (void) const;
// TAO extension for access to the underlying pointer.
virtual void _downcast (CORBA_Object *base_ptr,
CORBA_Environment &ACE_TRY_ENV =
TAO_default_environment ());
// No default to workaround egcs problem with templates and
// namespaces
virtual CORBA_Object *_upcast (void);
virtual void _release (void);
// Implement the TAO_Object_Field methods.
private:
T *ptr_;
};
#if defined (__ACE_INLINE__)
#include "tao/varout.i"
#endif /* __ACE_INLINE__ */
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "tao/varout.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("varout.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
#include "ace/post.h"
#endif /* TAO_VAROUT_H */
|