Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:52:55

0001 
0002 //  (C) Copyright Edward Diener 2011,2012,2013
0003 //  Use, modification and distribution are subject to the Boost Software License,
0004 //  Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0005 //  http://www.boost.org/LICENSE_1_0.txt).
0006 
0007 #if !defined(BOOST_TTI_HAS_MEMBER_DATA_HPP)
0008 #define BOOST_TTI_HAS_MEMBER_DATA_HPP
0009 
0010 #include <boost/config.hpp>
0011 #include <boost/preprocessor/cat.hpp>
0012 #include <boost/tti/detail/ddeftype.hpp>
0013 #include <boost/tti/detail/dmem_data.hpp>
0014 #include <boost/tti/gen/has_member_data_gen.hpp>
0015 
0016 /*
0017 
0018   The succeeding comments in this file are in doxygen format.
0019 
0020 */
0021 
0022 /** \file
0023 */
0024 
0025 /// A macro which expands to a metafunction which tests whether member data with a particular name and type exists.
0026 /**
0027 
0028     BOOST_TTI_TRAIT_HAS_MEMBER_DATA is a macro which expands to a metafunction.
0029     The metafunction tests whether member data with a particular
0030     name and type exists. The macro takes the form of BOOST_TTI_TRAIT_HAS_MEMBER_DATA(trait,name) where
0031     
0032     trait = the name of the metafunction. <br/>
0033     name  = the name of the inner member data.
0034 
0035     BOOST_TTI_TRAIT_HAS_MEMBER_DATA generates a metafunction called "trait" where 'trait' is the macro parameter.
0036     
0037   @code
0038   
0039               template<class BOOST_TTI_TP_ET,class BOOST_TTI_TP_TYPE>
0040               struct trait
0041                 {
0042                 static const value = unspecified;
0043                 typedef mpl::bool_<true-or-false> type;
0044                 };
0045 
0046               The metafunction types and return:
0047     
0048                 BOOST_TTI_TP_ET   = the enclosing type in which to look for our 'name'
0049                                     The enclosing type can be a class, struct, or union.
0050                                                          OR
0051                                     The type of the member data in the form of a pointer
0052                                     to member data.
0053                 
0054                 BOOST_TTI_TP_TYPE = (optional) The type of the member data if the first
0055                                     parameter is the enclosing type.
0056                 
0057                 returns  = 'value' is true if the 'name' exists, with the correct data type,
0058                            otherwise 'value' is false.
0059                           
0060   @endcode
0061   
0062 */
0063 #define BOOST_TTI_TRAIT_HAS_MEMBER_DATA(trait,name) \
0064   BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_DATA(trait,name) \
0065   template<class BOOST_TTI_TP_ET,class BOOST_TTI_TP_TYPE = BOOST_TTI_NAMESPACE::detail::deftype> \
0066   struct trait \
0067     { \
0068     typedef typename \
0069     BOOST_PP_CAT(trait,_detail_hmd) \
0070         < \
0071         BOOST_TTI_TP_ET, \
0072         BOOST_TTI_TP_TYPE \
0073         >::type type; \
0074     BOOST_STATIC_CONSTANT(bool,value=type::value); \
0075     }; \
0076 /**/
0077 
0078 /// A macro which expands to a metafunction which tests whether a member data with a particular name and type exists.
0079 /**
0080 
0081     BOOST_TTI_HAS_MEMBER_DATA is a macro which expands to a metafunction.
0082     The metafunction tests whether member data with a particular
0083     name and type exists. The macro takes the form of BOOST_TTI_HAS_MEMBER_DATA(name) where
0084     
0085     name  = the name of the inner member.
0086 
0087     BOOST_TTI_HAS_MEMBER_DATA generates a metafunction called "has_member_data_name" where 'name' is the macro parameter.
0088     
0089   @code
0090   
0091               template<class BOOST_TTI_TP_ET,class BOOST_TTI_TP_TYPE>
0092               struct has_member_data_'name'
0093                 {
0094                 static const value = unspecified;
0095                 typedef mpl::bool_<true-or-false> type;
0096                 };
0097 
0098               The metafunction types and return:
0099     
0100                 BOOST_TTI_TP_ET   = the enclosing type in which to look for our 'name'.
0101                                     The enclosing type can be a class, struct, or union.
0102                                                          OR
0103                                     The type of the member data in the form of a pointer
0104                                     to member data.
0105                 
0106                 BOOST_TTI_TP_TYPE = (optional) The type of the member data if the first
0107                                     parameter is the enclosing type.
0108                 
0109                 returns  = 'value' is true if the 'name' exists, with the correct data type,
0110                            otherwise 'value' is false.
0111                           
0112   @endcode
0113   
0114 */
0115 #define BOOST_TTI_HAS_MEMBER_DATA(name) \
0116   BOOST_TTI_TRAIT_HAS_MEMBER_DATA \
0117   ( \
0118   BOOST_TTI_HAS_MEMBER_DATA_GEN(name), \
0119   name \
0120   ) \
0121 /**/
0122 
0123 #endif // BOOST_TTI_HAS_MEMBER_DATA_HPP