Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52551 - in sandbox/mirror: boost/mirror libs/mirror/example libs/mirror/example/factories libs/mirror/example/traversal libs/mirror/test
From: chochlik_at_[hidden]
Date: 2009-04-22 14:27:43


Author: matus.chochlik
Date: 2009-04-22 14:27:40 EDT (Wed, 22 Apr 2009)
New Revision: 52551
URL: http://svn.boost.org/trac/boost/changeset/52551

Log:
[mirror 0.4.x]
- added several quick registering macros
  for registering classes and class constructors
- updated several examples to show the usage of the
  new macros
- updated the some tests to use the new macros
- updated the input_ui factory plugin in the examples

Text files modified:
   sandbox/mirror/boost/mirror/meta_class.hpp | 125 +++++++++++++++++++++++
   sandbox/mirror/boost/mirror/meta_constructors.hpp | 209 +++++++++++++++++++++++++++++++++++----
   sandbox/mirror/libs/mirror/example/Jamfile.v2 | 10
   sandbox/mirror/libs/mirror/example/factories/input_ui.hpp | 24 ++++
   sandbox/mirror/libs/mirror/example/factories/tetrahedron.hpp | 55 ++++-----
   sandbox/mirror/libs/mirror/example/traversal/sample_visitor.cpp | 89 ++--------------
   sandbox/mirror/libs/mirror/test/classes.hpp | 18 ---
   sandbox/mirror/libs/mirror/test/simple_classes.hpp | 68 +-----------
   8 files changed, 388 insertions(+), 210 deletions(-)

Modified: sandbox/mirror/boost/mirror/meta_class.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_class.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_class.hpp 2009-04-22 14:27:40 EDT (Wed, 22 Apr 2009)
@@ -23,6 +23,9 @@
 #include <boost/mpl/insert_range.hpp>
 #include <boost/mpl/joint_view.hpp>
 //
+// preprocessor
+#include <boost/preprocessor/seq/for_each.hpp>
+#include <boost/preprocessor/seq/for_each_i.hpp>
 // basic meta types
 #include <boost/mirror/meta_type.hpp>
 // reflection of class inheritance
@@ -124,9 +127,129 @@
  * with private or protected members, that should be refleccted
  */
 #define BOOST_MIRROR_FRIENDLY_CLASS(CLASS_NAME) \
