Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / Sequence_Unit_Tests / testing_string_traits.hpp
blob87ed022d8decea6693702299fcb6e9c96c0b1809
1 #ifndef guard_testing_string_traits_hpp
2 #define guard_testing_string_traits_hpp
3 /**
4 * @file
6 * @brief Specialize the string traits so they can be used in testing.
8 * @author Carlos O'Ryan
9 */
11 #include "testing_exception.hpp"
12 #include "tao/String_Traits_T.h"
13 #include "testing_counters.hpp"
15 template<typename charT>
16 struct testing_string_traits
17 : public TAO::details::string_traits_base<charT>
18 , public TAO::details::string_traits_decorator<charT,testing_string_traits<charT> >
20 static call_counter default_initializer_calls;
21 static call_counter duplicate_calls;
22 static call_counter release_calls;
23 static call_counter not_released_from_const_calls;
24 static call_counter not_released_from_managed_calls;
26 typedef charT char_type;
27 typedef TAO::details::string_traits<charT,false> real_traits;
29 static char_type * default_initializer()
31 default_initializer_calls();
32 return real_traits::default_initializer();
35 static char_type * duplicate(char_type const * s)
37 duplicate_calls();
38 return real_traits::duplicate(s);
41 static void release(char_type * s)
43 release_calls();
44 real_traits::release(s);
47 static void not_released_from_const(
48 char_type * & dst, char_type const * src)
50 not_released_from_const_calls();
51 real_traits::not_released_from_const(dst, src);
54 static void not_released_from_managed(
55 char_type * & dst, char_type const * src)
57 not_released_from_managed_calls();
58 real_traits::not_released_from_managed(dst, src);
62 template<typename charT> call_counter
63 testing_string_traits<charT>::default_initializer_calls;
65 template<typename charT> call_counter
66 testing_string_traits<charT>::duplicate_calls;
68 template<typename charT> call_counter
69 testing_string_traits<charT>::release_calls;
71 template<typename charT> call_counter
72 testing_string_traits<charT>::not_released_from_const_calls;
74 template<typename charT> call_counter
75 testing_string_traits<charT>::not_released_from_managed_calls;
77 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
78 namespace TAO
80 namespace details
83 template<>
84 struct string_traits<char,true>
85 : public testing_string_traits<char>
89 template<>
90 struct string_traits<CORBA::WChar,true>
91 : public testing_string_traits<CORBA::WChar>
95 } // namespace details
96 } // namespace TAO
97 TAO_END_VERSIONED_NAMESPACE_DECL
99 #endif // guard_testing_string_traits_hpp