blob: 79ec2b816f7a708592dd190c67ab8af6fc9edf24 [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
Jeff Thompson3d613fd2013-10-15 15:39:04 -070015#ifndef NDNBOOST_RT_CLA_BASIC_PARAMETER_HPP_062604GER
16#define NDNBOOST_RT_CLA_BASIC_PARAMETER_HPP_062604GER
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070017
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
Jeff Thompson3d613fd2013-10-15 15:39:04 -070031namespace NDNBOOST_RT_PARAM_NAMESPACE {
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070032
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
Jeff Thompson3d613fd2013-10-15 15:39:04 -070062#define NDNBOOST_RT_CLA_NAMED_PARAM_GENERATORS( param_type ) \
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070063template<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
Jeff Thompson3d613fd2013-10-15 15:39:04 -070081} // namespace NDNBOOST_RT_PARAM_NAMESPACE
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070082
83} // namespace ndnboost
84
Jeff Thompson3d613fd2013-10-15 15:39:04 -070085#endif // NDNBOOST_RT_CLA_BASIC_PARAMETER_HPP_062604GER