Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tao / Objref_VarOut_T.h
blob4ab23d311806b89992db64fd931faac0788bfd82
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Objref_VarOut_T.h
7 * @author Jeff Parsons
8 */
9 //=============================================================================
11 #ifndef TAO_OBJREF_VAROUT_T_H
12 #define TAO_OBJREF_VAROUT_T_H
14 #include /**/ "ace/pre.h"
16 #include "tao/Basic_Types.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 # pragma once
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include "tao/varbase.h"
24 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
26 class TAO_OutputCDR;
28 namespace TAO
30 /**
31 * struct Objref_Traits
33 * @brief Specialized for each interface in generated code. Just forward
34 * declare, a specialization must always be there, if not, we get a
35 * compile error.
37 template<typename T> struct Objref_Traits;
40 /**
41 * @class TAO_Objref_Var_T
43 * @brief Parameterized implementation of @c _var class for object
44 * references.
46 template <typename T>
47 class TAO_Objref_Var_T : private TAO_Base_var
49 public:
50 TAO_Objref_Var_T ();
51 TAO_Objref_Var_T (T * p) : ptr_ (p) {}
52 TAO_Objref_Var_T (const TAO_Objref_Var_T<T> &);
53 ~TAO_Objref_Var_T ();
55 TAO_Objref_Var_T<T> & operator= (T *);
56 TAO_Objref_Var_T<T> & operator= (const TAO_Objref_Var_T<T> &);
57 T * operator-> () const;
59 /// Cast operators.
60 operator T * const & () const;
61 operator T *& ();
63 typedef T _obj_type;
64 typedef T * _in_type;
65 typedef T *& _inout_type;
66 typedef T *& _out_type;
67 typedef T * _retn_type;
69 _in_type in () const;
70 _inout_type inout ();
71 _out_type out ();
72 _retn_type _retn ();
74 /// TAO extension.
75 _retn_type ptr () const;
77 protected:
78 T * ptr_;
79 void free ();
80 void reset (T *);
82 private:
83 // Unimplemented - prevents widening assignment.
84 TAO_Objref_Var_T (const TAO_Base_var &);
85 void operator= (const TAO_Base_var &);
88 /**
89 * @class TAO_Objref_Out_T
91 * @brief Parametrized implementation of _out class for object references.
93 template <typename T>
94 class TAO_Objref_Out_T
96 public:
97 TAO_Objref_Out_T (T *&p);
98 TAO_Objref_Out_T (TAO_Objref_Var_T<T> &p);
99 TAO_Objref_Out_T (const TAO_Objref_Out_T<T> &p);
101 TAO_Objref_Out_T &operator= (T *p);
102 TAO_Objref_Out_T &operator= (const TAO_Objref_Out_T<T> &p);
103 TAO_Objref_Out_T &operator= (const TAO_Objref_Var_T<T> &p);
105 /// Cast operator.
106 operator T *& ();
108 T *& ptr ();
109 T * operator-> ();
111 private:
112 T *& ptr_;
115 TAO_END_VERSIONED_NAMESPACE_DECL
117 #if defined (__ACE_INLINE__)
118 #include "tao/Objref_VarOut_T.inl"
119 #endif /* __ACE_INLINE__ */
121 #include "tao/Objref_VarOut_T.cpp"
123 #include /**/ "ace/post.h"
125 #endif /* TAO_OBJREF_VAROUT_T_H */