00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file DynAnyUtils_T.h 00006 * 00007 * $Id: DynAnyUtils_T.h 76995 2007-02-11 12:51:42Z johnnyw $ 00008 * 00009 * Declaration of templatized common code used in Dynamic Any 00010 * 00011 * @author Jeff Parsons <j.parsons@vanderbilt.edu> 00012 */ 00013 //============================================================================= 00014 00015 #ifndef TAO_DYNANYUTILS_T_H 00016 #define TAO_DYNANYUTILS_T_H 00017 00018 #include /**/ "ace/pre.h" 00019 00020 #include "tao/DynamicAny/DynamicAny.h" 00021 00022 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00023 # pragma once 00024 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00025 00026 #include "tao/AnyTypeCode/BasicTypeTraits.h" 00027 00028 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00029 00030 class TAO_DynCommon; 00031 00032 namespace TAO 00033 { 00034 // Encapsulates common code for inserting and extracting basic 00035 // types, parameterized on the basic type. 00036 template<typename T> 00037 struct DynAnyBasicTypeUtils 00038 { 00039 static void 00040 insert_value (const T &val, 00041 TAO_DynCommon *the_dynany); 00042 00043 static typename BasicTypeTraits<T>::return_type 00044 get_value (TAO_DynCommon *the_dynany); 00045 }; 00046 00047 // Encapsulates code that would otherwise be repeated in 00048 // TAO_DynCommon::set_flag(). Parameterized on the type 00049 // of dynany impl class that underlies the DynAny arg. 00050 template<typename T> 00051 struct DynAnyFlagUtils 00052 { 00053 static void 00054 set_flag_t (DynamicAny::DynAny_ptr component, 00055 CORBA::Boolean destroying); 00056 }; 00057 00058 // Used by MakeDynAnyUtils below, parameterized on the type of 00059 // impl class and on {Any | TypeCode}. 00060 template<typename DA_IMPL, typename ANY_TC> 00061 struct CreateDynAnyUtils 00062 { 00063 static DynamicAny::DynAny_ptr 00064 create_dyn_any_t (ANY_TC any_tc); 00065 }; 00066 00067 // Code common to DynAnyFactory create_* calls, parameterized on 00068 // {Any | TypeCode}. 00069 namespace MakeDynAnyUtils 00070 { 00071 template<typename ANY_TC> 00072 DynamicAny::DynAny_ptr 00073 make_dyn_any_t (CORBA::TypeCode_ptr tc, ANY_TC any_tc); 00074 } 00075 } 00076 00077 TAO_END_VERSIONED_NAMESPACE_DECL 00078 00079 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) 00080 #include "tao/DynamicAny/DynAnyUtils_T.cpp" 00081 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ 00082 00083 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) 00084 #pragma implementation ("tao/DynamicAny/DynAnyUtils_T.cpp") 00085 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ 00086 00087 #include /**/ "ace/post.h" 00088 00089 #endif /* TAO_DYNANYUTILS_T_H */