Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tao / DynamicAny / DynValue_i.h
blobf3f8884342e94f441e36786f017f1c9e64f99ae3
1 // -*- C++ -*-
2 //=============================================================================
3 /**
4 * @file DynValue_i.h
6 * @author simon dot massey at prismtech dot com
7 */
8 //=============================================================================
11 #ifndef TAO_DYNVALUE_I_H
12 #define TAO_DYNVALUE_I_H
13 #include /**/ "ace/pre.h"
15 #include "tao/DynamicAny/DynValueCommon_i.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
18 # pragma once
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #if defined (_MSC_VER)
22 # pragma warning(push)
23 # pragma warning (disable:4250)
24 #endif /* _MSC_VER */
26 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
28 /**
29 * @class TAO_DynValue_i
31 * @brief Implementation of the DynValue class.
33 class TAO_DynamicAny_Export TAO_DynValue_i
34 : public virtual DynamicAny::DynValue,
35 public virtual TAO_DynValueCommon_i
37 public:
38 /// Constructor.
39 TAO_DynValue_i (CORBA::Boolean allow_truncation=true);
41 /// Destructor.
42 ~TAO_DynValue_i ();
44 /// Initialize using an Any.
45 void init (const CORBA::Any& any);
47 /// Initialize using a TypeCode and an input stream
48 void init (CORBA::TypeCode_ptr tc, TAO_InputCDR &in);
50 /// Initialize using just a TypeCode.
51 void init (CORBA::TypeCode_ptr tc);
53 // = LocalObject methods.
54 static TAO_DynValue_i *_narrow (CORBA::Object_ptr obj);
56 // = Functions specific to DynValue.
57 virtual DynamicAny::FieldName current_member_name ();
59 virtual CORBA::TCKind current_member_kind ();
61 virtual DynamicAny::NameValuePairSeq * get_members ();
63 virtual void set_members (const DynamicAny::NameValuePairSeq & value);
65 virtual DynamicAny::NameDynAnyPairSeq * get_members_as_dyn_any ();
67 virtual void set_members_as_dyn_any (
68 const DynamicAny::NameDynAnyPairSeq & value);
70 // = DynAny common functions not implemented in class TAO_DynCommon.
71 virtual void from_any (const CORBA::Any & value);
73 virtual CORBA::Any * to_any ();
75 virtual CORBA::Boolean equal (DynamicAny::DynAny_ptr dyn_any);
77 virtual void destroy ();
79 virtual DynamicAny::DynAny_ptr current_component ();
81 virtual void insert_val (CORBA::ValueBase * value);
83 virtual CORBA::ValueBase * get_val ();
85 // = DynValueCommon needed to be provided here
86 virtual void set_to_value ();
88 private:
89 /// List of base types.
90 typedef ACE_Array_Base<CORBA::TypeCode_var> BaseTypesList_t;
92 /// Decompose the given TypeCode into its hiarchical list of
93 /// basetypes. The first element of the list is our actual type,
94 /// each basetype follows in order backwards down the hiarchy.
95 /// All types stored in the list are de-aliased. Optionally
96 /// return the total_member_count of the fully derived type.
97 static void get_base_types (
98 CORBA::TypeCode_ptr,
99 BaseTypesList_t &,
100 CORBA::ULong *total_member_count = 0);
102 /// Return the unaliased valuetype typecode that corresponds to
103 /// index (0..total_members-1) from the given hiarchical list of
104 /// the derived type and it basetypes.
105 static CORBA::TypeCode_ptr get_correct_base_type (
106 const BaseTypesList_t &base_types,
107 CORBA::ULong &index);
109 /// Return the member_type at index (0..total_members-1) from
110 /// the given hiarchical list of the derived type and it basetypes.
111 static CORBA::TypeCode_ptr get_member_type (
112 const BaseTypesList_t &,
113 CORBA::ULong index);
115 /// Return the member_name at index (0..total_members-1) from
116 /// the given hiarchical list of the derived type and it basetypes.
117 static const char * get_member_name (
118 const BaseTypesList_t &,
119 CORBA::ULong index);
121 /// Check if the typecode is acceptable.
122 void check_typecode (CORBA::TypeCode_ptr tc);
124 /// Common code from the init() functions, initializes the
125 /// private bits from the given TypeCode
126 void init_helper (CORBA::TypeCode_ptr tc);
128 /// Code common to the init(Any) and the member
129 /// function from_any().
130 void from_any_helper (const CORBA::Any &any);
132 /// Write the value to the output stream.
133 void to_outputCDR (TAO_OutputCDR &);
135 /// Read the value from the input stream
136 void from_inputCDR (TAO_InputCDR &);
138 /// These are not implimented!
139 /// Use copy() or assign() instead of these.
140 TAO_DynValue_i (const TAO_DynValue_i &src);
141 TAO_DynValue_i &operator= (const TAO_DynValue_i &src);
143 /// Each component of DynValue and DynValueBox is also a DynAny.
144 ACE_Array_Base<DynamicAny::DynAny_var> da_members_;
146 /// First element of this is our type, each basetype follows
147 /// in order backwards down the hiarchy. All types stored are
148 /// de-aliased.
149 BaseTypesList_t da_base_types_;
152 TAO_END_VERSIONED_NAMESPACE_DECL
154 #if defined(_MSC_VER)
155 # pragma warning(pop)
156 #endif /* _MSC_VER */
158 #include /**/ "ace/post.h"
159 #endif /* TAO_DYNVALUE_I_H */