Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:01:20

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_STATIC_MEMBER_FUNCTION_HPP)
0008 #define BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_HPP
0009 
0010 #include <boost/config.hpp>
0011 #include <boost/function_types/property_tags.hpp>
0012 #include <boost/mpl/vector.hpp>
0013 #include <boost/preprocessor/cat.hpp>
0014 #include <boost/tti/detail/dstatic_mem_fun.hpp>
0015 #include <boost/tti/gen/has_static_member_function_gen.hpp>
0016 
0017 /*
0018 
0019   The succeeding comments in this file are in doxygen format.
0020 
0021 */
0022 
0023 /** \file
0024 */
0025 
0026 /// A macro which expands to a metafunction which tests whether a static member function with a particular name and signature exists.
0027 /**
0028 
0029     BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_FUNCTION is a macro which expands to a metafunction.
0030     The metafunction tests whether a static member function with a particular name
0031     and signature exists. The macro takes the form of BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_FUNCTION(trait,name) where
0032     
0033     trait = the name of the metafunction <br/>
0034     name  = the name of the inner member.
0035 
0036     BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_FUNCTION generates a metafunction called "trait" where 'trait' is the macro parameter.
0037     
0038   @code
0039   
0040               template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_R,class BOOST_TTI_TP_FS,class BOOST_TTI_TP_TAG>
0041               struct trait
0042                 {
0043                 static const value = unspecified;
0044                 typedef mpl::bool_<true-or-false> type;
0045                 };
0046 
0047               The metafunction types and return:
0048     
0049                 BOOST_TTI_TP_T   = the enclosing type in which to look for our 'name'.
0050                                    The enclosing type can be a class, struct, or union.
0051                 
0052                 BOOST_TTI_TP_R   = the return type of the static member function
0053                                        OR
0054                           the signature of a function in the form of Return_Type ( Parameter_Types )
0055                 
0056                 BOOST_TTI_TP_FS  = (optional) the parameters of the static member function as a boost::mpl forward sequence
0057                           if the second parameter is a return type and the function parameters exist.
0058                 
0059                 BOOST_TTI_TP_TAG = (optional) a boost::function_types tag to apply to the static member function
0060                           if the second parameter is a return type and the need for a tag exists.
0061                 
0062                 returns = 'value' is true if the 'name' exists, 
0063                           with the appropriate static member function type,
0064                           otherwise 'value' is false.
0065                           
0066   @endcode
0067   
0068 */
0069 #define BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_FUNCTION(trait,name) \
0070   BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION(trait,name) \
0071   template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_R,class BOOST_TTI_TP_FS = boost::mpl::vector<>,class BOOST_TTI_TP_TAG = boost::function_types::null_tag> \
0072   struct trait \
0073     { \
0074     typedef typename \
0075     BOOST_PP_CAT(trait,_detail_hsmf)<BOOST_TTI_TP_T,BOOST_TTI_TP_R,BOOST_TTI_TP_FS,BOOST_TTI_TP_TAG>::type type; \
0076     BOOST_STATIC_CONSTANT(bool,value=type::value); \
0077     }; \
0078 /**/
0079 
0080 /// A macro which expands to a metafunction which tests whether a static member function with a particular name and signature exists.
0081 /**
0082 
0083     BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION is a macro which expands to a metafunction.
0084     The metafunction tests whether a static member function with a particular name
0085     and signature exists. The macro takes the form of BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION(name) where
0086     
0087     name  = the name of the inner member.
0088 
0089     BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION generates a metafunction called "has_static_member_function_name" where 'name' is the macro parameter.
0090     
0091   @code
0092   
0093               template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_R,class BOOST_TTI_TP_FS,class BOOST_TTI_TP_TAG>
0094               struct has_static_member_function_'name'
0095                 {
0096                 static const value = unspecified;
0097                 typedef mpl::bool_<true-or-false> type;
0098                 };
0099 
0100               The metafunction types and return:
0101     
0102                 BOOST_TTI_TP_T   = the enclosing type in which to look for our 'name'.
0103                                    The enclosing type can be a class, struct, or union.
0104                 
0105                 BOOST_TTI_TP_R   = the return type of the static member function
0106                                        OR
0107                           the signature of a function in the form of Return_Type ( Parameter_Types )
0108                 
0109                 BOOST_TTI_TP_FS  = (optional) the parameters of the static member function as a boost::mpl forward sequence
0110                           if the second parameter is a return type and the function parameters exist.
0111                 
0112                 BOOST_TTI_TP_TAG = (optional) a boost::function_types tag to apply to the static member function
0113                           if the second parameter is a return type and the need for a tag exists.
0114                 
0115                 returns = 'value' is true if the 'name' exists, 
0116                           with the appropriate static member function type,
0117                           otherwise 'value' is false.
0118                           
0119   @endcode
0120   
0121 */
0122 #define BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION(name) \
0123   BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_FUNCTION \
0124   ( \
0125   BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_GEN(name), \
0126   name \
0127   ) \
0128 /**/
0129 
0130 #endif // BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_HPP