Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tao / Object_Reference_Traits_T.h
blob7f5d85519aad2e661185f7a2ede2c60db0076153
1 #ifndef guard_object_reference_traits_hpp
2 #define guard_object_reference_traits_hpp
3 /**
4 * @file
6 * @brief Implement the element manipulation traits for object
7 * reference types.
9 * @author Carlos O'Ryan
11 #include "Object_Reference_Traits_Base_T.h"
12 #include "ace/OS_NS_string.h"
14 #include <algorithm>
15 #include <functional>
17 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
19 namespace TAO
21 namespace details
23 template<class object_t, class object_t_var, class derived>
24 struct object_reference_traits_decorator
26 typedef object_t object_type;
27 typedef object_type * value_type;
28 typedef object_type const * const_value_type;
29 typedef object_t_var object_type_var;
31 inline static void zero_range(
32 object_type ** begin, object_type ** end)
34 ACE_OS::memset (begin, 0, (end - begin) * sizeof (object_type*));
37 inline static void initialize_range(
38 object_type ** begin, object_type ** end)
40 std::generate(begin, end, &derived::default_initializer);
43 // Allow MSVC++ >= 8 checked iterators to be used.
44 template <typename iter>
45 inline static void copy_range(
46 object_type ** begin, object_type ** end, iter dst)
48 std::transform(begin, end, dst, &derived::duplicate);
51 // Allow MSVC++ >= 8 checked iterators to be used.
52 template <typename iter>
53 inline static void copy_swap_range(
54 object_type ** begin, object_type ** end, iter dst)
56 std::swap_ranges(begin, end, dst);
59 inline static void release_range(
60 object_type ** begin, object_type ** end)
62 std::for_each(begin, end, &derived::release);
65 inline static object_type const * initialize_if_zero(object_type * & element)
67 if (element == 0)
69 element = derived::nil();
71 return element;
75 template<typename object_t, typename object_t_var, bool dummy>
76 struct object_reference_traits
77 : public object_reference_traits_base<object_t, object_t_var>
78 , public object_reference_traits_decorator<object_t, object_t_var, object_reference_traits<object_t,object_t_var,dummy> >
80 typedef object_t object_type;
81 typedef object_type * value_type;
82 typedef object_type const * const_value_type;
83 typedef object_t_var object_type_var;
85 } // namespace details
86 } // namespace CORBA
88 TAO_END_VERSIONED_NAMESPACE_DECL
90 #endif // guard_object_reference_traits_hpp