blob: 743d755860433d11d36b6c9524b30f8a83258381 [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 typed parameter model
13// ***************************************************************************
14
Jeff Thompson3d613fd2013-10-15 15:39:04 -070015#ifndef NDNBOOST_RT_CLA_TYPED_PARAMETER_HPP_062604GER
16#define NDNBOOST_RT_CLA_TYPED_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/fwd.hpp>
22#include <ndnboost/test/utils/runtime/validation.hpp>
23
24#include <ndnboost/test/utils/runtime/cla/parameter.hpp>
25#include <ndnboost/test/utils/runtime/cla/argument_factory.hpp>
26
27// Boost.Test
28#include <ndnboost/test/utils/rtti.hpp>
29
30namespace ndnboost {
31
Jeff Thompson3d613fd2013-10-15 15:39:04 -070032namespace NDNBOOST_RT_PARAM_NAMESPACE {
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070033
34namespace cla {
35
36// ************************************************************************** //
37// ************** runtime::cla::typed_parameter ************** //
38// ************************************************************************** //
39
40template<typename T>
41class typed_parameter : public cla::parameter {
42public:
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>
49 void accept_modifier( Modifier const& m )
50 {
51 cla::parameter::accept_modifier( m );
52
53 m_arg_factory.accept_modifier( m );
54
Jeff Thompson3d613fd2013-10-15 15:39:04 -070055 NDNBOOST_RT_PARAM_VALIDATE_LOGIC( !p_optional || !m_arg_factory.m_value_generator,
56 NDNBOOST_RT_PARAM_LITERAL( "can't define a value generator for optional parameter " ) << id_2_report() );
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070057 }
58
59private:
60 // Data members
61 typed_argument_factory<T> m_arg_factory;
62};
63
64} // namespace cla
65
Jeff Thompson3d613fd2013-10-15 15:39:04 -070066} // namespace NDNBOOST_RT_PARAM_NAMESPACE
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070067
68} // namespace ndnboost
69
Jeff Thompson3d613fd2013-10-15 15:39:04 -070070#endif // NDNBOOST_RT_CLA_TYPED_PARAMETER_HPP_062604GER