- friend struct ::boost::mirror::meta_class_attributes_base<CLASS_NAME>;
+ friend struct ::boost::mirror::meta_class_attributes_base<CLASS_NAME>;
 
 
+/** A helper macro used in the BOOST_MIRROR_QREG_* macros,
+ * as a parameter to the BOOST_PP_SEQ_FOR_EACH_I and
+ * registers the i-th base class of the registered class
+ */
+#define BOOST_MIRROR_QREG_CLASS_REG_BASE_CLASS_HELPER(R, DATA, I, BASE_CLASS)\
+ BOOST_MIRROR_REG_BASE_CLASS(I, public, BASE_CLASS)
+
+/** A helper macro used in the BOOST_MIRROR_QREG_* macros,
+ * as a parameter to the BOOST_PP_SEQ_FOR_EACH_I and
+ * registers the i-th virtual base class of the registered class
+ */
+#define BOOST_MIRROR_QREG_CLASS_REG_V_BASE_CLASS_HELPER(R, DATA, I, BASE_CLASS)\
+ BOOST_MIRROR_REG_VIRTUAL_BASE_CLASS(I, public, BASE_CLASS)
+
+/** Another helper macro used in the BOOST_MIRROR_QREG_* macros
+ * as a parameter to BOOST_PP_SEQ_FOR_EACH, which registers
+ * a class member attribute
+ */
+#define BOOST_MIRROR_QREG_CLASS_REG_ATTRIB_HELPER(R, DATA, ATTRIB)\
+ BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, ATTRIB)
+
+
+/** This macro provides a quick all-in-one registering of
+ * a class. It registers the class' type, its base classes
+ * and member attributes.
+ */
+#define BOOST_MIRROR_QREG_CLASS( \
+ NAMESPACE, \
+ CLASS, \
+ BASE_CLASS_PP_SEQ, \
+ ATTRIB_PP_SEQ \
+) \
+/** Registers the type */ \
+BOOST_MIRROR_REG_TYPE(NAMESPACE, CLASS) \
+/** Registers the base classes */ \
+BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(NAMESPACE :: CLASS) \
+BOOST_PP_SEQ_FOR_EACH_I( \
+ BOOST_MIRROR_QREG_CLASS_REG_BASE_CLASS_HELPER, \
+ _, \
+ BASE_CLASS_PP_SEQ \
+) \
+BOOST_MIRROR_REG_BASE_CLASSES_END \
+/** Registers the class' attributes */ \
+BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(NAMESPACE :: CLASS) \
+BOOST_PP_SEQ_FOR_EACH( \
+ BOOST_MIRROR_QREG_CLASS_REG_ATTRIB_HELPER, \
+ _, \
+ ATTRIB_PP_SEQ \
+) \
+BOOST_MIRROR_REG_CLASS_ATTRIBS_END
+
+
+/** A variant of BOOST_MIRROR_QREG_CLASS for classes that have
+ * only virtual base classes (i.e. no base clases with regular
+ * inheritance).
+ */
+#define BOOST_MIRROR_QREG_CLASS_V_BASES( \
+ NAMESPACE, \
+ CLASS, \
+ BASE_CLASS_PP_SEQ, \
+ ATTRIB_PP_SEQ \
+) \
+/** Registers the type */ \
+BOOST_MIRROR_REG_TYPE(NAMESPACE, CLASS) \
+/** Registers the base classes */ \
+BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(NAMESPACE :: CLASS) \
+BOOST_PP_SEQ_FOR_EACH_I( \
+ BOOST_MIRROR_QREG_CLASS_REG_V_BASE_CLASS_HELPER, \
+ _, \
+ BASE_CLASS_PP_SEQ \
+) \
+BOOST_MIRROR_REG_BASE_CLASSES_END \
+/** Registers the class' attributes */ \
+BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(NAMESPACE :: CLASS) \
+BOOST_PP_SEQ_FOR_EACH( \
+ BOOST_MIRROR_QREG_CLASS_REG_ATTRIB_HELPER, \
+ _, \
+ ATTRIB_PP_SEQ \
+) \
+BOOST_MIRROR_REG_CLASS_ATTRIBS_END
+
+
+/** Similar to BOOST_MIRROR_QREG_CLASS this macro registers
+ * a class without base classes.
+ */
+#define BOOST_MIRROR_QREG_CLASS_NO_BASE( \
+ NAMESPACE, \
+ CLASS, \
+ ATTRIB_PP_SEQ \
+) \
+/** Registers the type */ \
+BOOST_MIRROR_REG_TYPE(NAMESPACE, CLASS) \
+/** Registers the class' attributes */ \
+BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(NAMESPACE :: CLASS) \
+BOOST_PP_SEQ_FOR_EACH( \
+ BOOST_MIRROR_QREG_CLASS_REG_ATTRIB_HELPER, \
+ _, \
+ ATTRIB_PP_SEQ \
+) \
+BOOST_MIRROR_REG_CLASS_ATTRIBS_END
+
+/** similar to BOOST_MIRROR_QREG_CLASS this macro registers
+ * a class with base classes but without any own attributes
+ */
+#define BOOST_MIRROR_QREG_CLASS_NO_ATTR( \
+ NAMESPACE, \
+ CLASS, \
+ BASE_CLASS_PP_SEQ, \
+ ATTRIB_PP_SEQ \
+) \
+/** Registers the type */ \
+BOOST_MIRROR_REG_TYPE(NAMESPACE, CLASS) \
+/** Registers the base classes */ \
+BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(NAMESPACE :: CLASS) \
+BOOST_PP_SEQ_FOR_EACH_I( \
+ BOOST_MIRROR_QREG_CLASS_REG_BASE_CLASS_HELPER, \
+ _, \
+ BASE_CLASS_PP_SEQ \
+) \
+BOOST_MIRROR_REG_BASE_CLASSES_END \
 
 } // namespace mirror
 } // namespace boost

Modified: sandbox/mirror/boost/mirror/meta_constructors.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_constructors.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_constructors.hpp 2009-04-22 14:27:40 EDT (Wed, 22 Apr 2009)
@@ -21,13 +21,18 @@
 #include <boost/preprocessor/seq/seq.hpp>
 #include <boost/preprocessor/cat.hpp>
 #include <boost/preprocessor/comparison/not_equal.hpp>
+#include <boost/preprocessor/comparison/equal.hpp>
 #include <boost/preprocessor/seq/for_each.hpp>
+#include <boost/preprocessor/seq/for_each_i.hpp>
 #include <boost/preprocessor/punctuation/comma_if.hpp>
 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
 #include <boost/preprocessor/repetition/enum_params.hpp>
 #include <boost/preprocessor/facilities/empty.hpp>
 #include <boost/preprocessor/stringize.hpp>
 #include <boost/preprocessor/wstringize.hpp>
+#include <boost/preprocessor/logical/and.hpp>
+#include <boost/preprocessor/logical/not.hpp>
+#include <boost/preprocessor/arithmetic/sub.hpp>
 
 #include <boost/char_type_switch/string.hpp>
 #include <boost/mirror/meta_data_fwd.hpp>
