blob: d402977b6bcd2f1505d2d20aede46f5845875b41 [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: 49312 $
11//
12// Description : specific value generators
13// ***************************************************************************
14
15#ifndef BOOST_RT_CLA_VALUE_GENERATOR_HPP_062604GER
16#define BOOST_RT_CLA_VALUE_GENERATOR_HPP_062604GER
17
18// Boost.Runtime.Parameter
19#include <ndnboost/test/utils/runtime/config.hpp>
20
21#include <ndnboost/test/utils/runtime/cla/fwd.hpp>
22#include <ndnboost/test/utils/runtime/cla/parser.hpp>
23
24namespace ndnboost {
25
26namespace BOOST_RT_PARAM_NAMESPACE {
27
28namespace cla {
29
30namespace rt_cla_detail {
31
32// ************************************************************************** //
33// ************** runtime::cla::const_generator ************** //
34// ************************************************************************** //
35
36template<typename T>
37class const_generator {
38public:
39 // Constructor
40 explicit const_generator( T const& t ) : m_const_value( t ) {}
41
42 // generator interface
43 void operator()( parser const&, ndnboost::optional<T>& t ) const { t = m_const_value; }
44
45private:
46 // Data members
47 T m_const_value;
48};
49
50// ************************************************************************** //
51// ************** runtime::cla::ref_generator ************** //
52// ************************************************************************** //
53
54template<typename T>
55class ref_generator {
56public:
57 // Constructor
58 explicit ref_generator( cstring ref_id ) : m_ref_id( ref_id ) {}
59
60 // generator interface
61 void operator()( parser const& p, ndnboost::optional<T>& t ) const
62 {
63 p.get( m_ref_id, t );
64 }
65
66private:
67 // Data members
68 cstring m_ref_id;
69};
70
71//____________________________________________________________________________//
72
73} // namespace rt_cla_detail
74
75} // namespace cla
76
77} // namespace BOOST_RT_PARAM_NAMESPACE
78
79} // namespace ndnboost
80
81#endif // BOOST_RT_CLA_VALUE_GENERATOR_HPP_062604GER