Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67017 - in sandbox/tti/boost/tti: . detail
From: eldiener_at_[hidden]
Date: 2010-12-04 22:14:16


Author: eldiener
Date: 2010-12-04 22:14:14 EST (Sat, 04 Dec 2010)
New Revision: 67017
URL: http://svn.boost.org/trac/boost/changeset/67017

Log:
Updates to the macros
Text files modified:
   sandbox/tti/boost/tti/TTIntrospection.hpp | 241 +++++++++++++++++++++++++++++++++++++++
   sandbox/tti/boost/tti/detail/TTIntrospectionDetail.hpp | 31 ++--
   2 files changed, 252 insertions(+), 20 deletions(-)

Modified: sandbox/tti/boost/tti/TTIntrospection.hpp
==============================================================================
--- sandbox/tti/boost/tti/TTIntrospection.hpp (original)
+++ sandbox/tti/boost/tti/TTIntrospection.hpp 2010-12-04 22:14:14 EST (Sat, 04 Dec 2010)
@@ -30,7 +30,7 @@
   template<class T> \
   struct trait \
     { \
- typedef typename tti::detail::hastype::trait<T>::type type; \
+ typedef typename tti::detail::trait<T>::type type; \
     \
     BOOST_STATIC_CONSTANT(bool,value=type::value); \
     }; \
@@ -45,6 +45,36 @@
   ) \
 /**/
 
+#define TTI_TRAIT_MFT_HAS_TYPE(trait,name) \
+namespace tti \
+ { \
+ namespace detail \
+ { \
+ TTI_DETAIL_TRAIT_HAS_TYPE(trait,name) \
+ } \
+ template<class T> \
+ struct trait \
+ { \
+ typedef typename \
+ tti::detail::eval \
+ < \
+ tti::detail::trait<T> \
+ >::type \
+ type; \
+ \
+ BOOST_STATIC_CONSTANT(bool,value=type::value); \
+ }; \
+ } \
+/**/
+
+#define TTI_MFT_HAS_TYPE(name) \
+ TTI_TRAIT_MFT_HAS_TYPE \
+ ( \
+ BOOST_PP_CAT(mft_has_type_,name), \
+ name \
+ ) \
+/**/
+
 #define TTI_TRAIT_MEMBER_TYPE(trait,name) \
 namespace tti \
   { \
@@ -59,8 +89,8 @@
     typedef typename \
       boost::mpl::eval_if \
         < \
- tti::detail::hastype::trait<T>, \
- tti::detail::membertype::trait<T>, \
+ tti::detail::trait<T>, \
+ tti::detail::member_type::trait<T>, \
         tti::detail::notype \
>::type \
     type; \
@@ -76,6 +106,43 @@
   ) \
 /**/
   
+#define TTI_TRAIT_MFT_MEMBER_TYPE(trait,name) \
+namespace tti \
+ { \
+ namespace detail \
+ { \
+ TTI_DETAIL_TRAIT_HAS_TYPE(trait,name) \
+ TTI_DETAIL_TRAIT_MEMBER_TYPE(trait,name) \
+ } \
+ template<class T> \
+ struct trait \
+ { \
+ typedef typename \
+ boost::mpl::eval_if \
+ < \
+ tti::detail::eval \
+ < \
+ tti::detail::trait<T> \
+ >, \
+ tti::detail::eval \
+ < \
+ tti::detail::member_type::trait<T> \
+ >, \
+ tti::detail::notype \
+ >::type \
+ type; \
+ }; \
+ } \
+/**/
+
+#define TTI_MFT_MEMBER_TYPE(name) \
+ TTI_TRAIT_MFT_MEMBER_TYPE \
+ ( \
+ BOOST_PP_CAT(mft_member_type_,name), \
+ name \
+ ) \
+/**/
+
 #define TTI_TRAIT_HAS_TYPE_CHECK_TYPEDEF(trait,name) \
 namespace tti \
   { \
@@ -129,6 +196,63 @@
   ) \
 /**/
 