@@ -35,10 +40,14 @@
 namespace boost {
 namespace mirror {
 
+/** Forward declaration of the meta-constructors base template
+ */
 template <class Class /*, class VariantTag*/ >
 struct meta_constructors_base;
 
-#define BOOST_MIRROR_REG_TEMPLATE_CONSTRUCTORS_BEGIN(TEMPLATE, TEMPL_ARG_COUNT) \
+/** Begins the registering of template class' constructors
+ */
+#define BOOST_MIRROR_REG_TEMPLATE_CONSTRUCTORS_BEGIN(TEMPLATE, TEMPL_ARG_COUNT)\
 template < BOOST_PP_ENUM_PARAMS(TEMPL_ARG_COUNT, typename T) > \
 struct meta_constructors_base< \
         TEMPLATE < BOOST_PP_ENUM_PARAMS(TEMPL_ARG_COUNT, T) > \
@@ -47,12 +56,17 @@
         typedef mpl::vector0<>
 
 
+/** Begins the registering of class' constructors
+ */
 #define BOOST_MIRROR_REG_CONSTRUCTORS_BEGIN(CLASS) \
 template <> \
 struct meta_constructors_base< CLASS > \
 { \
         typedef mpl::vector0<>
 
+/** Registers the parameter name of the j-th parameter
+ * of the i-th constructor
+ */
 #define BOOST_MIRROR_REG_CONSTRUCTOR_PARAM_NAME(CONSTRUCTOR, PARAM, NAME) \
 inline static const ::std::string& get_param_name( \
         mpl::false_, \
@@ -75,11 +89,17 @@
         return result; \
 }
 
+
+/** Ends the registering of (template) class' constructors
+ */
 #define BOOST_MIRROR_REG_CONSTRUCTORS_END \
         param_type_lists; \
         template <class ConstrIndex, class ParamIndex> \
- inline static const cts::bstring& base_param_name(ConstrIndex ci, ParamIndex pi) \
- {\
+ inline static const cts::bstring& base_param_name( \
+ ConstrIndex ci, \
+ ParamIndex pi \
+ ) \
+ { \
                 return get_param_name( \
                         mpl::false_(), \
                         ::std::char_traits< cts::bchar >(), \
@@ -89,45 +109,180 @@
         } \
 };
 
-#define BOOST_MIRROR_REG_CONSTR_EXTRACT_PARAM_TYPE(R, X, TYPE_AND_NAME) \
- BOOST_PP_COMMA_IF(BOOST_PP_NOT_EQUAL(R, 2) ) \
- BOOST_PP_SEQ_HEAD(TYPE_AND_NAME)
+
+/** Helper macro which expands into the type of the j-th parameter
+ * preceeded by a comma if it is not the first parameter
+ */
+#define BOOST_MIRROR_REG_CONSTR_EXTRACT_PARAM_TYPE( \
+ R, X, \
+ PARAM_INDEX, \
+ TYPE_AND_NAME \
+) BOOST_PP_COMMA_IF(PARAM_INDEX) BOOST_PP_SEQ_HEAD(TYPE_AND_NAME)
 
 
-#define BOOST_MIRROR_REG_CONSTR_REG_CALL_PARAM_NAME(R, CONSTR_INDEX, TYPE_AND_NAME) \
- BOOST_MIRROR_REG_CONSTRUCTOR_PARAM_NAME( \
+
+/** Calls the BOOST_MIRROR_REG_CONSTRUCTOR_PARAM_NAME macro
+ * in repetitions.
+ */
+#define BOOST_MIRROR_REG_CONSTR_REG_CALL_PARAM_NAME(\
+ R, \
+ CONSTR_INDEX, \
+ PARAM_INDEX, \
+ TYPE_AND_NAME \
+) BOOST_MIRROR_REG_CONSTRUCTOR_PARAM_NAME( \
                 CONSTR_INDEX, \
- R-2, \
+ PARAM_INDEX, \
                 BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(TYPE_AND_NAME)) \
         )
 
-#define BOOST_MIRROR_REG_CONSTRUCTOR_PUSH_BACK_PARAM_TYPES(CONSTR_INDEX, TYPENAME_KW) \
- typedef TYPENAME_KW mpl::push_back< \
+
+/** Adds the parameter typelist to the list storing
+ * storing the parameter types for the individual constructors
+ */
+#define BOOST_MIRROR_REG_CONSTRUCTOR_PUSH_BACK_PARAM_TYPES( \
+ CONSTR_INDEX, \
+ TYPENAME_KW\
+) typedef TYPENAME_KW mpl::push_back< \
                 BOOST_PP_CAT(param_type_lists_, CONSTR_INDEX), \
                 BOOST_PP_CAT(BOOST_PP_CAT(constr_, CONSTR_INDEX), _params) \
>::type
 
 
+/** Registers a single default constructor
+ */
 #define BOOST_MIRROR_REG_DEFAULT_CONSTRUCTOR(CONSTR_INDEX) \
         param_type_lists_ ## CONSTR_INDEX ; \
         typedef mpl::vector0< \
> BOOST_PP_CAT(BOOST_PP_CAT(constr_, CONSTR_INDEX), _params) ;\
- BOOST_MIRROR_REG_CONSTRUCTOR_PUSH_BACK_PARAM_TYPES(CONSTR_INDEX, BOOST_PP_EMPTY())
-
-#define BOOST_MIRROR_REG_CLASS_OR_TEMPL_CONSTRUCTOR(CONSTR_INDEX, PARAM_SEQ, TYPENAME_KW) \
+ BOOST_MIRROR_REG_CONSTRUCTOR_PUSH_BACK_PARAM_TYPES(\
+ CONSTR_INDEX, \
+ BOOST_PP_EMPTY()\
+ )
+
+/** registers a single non-default constructor
+ */
+#define BOOST_MIRROR_DO_REG_CLASS_OR_TEMPL_CONSTRUCTOR(\
+ CONSTR_INDEX, \
+ PARAM_SEQ, \
+ TYPENAME_KW\
+) \
         param_type_lists_ ## CONSTR_INDEX ; \
         typedef BOOST_PP_CAT(mpl::vector, BOOST_PP_SEQ_SIZE(PARAM_SEQ)) < \
