blob: 39ebb72bfc9d1cb4e545ff203fce4a3b2bd1bdf1 [file] [log] [blame]
Jeff Thompsonef2d5a42013-08-22 19:09:24 -07001// (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 <ndnboost/test/utils/runtime/config.hpp>
20
21#include <ndnboost/test/utils/runtime/cla/typed_parameter.hpp>
22
23// Boost.Test
24#include <ndnboost/test/utils/rtti.hpp>
25
26// Boost
27#include <ndnboost/utility/base_from_member.hpp>
28
29namespace ndnboost {
30
31namespace BOOST_RT_PARAM_NAMESPACE {
32
33namespace cla {
34
35// ************************************************************************** //
36// ************** runtime::cla::basic_parameter ************** //
37// ************************************************************************** //
38
39template<typename T, typename IdPolicy>
40class basic_parameter : private base_from_member<IdPolicy>, public typed_parameter<T> {
41public:
42 // Constructors
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>
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 ) \
63template<typename T> \
64inline shared_ptr<param_type ## _t<T> > \
65param_type( cstring name = cstring() ) \
66{ \
67 return shared_ptr<param_type ## _t<T> >( new param_type ## _t<T>( name ) ); \
68} \
69 \
70inline shared_ptr<param_type ## _t<cstring> > \
71param_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 ndnboost
84
85#endif // BOOST_RT_CLA_BASIC_PARAMETER_HPP_062604GER