3 //=============================================================================
5 * @file DynAnyUtils_T.h
7 * Declaration of templatized common code used in Dynamic Any
9 * @author Jeff Parsons <j.parsons@vanderbilt.edu>
11 //=============================================================================
13 #ifndef TAO_DYNANYUTILS_T_H
14 #define TAO_DYNANYUTILS_T_H
16 #include /**/ "ace/pre.h"
18 #include "tao/DynamicAny/DynamicAny.h"
20 #if !defined (ACE_LACKS_PRAGMA_ONCE)
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
24 #include "tao/AnyTypeCode/BasicTypeTraits.h"
26 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
32 // Encapsulates common code for inserting and extracting basic
33 // types, parameterized on the basic type.
35 struct DynAnyBasicTypeUtils
38 insert_value (const T
&val
,
39 TAO_DynCommon
*the_dynany
);
41 static typename BasicTypeTraits
<T
>::return_type
42 get_value (TAO_DynCommon
*the_dynany
);
45 // Encapsulates code that would otherwise be repeated in
46 // TAO_DynCommon::set_flag(). Parameterized on the type
47 // of dynany impl class that underlies the DynAny arg.
49 struct DynAnyFlagUtils
52 set_flag_t (DynamicAny::DynAny_ptr component
,
53 CORBA::Boolean destroying
);
56 // Used by MakeDynAnyUtils below, parameterized on the type of
57 // impl class and on {Any | TypeCode | inputCDR}.
58 template<typename DA_IMPL
, typename ANY_TC
>
59 struct CreateDynAnyUtils
61 static DynamicAny::DynAny_ptr
64 CORBA::Boolean allow_truncation
= true);
66 static DynamicAny::DynAny_ptr
68 CORBA::TypeCode_ptr tc
,
70 CORBA::Boolean allow_truncation
= true);
73 // Code common to DynAnyFactory create_* calls, parameterized on
74 // {Any | TypeCode | inputCDR}.
75 namespace MakeDynAnyUtils
77 template<typename ANY_TC
>
78 DynamicAny::DynAny_ptr
80 CORBA::TypeCode_ptr tc
,
82 CORBA::Boolean allow_truncation
= true);
86 TAO_END_VERSIONED_NAMESPACE_DECL
88 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
89 #include "tao/DynamicAny/DynAnyUtils_T.cpp"
90 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
92 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
93 #pragma implementation ("tao/DynamicAny/DynAnyUtils_T.cpp")
94 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
96 #include /**/ "ace/post.h"
98 #endif /* TAO_DYNANYUTILS_T_H */