source: NonGTP/Boost/boost/test/utils/runtime/cla/basic_parameter.hpp @ 857

Revision 857, 3.6 KB checked in by igarcia, 18 years ago (diff)
Line 
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 $
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
26namespace boost {
27
28namespace BOOST_RT_PARAM_NAMESPACE {
29
30namespace cla {
31
32// ************************************************************************** //
33// **************         runtime::cla::basic_parameter        ************** //
34// ************************************************************************** //
35
36template<typename T, typename IdPolicy>
37class basic_parameter : public typed_parameter<T> {
38public:
39    // Constructors
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>
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
55private:
56    IdPolicy    m_id_policy;
57};
58
59//____________________________________________________________________________//
60
61#define BOOST_RT_CLA_NAMED_PARAM_GENERATORS( param_type )                                       \
62template<typename T>                                                                            \
63inline shared_ptr<param_type ## _t<T> >                                                         \
64param_type( cstring name = cstring() )                                                          \
65{                                                                                               \
66    return shared_ptr<param_type ## _t<T> >( new param_type ## _t<T>( name ) );                 \
67}                                                                                               \
68                                                                                                \
69inline shared_ptr<param_type ## _t<cstring> >                                                   \
70param_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  2005/04/12 06:42:43  rogeeff
89//   Runtime.Param library initial commit
90//
91// ************************************************************************** //
92
93#endif // BOOST_RT_CLA_BASIC_PARAMETER_HPP_062604GER
Note: See TracBrowser for help on using the repository browser.