- BOOST_PP_SEQ_FOR_EACH(BOOST_MIRROR_REG_CONSTR_EXTRACT_PARAM_TYPE, 0, PARAM_SEQ) \
+ BOOST_PP_SEQ_FOR_EACH_I( \
+ BOOST_MIRROR_REG_CONSTR_EXTRACT_PARAM_TYPE, \
+ 0, \
+ PARAM_SEQ \
+ ) \
> BOOST_PP_CAT(BOOST_PP_CAT(constr_, CONSTR_INDEX), _params) ;\
- BOOST_PP_SEQ_FOR_EACH(BOOST_MIRROR_REG_CONSTR_REG_CALL_PARAM_NAME, CONSTR_INDEX, PARAM_SEQ) \
- BOOST_MIRROR_REG_CONSTRUCTOR_PUSH_BACK_PARAM_TYPES(CONSTR_INDEX, TYPENAME_KW)
+ BOOST_PP_SEQ_FOR_EACH_I( \
+ BOOST_MIRROR_REG_CONSTR_REG_CALL_PARAM_NAME, \
+ CONSTR_INDEX, \
+ PARAM_SEQ \
+ ) \
+ BOOST_MIRROR_REG_CONSTRUCTOR_PUSH_BACK_PARAM_TYPES( \
+ CONSTR_INDEX, \
+ TYPENAME_KW \
+ )
+
+
+
+/** Decides whether the PARAM_SEQ is a argument sequence for
+ * a default constructor (having no parameters)
+ */
+#define BOOST_MIRROR_IS_VOID_FN_ARG_LIST(PARAM_SEQ) \
+ BOOST_PP_AND( \
+ BOOST_PP_EQUAL(BOOST_PP_SEQ_SIZE(PARAM_SEQ),1), \
+ BOOST_PP_EQUAL( \
+ BOOST_PP_SEQ_SIZE( \
+ BOOST_PP_SEQ_HEAD(PARAM_SEQ) \
+ ),1 \
+ ) \
+ )
+
+/** expands into the default constructor registering macro
+ */
+#define BOOST_MIRROR_REG_CLASS_OR_TEMPL_CONSTRUCTOR_1( \
+ CONSTR_INDEX, \
+ PARAM_SEQ, \
+ TYPENAME_KW \
+) BOOST_MIRROR_REG_DEFAULT_CONSTRUCTOR(CONSTR_INDEX)
+
+/** expands into the non-default constructor registering macro
+ */
+#define BOOST_MIRROR_REG_CLASS_OR_TEMPL_CONSTRUCTOR_0( \
+ CONSTR_INDEX, \
+ PARAM_SEQ, \
+ TYPENAME_KW \
+) BOOST_MIRROR_DO_REG_CLASS_OR_TEMPL_CONSTRUCTOR( \
+ CONSTR_INDEX, \
+ PARAM_SEQ, \
+ TYPENAME_KW \
+)
+
+/** Registers a single constructor, by disparching between
+ * the BOOST_MIRROR_DO_REG_CLASS_OR_TEMPL_CONSTRUCTOR and
+ * the BOOST_MIRROR_REG_DEFAULT_CONSTRUCTOR macros based on
+ * whether the constructor is default or non-default.
+ * Default constructors are identified as those
+ * having only a single parameter of void type. All other constructors
+ * are considered as non-default.
+ */
+#define BOOST_MIRROR_REG_CLASS_OR_TEMPL_CONSTRUCTOR( \
+ CONSTR_INDEX, \
+ PARAM_SEQ, \
+ TYPENAME_KW \
+) BOOST_PP_CAT( \
+ BOOST_MIRROR_REG_CLASS_OR_TEMPL_CONSTRUCTOR_, \
+ BOOST_MIRROR_IS_VOID_FN_ARG_LIST(PARAM_SEQ) \
+) (CONSTR_INDEX, PARAM_SEQ, TYPENAME_KW)
+
+
 
+/** Registers a constructor of a non-template class
+ */
 #define BOOST_MIRROR_REG_CONSTRUCTOR(CONSTR_INDEX, PARAM_SEQ) \
- BOOST_MIRROR_REG_CLASS_OR_TEMPL_CONSTRUCTOR(CONSTR_INDEX, PARAM_SEQ, BOOST_PP_EMPTY())
+ BOOST_MIRROR_REG_CLASS_OR_TEMPL_CONSTRUCTOR( \
+ CONSTR_INDEX, \
+ PARAM_SEQ, \
+ BOOST_PP_EMPTY() \
+ )
  
+/** Registers a constructor of a template class
+ */
 #define BOOST_MIRROR_REG_TEMPLATE_CONSTRUCTOR(CONSTR_INDEX, PARAM_SEQ) \
