Array_Traits_T.h

Go to the documentation of this file.
00001 #ifndef guard_array_traits_hpp
00002 #define guard_array_traits_hpp
00003 /**
00004  * @file
00005  *
00006  * @brief Implement the element manipulation traits for types with
00007  * array-like semantics.
00008  *
00009  * Array_Traits_T.h,v 1.6 2006/06/21 12:14:14 jwillemsen Exp
00010  *
00011  * @author Carlos O'Ryan
00012  */
00013 
00014 #include <algorithm>
00015 #include "tao/Array_VarOut_T.h"
00016 
00017 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00018 
00019 namespace TAO
00020 {
00021 namespace details
00022 {
00023 
00024 template <typename T_forany>
00025 struct array_traits
00026 {
00027   typedef T_forany forany_type;
00028   typedef typename T_forany::_array_type value_type;
00029   typedef typename T_forany::_array_type const const_value_type;
00030   typedef typename T_forany::_slice_type slice_type;
00031 
00032   inline static void copy (slice_type * _tao_to, const slice_type * _tao_from)
00033   {
00034     TAO::Array_Traits<forany_type>::copy (_tao_to, _tao_from);
00035   }
00036 
00037   inline static void free (slice_type * value)
00038   {
00039     TAO::Array_Traits<forany_type>::free (value);
00040   }
00041 
00042   inline static slice_type * alloc (void)
00043   {
00044     return TAO::Array_Traits<forany_type>::alloc ();
00045   }
00046 
00047   inline static slice_type * dup(
00048       const slice_type * value)
00049   {
00050     return TAO::Array_Traits<forany_type>::dup (value);
00051   }
00052 
00053   inline static void zero_range(
00054       value_type * begin, value_type * end)
00055   {
00056     std::for_each(
00057         begin, end, &TAO::Array_Traits<forany_type>::zero);
00058   }
00059 
00060   inline static void initialize_range(
00061       value_type * begin, value_type * end)
00062   {
00063     std::for_each(
00064         begin, end, &TAO::Array_Traits<forany_type>::zero);
00065   }
00066 
00067   inline static void copy_range(
00068       value_type * begin, value_type * end, value_type *dst)
00069   {
00070     for(value_type * i = begin; i != end; ++i, ++dst)
00071     {
00072       TAO::Array_Traits<forany_type>::copy(*dst, *i);
00073     }
00074   }
00075 };
00076 
00077 } // namespace details
00078 } // namespace CORBA
00079 
00080 TAO_END_VERSIONED_NAMESPACE_DECL
00081 
00082 #endif // guard_array_traits_hpp

Generated on Thu Nov 9 11:54:07 2006 for TAO by doxygen 1.3.6