Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame^] | 1 | // (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 | |
| 24 | namespace ndnboost { |
| 25 | |
| 26 | namespace BOOST_RT_PARAM_NAMESPACE { |
| 27 | |
| 28 | namespace cla { |
| 29 | |
| 30 | namespace rt_cla_detail { |
| 31 | |
| 32 | // ************************************************************************** // |
| 33 | // ************** runtime::cla::const_generator ************** // |
| 34 | // ************************************************************************** // |
| 35 | |
| 36 | template<typename T> |
| 37 | class const_generator { |
| 38 | public: |
| 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 | |
| 45 | private: |
| 46 | // Data members |
| 47 | T m_const_value; |
| 48 | }; |
| 49 | |
| 50 | // ************************************************************************** // |
| 51 | // ************** runtime::cla::ref_generator ************** // |
| 52 | // ************************************************************************** // |
| 53 | |
| 54 | template<typename T> |
| 55 | class ref_generator { |
| 56 | public: |
| 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 | |
| 66 | private: |
| 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 |