- BOOST_MIRROR_REG_CLASS_OR_TEMPL_CONSTRUCTOR(CONSTR_INDEX, PARAM_SEQ, typename)
+ BOOST_MIRROR_REG_CLASS_OR_TEMPL_CONSTRUCTOR( \
+ CONSTR_INDEX, \
+ PARAM_SEQ, \
+ typename \
+ )
  
+/** Helper macro used to call the BOOST_MIRROR_REG_CONSTRUCTOR
+ * for each constructor in the quick registering macro
+ */
+#define BOOST_MIRROR_CALL_REG_CONSTRUCTOR_QREG(R, D, PARAM_SEQ)\
+ BOOST_MIRROR_REG_CONSTRUCTOR(BOOST_PP_SUB(R,2), PARAM_SEQ)
+
+/** Quick and simple constructor registering macro
+ */
+#define BOOST_MIRROR_QREG_CONSTRUCTORS( \
+ CLASS, \
+ CONSTR_PARAM_SEQ_SEQ \
+) \
+BOOST_MIRROR_REG_CONSTRUCTORS_BEGIN( CLASS ) \
+ BOOST_PP_SEQ_FOR_EACH( \
+ BOOST_MIRROR_CALL_REG_CONSTRUCTOR_QREG, \
+ _, \
+ CONSTR_PARAM_SEQ_SEQ \
+ ) \
+BOOST_MIRROR_REG_CONSTRUCTORS_END
+
+
+
+
+/** Helper macro which registers the constructors of
+ * native C++ types and some other commonly used types
+ * like strings.
+ */
 #define BOOST_MIRROR_REGISTER_NATIVE_TYPE_CONSTRUCTORS(TYPE)\
 BOOST_MIRROR_REG_CONSTRUCTORS_BEGIN( TYPE ) \
         BOOST_MIRROR_REG_DEFAULT_CONSTRUCTOR(0) \
@@ -153,6 +308,9 @@
 
 #undef BOOST_MIRROR_REGISTER_NATIVE_TYPE_CONSTRUCTORS
 
