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 typed parameter model 13 // *************************************************************************** 14 15 #ifndef BOOST_RT_CLA_TYPED_PARAMETER_HPP_062604GER 16 #define BOOST_RT_CLA_TYPED_PARAMETER_HPP_062604GER 17 18 // Boost.Runtime.Parameter 19 #include <boost/test/utils/runtime/config.hpp> 20 21 #include <boost/test/utils/runtime/fwd.hpp> 22 #include <boost/test/utils/runtime/validation.hpp> 23 24 #include <boost/test/utils/runtime/cla/parameter.hpp> 25 #include <boost/test/utils/runtime/cla/argument_factory.hpp> 26 27 // Boost.Test 28 #include <boost/test/utils/rtti.hpp> 29 30 namespace boost { 31 32 namespace BOOST_RT_PARAM_NAMESPACE { 33 34 namespace cla { 35 36 // ************************************************************************** // 37 // ************** runtime::cla::typed_parameter ************** // 38 // ************************************************************************** // 39 40 template<typename T> 41 class typed_parameter : public cla::parameter { 42 public: typed_parameter(identification_policy & ID)43 explicit typed_parameter( identification_policy& ID ) 44 : cla::parameter( ID, m_arg_factory, rtti::type_id<T>() == rtti::type_id<bool>() ) 45 {} 46 47 // parameter properties modification 48 template<typename Modifier> accept_modifier(Modifier const & m)49 void accept_modifier( Modifier const& m ) 50 { 51 cla::parameter::accept_modifier( m ); 52 53 m_arg_factory.accept_modifier( m ); 54 55 BOOST_RT_PARAM_VALIDATE_LOGIC( !p_optional || !m_arg_factory.m_value_generator, 56 BOOST_RT_PARAM_LITERAL( "can't define a value generator for optional parameter " ) << id_2_report() ); 57 } 58 59 private: 60 // Data members 61 typed_argument_factory<T> m_arg_factory; 62 }; 63 64 } // namespace cla 65 66 } // namespace BOOST_RT_PARAM_NAMESPACE 67 68 } // namespace boost 69 70 #endif // BOOST_RT_CLA_TYPED_PARAMETER_HPP_062604GER 71