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 : defines model of named parameter |
| 13 | // *************************************************************************** |
| 14 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 15 | #ifndef NDNBOOST_RT_CLA_NAMED_PARAMETER_HPP_062604GER |
| 16 | #define NDNBOOST_RT_CLA_NAMED_PARAMETER_HPP_062604GER |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 17 | |
| 18 | // Boost.Runtime.Parameter |
| 19 | #include <ndnboost/test/utils/runtime/config.hpp> |
| 20 | |
| 21 | #include <ndnboost/test/utils/runtime/cla/basic_parameter.hpp> |
| 22 | #include <ndnboost/test/utils/runtime/cla/id_policy.hpp> |
| 23 | |
| 24 | namespace ndnboost { |
| 25 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 26 | namespace NDNBOOST_RT_PARAM_NAMESPACE { |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 27 | |
| 28 | namespace cla { |
| 29 | |
| 30 | // ************************************************************************** // |
| 31 | // ************** string_name_policy ************** // |
| 32 | // ************************************************************************** // |
| 33 | |
| 34 | class string_name_policy : public basic_naming_policy { |
| 35 | public: |
| 36 | // Constructor |
| 37 | string_name_policy(); |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 38 | NDNBOOST_RT_PARAM_UNNEEDED_VIRTUAL ~string_name_policy() {} |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 39 | |
| 40 | // policy interface |
| 41 | virtual bool responds_to( cstring name ) const; |
| 42 | virtual bool conflict_with( identification_policy const& ) const; |
| 43 | |
| 44 | // Accept modifier |
| 45 | template<typename Modifier> |
| 46 | void accept_modifier( Modifier const& m ) |
| 47 | { |
| 48 | basic_naming_policy::accept_modifier( m ); |
| 49 | |
| 50 | if( m.has( guess_name_m ) ) |
| 51 | m_guess_name = true; |
| 52 | } |
| 53 | |
| 54 | private: |
| 55 | // Naming policy interface |
| 56 | virtual bool match_name( argv_traverser& tr ) const; |
| 57 | |
| 58 | // Data members |
| 59 | bool m_guess_name; |
| 60 | }; |
| 61 | |
| 62 | // ************************************************************************** // |
| 63 | // ************** runtime::cla::named_parameter ************** // |
| 64 | // ************************************************************************** // |
| 65 | |
| 66 | template<typename T> |
| 67 | class named_parameter_t : public basic_parameter<T,string_name_policy> { |
| 68 | typedef basic_parameter<T,string_name_policy> base; |
| 69 | public: |
| 70 | // Constructors |
| 71 | explicit named_parameter_t( cstring name ) : base( name ) {} |
| 72 | }; |
| 73 | |
| 74 | //____________________________________________________________________________// |
| 75 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 76 | NDNBOOST_RT_CLA_NAMED_PARAM_GENERATORS( named_parameter ) |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 77 | |
| 78 | //____________________________________________________________________________// |
| 79 | |
| 80 | } // namespace cla |
| 81 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 82 | } // namespace NDNBOOST_RT_PARAM_NAMESPACE |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 83 | |
| 84 | } // namespace ndnboost |
| 85 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 86 | #ifndef NDNBOOST_RT_PARAM_OFFLINE |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 87 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 88 | # define NDNBOOST_RT_PARAM_INLINE inline |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 89 | # include <ndnboost/test/utils/runtime/cla/named_parameter.ipp> |
| 90 | |
| 91 | #endif |
| 92 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 93 | #endif // NDNBOOST_RT_CLA_NAMED_PARAMETER_HPP_062604GER |