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