+/** Template providing meta-data about the constructors
+ * of the Class.
+ */
 template <class Class /*, class VariantTag*/ >
 struct meta_constructors : public meta_constructors_base<Class>
 {
@@ -186,7 +344,8 @@
> size;
 
                         template <class CharT, class ParamIndex>
- inline static const ::std::basic_string<CharT>& get_param_name(
+ inline static const ::std::basic_string<CharT>&
+ get_param_name(
                                 mpl::false_ full_or_base,
                                 const ::std::char_traits<CharT>& traits,
                                 ParamIndex
@@ -219,10 +378,16 @@
                         }
                 private:
                         template <class Functor, class ParamIndex>
- static inline void call_for_each(Functor func, ParamIndex pi)
+ static inline void call_for_each(
+ Functor func,
+ ParamIndex pi
+ )
                         {
                                 func((params*)0, pi);
- call_for_each(func, mpl::next<ParamIndex>::type());
+ call_for_each(
+ func,
+ typename mpl::next<ParamIndex>::type()
+ );
                         }
 
                         template <class Functor>

Modified: sandbox/mirror/libs/mirror/example/Jamfile.v2
==============================================================================
--- sandbox/mirror/libs/mirror/example/Jamfile.v2 (original)
+++ sandbox/mirror/libs/mirror/example/Jamfile.v2 2009-04-22 14:27:40 EDT (Wed, 22 Apr 2009)
@@ -37,6 +37,11 @@
 #
 exe algo_begin_end : algorithms/begin_end.cpp ;
 #
+# configurable factories
+#
+exe fctry_tetrahedron : factories/tetrahedron.cpp ;
+exe fn_call_inserter : factories/inserter.cpp ;
+#
 # traversal by visitors
 #
 exe tvrsl_sample_visitor : traversal/sample_visitor.cpp ;
@@ -46,11 +51,6 @@
 exe tvrsl_meta_path_full : traversal/meta_path_full.cpp ;
 exe tvrsl_meta_path_visitor : traversal/sample_meta_path.cpp ;
 #
-# configurable factories
-#
-exe fctry_tetrahedron : factories/tetrahedron.cpp ;
-exe fn_call_inserter : factories/inserter.cpp ;
-#
 # class generators
 #
 #

Modified: sandbox/mirror/libs/mirror/example/factories/input_ui.hpp
==============================================================================
--- sandbox/mirror/libs/mirror/example/factories/input_ui.hpp (original)
+++ sandbox/mirror/libs/mirror/example/factories/input_ui.hpp 2009-04-22 14:27:40 EDT (Wed, 22 Apr 2009)
@@ -67,6 +67,17 @@
 {
         Product x;
 
+ struct constr_param_name_printer
+ {
+ template <class MetaParams, class ParamIndex>
+ inline void operator()(MetaParams* pmp, ParamIndex pi) const
+ {
+ if(ParamIndex::value > 0)
+ boost::cts::bcout() << BOOST_CTS_LIT(", ");
+ ::boost::cts::bcout() << MetaParams::base_param_name(pi);
+ }
+ };
+
         template <class Context, class ConstrIndex, class ParamIndex>
         console_input_ui(int tabs, Context* pc, ConstrIndex ci, ParamIndex pi)
         {
@@ -78,7 +89,18 @@
                         boost::mirror::meta_constructors<
                                 Context
>::base_param_name(ci, pi) <<
- BOOST_CTS_LIT(" = ") <<
+ BOOST_CTS_LIT(" for ") <<
+ BOOST_MIRRORED_TYPE(Context)::full_name() <<
+ BOOST_CTS_LIT("(");
+ //
+ boost::mirror::meta_constructors<
+ Context
+ >::template constructor<
+ ConstrIndex
+ >::params::for_each(constr_param_name_printer());
+ //
+ ::boost::cts::bcout() <<
+ BOOST_CTS_LIT(") = ") <<
                         ::std::flush;
                 ::boost::cts::bcin() >> x;
         }

Modified: sandbox/mirror/libs/mirror/example/factories/tetrahedron.hpp
==============================================================================
--- sandbox/mirror/libs/mirror/example/factories/tetrahedron.hpp (original)
+++ sandbox/mirror/libs/mirror/example/factories/tetrahedron.hpp 2009-04-22 14:27:40 EDT (Wed, 22 Apr 2009)
@@ -122,35 +122,32 @@
 BOOST_MIRROR_REG_NAMESPACE( (test) )
 
 // register the vector, triangle and tetrahedron classes
-BOOST_MIRROR_REG_TYPE( ::test, vector)
-BOOST_MIRROR_REG_TYPE( ::test, triangle)
-BOOST_MIRROR_REG_TYPE( ::test, tetrahedron)
-
-// register the constructors of ::test::vector
-BOOST_MIRROR_REG_CONSTRUCTORS_BEGIN( ::test::vector )
- BOOST_MIRROR_REG_CONSTRUCTOR(0,
- ((double)(x))((double)(y))((double)(z))
- )
- BOOST_MIRROR_REG_CONSTRUCTOR(1,
- ((double)(w))
- )
- BOOST_MIRROR_REG_DEFAULT_CONSTRUCTOR(2)
-BOOST_MIRROR_REG_CONSTRUCTORS_END
-
-// register the constructor of ::test::triangle
-BOOST_MIRROR_REG_CONSTRUCTORS_BEGIN( ::test::triangle )
- BOOST_MIRROR_REG_CONSTRUCTOR(0,
- ((::test::vector)(a))((::test::vector)(b))((::test::vector)(c))
- )
- BOOST_MIRROR_REG_DEFAULT_CONSTRUCTOR(1)
-BOOST_MIRROR_REG_CONSTRUCTORS_END
-
-// register the constructor of ::test::tetrahedron
-BOOST_MIRROR_REG_CONSTRUCTORS_BEGIN( ::test::tetrahedron )
- BOOST_MIRROR_REG_CONSTRUCTOR(0,
- ((::test::triangle)(base))((::test::vector)(apex))
- )
-BOOST_MIRROR_REG_CONSTRUCTORS_END
+// abnnd their constructor
+//
+// ::test::vector
+BOOST_MIRROR_QREG_CLASS_NO_BASE( ::test, vector, (x)(y)(z))
+BOOST_MIRROR_QREG_CONSTRUCTORS(
+ ::test::vector,
+ // ::test::vector(double x, double y, double z)
+ (((double)(x))((double)(y))((double)(z)))
+ // ::test::vector(double w)
+ (((double)(w)))
+ // ::test::vector(void)
+ (((void)))
+)
+// ::test::triangle
+BOOST_MIRROR_QREG_CLASS_NO_BASE( ::test, triangle, (a)(b)(c))
+BOOST_MIRROR_QREG_CONSTRUCTORS(
+ ::test::triangle,
+ (((::test::vector)(a))((::test::vector)(b))((::test::vector)(c)))
+ (((void)))
+)
+// ::test::tetrahedron
+BOOST_MIRROR_QREG_CLASS_NO_BASE( ::test, tetrahedron, (base)(apex))
+BOOST_MIRROR_QREG_CONSTRUCTORS(
+ ::test::tetrahedron,
+ (((::test::triangle)(base))((::test::vector)(apex)))
+)
 
 } // namespace mirror
 } // namespace boost

Modified: sandbox/mirror/libs/mirror/example/traversal/sample_visitor.cpp
==============================================================================
--- sandbox/mirror/libs/mirror/example/traversal/sample_visitor.cpp (original)
+++ sandbox/mirror/libs/mirror/example/traversal/sample_visitor.cpp 2009-04-22 14:27:40 EDT (Wed, 22 Apr 2009)
@@ -71,6 +71,7 @@
         struct H : F, G
         {
                 wchar_t w;
+ unsigned short u;
         };
 
 
@@ -83,83 +84,19 @@
  */
 BOOST_MIRROR_REG_NAMESPACE((Test))
 
-/** Register the types and classes
+/** Register the classes
  */
-BOOST_MIRROR_REG_TYPE(::Test, A)
-BOOST_MIRROR_REG_TYPE(::Test, B)
-BOOST_MIRROR_REG_TYPE(::Test, C)
-BOOST_MIRROR_REG_TYPE(::Test, D)
-BOOST_MIRROR_REG_TYPE(::Test, E)
-BOOST_MIRROR_REG_TYPE(::Test, F)
-BOOST_MIRROR_REG_TYPE(::Test, G)
-BOOST_MIRROR_REG_TYPE(::Test, H)
-
-
-BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::Test::B)
-BOOST_MIRROR_REG_VIRTUAL_BASE_CLASS(0, public, ::Test::A)
-BOOST_MIRROR_REG_BASE_CLASSES_END
-
-BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::Test::C)
-BOOST_MIRROR_REG_VIRTUAL_BASE_CLASS(0, public, ::Test::A)
-BOOST_MIRROR_REG_BASE_CLASSES_END
-
-BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::Test::D)
-BOOST_MIRROR_REG_VIRTUAL_BASE_CLASS(0, public, ::Test::A)
-BOOST_MIRROR_REG_BASE_CLASSES_END
-
-BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::Test::E)
-BOOST_MIRROR_REG_SIMPLE_BASE_CLASS(0, ::Test::B)
-BOOST_MIRROR_REG_SIMPLE_BASE_CLASS(1, ::Test::C)
-BOOST_MIRROR_REG_SIMPLE_BASE_CLASS(2, ::Test::D)
-BOOST_MIRROR_REG_BASE_CLASSES_END
-
-BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::Test::F)
-BOOST_MIRROR_REG_VIRTUAL_BASE_CLASS(0, public, ::Test::E)
-BOOST_MIRROR_REG_BASE_CLASSES_END
-
-BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::Test::G)
-BOOST_MIRROR_REG_VIRTUAL_BASE_CLASS(0, public, ::Test::E)
-BOOST_MIRROR_REG_BASE_CLASSES_END
-
-BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::Test::H)
-BOOST_MIRROR_REG_SIMPLE_BASE_CLASS(0, ::Test::F)
-BOOST_MIRROR_REG_SIMPLE_BASE_CLASS(1, ::Test::G)
-BOOST_MIRROR_REG_BASE_CLASSES_END
-
-
-/** Class attributes
- */
-BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::A)
- BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, long, l)
-BOOST_MIRROR_REG_CLASS_ATTRIBS_END
-
-BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::B)
- BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, int, i)
-BOOST_MIRROR_REG_CLASS_ATTRIBS_END
-
-BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::C)
- BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, double, d)
-BOOST_MIRROR_REG_CLASS_ATTRIBS_END
-
-BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::D)
- BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, short, s)
-BOOST_MIRROR_REG_CLASS_ATTRIBS_END
-
-BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::E)
- BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, float, f)
-BOOST_MIRROR_REG_CLASS_ATTRIBS_END
-
-BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::F)
- BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, bool, b)
-BOOST_MIRROR_REG_CLASS_ATTRIBS_END
-
-BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::G)
- BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, char, c)
-BOOST_MIRROR_REG_CLASS_ATTRIBS_END
-
-BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::Test::H)
- BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, wchar_t, w)
-BOOST_MIRROR_REG_CLASS_ATTRIBS_END
+// class with no base classes
+BOOST_MIRROR_QREG_CLASS_NO_BASE(::Test, A, (l))
+// class with only virtual base classes
+BOOST_MIRROR_QREG_CLASS_V_BASES(::Test, B, (::Test::A), (i))
+BOOST_MIRROR_QREG_CLASS_V_BASES(::Test, C, (::Test::A), (d))
+BOOST_MIRROR_QREG_CLASS_V_BASES(::Test, D, (::Test::A), (s))
+// class with both regular base classes and member attributes
+BOOST_MIRROR_QREG_CLASS(::Test, E, (::Test::B)(::Test::C)(::Test::D), (f))
+BOOST_MIRROR_QREG_CLASS_V_BASES(::Test, F, (::Test::E), (b))
+BOOST_MIRROR_QREG_CLASS_V_BASES(::Test, G, (::Test::E), (c))
+BOOST_MIRROR_QREG_CLASS(::Test, H, (::Test::F)(::Test::G), (w)(u))
 
 } // namespace mirror
 } // namespace boost