+#define TTI_TRAIT_MFT_HAS_TYPE_CHECK_TYPEDEF(trait,name) \
+namespace tti \
+ { \
+ namespace detail \
+ { \
+ BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait, name, false) \
+ } \
+ \
+ template<class T,class U,class B> \
+ struct BOOST_PP_CAT(trait,_impl) \
+ { \
+ typedef typename \
+ boost::mpl::eval_if \
+ < \
+ boost::is_same<typename T::type::name,U>, \
+ boost::mpl::true_, \
+ boost::mpl::false_ \
+ >::type \
+ type; \
+ }; \
+ \
+ template<class T,class U> \
+ struct BOOST_PP_CAT(trait,_impl)<T,U,boost::mpl::false_::type> \
+ { \
+ typedef boost::mpl::false_::type type; \
+ }; \
+ \
+ template<class T,class U> \
+ struct trait \
+ { \
+ \
+ typedef typename \
+ BOOST_PP_CAT(trait,_impl) \
+ < \
+ T, \
+ U, \
+ typename \
+ tti::detail::eval \
+ < \
+ tti::detail::trait<T> \
+ >::type \
+ >::type \
+ type; \
+ \
+ BOOST_STATIC_CONSTANT(bool,value=type::value); \
+ }; \
+ } \
+/**/
+
+#define TTI_MFT_HAS_TYPE_CHECK_TYPEDEF(name) \
+ TTI_TRAIT_MFT_HAS_TYPE_CHECK_TYPEDEF \
+ ( \
+ BOOST_PP_CAT(mft_has_type_check_typedef_,name), \
+ name \
+ ) \
+/**/
+
 #define TTI_TRAIT_HAS_TEMPLATE(trait,name) \
 namespace tti \
   { \
@@ -447,6 +571,32 @@
     <
     class T,
     template<class> class HasMember,
+ class R,
+ BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(TTI_MAX_PARAMETERS,class P,tti::detail::noparam)
+ >
+ struct mf_mft_has_member_function :
+ tti::detail::eval
+ <
+ HasMember
+ <
+ tti::detail::eval
+ <
+ tti::detail::ptmf
+ <
+ T,
+ R,
+ BOOST_PP_ENUM_PARAMS(TTI_MAX_PARAMETERS,P)
+ >
+ >
+ >
+ >
+ {
+ };
+
+ template
+ <
+ class T,
+ template<class> class HasMember,
     class R
>
   struct mf_has_member_data :
@@ -470,6 +620,30 @@
   template
     <
     class T,
+ template<class> class HasMember,
+ class R
+ >
+ struct mf_mft_has_member_data :
+ tti::detail::eval
+ <
+ HasMember
+ <
+ tti::detail::eval
+ <
+ tti::detail::ptmd
+ <
+ T,
+ R
+ >
+ >
+ >
+ >
+ {
+ };
+
+ template
+ <
+ class T,
     template<class,class> class HasStaticMember,
     class R,
     BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(TTI_MAX_PARAMETERS,class P,tti::detail::noparam)
@@ -497,6 +671,32 @@
     <
     class T,
     template<class,class> class HasStaticMember,
+ class R,
+ BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(TTI_MAX_PARAMETERS,class P,tti::detail::noparam)
+ >
+ struct mf_mft_has_static_function :
+ tti::detail::eval
+ <
+ HasStaticMember
+ <
+ T,
+ tti::detail::eval
+ <
+ tti::detail::tfunction
+ <
+ R,
+ BOOST_PP_ENUM_PARAMS(TTI_MAX_PARAMETERS,P)
+ >
+ >
+ >
+ >
+ {
+ };
+
+ template
+ <
+ class T,
+ template<class,class> class HasStaticMember,
     class R
>
   struct mf_has_static_data :
@@ -520,6 +720,30 @@
   template
     <
     class T,
+ template<class,class> class HasStaticMember,
+ class R
+ >
+ struct mf_mft_has_static_data :
+ tti::detail::eval
+ <
+ HasStaticMember
+ <
+ T,
+ tti::detail::eval
+ <
+ tti::detail::tdata
+ <
+ R
+ >
+ >
+ >
+ >
+ {
+ };
+
+ template
+ <
+ class T,
     template<class,class> class HasTypeCheckTypedef,
     class U
>
@@ -528,6 +752,17 @@
     {
     };
     
+ template
+ <
+ class T,
+ template<class,class> class HasTypeCheckTypedef,
+ class U
+ >
+ struct mf_mft_has_type_check_typedef :
+ public mf_mft_has_static_data<T,HasTypeCheckTypedef,U>
+ {
+ };
+
   }
   
 #endif // TT_INTROSPECTION_HPP

Modified: sandbox/tti/boost/tti/detail/TTIntrospectionDetail.hpp
==============================================================================
--- sandbox/tti/boost/tti/detail/TTIntrospectionDetail.hpp (original)
+++ sandbox/tti/boost/tti/detail/TTIntrospectionDetail.hpp 2010-12-04 22:14:14 EST (Sat, 04 Dec 2010)
@@ -171,30 +171,27 @@
 /**/
 #endif
 
-#define TTI_DETAIL_TRAIT_MEMBER_TYPE(trait,name) \
-namespace membertype \
+#define TTI_DETAIL_TRAIT_HAS_TYPE(trait,name) \
+namespace mpl \
   { \
- template<class T> \
- struct trait \
- { \
- typedef typename T::name type; \
- }; \
+ BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait, name, false) \
   } \
+template<class T> \
+struct trait \
+ { \
+ typedef typename mpl::trait<T>::type type; \
+ \
+ BOOST_STATIC_CONSTANT(bool,value=type::value); \
+ }; \
 /**/
 
-#define TTI_DETAIL_TRAIT_HAS_TYPE(trait,name) \
-namespace hastype \
+#define TTI_DETAIL_TRAIT_MEMBER_TYPE(trait,name) \
+namespace member_type \
   { \
- namespace mpl \
- { \
- BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait, name, false) \
- } \
   template<class T> \
   struct trait \
     { \
- typedef typename mpl::trait<T>::type type; \
- \
- BOOST_STATIC_CONSTANT(bool,value=type::value); \
+ typedef typename T::name type; \
     }; \
   } \
 /**/
@@ -228,7 +225,7 @@
     struct eval;
     
 #define BOOST_PP_ITERATION_LIMITS (1,BOOST_PP_ADD(2,TTI_MAX_PARAMETERS))
-#define BOOST_PP_FILENAME_1 "TTIntrospectionIterateEval.hpp"
+#define BOOST_PP_FILENAME_1 <boost\tti\detail\TTIntrospectionIterateEval.hpp>
 #include BOOST_PP_ITERATE()
 
     template


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk