1 // (C) Copyright Gennadiy Rozental 2005. 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: basic_parameter.hpp,v $ 9 // 10 // Version : $Revision: 1.1.1.1 $ 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 namespace boost { 27 28 namespace BOOST_RT_PARAM_NAMESPACE { 29 30 namespace cla { 31 32 // ************************************************************************** // 33 // ************** runtime::cla::basic_parameter ************** // 34 // ************************************************************************** // 35 36 template<typename T, typename IdPolicy> 37 class basic_parameter : public typed_parameter<T> { 38 public: 39 // Constructors basic_parameter(cstring n)40 explicit basic_parameter( cstring n ) 41 : typed_parameter<T>( m_id_policy ) 42 { 43 this->accept_modifier( name = n ); 44 } 45 46 // parameter properties modification 47 template<typename Modifier> accept_modifier(Modifier const & m)48 void accept_modifier( Modifier const& m ) 49 { 50 typed_parameter<T>::accept_modifier( m ); 51 52 m_id_policy.accept_modifier( m ); 53 } 54 55 private: 56 IdPolicy m_id_policy; 57 }; 58 59 //____________________________________________________________________________// 60 61 #define BOOST_RT_CLA_NAMED_PARAM_GENERATORS( param_type ) \ 62 template<typename T> \ 63 inline shared_ptr<param_type ## _t<T> > \ 64 param_type( cstring name = cstring() ) \ 65 { \ 66 return shared_ptr<param_type ## _t<T> >( new param_type ## _t<T>( name ) ); \ 67 } \ 68 \ 69 inline shared_ptr<param_type ## _t<cstring> > \ 70 param_type( cstring name = cstring() ) \ 71 { \ 72 return shared_ptr<param_type ## _t<cstring> >( new param_type ## _t<cstring>( name ) ); \ 73 } \ 74 /**/ 75 76 //____________________________________________________________________________// 77 78 } // namespace cla 79 80 } // namespace BOOST_RT_PARAM_NAMESPACE 81 82 } // namespace boost 83 84 // ************************************************************************** // 85 // Revision History: 86 // 87 // $Log: basic_parameter.hpp,v $ 88 // Revision 1.1.1.1 2006/03/20 20:15:29 ewalkup 89 // boost libraries 90 // 91 // Revision 1.1 2005/04/12 06:42:43 rogeeff 92 // Runtime.Param library initial commit 93 // 94 // ************************************************************************** // 95 96 #endif // BOOST_RT_CLA_BASIC_PARAMETER_HPP_062604GER 97