Modified: sandbox/mirror/libs/mirror/test/classes.hpp
==============================================================================
--- sandbox/mirror/libs/mirror/test/classes.hpp (original)
+++ sandbox/mirror/libs/mirror/test/classes.hpp 2009-04-22 14:27:40 EDT (Wed, 22 Apr 2009)
@@ -130,12 +130,7 @@
 namespace mirror {
 
 /** class ::test::A */
-BOOST_MIRROR_REG_TYPE(::test, A)
-BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::test::A)
- BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, a1)
- BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, a2)
- BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, a3)
-BOOST_MIRROR_REG_CLASS_ATTRIBS_END
+BOOST_MIRROR_QREG_CLASS_NO_BASE(::test, A, (a1)(a2)(a3))
 
 /** class ::test::B */
 BOOST_MIRROR_REG_TYPE(::test, B)
@@ -210,16 +205,7 @@
 BOOST_MIRROR_REG_CLASS_ATTRIBS_END
 
 /** class ::test::H */
-BOOST_MIRROR_REG_TYPE(::test, H)
-BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::test::H)
- BOOST_MIRROR_REG_BASE_CLASS(0, public, ::test::F)
- BOOST_MIRROR_REG_BASE_CLASS(1, public, ::test::G)
-BOOST_MIRROR_REG_BASE_CLASSES_END
-BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::test::H)
- BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, wchar_t, h1)
- BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, wchar_t, h2)
- BOOST_MIRROR_REG_SIMPLE_CLASS_ATTRIB(_, wchar_t, h3)
-BOOST_MIRROR_REG_CLASS_ATTRIBS_END
+BOOST_MIRROR_QREG_CLASS(::test, H, (::test::F)(::test::G), (h1)(h2)(h3))
 
 /** class ::test::I */
 BOOST_MIRROR_REG_TYPE(::test, I)

