Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / tao / DynamicAny / DynAnyUtils_T.h
blob6d6ba6e033b969653d487493fc0148790a193246
1 // -*- C++ -*-
3 //=============================================================================
4 /**
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)
21 # pragma once
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
24 #include "tao/AnyTypeCode/BasicTypeTraits.h"
26 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
28 class TAO_DynCommon;
30 namespace TAO
32 // Encapsulates common code for inserting and extracting basic
33 // types, parameterized on the basic type.
34 template<typename T>
35 struct DynAnyBasicTypeUtils
37 static void
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.
48 template<typename T>
49 struct DynAnyFlagUtils
51 static void
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
62 create_dyn_any_t (
63 ANY_TC any_tc,
64 CORBA::Boolean allow_truncation= true);
66 static DynamicAny::DynAny_ptr
67 create_dyn_any_t (
68 CORBA::TypeCode_ptr tc,
69 ANY_TC any_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
79 make_dyn_any_t (
80 CORBA::TypeCode_ptr tc,
81 ANY_TC any_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 */