1 // (C) Copyright Gennadiy Rozental 2005-2008. 2 // Use, modification, and distribution are subject to the 3 // Boost Software License, Version 1.0. (See accompanying file 4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 6 // See http://www.boost.org/libs/test for the library home page. 7 // 8 // File : $RCSfile$ 9 // 10 // Version : $Revision: 54633 $ 11 // 12 // Description : generic custom parameter generator 13 // *************************************************************************** 14 15 #ifndef BOOST_RT_CLA_BASIC_PARAMETER_HPP_062604GER 16 #define BOOST_RT_CLA_BASIC_PARAMETER_HPP_062604GER 17 18 // Boost.Runtime.Parameter 19 #include <boost/test/utils/runtime/config.hpp> 20 21 #include <boost/test/utils/runtime/cla/typed_parameter.hpp> 22 23 // Boost.Test 24 #include <boost/test/utils/rtti.hpp> 25 26 // Boost 27 #include <boost/utility/base_from_member.hpp> 28 29 namespace boost { 30 31 namespace BOOST_RT_PARAM_NAMESPACE { 32 33 namespace cla { 34 35 // ************************************************************************** // 36 // ************** runtime::cla::basic_parameter ************** // 37 // ************************************************************************** // 38 39 template<typename T, typename IdPolicy> 40 class basic_parameter : private base_from_member<IdPolicy>, public typed_parameter<T> { 41 public: 42 // Constructors basic_parameter(cstring n)43 explicit basic_parameter( cstring n ) 44 : base_from_member<IdPolicy>() 45 , typed_parameter<T>( base_from_member<IdPolicy>::member ) 46 { 47 this->accept_modifier( name = n ); 48 } 49 50 // parameter properties modification 51 template<typename Modifier> accept_modifier(Modifier const & m)52 void accept_modifier( Modifier const& m ) 53 { 54 typed_parameter<T>::accept_modifier( m ); 55 56 base_from_member<IdPolicy>::member.accept_modifier( m ); 57 } 58 }; 59 60 //____________________________________________________________________________// 61 62 #define BOOST_RT_CLA_NAMED_PARAM_GENERATORS( param_type ) \ 63 template<typename T> \ 64 inline shared_ptr<param_type ## _t<T> > \ 65 param_type( cstring name = cstring() ) \ 66 { \ 67 return shared_ptr<param_type ## _t<T> >( new param_type ## _t<T>( name ) ); \ 68 } \ 69 \ 70 inline shared_ptr<param_type ## _t<cstring> > \ 71 param_type( cstring name = cstring() ) \ 72 { \ 73 return shared_ptr<param_type ## _t<cstring> >( new param_type ## _t<cstring>( name ) ); \ 74 } \ 75 /**/ 76 77 //____________________________________________________________________________// 78 79 } // namespace cla 80 81 } // namespace BOOST_RT_PARAM_NAMESPACE 82 83 } // namespace boost 84 85 #endif // BOOST_RT_CLA_BASIC_PARAMETER_HPP_062604GER 86