Modified: sandbox/mirror/libs/mirror/test/simple_classes.hpp
==============================================================================
--- sandbox/mirror/libs/mirror/test/simple_classes.hpp (original)
+++ sandbox/mirror/libs/mirror/test/simple_classes.hpp 2009-04-22 14:27:40 EDT (Wed, 22 Apr 2009)
@@ -61,66 +61,14 @@
 namespace boost {
 namespace mirror {
 
-BOOST_MIRROR_REG_TYPE(::test, A)
-BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::test::A)
- BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, a)
-BOOST_MIRROR_REG_CLASS_ATTRIBS_END
-
-BOOST_MIRROR_REG_TYPE(::test, B)
-BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::test::B)
- BOOST_MIRROR_REG_BASE_CLASS(0, public, ::test::A)
-BOOST_MIRROR_REG_BASE_CLASSES_END
-BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::test::B)
- BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, b)
-BOOST_MIRROR_REG_CLASS_ATTRIBS_END
-
-BOOST_MIRROR_REG_TYPE(::test, C)
-BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::test::C)
- BOOST_MIRROR_REG_BASE_CLASS(0, public, ::test::B)
-BOOST_MIRROR_REG_BASE_CLASSES_END
-BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::test::C)
- BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, c)
-BOOST_MIRROR_REG_CLASS_ATTRIBS_END
-
-BOOST_MIRROR_REG_TYPE(::test, D)
-BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::test::D)
- BOOST_MIRROR_REG_BASE_CLASS(0, public, ::test::C)
-BOOST_MIRROR_REG_BASE_CLASSES_END
-BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::test::D)
- BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, d)
-BOOST_MIRROR_REG_CLASS_ATTRIBS_END
-
-BOOST_MIRROR_REG_TYPE(::test, E)
-BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::test::E)
- BOOST_MIRROR_REG_BASE_CLASS(0, public, ::test::D)
-BOOST_MIRROR_REG_BASE_CLASSES_END
-BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::test::E)
- BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, e)
-BOOST_MIRROR_REG_CLASS_ATTRIBS_END
-
-BOOST_MIRROR_REG_TYPE(::test, F)
-BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::test::F)
- BOOST_MIRROR_REG_BASE_CLASS(0, public, ::test::E)
-BOOST_MIRROR_REG_BASE_CLASSES_END
-BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::test::F)
- BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, f)
-BOOST_MIRROR_REG_CLASS_ATTRIBS_END
-
-BOOST_MIRROR_REG_TYPE(::test, G)
-BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::test::G)
- BOOST_MIRROR_REG_BASE_CLASS(0, public, ::test::F)
-BOOST_MIRROR_REG_BASE_CLASSES_END
-BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::test::G)
- BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, g)
-BOOST_MIRROR_REG_CLASS_ATTRIBS_END
-
-BOOST_MIRROR_REG_TYPE(::test, H)
-BOOST_MIRROR_REG_BASE_CLASSES_BEGIN(::test::H)
- BOOST_MIRROR_REG_BASE_CLASS(0, public, ::test::G)
-BOOST_MIRROR_REG_BASE_CLASSES_END
-BOOST_MIRROR_REG_CLASS_ATTRIBS_BEGIN(::test::H)
- BOOST_MIRROR_REG_AUTO_CLASS_ATTRIB(_, h)
-BOOST_MIRROR_REG_CLASS_ATTRIBS_END
+BOOST_MIRROR_QREG_CLASS_NO_BASE(::test, A, (a))
+BOOST_MIRROR_QREG_CLASS(::test, B, (::test::A), (b))
+BOOST_MIRROR_QREG_CLASS(::test, C, (::test::B), (c))
+BOOST_MIRROR_QREG_CLASS(::test, D, (::test::C), (d))
+BOOST_MIRROR_QREG_CLASS(::test, E, (::test::D), (e))
+BOOST_MIRROR_QREG_CLASS(::test, F, (::test::E), (f))
+BOOST_MIRROR_QREG_CLASS(::test, G, (::test::F), (g))
+BOOST_MIRROR_QREG_CLASS(::test, H, (::test::G), (h))
 
 } // namespace miror
 } // namespace boost


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