diff options
Diffstat (limited to 'TAO/tao/DynamicAny/DynAnyUtils_T.h')
-rw-r--r-- | TAO/tao/DynamicAny/DynAnyUtils_T.h | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/TAO/tao/DynamicAny/DynAnyUtils_T.h b/TAO/tao/DynamicAny/DynAnyUtils_T.h new file mode 100644 index 00000000000..f91d18b9f25 --- /dev/null +++ b/TAO/tao/DynamicAny/DynAnyUtils_T.h @@ -0,0 +1,102 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file DynAnyUtils_T.h + * + * $Id$ + * + * Declaration of templatized common code used in Dynamic Any + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + +#ifndef TAO_DYNANYUTILS_T_H +#define TAO_DYNANYUTILS_T_H + +#include /**/ "ace/pre.h" + +#include "tao/DynamicAny/DynamicAny.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/AnyTypeCode/BasicTypeTraits.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +class TAO_DynCommon; + +namespace TAO +{ + // Encapsulates common code for inserting and extracting basic + // types, parameterized on the basic type. + template<typename T> + struct DynAnyBasicTypeUtils + { + static void + insert_value (const T &val, + TAO_DynCommon *the_dynany) + ACE_THROW_SPEC (( + CORBA::SystemException, + DynamicAny::DynAny::TypeMismatch, + DynamicAny::DynAny::InvalidValue + )); + + static typename BasicTypeTraits<T>::return_type + get_value (TAO_DynCommon *the_dynany) + ACE_THROW_SPEC (( + CORBA::SystemException, + DynamicAny::DynAny::TypeMismatch, + DynamicAny::DynAny::InvalidValue + )); + }; + + // Encapsulates code that would otherwise be repeated in + // TAO_DynCommon::set_flag(). Parameterized on the type + // of dynany impl class that underlies the DynAny arg. + template<typename T> + struct DynAnyFlagUtils + { + static void + set_flag_t (DynamicAny::DynAny_ptr component, + CORBA::Boolean destroying) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + }; + + // Used by MakeDynAnyUtils below, parameterized on the type of + // impl class and on {Any | TypeCode}. + template<typename DA_IMPL, typename ANY_TC> + struct CreateDynAnyUtils + { + static DynamicAny::DynAny_ptr + create_dyn_any_t (ANY_TC any_tc); + }; + + // Code common to DynAnyFactory create_* calls, parameterized on + // {Any | TypeCode}. + namespace MakeDynAnyUtils + { + template<typename ANY_TC> + DynamicAny::DynAny_ptr + make_dyn_any_t (CORBA::TypeCode_ptr tc, ANY_TC any_tc); + } +} + +TAO_END_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "tao/DynamicAny/DynAnyUtils_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("tao/DynamicAny/DynAnyUtils_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* TAO_DYNANYUTILS_T_H */ |