Boost logo

Boost-Commit :

From: oryol_at_[hidden]
Date: 2008-05-01 20:51:24


Author: jeremypack
Date: 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
New Revision: 45003
URL: http://svn.boost.org/trac/boost/changeset/45003

Log:
Various changes and fixes, including:

Readability improvements to code.
Move reflector class into reflection class.
Change reflection default interface, to make it terser.
Add reflection for data members.

Added:
   sandbox/boost/extension/impl/factory.hpp (contents, props changed)
   sandbox/boost/extension/impl/factory_map.hpp (contents, props changed)
   sandbox/boost/reflection/adapter.hpp (contents, props changed)
   sandbox/boost/reflection/data.hpp (contents, props changed)
   sandbox/boost/reflection/data_info.hpp (contents, props changed)
   sandbox/boost/reflection/impl/constructor.hpp (contents, props changed)
   sandbox/boost/reflection/impl/function.hpp (contents, props changed)
   sandbox/boost/reflection/parameter.hpp (contents, props changed)
Removed:
   sandbox/boost/extension/counted_factory_map.hpp
   sandbox/boost/reflection/method_info.hpp
   sandbox/boost/reflection/reflector.hpp
Text files modified:
   sandbox/boost/extension/common.hpp | 4
   sandbox/boost/extension/convenience.hpp | 16 +
   sandbox/boost/extension/factory.hpp | 100 ----------
   sandbox/boost/extension/factory_map.hpp | 95 +---------
   sandbox/boost/extension/filesystem.hpp | 12
   sandbox/boost/extension/functor.hpp | 15
   sandbox/boost/extension/impl/decl.hpp | 2
   sandbox/boost/extension/impl/library_impl.hpp | 66 ++-----
   sandbox/boost/extension/impl/shared_library.hpp | 2
   sandbox/boost/extension/impl/typeinfo.hpp | 18 +-
   sandbox/boost/extension/shared_library.hpp | 16 -
   sandbox/boost/reflection/common.hpp | 6
   sandbox/boost/reflection/constructor.hpp | 29 --
   sandbox/boost/reflection/constructor_info.hpp | 16
   sandbox/boost/reflection/factory.hpp | 11 -
   sandbox/boost/reflection/function.hpp | 51 +----
   sandbox/boost/reflection/function_info.hpp | 19 +
   sandbox/boost/reflection/generic_constructor.hpp | 9
   sandbox/boost/reflection/impl/reflection.hpp | 8
   sandbox/boost/reflection/impl/reflector_free_functions.hpp | 4
   sandbox/boost/reflection/impl/reflector_functions.hpp | 29 +-
   sandbox/boost/reflection/impl/reflector_parameter_functions.hpp | 74 +++++---
   sandbox/boost/reflection/instance.hpp | 12
   sandbox/boost/reflection/parameter_map.hpp | 131 --------------
   sandbox/boost/reflection/reflection.hpp | 345 +++++++++++++++++++++++----------------
   sandbox/boost/reflection/static_reflection.hpp | 6
   sandbox/libs/reflection/examples/extension/car_lib.cpp | 22 -
   sandbox/libs/reflection/examples/extension/extension.cpp | 2
   sandbox/libs/reflection/examples/tutorial_1/hello_world.cpp | 21 -
   sandbox/libs/reflection/test/Jamfile.v2 | 1
   sandbox/libs/reflection/test/basic_test.cpp | 16
   sandbox/libs/reflection/test/multi_param_test.cpp | 10
   sandbox/libs/reflection/test/parameter_info_test.cpp | 9
   sandbox/libs/reflection/test/parameters_test.cpp | 2
   sandbox/libs/reflection/test/shared_library_test.cpp | 4
   sandbox/libs/reflection/test/single_param_test.cpp | 10
   36 files changed, 456 insertions(+), 737 deletions(-)

Modified: sandbox/boost/extension/common.hpp
==============================================================================
--- sandbox/boost/extension/common.hpp (original)
+++ sandbox/boost/extension/common.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -20,7 +20,7 @@
 #include <boost/preprocessor/iteration/iterate.hpp>
 
 #ifndef BOOST_EXTENSION_MAX_FUNCTOR_PARAMS
-# define BOOST_EXTENSION_MAX_FUNCTOR_PARAMS 6
+#define BOOST_EXTENSION_MAX_FUNCTOR_PARAMS 10
 #endif
 
-#endif // BOOST_EXTENSION_COMMON_HPP
+#endif // BOOST_EXTENSION_COMMON_HPP

Modified: sandbox/boost/extension/convenience.hpp
==============================================================================
--- sandbox/boost/extension/convenience.hpp (original)
+++ sandbox/boost/extension/convenience.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -1,6 +1,6 @@
 /*
  * Boost.Extension / convenience functions:
- * for now only one to load a library and register it in the factory
+ * for now only one to load a library and register it in the factory
  * map.
  *
  * (C) Copyright Jeremy Pack 2007
@@ -16,23 +16,25 @@
 
 #include <boost/extension/factory_map.hpp>
 
-namespace boost{namespace extensions{
-
-inline void load_single_library(factory_map & current_factory_map,
- const char * library_path,
+namespace boost {
+namespace extensions {
+
+inline void load_single_library(factory_map & current_factory_map,
+ const char * library_path,
                                 const char * external_function_name) {
     shared_library lib(library_path);
     if (!lib.open()) {
       return;
     }
- void (*func)(factory_map &) =
+ void (*func)(factory_map &) =
       lib.shared_library::get<void, factory_map &>(external_function_name);
     if (!func) {
       return;
     }
     (*func)(current_factory_map);
 }
-}}
+} // namespace extensions
+} // namespace boost
 
 
 

Deleted: sandbox/boost/extension/counted_factory_map.hpp
==============================================================================
--- sandbox/boost/extension/counted_factory_map.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
+++ (empty file)
@@ -1,490 +0,0 @@
-/*
- * Boost.Extension / counted factory map:
- * map of factories (for the implementations) with a reference count
- *
- * (C) Copyright Jeremy Pack 2007
- * Distributed under the Boost Software License, Version 1.0. (See
- * accompanying file LICENSE_1_0.txt or copy at
- * http://www.boost.org/LICENSE_1_0.txt)
- *
- * See http://www.boost.org/ for latest version.
- */
-
-#ifndef BOOST_EXTENSION_COUNTED_FACTORY_MAP_HPP
-#define BOOST_EXTENSION_COUNTED_FACTORY_MAP_HPP
-#include <list>
-#include <memory>
-#include <map>
-#include <boost/extension/counted_factory.hpp>
-#include <boost/extension/extension.hpp>
-#include <boost/extension/impl/typeinfo.hpp>
-
-#ifdef BOOST_EXTENSION_USE_PP
-
-#include <boost/preprocessor/arithmetic/inc.hpp>
-#include <boost/preprocessor/if.hpp>
-#include <boost/preprocessor/punctuation/comma_if.hpp>
-#include <boost/preprocessor/repetition.hpp>
-
-#ifndef BOOST_EXTENSION_MAX_FUNCTOR_PARAMS
-#define BOOST_EXTENSION_MAX_FUNCTOR_PARAMS 6
-#endif
-
-#endif
-
-
-namespace boost{namespace extensions{
-
-
-template <class TypeInfo>
-class basic_counted_factory_map
-{
-protected:
- class generic_factory_container
- {
- public:
- virtual bool remove_library(const char * library_name) = 0;
- virtual ~generic_factory_container(){}
- };
- template <class Interface, class Info, class Param1 = void,
- class Param2 = void, class Param3 = void, class Param4 = void,
- class Param5 = void, class Param6 = void>
- class factory_container :
- public std::list<counted_factory<Interface, Info, Param1, Param2, Param3,
- Param4, Param5, Param6> >,
- public generic_factory_container
- {
- public:
- int * counter_;
- factory_container(int * counter) : counter_(counter) {++(*counter_);}
- virtual ~factory_container() {--(*counter_);}
- virtual bool remove_library(const char * library_name)
- {
- for (typename std::list<counted_factory<Interface, Info, Param1,
- Param2, Param3, Param4, Param5, Param6> >::iterator it =
- this->begin();
- it != this->end();)
- {
- if (strcmp(it->library(), library_name) == 0)
- this->erase(it++);
- else
- ++it;
- }
- return this->size() == 0;
- }
- // factory_container() {}
- // factory_container(basic_counted_factory_map & z)
- // :std::list<counted_factory<Interface, Info, Param1, Param2, Param3,
- // Param4, Param5, Param6> >(z.get<Interface, Param1, Param2, Param3,
- // Param4, Param5, Param6>()){}
- //virtual ~factory_container(){}
- };
- typedef std::map<TypeInfo, generic_factory_container *> FactoryMap;
- FactoryMap factories_;
- std::string current_library_;
- int default_counter_;
- int * current_counter_;
-public:
- basic_counted_factory_map() : default_counter_(0),
- current_counter_(&default_counter_){}
- ~basic_counted_factory_map(){
- for(typename FactoryMap::iterator it = factories_.begin();
- it != factories_.end(); ++it)
- delete it->second;
- //TODO - test for memory leaks.
- }
-
-#ifdef BOOST_EXTENSION_USE_PP
-
-#define BOOST_EXTENSION_COUNTED_FACTORY_MAP_OP_LIST(Z, N, _) \
-template<class Interface, class Info BOOST_PP_COMMA_IF(N) \
- BOOST_PP_ENUM_PARAMS(N, \
- class Param) > \
-operator std::list<counted_factory<Interface, Info \
- BOOST_PP_COMMA_IF(N) \
- BOOST_PP_ENUM_PARAMS(N, Param) > > & () { \
- return this->get<Interface, Info BOOST_PP_COMMA_IF(N) \
- BOOST_PP_ENUM_PARAMS(N, Param) >(); \
-}
-/**/
-
-#define BOOST_EXTENSION_COUNTED_FACTORY_MAP_GET_METHOD(Z, N, _) \
-template <class Interface, class Info BOOST_PP_COMMA_IF(N) \
- BOOST_PP_ENUM_PARAMS(N, class Param) > \
-std::list<counted_factory<Interface, Info BOOST_PP_COMMA_IF(N) \
- BOOST_PP_ENUM_PARAMS(N, Param) > > & get() \
-{ \
- TypeInfo current_type = \
- type_info_handler<TypeInfo, counted_factory<Interface, Info \
- BOOST_PP_COMMA_IF(N) \
- BOOST_PP_ENUM_PARAMS(N, Param) > >::get_class_type(); \
- typename FactoryMap::iterator it = factories_.find(current_type); \
- if (it == factories_.end()) \
- { \
- factory_container<Interface, Info BOOST_PP_COMMA_IF(N) \
- BOOST_PP_ENUM_PARAMS(N, Param) > * ret = \
- new factory_container<Interface, Info BOOST_PP_COMMA_IF(N) \
- BOOST_PP_ENUM_PARAMS(N, Param) >(current_counter_); \
- factories_[current_type] = ret; \
- return *ret; \
- } \
- else \
- { \
- return static_cast<factory_container<Interface, Info BOOST_PP_COMMA_IF(N) \
- BOOST_PP_ENUM_PARAMS(N, Param) > &>(*(it->second)); \
- } \
-}
-/**/
-
-#define BOOST_EXTENSION_COUNTED_FACTORY_MAP_ADD_METHOD(Z, N, _) \
-template <class Actual, class Interface, class Info BOOST_PP_COMMA_IF(N) \
- BOOST_PP_ENUM_PARAMS(N, class Param) > \
-void add(Info info) \
-{ \
- typedef std::list<counted_factory<Interface, Info BOOST_PP_COMMA_IF(N) \
- BOOST_PP_ENUM_PARAMS(N, Param) > > ListType; \
- ListType & s = this->get<Interface, Info BOOST_PP_COMMA_IF(N) \
- BOOST_PP_ENUM_PARAMS(N, Param) >(); \
- counted_factory<Interface, Info BOOST_PP_COMMA_IF(N) \
- BOOST_PP_ENUM_PARAMS(N, Param) > f(info); \
- f.set_library(current_library_.c_str()); \
- f.set_counter(current_counter_); \
- f.set_type_special((Actual*)0); \
- s.push_back(f); \
-}
-/**/
-
-
-BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_EXTENSION_MAX_FUNCTOR_PARAMS), \
- BOOST_EXTENSION_COUNTED_FACTORY_MAP_OP_LIST, _)
-
-
-BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_EXTENSION_MAX_FUNCTOR_PARAMS), \
- BOOST_EXTENSION_COUNTED_FACTORY_MAP_GET_METHOD, _)
-
-
-BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_EXTENSION_MAX_FUNCTOR_PARAMS), \
- BOOST_EXTENSION_COUNTED_FACTORY_MAP_ADD_METHOD, _)
-
-
-#undef BOOST_EXTENSION_COUNTED_FACTORY_MAP_OP_LIST
-#undef BOOST_EXTENSION_COUNTED_FACTORY_MAP_GET_METHOD
-#undef BOOST_EXTENSION_COUNTED_FACTORY_MAP_ADD_METHOD
-#else
- template <class Interface, class Info>
-operator std::list<counted_factory<Interface, Info> > & ()
- {return this->get<Interface, Info>();}
- template <class Interface, class Info>
-std::list<counted_factory<Interface, Info> > & get()
- {
- TypeInfo current_type =
- type_info_handler<TypeInfo,
- counted_factory<Interface, Info> >::get_class_type();
- typename FactoryMap::iterator it =
- factories_.find(current_type);
-
- if (it == factories_.end())
- {
- factory_container<Interface, Info> * ret =
- new factory_container<Interface, Info>(current_counter_);
- factories_[current_type] = ret;
- return *ret;
- }
- else
- {
- // Change to dynamic if this fails
- return static_cast<factory_container<Interface,
- Info> &>(*(it->second));
- }
- }
-template <class Actual, class Interface, class Info>
-void add(Info info)
- {
- typedef std::list<counted_factory<Interface, Info> > ListType;
- ListType & s = this->get<Interface, Info>();
- counted_factory<Interface, Info> f(info);
- f.set_library(current_library_.c_str());
- f.set_counter(current_counter_);
- //f.set_type<Actual>();
- f.set_type_special((Actual*)0);
- s.push_back(f);
- //it->set_type<Actual>();
- }
- template <class Interface, class Info, class Param1>
-operator std::list<counted_factory<Interface, Info, Param1> > & ()
- {return this->get<Interface, Info, Param1>();}
- template <class Interface, class Info, class Param1>
-std::list<counted_factory<Interface, Info, Param1> > & get()
- {
- TypeInfo current_type =
- type_info_handler<TypeInfo, counted_factory<Interface, Info,
- Param1> >::get_class_type();
- typename FactoryMap::iterator it = factories_.find(current_type);
-
- if (it == factories_.end())
- {
- factory_container<Interface, Info, Param1> * ret =
- new factory_container<Interface, Info, Param1>(current_counter_);
- factories_[current_type] = ret;
- return *ret;
- }
- else
- {
- // Change to dynamic if this fails
- return static_cast<factory_container<Interface, Info,
- Param1> &>(*(it->second));
- }
- }
-template <class Actual, class Interface, class Info, class Param1>
-void add(Info info)
- {
- typedef std::list<counted_factory<Interface, Info, Param1> > ListType;
- ListType & s = this->get<Interface, Info, Param1>();
- counted_factory<Interface, Info, Param1> f(info);
- f.set_library(current_library_.c_str());
- f.set_counter(current_counter_);
- //f.set_type<Actual>();
- f.set_type_special((Actual*)0);
- s.push_back(f);
- //it->set_type<Actual>();
- }
- template <class Interface, class Info, class Param1, class Param2>
-operator std::list<counted_factory<Interface, Info, Param1, Param2> > & ()
- {return this->get<Interface, Info, Param1, Param2>();}
- template <class Interface, class Info, class Param1, class Param2>
-std::list<counted_factory<Interface, Info, Param1, Param2> > & get()
- {
- TypeInfo current_type =
- type_info_handler<TypeInfo, counted_factory<Interface, Info, Param1,
- Param2> >::get_class_type();
- typename FactoryMap::iterator it =
- factories_.find(current_type);
-
- if (it == factories_.end())
- {
- factory_container<Interface, Info, Param1, Param2> * ret =
- new factory_container<Interface, Info, Param1,
- Param2>(current_counter_);
- factories_[current_type] = ret;
- return *ret;
- }
- else
- {
- // Change to dynamic if this fails
- return static_cast<factory_container<Interface, Info, Param1,
- Param2> &>(*(it->second));
- }
- }
-template <class Actual, class Interface, class Info, class Param1,
- class Param2>
-void add(Info info)
- {
- typedef std::list<counted_factory<Interface, Info, Param1, Param2> >
- ListType;
- ListType & s = this->get<Interface, Info, Param1, Param2>();
- counted_factory<Interface, Info, Param1, Param2> f(info);
- f.set_library(current_library_.c_str());
- f.set_counter(current_counter_);
- //f.set_type<Actual>();
- f.set_type_special((Actual*)0);
- s.push_back(f);
- //it->set_type<Actual>();
- }
- template <class Interface, class Info, class Param1, class Param2,
- class Param3>
-operator std::list<counted_factory<Interface, Info, Param1, Param2,
- Param3> > & ()
- {return this->get<Interface, Info, Param1, Param2, Param3>();}
- template <class Interface, class Info, class Param1, class Param2,
- class Param3>
-std::list<counted_factory<Interface, Info, Param1, Param2, Param3> > & get()
- {
- TypeInfo current_type =
- type_info_handler<TypeInfo, counted_factory<Interface, Info, Param1,
- Param2, Param3> >::get_class_type();
- typename FactoryMap::iterator it =
- factories_.find(current_type);
-
- if (it == factories_.end())
- {
- factory_container<Interface, Info, Param1, Param2, Param3> * ret =
- new factory_container<Interface, Info, Param1, Param2,
- Param3>(current_counter_);
- factories_[current_type] = ret;
- return *ret;
- }
- else
- {
- // Change to dynamic if this fails
- return static_cast<factory_container<Interface, Info, Param1, Param2,
- Param3> &>(*(it->second));
- }
- }
-template <class Actual, class Interface, class Info, class Param1,
- class Param2, class Param3>
-void add(Info info)
- {
- typedef std::list<counted_factory<Interface, Info, Param1, Param2,
- Param3> > ListType;
- ListType & s = this->get<Interface, Info, Param1, Param2, Param3>();
- counted_factory<Interface, Info, Param1, Param2, Param3> f(info);
- f.set_library(current_library_.c_str());
- f.set_counter(current_counter_);
- //f.set_type<Actual>();
- f.set_type_special((Actual*)0);
- s.push_back(f);
- //it->set_type<Actual>();
- }
- template <class Interface, class Info, class Param1, class Param2,
- class Param3, class Param4>
-operator std::list<counted_factory<Interface, Info, Param1, Param2, Param3,
- Param4> > & ()
- {return this->get<Interface, Info, Param1, Param2, Param3, Param4>();}
- template <class Interface, class Info, class Param1, class Param2,
- class Param3, class Param4>
-std::list<counted_factory<Interface, Info, Param1, Param2, Param3,
- Param4> > & get()
- {
- TypeInfo current_type =
- type_info_handler<TypeInfo, counted_factory<Interface, Info, Param1,
- Param2, Param3, Param4> >::get_class_type();
- typename FactoryMap::iterator it =
- factories_.find(current_type);
-
- if (it == factories_.end())
- {
- factory_container<Interface, Info, Param1, Param2, Param3,
- Param4> * ret =
- new factory_container<Interface, Info, Param1, Param2, Param3,
- Param4>(current_counter_);
- factories_[current_type] = ret;
- return *ret;
- }
- else
- {
- // Change to dynamic if this fails
- return static_cast<factory_container<Interface, Info, Param1, Param2,
- Param3, Param4> &>(*(it->second));
- }
- }
-template <class Actual, class Interface, class Info, class Param1,
- class Param2, class Param3, class Param4>
-void add(Info info)
- {
- typedef std::list<counted_factory<Interface, Info, Param1, Param2,
- Param3, Param4> > ListType;
- ListType & s = this->get<Interface, Info, Param1, Param2, Param3,
- Param4>();
- counted_factory<Interface, Info, Param1, Param2, Param3, Param4> f(info);
- f.set_library(current_library_.c_str());
- f.set_counter(current_counter_);
- //f.set_type<Actual>();
- f.set_type_special((Actual*)0);
- s.push_back(f);
- //it->set_type<Actual>();
- }
- template <class Interface, class Info, class Param1, class Param2,
- class Param3, class Param4, class Param5>
- operator std::list<counted_factory<Interface, Info, Param1, Param2, Param3,
- Param4, Param5> > & ()
- {
- return this->get<Interface, Info, Param1, Param2, Param3, Param4,
- Param5>();
- }
- template <class Interface, class Info, class Param1, class Param2,
- class Param3, class Param4, class Param5>
- std::list<counted_factory<Interface, Info, Param1, Param2, Param3, Param4,
- Param5> > & get()
- {
- TypeInfo current_type =
- type_info_handler<TypeInfo, counted_factory<Interface, Info, Param1,
- Param2, Param3, Param4, Param5> >::get_class_type();
- typename FactoryMap::iterator it =
- factories_.find(current_type);
-
- if (it == factories_.end()) {
- factory_container<Interface, Info, Param1, Param2, Param3, Param4,
- Param5> * ret = new factory_container<Interface, Info, Param1, Param2,
- Param3, Param4, Param5>(current_counter_);
- factories_[current_type] = ret;
- return *ret;
- } else {
- // Change to dynamic if this fails
- return static_cast<factory_container<Interface, Info, Param1, Param2,
- Param3, Param4, Param5> &>(*(it->second));
- }
- }
- template <class Actual, class Interface, class Info, class Param1,
- class Param2, class Param3, class Param4, class Param5>
- void add(Info info)
- {
- typedef std::list<counted_factory<Interface, Info, Param1, Param2,
- Param3, Param4, Param5> > ListType;
- ListType & s = this->get<Interface, Info, Param1, Param2, Param3, Param4,
- Param5>();
- counted_factory<Interface, Info, Param1, Param2, Param3, Param4,
- Param5> f(info);
- f.set_library(current_library_.c_str());
- f.set_counter(current_counter_);
- //f.set_type<Actual>();
- f.set_type_special((Actual*)0);
- s.push_back(f);
- //it->set_type<Actual>();
- }
- template <class Interface, class Info, class Param1, class Param2,
- class Param3, class Param4, class Param5, class Param6>
- operator std::list<counted_factory<Interface, Info, Param1, Param2, Param3,
- Param4, Param5, Param6> > & () {
- return this->get<Interface, Info, Param1, Param2, Param3, Param4, Param5,
- Param6>();}
- template <class Interface, class Info, class Param1, class Param2,
- class Param3, class Param4, class Param5, class Param6>
- std::list<counted_factory<Interface, Info, Param1, Param2, Param3, Param4,
- Param5, Param6> > & get()
- {
- TypeInfo current_type =
- type_info_handler<TypeInfo, counted_factory<Interface, Info, Param1,
- Param2, Param3, Param4, Param5, Param6> >::get_class_type();
- typename FactoryMap::iterator it =
- factories_.find(current_type);
-
- if (it == factories_.end()) {
- factory_container<Interface, Info, Param1, Param2, Param3, Param4,
- Param5, Param6> * ret =
- new factory_container<Interface, Info, Param1, Param2, Param3,
- Param4, Param5, Param6>(current_counter_);
- factories_[current_type] = ret;
- return *ret;
- }
- else
- {
- // Change to dynamic if this fails
- return static_cast<factory_container<Interface, Info, Param1, Param2,
- Param3, Param4, Param5, Param6> &>(*(it->second));
- }
- }
- template <class Actual, class Interface, class Info, class Param1,
- class Param2, class Param3, class Param4, class Param5,
- class Param6>
- void add(Info info)
- {
- typedef std::list<counted_factory<Interface, Info, Param1, Param2,
- Param3, Param4, Param5, Param6> > ListType;
- ListType & s = this->get<Interface, Info, Param1, Param2, Param3,
- Param4, Param5, Param6>();
- counted_factory<Interface, Info, Param1, Param2, Param3, Param4, Param5,
- Param6> f(info);
- f.set_library(current_library_.c_str());
- f.set_counter(current_counter_);
- //f.set_type<Actual>();
- f.set_type_special((Actual*)0);
- s.push_back(f);
- //it->set_type<Actual>();
- }
-#endif // BOOST_EXTENSION_USE_PP
-};
-
-typedef basic_counted_factory_map<default_type_info> counted_factory_map;
-}}
-
-#endif

Modified: sandbox/boost/extension/factory.hpp
==============================================================================
--- sandbox/boost/extension/factory.hpp (original)
+++ sandbox/boost/extension/factory.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -10,15 +10,13 @@
  * See http://www.boost.org/ for latest version.
  */
 
-#ifndef BOOST_PP_IS_ITERATING
-
-
 #ifndef BOOST_EXTENSION_FACTORY_HPP
 #define BOOST_EXTENSION_FACTORY_HPP
 
 #include <boost/extension/common.hpp>
 
-namespace boost{namespace extensions{
+namespace boost {
+namespace extensions {
 
 
 #define N BOOST_EXTENSION_MAX_FUNCTOR_PARAMS
@@ -31,7 +29,6 @@
 
 #undef N
 
-
 #define N BOOST_EXTENSION_MAX_FUNCTOR_PARAMS
 
 template <class T
@@ -42,93 +39,12 @@
 
 #undef N
 
-
 // generate specializations of create_function and factory
-# define BOOST_PP_ITERATION_LIMITS (0, BOOST_PP_INC(BOOST_EXTENSION_MAX_FUNCTOR_PARAMS) - 1)
-# define BOOST_PP_FILENAME_1 <boost/extension/factory.hpp> // this file
+# define BOOST_PP_ITERATION_LIMITS \
+ (0, BOOST_PP_INC(BOOST_EXTENSION_MAX_FUNCTOR_PARAMS) - 1)
+# define BOOST_PP_FILENAME_1 <boost/extension/impl/factory.hpp>
 # include BOOST_PP_ITERATE()
+} // namespace extensions
+} // namespace boost
 
-
-}} // namespace boost::extension
-
-#endif // BOOST_EXTENSION_FACTORY_HPP
-
-
-
-
-#else // BOOST_PP_IS_ITERATING
-
-
-// for convenience
-#define n BOOST_PP_ITERATION()
-
-
-
-template <
- class T,
- class D
- BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, class Param)
->
-struct create_function<
- T,
- D
- BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, Param)
->
-{
- static T * create(BOOST_PP_ENUM_BINARY_PARAMS(n, Param, p) )
- {
- return new D(BOOST_PP_ENUM_PARAMS(n, p));
- }
-};
-
-
-
-template <class T BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, class Param) >
-class factory<T BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, Param) >
-{
-public:
-
- template <class D>
- void set()
- {
- this->func = &create_function<
- T, D BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n,Param)
- >::create;
- }
-
- factory() : func(0) {}
-
- factory(factory<T> const& first) : func(first.func) {}
-
- factory& operator=(factory<T> const& first)
- {
- this->func = first->func;
- return *this;
- }
-
- bool is_valid() { return this->func != 0; }
-
- T* create(BOOST_PP_ENUM_BINARY_PARAMS(n, Param, p))
- {
- if (this->func)
- {
- return this->func(BOOST_PP_ENUM_PARAMS(n, p));
- }
- else
- {
- return 0;
- }
- }
-
-private:
-
- typedef T* (*func_ptr_type)(BOOST_PP_ENUM_PARAMS(n, Param));
- func_ptr_type func;
-
-};
-
-
-#undef n
-
-
-#endif // BOOST_PP_IS_ITERATING
+#endif // BOOST_EXTENSION_FACTORY_HPP

Modified: sandbox/boost/extension/factory_map.hpp
==============================================================================
--- sandbox/boost/extension/factory_map.hpp (original)
+++ sandbox/boost/extension/factory_map.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -10,12 +10,6 @@
  * See http://www.boost.org/ for latest version.
  */
 
-
-#ifndef BOOST_PP_IS_ITERATING
-
-
-
-
 #ifndef BOOST_EXTENSION_FACTORY_MAP_HPP
 #define BOOST_EXTENSION_FACTORY_MAP_HPP
 
@@ -23,7 +17,8 @@
 #include <boost/extension/factory.hpp>
 #include <boost/extension/impl/typeinfo.hpp>
 
-namespace boost{namespace extensions{
+namespace boost {
+namespace extensions {
 
 template <class TypeInfo>
 class basic_factory_map
@@ -32,25 +27,22 @@
 public:
 
   // generate get and conversion template member functions from the
- // specification at the end of this file
+ // specification in impl/
 # define BOOST_PP_ITERATION_LIMITS (0, \
     BOOST_PP_INC(BOOST_EXTENSION_MAX_FUNCTOR_PARAMS) - 1)
-# define BOOST_PP_FILENAME_1 <boost/extension/factory_map.hpp> // this file
+# define BOOST_PP_FILENAME_1 <boost/extension/impl/factory_map.hpp>
 # include BOOST_PP_ITERATE()
 
- ~basic_factory_map()
- {
+ ~basic_factory_map() {
     for (typename std::map<TypeInfo, generic_map_holder*>::iterator
- it =maps_.begin(); it != maps_.end(); ++it)
- {
+ it =maps_.begin(); it != maps_.end(); ++it) {
       delete it->second;
     }
   }
 
 private:
 
- struct generic_map_holder
- {
+ struct generic_map_holder {
     virtual ~generic_map_holder() {}
   };
 
@@ -62,75 +54,8 @@
 
 typedef basic_factory_map<default_type_info> factory_map;
 
-}} // namespace boost::extensions
-
-// Note! This is the end of the include guard
-#endif // BOOST_EXTENSION_FACTORY_MAP_HPP
-
-
-
-
-#else // BOOST_PP_IS_ITERATING
-
-
-
-// for convenience
-# define n BOOST_PP_ITERATION()
-
-
-template <class Interface, class Info
- BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, class Param) >
-std::map<
- Info,
- factory<Interface BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, Param) >
- > &
-get()
-{
- typedef Interface* (* func_ptr_type )(BOOST_PP_ENUM_PARAMS(n, Param));
- typedef type_info_handler<TypeInfo, func_ptr_type> handler_type;
-
- TypeInfo t = handler_type::get_class_type();
-
- typename std::map<TypeInfo, generic_map_holder*>::iterator
- it = maps_.find(t);
-
- typedef factory<
- Interface
- BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, Param)
- > factory_type;
- typedef std::map<Info, factory_type> map_type;
-
- map_holder<map_type>* holder;
- if (it == maps_.end())
- {
- holder = new map_holder<map_type>;
- it = maps_.insert(std::make_pair(t, holder)).first;
- }
- else
- {
- holder = static_cast<map_holder<map_type>* > (it->second);
- }
-
- return *(static_cast<map_type* >(holder));
-}
-
-
-template <class Interface, class Info
- BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, class Param) >
-operator
- std::map<
- Info,
- factory<Interface BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, Param) >
- >
- ()
-{
- return get< Interface, Info
- BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, Param)>();
-}
-
-
-# undef n
-
+} // namespace extensions
+} // namespace boost
 
+#endif // BOOST_EXTENSION_FACTORY_MAP_HPP
 
-#endif // BOOST_PP_IS_ITERATING

Modified: sandbox/boost/extension/filesystem.hpp
==============================================================================
--- sandbox/boost/extension/filesystem.hpp (original)
+++ sandbox/boost/extension/filesystem.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -19,11 +19,11 @@
 #include <boost/extension/factory_map.hpp>
 #include <boost/extension/convenience.hpp>
 
-namespace boost{namespace extensions{
+namespace boost {namespace extensions {
 
-inline void load_all_libraries(factory_map & current_zone,
- const char * directory,
- const char * external_function_name,
+inline void load_all_libraries(factory_map & current_zone,
+ const char * directory,
+ const char * external_function_name,
                                int max_depth = 0)
 {
   if (max_depth < 0) return; // Recursion base case
@@ -34,12 +34,12 @@
   {
     if (is_directory(*file_iter))
     {
- load_all_libraries(current_zone, directory, file_iter->string().c_str(),
+ load_all_libraries(current_zone, directory, file_iter->string().c_str(),
                          max_depth - 1);
     }
     else if (is_library(filesystem::extension(*file_iter).c_str()))
     {
- load_single_library(current_zone, file_iter->string().c_str(),
+ load_single_library(current_zone, file_iter->string().c_str(),
                           external_function_name);
     }
   }

Modified: sandbox/boost/extension/functor.hpp
==============================================================================
--- sandbox/boost/extension/functor.hpp (original)
+++ sandbox/boost/extension/functor.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -43,7 +43,7 @@
 
 }} // namespace boost::extensions
 
-#endif // BOOST_EXTENSION_FUNCTOR_HPP
+#endif // BOOST_EXTENSION_FUNCTOR_HPP
 
 
 
@@ -54,7 +54,7 @@
 
 # define n BOOST_PP_ITERATION()
 
-template<class ReturnValue
+template <class ReturnValue
          BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, class Param) >
 class functor<ReturnValue
               BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, Param) >
@@ -66,18 +66,17 @@
 
 public:
 
- bool is_valid() const {return func_ != 0;}
+ bool is_valid() const { return func_ != 0; }
 
- functor(FunctionType func) : func_(func) {}
+ explicit functor(FunctionType func) : func_(func) {}
 
- functor(generic_function_ptr func) : func_(FunctionType(func)) {}
+ explicit functor(generic_function_ptr func) : func_(FunctionType(func)) {}
 
- ReturnValue operator()(BOOST_PP_ENUM_BINARY_PARAMS(n, Param, p))
- {
+ ReturnValue operator()(BOOST_PP_ENUM_BINARY_PARAMS(n, Param, p)) {
     return func_(BOOST_PP_ENUM_PARAMS(n, p));
   }
 };
 
 # undef n
 
-#endif // BOOST_PP_IS_ITERATING
+#endif // BOOST_PP_IS_ITERATING

Modified: sandbox/boost/extension/impl/decl.hpp
==============================================================================
--- sandbox/boost/extension/impl/decl.hpp (original)
+++ sandbox/boost/extension/impl/decl.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -14,7 +14,7 @@
 #define BOOST_EXTENSION_DECL_HPP
 
 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(MSC_VER)
-# define BOOST_EXTENSION_EXPORT_DECL __declspec(dllexport)
+# define BOOST_EXTENSION_EXPORT_DECL __declspec(dllexport)
 # define BOOST_EXTENSION_IMPORT_DECL __declspec(dllimport)
 #else
 # define BOOST_EXTENSION_EXPORT_DECL

Added: sandbox/boost/extension/impl/factory.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/extension/impl/factory.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -0,0 +1,78 @@
+/*
+ * Copyright Jeremy Pack 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
+ */
+
+
+// No header guard - this file is intended to be included multiple times.
+
+# define N BOOST_PP_ITERATION()
+
+template <
+ class T,
+ class D
+ BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_PARAMS(N, class Param)
+>
+struct create_function<
+ T,
+ D
+ BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_PARAMS(N, Param)
+>
+{
+ static T * create(BOOST_PP_ENUM_BINARY_PARAMS(N, Param, p) )
+ {
+ return new D(BOOST_PP_ENUM_PARAMS(N, p));
+ }
+};
+
+
+
+template <class T BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_PARAMS(N, class Param) >
+class factory<T BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_PARAMS(N, Param) >
+{
+public:
+
+ template <class D>
+ void set()
+ {
+ this->func = &create_function<
+ T, D BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_PARAMS(N,Param)
+ >::create;
+ }
+
+ factory() : func(0) {}
+
+ factory(factory<T> const& first) : func(first.func) {}
+
+ factory& operator=(factory<T> const& first)
+ {
+ this->func = first->func;
+ return *this;
+ }
+
+ bool is_valid() { return this->func != 0; }
+
+ T* create(BOOST_PP_ENUM_BINARY_PARAMS(N, Param, p))
+ {
+ if (this->func)
+ {
+ return this->func(BOOST_PP_ENUM_PARAMS(N, p));
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+private:
+
+ typedef T* (*func_ptr_type)(BOOST_PP_ENUM_PARAMS(N, Param));
+ func_ptr_type func;
+
+};
+
+#undef N
\ No newline at end of file

Added: sandbox/boost/extension/impl/factory_map.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/extension/impl/factory_map.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -0,0 +1,64 @@
+/*
+ * Copyright Jeremy Pack 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
+ */
+
+
+// No header guard - this file is intended to be included multiple times.
+
+# define N BOOST_PP_ITERATION()
+
+template <class Interface, class Info
+ BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_PARAMS(N, class Param) >
+std::map<
+ Info,
+ factory<Interface BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_PARAMS(N, Param) >
+ > &
+get() {
+ typedef Interface* (* func_ptr_type )(BOOST_PP_ENUM_PARAMS(N, Param));
+ typedef type_info_handler<TypeInfo, func_ptr_type> handler_type;
+
+ TypeInfo t = handler_type::get_class_type();
+
+ typename std::map<TypeInfo, generic_map_holder*>::iterator
+ it = maps_.find(t);
+
+ typedef factory<
+ Interface
+ BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_PARAMS(N, Param)
+ > factory_type;
+ typedef std::map<Info, factory_type> map_type;
+
+ map_holder<map_type>* holder;
+ if (it == maps_.end())
+ {
+ holder = new map_holder<map_type>;
+ it = maps_.insert(std::make_pair(t, holder)).first;
+ }
+ else
+ {
+ holder = static_cast<map_holder<map_type>* > (it->second);
+ }
+
+ return *(static_cast<map_type* >(holder));
+}
+
+
+template <class Interface, class Info
+ BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_PARAMS(N, class Param) >
+operator
+ std::map<
+ Info,
+ factory<Interface BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_PARAMS(N, Param) >
+ >
+ ()
+{
+ return get< Interface, Info
+ BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_PARAMS(N, Param)>();
+}
+
+#undef N
\ No newline at end of file

Modified: sandbox/boost/extension/impl/library_impl.hpp
==============================================================================
--- sandbox/boost/extension/impl/library_impl.hpp (original)
+++ sandbox/boost/extension/impl/library_impl.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -15,30 +15,29 @@
 
 #include <cstring>
 
-#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+#if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) \
+ && !defined(BOOST_DISABLE_WIN32) && !defined(__GNUC__)
 
 #ifndef _WIN32_WINNT
 #define _WIN32_WINNT 0x0501
 #endif
 
+#ifndef BOOST_EXTENSION_NO_LEAN_WIN32
 #ifndef WIN32_LEAN_AND_MEAN
 #define WIN32_LEAN_AND_MEAN
 #endif
+#endif
+
 #include <Windows.h>
-namespace
-{
+namespace boost {
+namespace extensions {
+namespace impl {
   typedef HMODULE library_handle;
   typedef FARPROC generic_function_ptr;
- inline bool is_library(const char * file_name)
- {
- int len = strlen(file_name);
- return (len > 3 && file_name[len-4] == '.' && file_name[len-3] == 'd'
- && file_name[len-2] == 'l' && file_name[len-1] == 'l');
- }
   inline library_handle load_shared_library(const char * libraryName) {
     return LoadLibraryA(libraryName);
   }
- inline generic_function_ptr get_function(library_handle handle,
+ inline generic_function_ptr get_function(library_handle handle,
                                            const char * function_name) {
     return GetProcAddress(handle, function_name);
   }
@@ -46,56 +45,31 @@
     return FreeLibrary(handle) != 0;
   }
 }
-# pragma comment(lib, "kernel32.lib")
-#else
-#ifdef __APPLE__
-namespace
-{
- inline bool is_library(const char * file_name)
- {
- int len = strlen(file_name);
- return ((len > 5 && file_name[len-7] == '.' && file_name[len-6] == 'b'
- && file_name[len-5] == 'u' && file_name[len-4] == 'n'
- && file_name[len-3] == 'd' && file_name[len-2] == 'l' &&
- file_name[len-1] == 'e') || (len > 4 && file_name[len-6] == '.'
- && file_name[len-5] == 'd'
- && file_name[len-4] == 'y'
- && file_name[len-3] == 'l' &&
- file_name[len-2] == 'i'
- && file_name[len-1] == 'b'));
- }
-}
-#define BOOST_EXTENSION_LIBRARY_EXTENSION "dylib"
+} // namespace impl
+} // namespace extensions
+} // namespace boost
 
+# pragma comment(lib, "kernel32.lib")
 #else
-namespace
-{
- inline bool is_library(const char * file_name)
- {
- int len = strlen(file_name);
- return (len > 2 && file_name[len-3] == '.' && file_name[len-2] == 's'
- && file_name[len-1] == 'o');
- }
-}
-#define BOOST_EXTENSION_LIBRARY_EXTENSION "so"
-#endif
-
 #include <dlfcn.h>
-namespace
-{
+namespace boost {
+namespace extensions {
+namespace impl {
   typedef void * library_handle;
   typedef void * generic_function_ptr;
   inline library_handle load_shared_library(const char * library_name) {
     return dlopen(library_name, RTLD_LAZY);
   }
- inline generic_function_ptr get_function(library_handle handle,
+ inline generic_function_ptr get_function(library_handle handle,
                                            const char * function_name) {
     return dlsym(handle, function_name);
   }
   inline bool close_shared_library(library_handle handle) {
     return dlclose(handle)==0;
   }
-}
+} // namespace impl
+} // namespace extensions
+} // namespace boost
 
 #endif
 

Modified: sandbox/boost/extension/impl/shared_library.hpp
==============================================================================
--- sandbox/boost/extension/impl/shared_library.hpp (original)
+++ sandbox/boost/extension/impl/shared_library.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -14,6 +14,6 @@
           BOOST_PP_ENUM_PARAMS(N, class Param) >
 ReturnValue (*get(const std::string& name))(BOOST_PP_ENUM_PARAMS(N, Param)) {
   return reinterpret_cast<ReturnValue (*)(BOOST_PP_ENUM_PARAMS(N, Param))>
- (get_function(handle_, name.c_str()));
+ (impl::get_function(handle_, name.c_str()));
 }
 #undef N
\ No newline at end of file

Modified: sandbox/boost/extension/impl/typeinfo.hpp
==============================================================================
--- sandbox/boost/extension/impl/typeinfo.hpp (original)
+++ sandbox/boost/extension/impl/typeinfo.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -42,17 +42,17 @@
 #if defined(__APPLE__) || defined(__GNUC__) || defined(BOOST_EXTENSION_FORCE_FAST_TYPEINFO)
 namespace boost {
 namespace extensions {
-bool operator<(const default_type_info& first,
+inline bool operator<(const default_type_info& first,
                const default_type_info& second) {
   return &first.type < &second.type;
 }
 
-bool operator==(const default_type_info& first,
+inline bool operator==(const default_type_info& first,
                const default_type_info& second) {
   return &first.type == &second.type;
 }
 
-bool operator>(const default_type_info& first,
+inline bool operator>(const default_type_info& first,
                const default_type_info& second) {
   return &first.type > &second.type;
 }
@@ -61,17 +61,17 @@
 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
 #include <string>
 namespace boost { namespace extensions {
-bool operator<(const default_type_info& first,
+inline bool operator<(const default_type_info& first,
                const default_type_info& second) {
   return std::strcmp(first.type.raw_name(), second.type.raw_name()) < 0;
 }
 
-bool operator==(const default_type_info& first,
+inline bool operator==(const default_type_info& first,
                const default_type_info& second) {
   return std::strcmp(first.type.raw_name(), second.type.raw_name()) == 0;
 }
 
-bool operator>(const default_type_info& first,
+inline bool operator>(const default_type_info& first,
                const default_type_info& second) {
   return std::strcmp(first.type.raw_name(), second.type.raw_name()) > 0;
 }
@@ -80,17 +80,17 @@
 #else // OTHER OS
 #include <string>
 namespace boost { namespace extensions {
-bool operator<(const default_type_info& first,
+inline bool operator<(const default_type_info& first,
                const default_type_info& second) {
   return std::strcmp(first.type.name(), second.type.name()) < 0;
 }
 
-bool operator==(const default_type_info& first,
+inline bool operator==(const default_type_info& first,
                const default_type_info& second) {
   return std::strcmp(first.type.name(), second.type.name()) == 0;
 }
 
-bool operator>(const default_type_info& first,
+inline bool operator>(const default_type_info& first,
                const default_type_info& second) {
   return std::strcmp(first.type.name(), second.type.name()) > 0;
 }

Modified: sandbox/boost/extension/shared_library.hpp
==============================================================================
--- sandbox/boost/extension/shared_library.hpp (original)
+++ sandbox/boost/extension/shared_library.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -22,15 +22,15 @@
 class shared_library
 {
 public:
- bool is_open(){return handle_ != 0;}
+ bool is_open() { return handle_ != 0; }
   bool open() {
- return (handle_ = load_shared_library(location_.c_str())) != 0;
+ return (handle_ = impl::load_shared_library(location_.c_str())) != 0;
   }
   bool close() {
- return close_shared_library(handle_);
- }
+ return impl::close_shared_library(handle_);
+ }
   shared_library(const std::string& location, bool auto_close = false)
- :location_(location), handle_(0), auto_close_(auto_close) {
+ : location_(location), handle_(0), auto_close_(auto_close) {
   }
 #define BOOST_PP_ITERATION_LIMITS (0, \
     BOOST_PP_INC(BOOST_EXTENSION_MAX_FUNCTOR_PARAMS) - 1)
@@ -38,12 +38,8 @@
 #include BOOST_PP_ITERATE()
 protected:
   std::string location_;
- library_handle handle_;
+ impl::library_handle handle_;
   bool auto_close_;
 };
 }}
 #endif // BOOST_EXTENSION_SHARED_LIBRARY_HPP
-
-
-
-

Added: sandbox/boost/reflection/adapter.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/reflection/adapter.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -0,0 +1,63 @@
+/*
+ * Boost.Reflection / adapter (call functions using a parameter map)
+ *
+ * (C) Copyright Mariano G. Consoni 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
+ */
+
+
+#ifndef BOOST_REFLECTION_PARAMETER_MAP_HPP
+#define BOOST_REFLECTION_PARAMETER_MAP_HPP
+#include <boost/extension/impl/typeinfo.hpp>
+#include <boost/reflection/parameter.hpp>
+#include <exception>
+#include <map>
+#include <string>
+#include <vector>
+
+namespace boost { namespace reflections {
+class parameter_unavailable_exception : public std::exception {
+public:
+ virtual const char * what() {
+ return "Type not found in parameter_map";
+ }
+};
+
+template <class Info = std::string,
+ class TypeInfo = extensions::default_type_info>
+class basic_parameter_map
+ : public std::multimap<Info, generic_parameter<TypeInfo>*> {
+public:
+ ~basic_parameter_map() {
+ for (typename map_type::iterator it = begin(); it != end(); ++it) {
+ delete it->second;
+ }
+ }
+ typedef std::multimap<Info, generic_parameter<TypeInfo>*> map_type;
+ using map_type::equal_range;
+ using map_type::begin;
+ using map_type::end;
+ using map_type::insert;
+ template <class D>
+ std::vector<generic_parameter<TypeInfo>*> get(Info info) {
+ std::vector<generic_parameter<TypeInfo>*> parameters;
+ std::pair<typename map_type::iterator, typename map_type::iterator> its
+ = equal_range(info);
+ for (typename map_type::iterator current = its->first;
+ current != its->second; ++current) {
+ generic_parameter<TypeInfo>& p = *current->second;
+ if (p.template can_cast<D>()) {
+ parameters.push_back(current->second);
+ }
+ }
+ return parameters;
+ }
+};
+typedef basic_parameter_map<> parameter_map;
+}}
+
+#endif // BOOST_REFLECTION_PARAMETER_MAP_HPP

Modified: sandbox/boost/reflection/common.hpp
==============================================================================
--- sandbox/boost/reflection/common.hpp (original)
+++ sandbox/boost/reflection/common.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -19,7 +19,7 @@
 #include <boost/preprocessor/repetition.hpp>
 
 #ifndef BOOST_REFLECTION_MAX_FUNCTOR_PARAMS
-#define BOOST_REFLECTION_MAX_FUNCTOR_PARAMS 6
-#endif // BOOST_REFLECTION_MAX_FUNCTOR_PARAMS
+#define BOOST_REFLECTION_MAX_FUNCTOR_PARAMS 10
+#endif // BOOST_REFLECTION_MAX_FUNCTOR_PARAMS
 
-#endif // BOOST_REFLECTION_COMMON_HPP
+#endif // BOOST_REFLECTION_COMMON_HPP

Modified: sandbox/boost/reflection/constructor.hpp
==============================================================================
--- sandbox/boost/reflection/constructor.hpp (original)
+++ sandbox/boost/reflection/constructor.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -10,30 +10,17 @@
 #ifndef BOOST_REFLECTION_CONSTRUCTOR_HPP
 #define BOOST_REFLECTION_CONSTRUCTOR_HPP
 #include <boost/reflection/instance.hpp>
-namespace boost {namespace reflections {
+namespace boost {
+namespace reflections {
 template <BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PP_INC(\
           BOOST_REFLECTION_MAX_FUNCTOR_PARAMS), class Param, void)>
 class instance_constructor;
 
-#define BOOST_REFLECTION_INSTANCE_CONSTRUCTOR_CLASS(Z, N, _) \
-template <BOOST_PP_ENUM_PARAMS(N, class Param)> \
-class instance_constructor<BOOST_PP_ENUM_PARAMS(N, Param)> { \
-public: \
- instance_constructor(instance (*func)(BOOST_PP_ENUM_PARAMS(N, Param)) = 0) \
- : func_(func) { \
- } \
- instance call(BOOST_PP_ENUM_BINARY_PARAMS(N, Param, p)) { \
- return (*func_)(BOOST_PP_ENUM_PARAMS(N, p)); \
- } \
- instance operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, Param, p)) { \
- return (*func_)(BOOST_PP_ENUM_PARAMS(N, p)); \
- } \
- bool valid() {return func_ != 0;} \
- private: \
- instance (*func_)(BOOST_PP_ENUM_PARAMS(N, Param)); \
-};
+#define BOOST_PP_ITERATION_LIMITS (0, \
+ BOOST_PP_INC(BOOST_REFLECTION_MAX_FUNCTOR_PARAMS) - 1)
+#define BOOST_PP_FILENAME_1 <boost/reflection/impl/constructor.hpp>
+#include BOOST_PP_ITERATE()
 
-BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_REFLECTION_MAX_FUNCTOR_PARAMS), \
- BOOST_REFLECTION_INSTANCE_CONSTRUCTOR_CLASS, _)
-}}
+} // namespace reflections
+} // namespace boost
 #endif

Modified: sandbox/boost/reflection/constructor_info.hpp
==============================================================================
--- sandbox/boost/reflection/constructor_info.hpp (original)
+++ sandbox/boost/reflection/constructor_info.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -1,5 +1,5 @@
 /*
- * Boost.Reflection / main header
+ * Boost.Reflection / constructor information header
  *
  * (C) Copyright Mariano G. Consoni and Jeremy Pack 2007
  * Distributed under the Boost Software License, Version 1.0. (See
@@ -9,8 +9,8 @@
  * See http://www.boost.org/ for latest version.
  */
 
-#ifndef BOOST_REFLECTION_REFLECTION_HPP
-#define BOOST_REFLECTION_REFLECTION_HPP
+#ifndef BOOST_REFLECTION_CONSTRUCTOR_INFO_HPP
+#define BOOST_REFLECTION_CONSTRUCTOR_INFO_HPP
 
 #include <vector>
 
@@ -32,10 +32,10 @@
   std::vector<ParameterInfo> parameter_info_;
 
   // Constructors.
- basic_constructor_info(TypeInfo t) : type_info_(t) {
+ explicit basic_constructor_info(TypeInfo t) : type_info_(t) {
   }
 
- basic_constructor_info(const basic_constructor_info & s)
+ basic_constructor_info(const basic_constructor_info & s)
     : type_info_(s.type_info_) {
   }
 
@@ -57,10 +57,10 @@
   TypeInfo type_info_;
 
   // Constructors
- basic_constructor_info(TypeInfo t) : type_info_(t) {
+ explicit basic_constructor_info(TypeInfo t) : type_info_(t) {
   }
 
- basic_constructor_info(const basic_constructor_info & s)
+ basic_constructor_info(const basic_constructor_info & s)
     : type_info_(s.type_info_) {
   }
 
@@ -76,4 +76,4 @@
 };
 } // namespace reflections
 } // namespace boost
-#endif // BOOST_REFLECTION_REFLECTION_HPP
+#endif // BOOST_REFLECTION_CONSTRUCTOR_INFO_HPP

Added: sandbox/boost/reflection/data.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/reflection/data.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -0,0 +1,52 @@
+/*
+ * Copyright Jeremy Pack 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
+ */
+
+#ifndef BOOST_REFLECTION_DATA_HPP
+#define BOOST_REFLECTION_DATA_HPP
+
+#include <boost/reflection/instance.hpp>
+
+namespace boost {
+namespace reflections {
+namespace impl {
+// This is used to store, indexed by type information,
+// any member data pointers.
+typedef void* instance::*MemberPtr;
+
+template <class Object, class Data>
+Data& get_data_from_ptr(void* inst, MemberPtr ptr) {
+ Data Object::*data = reinterpret_cast<Data Object::*>(ptr);
+ Object* obj = reinterpret_cast<Object*>(inst);
+ return (obj->*data);
+}
+} // namespace impl
+
+template <class T>
+class data {
+public:
+ data(impl::MemberPtr data_ptr = 0,
+ T& (*conversion_function)(void*, impl::MemberPtr) = 0)
+ : data_ptr_(data_ptr),
+ conversion_function_(conversion_function) {
+ }
+ T& operator()(instance & inst) {
+ return (*conversion_function_)(inst.val_, data_ptr_);
+ }
+ bool valid() {
+ return conversion_function_ != 0 && data_ptr_ != 0;
+ }
+private:
+ impl::MemberPtr data_ptr_;
+ T& (*conversion_function_)(void*, impl::MemberPtr);
+};
+
+
+} // namespace reflections
+} // namespace boost
+#endif // BOOST_REFLECTION_DATA_HPP

Added: sandbox/boost/reflection/data_info.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/reflection/data_info.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -0,0 +1,54 @@
+/*
+ * Boost.Reflection / data info
+ *
+ * (C) Copyright Jeremy Pack 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
+ */
+
+#ifndef BOOST_REFLECTION_DATA_INFO_HPP
+#define BOOST_REFLECTION_DATA_INFO_HPP
+
+#include <vector>
+
+namespace boost {
+namespace reflections {
+
+// The basic_data_info class is used as a key in the map
+// of data available for the current reflection.
+template<class Info, class TypeInfo>
+struct basic_data_info {
+ // The type of the function pointer in the map.
+ TypeInfo type_info_;
+ // A description of the function pointer.
+ Info info_;
+
+ // Constructors.
+ basic_data_info(TypeInfo t, Info i)
+ : type_info_(t), info_(i) {
+ }
+
+ basic_data_info(const basic_data_info & s)
+ : type_info_(s.type_info_), info_(s.info_) {
+ }
+
+ basic_data_info & operator=(basic_data_info & s) {
+ type_info_ = s.type_info_;
+ info_ = s.info_;
+ }
+
+ // Less-than operator - for maps.
+ friend inline bool operator<(const basic_data_info & t,
+ const basic_data_info & s) {
+ return t.type_info_ < s.type_info_ ||
+ (t.type_info_ == s.type_info_ &&
+ t.info_ < s.info_);
+ }
+};
+
+} // namespace reflections
+} // namespace boost
+#endif // BOOST_REFLECTION_DATA_INFO_HPP

Modified: sandbox/boost/reflection/factory.hpp
==============================================================================
--- sandbox/boost/reflection/factory.hpp (original)
+++ sandbox/boost/reflection/factory.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -10,18 +10,7 @@
 #ifndef BOOST_REFLECTION_FACTORY_HPP
 #define BOOST_REFLECTION_FACTORY_HPP
 #include <boost/reflection/common.hpp>
-// #include <boost/reflection/generic_constructor.hpp>
 namespace boost {namespace reflections {
- /*
-template <class T>
-class factory : public generic_constructor<T> {
-public:
- factory(T(*factory_func)())
- : factory_func_(factory_func) {}
- virtual T * create(void ** params) {return (*factory_func_)();}
-private:
- T (*factory_func_)();
-};*/
 #define BOOST_REFLECTION_CONSTRUCT_FUNCTION(Z, N, _) \
 template <class Actual \
 BOOST_PP_COMMA_IF(N) \

Modified: sandbox/boost/reflection/function.hpp
==============================================================================
--- sandbox/boost/reflection/function.hpp (original)
+++ sandbox/boost/reflection/function.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -12,50 +12,21 @@
 
 #include <boost/reflection/instance.hpp>
 
-namespace boost {namespace reflections {
-
+namespace boost {
+namespace reflections {
+namespace impl {
 typedef void (instance::*MemberFunctionPtr)();
-template <class ReturnValue = void
+} // namespace impl
+template <class ReturnValue = void
           BOOST_PP_COMMA_IF(BOOST_REFLECTION_MAX_FUNCTOR_PARAMS)
           BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PP_INC
           (BOOST_REFLECTION_MAX_FUNCTOR_PARAMS), class Param, void)>
 class function;
-
-#define BOOST_REFLECTION_FUNCTION_CLASS(Z, N, _) \
-template <class ReturnValue BOOST_PP_COMMA_IF(N) \
- BOOST_PP_ENUM_PARAMS(N, class Param)> \
-class function<ReturnValue BOOST_PP_COMMA_IF(N) \
- BOOST_PP_ENUM_PARAMS(N, Param)> { \
-public: \
- function(ReturnValue (*func)(void *, MemberFunctionPtr \
- BOOST_PP_COMMA_IF(N) \
- BOOST_PP_ENUM_PARAMS(N, Param)) = 0, \
- MemberFunctionPtr member_function = 0) \
- : func_(func), \
- member_function_(member_function) { \
- } \
- ReturnValue call(instance & inst BOOST_PP_COMMA_IF(N) \
- BOOST_PP_ENUM_BINARY_PARAMS(N, Param, p)) { \
- return (*func_)(inst.val_, member_function_ BOOST_PP_COMMA_IF(N) \
- BOOST_PP_ENUM_PARAMS(N, p)); \
- } \
- ReturnValue operator()(instance & inst BOOST_PP_COMMA_IF(N) \
- BOOST_PP_ENUM_BINARY_PARAMS(N, Param, p)) { \
- return (*func_)(inst.val_, member_function_ BOOST_PP_COMMA_IF(N) \
- BOOST_PP_ENUM_PARAMS(N, p)); \
- } \
- bool valid() { \
- return member_function_ != 0 && func_ != 0; \
- } \
-private: \
- ReturnValue (*func_)(void *, MemberFunctionPtr \
- BOOST_PP_COMMA_IF(N) \
- BOOST_PP_ENUM_PARAMS(N, Param)); \
- MemberFunctionPtr member_function_; \
-};
-
 
-BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_REFLECTION_MAX_FUNCTOR_PARAMS), \
- BOOST_REFLECTION_FUNCTION_CLASS, _)
-}}
+#define BOOST_PP_ITERATION_LIMITS (0, \
+ BOOST_PP_INC(BOOST_REFLECTION_MAX_FUNCTOR_PARAMS) - 1)
+#define BOOST_PP_FILENAME_1 <boost/reflection/impl/function.hpp>
+#include BOOST_PP_ITERATE()
+} // namespace reflections
+} // namespace boost
 #endif

Modified: sandbox/boost/reflection/function_info.hpp
==============================================================================
--- sandbox/boost/reflection/function_info.hpp (original)
+++ sandbox/boost/reflection/function_info.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -9,8 +9,8 @@
  * See http://www.boost.org/ for latest version.
  */
 
-#ifndef BOOST_REFLECTION_REFLECTION_HPP
-#define BOOST_REFLECTION_REFLECTION_HPP
+#ifndef BOOST_REFLECTION_FUNCTION_INFO_HPP
+#define BOOST_REFLECTION_FUNCTION_INFO_HPP
 
 #include <vector>
 
@@ -28,15 +28,18 @@
   // A description of the function pointer.
   Info info_;
 
+ bool has_return_;
+
   // A description for each parameter of the function.
   // If ParameterInfo=void, this does not appear.
   std::vector<ParameterInfo> parameter_info_;
 
   // Constructors
- basic_function_info(TypeInfo t, Info i) : type_info_(t), info_(i) {
+ basic_function_info(TypeInfo t, Info i, bool has_return = true)
+ : type_info_(t), info_(i), has_return_(has_return) {
   }
 
- basic_function_info(const basic_function_info & s)
+ basic_function_info(const basic_function_info & s)
     : type_info_(s.type_info_), info_(s.info_) {
   }
 
@@ -62,11 +65,13 @@
   // A description of the function pointer.
   Info info_;
 
+
   // Constructors.
- basic_function_info(TypeInfo t, Info i) : type_info_(t), info_(i) {
+ basic_function_info(TypeInfo t, Info i)
+ : type_info_(t), info_(i) {
   }
 
- basic_function_info(const basic_function_info & s)
+ basic_function_info(const basic_function_info & s)
     : type_info_(s.type_info_), info_(s.info_) {
   }
 
@@ -86,4 +91,4 @@
 
 } // namespace reflections
 } // namespace boost
-#endif // BOOST_REFLECTION_REFLECTION_HPP
+#endif // BOOST_REFLECTION_FUNCTION_INFO_HPP

Modified: sandbox/boost/reflection/generic_constructor.hpp
==============================================================================
--- sandbox/boost/reflection/generic_constructor.hpp (original)
+++ sandbox/boost/reflection/generic_constructor.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -9,12 +9,15 @@
 
 #ifndef BOOST_EXTENSION_GENERIC_CONSTRUCTOR_HPP
 #define BOOST_EXTENSION_GENERIC_CONSTRUCTOR_HPP
-namespace boost {namespace reflections {
+
+namespace boost {
+namespace reflections {
 template <class T>
 class generic_constructor {
 public:
   virtual ~generic_constructor() {}
   virtual T * create(void ** params) = 0;
-};
-}}
+};
+} // namespace reflections
+} // namespace boost
 #endif

Added: sandbox/boost/reflection/impl/constructor.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/reflection/impl/constructor.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -0,0 +1,32 @@
+/*
+ * Copyright Jeremy Pack 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
+ */
+
+
+// No header guard - this file is intended to be included multiple times.
+
+# define N BOOST_PP_ITERATION()
+
+template <BOOST_PP_ENUM_PARAMS(N, class Param)>
+class instance_constructor<BOOST_PP_ENUM_PARAMS(N, Param)> {
+public:
+ instance_constructor(instance (*func)(BOOST_PP_ENUM_PARAMS(N, Param)) = 0)
+ : func_(func) {
+ }
+ instance call(BOOST_PP_ENUM_BINARY_PARAMS(N, Param, p)) {
+ return (*func_)(BOOST_PP_ENUM_PARAMS(N, p));
+ }
+ instance operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, Param, p)) {
+ return (*func_)(BOOST_PP_ENUM_PARAMS(N, p));
+ }
+ bool valid() {return func_ != 0;}
+private:
+ instance (*func_)(BOOST_PP_ENUM_PARAMS(N, Param));
+};
+
+#undef N
\ No newline at end of file

Added: sandbox/boost/reflection/impl/function.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/reflection/impl/function.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -0,0 +1,47 @@
+/*
+ * Copyright Jeremy Pack 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
+ */
+
+
+// No header guard - this file is intended to be included multiple times.
+
+# define N BOOST_PP_ITERATION()
+
+template <class ReturnValue BOOST_PP_COMMA_IF(N)
+ BOOST_PP_ENUM_PARAMS(N, class Param)>
+class function<ReturnValue BOOST_PP_COMMA_IF(N)
+ BOOST_PP_ENUM_PARAMS(N, Param)> {
+public:
+ function(ReturnValue (*func)(void *, impl::MemberFunctionPtr
+ BOOST_PP_COMMA_IF(N)
+ BOOST_PP_ENUM_PARAMS(N, Param)) = 0,
+ impl::MemberFunctionPtr member_function = 0)
+ : func_(func),
+ member_function_(member_function) {
+ }
+ ReturnValue call(instance & inst BOOST_PP_COMMA_IF(N)
+ BOOST_PP_ENUM_BINARY_PARAMS(N, Param, p)) {
+ return (*func_)(inst.val_, member_function_ BOOST_PP_COMMA_IF(N)
+ BOOST_PP_ENUM_PARAMS(N, p));
+ }
+ ReturnValue operator()(instance & inst BOOST_PP_COMMA_IF(N)
+ BOOST_PP_ENUM_BINARY_PARAMS(N, Param, p)) {
+ return (*func_)(inst.val_, member_function_ BOOST_PP_COMMA_IF(N)
+ BOOST_PP_ENUM_PARAMS(N, p));
+ }
+ bool valid() {
+ return member_function_ != 0 && func_ != 0;
+ }
+private:
+ ReturnValue (*func_)(void *, impl::MemberFunctionPtr
+ BOOST_PP_COMMA_IF(N)
+ BOOST_PP_ENUM_PARAMS(N, Param));
+ impl::MemberFunctionPtr member_function_;
+};
+
+#undef N
\ No newline at end of file

Modified: sandbox/boost/reflection/impl/reflection.hpp
==============================================================================
--- sandbox/boost/reflection/impl/reflection.hpp (original)
+++ sandbox/boost/reflection/impl/reflection.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -26,7 +26,7 @@
                             ::get_class_type());
 
   // Determine whether or not such a constructor exists.
- typename std::map<constructor_info, FunctionPtr>::iterator it =
+ typename std::map<constructor_info, impl::FunctionPtr>::iterator it =
     constructors_.find(ctr_info);
 
   if (it == constructors_.end()) {
@@ -47,13 +47,15 @@
 function<ReturnValue BOOST_PP_COMMA_IF(N)
          BOOST_PP_ENUM_PARAMS(N, Param)> get_function(Info info) {
   // Construct a function_info structure to look up the function in the map.
+ // has_return is set to true here because it makes no difference when doing
+ // a lookup in the map.
   function_info func_info(reflections::type_info_handler<TypeInfo,
                           ReturnValue (*)(BOOST_PP_ENUM_PARAMS(N, Param))>
                           ::get_class_type(), info);
 
   // Look up the function.
   typename std::map<function_info,
- std::pair<MemberFunctionPtr, FunctionPtr> >::iterator it =
+ std::pair<impl::MemberFunctionPtr, impl::FunctionPtr> >::iterator it =
     functions_.find(func_info);
 
   if (it == functions_.end()) {
@@ -64,7 +66,7 @@
     return function<ReturnValue BOOST_PP_COMMA_IF(N)
                     BOOST_PP_ENUM_PARAMS(N, Param)>
       // reinterpret_cast is safe, because we looked it up by its type.
- (reinterpret_cast<ReturnValue (*)(void *, MemberFunctionPtr
+ (reinterpret_cast<ReturnValue (*)(void *, impl::MemberFunctionPtr
                                         BOOST_PP_COMMA_IF(N)
                                         BOOST_PP_ENUM_PARAMS(N, Param))>
         (it->second.second), it->second.first);

Modified: sandbox/boost/reflection/impl/reflector_free_functions.hpp
==============================================================================
--- sandbox/boost/reflection/impl/reflector_free_functions.hpp (original)
+++ sandbox/boost/reflection/impl/reflector_free_functions.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -31,14 +31,14 @@
 template <class T, class ReturnValue BOOST_PP_COMMA_IF(N)
           BOOST_PP_ENUM_PARAMS(N, class Param)>
 static ReturnValue call_member(void * val,
- MemberFunctionPtr member_function
+ impl::MemberFunctionPtr member_function
                                BOOST_PP_COMMA_IF(N)
                                BOOST_PP_ENUM_BINARY_PARAMS(N, Param, p)) {
   // Convert to a T*.
   T * actual = static_cast<T*>(val);
 
   // Convert the MemberFunctionPtr to the requested type.
- ReturnValue (T::*func)(BOOST_PP_ENUM_PARAMS(N, Param)) =
+ ReturnValue (T::*func)(BOOST_PP_ENUM_PARAMS(N, Param)) =
     reinterpret_cast<ReturnValue (T::*)(BOOST_PP_ENUM_PARAMS(N, Param))>
       (member_function);
 

Modified: sandbox/boost/reflection/impl/reflector_functions.hpp
==============================================================================
--- sandbox/boost/reflection/impl/reflector_functions.hpp (original)
+++ sandbox/boost/reflection/impl/reflector_functions.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -12,44 +12,41 @@
 
 # define N BOOST_PP_ITERATION()
 
-
 template <class ParamFirst BOOST_PP_COMMA_IF(N)
           BOOST_PP_ENUM_PARAMS(N, class Param)>
-void reflect_constructor() {
+reflector& constructor() {
   instance (*ctor_func)(
     ParamFirst BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_PARAMS(N, Param))
       (&impl::construct_instance<T, ParamFirst
                                  BOOST_PP_COMMA_IF(N)
                                  BOOST_PP_ENUM_PARAMS(N, Param)>);
- reflection_->constructors_.insert(std::make_pair<TypeInfo, FunctionPtr>(
+ reflection_->constructors_.insert(std::make_pair<TypeInfo, impl::FunctionPtr>(
       reflections::type_info_handler
       <TypeInfo, instance (*)(ParamFirst BOOST_PP_COMMA_IF(N)
                               BOOST_PP_ENUM_PARAMS(N, Param))>
         ::get_class_type(),
- reinterpret_cast<FunctionPtr>(ctor_func)));
-
- // add_constructor<ParamFirst BOOST_PP_COMMA_IF(N)
- // BOOST_PP_ENUM_PARAMS(N, Param)>(&impl::construct_instance<T, ParamFirst
- // BOOST_PP_COMMA_IF(N)
- // BOOST_PP_ENUM_PARAMS(N, Param)>);
+ reinterpret_cast<impl::FunctionPtr>(ctor_func)));
+ return *this;
 }
+
 template <class ReturnValue BOOST_PP_COMMA_IF(N)
           BOOST_PP_ENUM_PARAMS(N, class Param)>
-void reflect(ReturnValue (T::*func)(BOOST_PP_ENUM_PARAMS(N, Param)),
- Info info) {
+reflector& function(ReturnValue (T::*func)(BOOST_PP_ENUM_PARAMS(N, Param)),
+ Info info) {
   function_info f(reflections::type_info_handler<TypeInfo,
                   ReturnValue (*)(BOOST_PP_ENUM_PARAMS(N, Param))>
                     ::get_class_type(), info);
- ReturnValue (*f2)(void *, MemberFunctionPtr BOOST_PP_COMMA_IF(N)
+ ReturnValue (*f2)(void *, impl::MemberFunctionPtr BOOST_PP_COMMA_IF(N)
       BOOST_PP_ENUM_PARAMS(N, Param)) =
       &impl::call_member<T, ReturnValue BOOST_PP_COMMA_IF(N)
                    BOOST_PP_ENUM_PARAMS(N, Param)>;
- std::pair<MemberFunctionPtr, FunctionPtr>
- p(reinterpret_cast<MemberFunctionPtr>(func),
- reinterpret_cast<FunctionPtr>(f2));
- std::pair<function_info, std::pair<MemberFunctionPtr, FunctionPtr> >
+ std::pair<impl::MemberFunctionPtr, impl::FunctionPtr>
+ p(reinterpret_cast<impl::MemberFunctionPtr>(func),
+ reinterpret_cast<impl::FunctionPtr>(f2));
+ std::pair<function_info, std::pair<impl::MemberFunctionPtr, impl::FunctionPtr> >
     p2(f, p);
   reflection_->functions_.insert(p2);
+ return *this;
 }
 
 

Modified: sandbox/boost/reflection/impl/reflector_parameter_functions.hpp
==============================================================================
--- sandbox/boost/reflection/impl/reflector_parameter_functions.hpp (original)
+++ sandbox/boost/reflection/impl/reflector_parameter_functions.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -1,7 +1,7 @@
 /*
  * Copyright Jeremy Pack 2007
  * Distributed under the Boost Software License, Version 1.0. (See
- * accompanying file LICENSE_1_0.txt or copy at
+ * accompanying file LICENSE_1_0.txt or copy atÄ
  * http://www.boost.org/LICENSE_1_0.txt)
  *
  * See http://www.boost.org/ for latest version.
@@ -28,65 +28,83 @@
 public:
 template <class ParamFirst BOOST_PP_COMMA_IF(N)
   BOOST_PP_ENUM_PARAMS(N, class Param)>
-void reflect_constructor(BOOST_PP_ENUM_PARAMS(N, ParameterInfo i)) {
+reflector& reflect_constructor(BOOST_PP_ENUM_PARAMS(N, ParameterInfo i)) {
   instance (*ctor_func)(
     ParamFirst BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_PARAMS(N, Param))
       (&impl::construct_instance<T, ParamFirst
                                  BOOST_PP_COMMA_IF(N)
                                  BOOST_PP_ENUM_PARAMS(N, Param)>);
-
   constructor_info f(reflections::type_info_handler
       <TypeInfo, instance (*)(ParamFirst BOOST_PP_COMMA_IF(N)
                               BOOST_PP_ENUM_PARAMS(N, Param))>
         ::get_class_type());
- BOOST_REFLECTION_PUSH_PARAMETER_INFO(f, N);
- reflection_->constructors_.insert(std::make_pair<TypeInfo, FunctionPtr>(
- f, reinterpret_cast<FunctionPtr>(ctor_func)));
+ BOOST_REFLECTION_PUSH_PARAMETER_INFO(f, N);
+ reflection_->constructors_.insert(std::make_pair<TypeInfo, impl::FunctionPtr>(
+ f, reinterpret_cast<impl::FunctionPtr>(ctor_func)));
+ return *this;
 }
 
+// This version of the function is for reflecting functions that have
+// return values - so that the name of the return value can be set.
 template <class ReturnValue BOOST_PP_COMMA_IF(N)
           BOOST_PP_ENUM_PARAMS(N, class Param)>
-void reflect(ReturnValue (T::*func)(BOOST_PP_ENUM_PARAMS(N, Param)),
+reflector& function(ReturnValue (T::*func)(BOOST_PP_ENUM_PARAMS(N, Param)),
              Info info, ParameterInfo i_return BOOST_PP_COMMA_IF(N)
              BOOST_PP_ENUM_PARAMS(N, ParameterInfo i)) {
+ // Create the function_info for this function.
   function_info f(reflections::type_info_handler<TypeInfo,
                   ReturnValue (*)(BOOST_PP_ENUM_PARAMS(N, Param))>
- ::get_class_type(), info);
- BOOST_REFLECTION_PUSH_PARAMETER_INFO(f, N);
+ ::get_class_type(), info, true);
+
+ // Add the ParameterInfo for each parameter to the function_info.
+ BOOST_REFLECTION_PUSH_PARAMETER_INFO(f, N);
+ // Add the ParameterInfo for the return type.
   f.parameter_info_.push_back(i_return);
- ReturnValue (*f2)(void *, MemberFunctionPtr BOOST_PP_COMMA_IF(N)
+
+ // Get a function pointer to a function that calls this member
+ // function when given a void* that actually points to an instance
+ // of this class.
+ ReturnValue (*f2)(void *, impl::MemberFunctionPtr BOOST_PP_COMMA_IF(N)
       BOOST_PP_ENUM_PARAMS(N, Param)) =
       &impl::call_member<T, ReturnValue BOOST_PP_COMMA_IF(N)
                    BOOST_PP_ENUM_PARAMS(N, Param)>;
- std::pair<MemberFunctionPtr, FunctionPtr>
- in_pair(reinterpret_cast<MemberFunctionPtr>(func),
- reinterpret_cast<FunctionPtr>(f2));
- std::pair<function_info, std::pair<MemberFunctionPtr, FunctionPtr> >
+
+ // Create the pair objects to insert into the map.
+ std::pair<impl::MemberFunctionPtr, impl::FunctionPtr>
+ in_pair(reinterpret_cast<impl::MemberFunctionPtr>(func),
+ reinterpret_cast<impl::FunctionPtr>(f2));
+ std::pair<function_info, std::pair<impl::MemberFunctionPtr, impl::FunctionPtr> >
     out_pair(f, in_pair);
   reflection_->functions_.insert(out_pair);
+ return *this;
 }
 
-template <class ParamFirst BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_PARAMS(N, class Param)>
-void reflect(void (T::*func)(ParamFirst p_first BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_PARAMS(N, Param)),
+// This version of the function is for reflecting functions that have
+// no return value.
+template <class ParamFirst BOOST_PP_COMMA_IF(N)
+ BOOST_PP_ENUM_PARAMS(N, class Param)>
+reflector& function(void (T::*func)(ParamFirst p_first BOOST_PP_COMMA_IF(N)
+ BOOST_PP_ENUM_PARAMS(N, Param)),
              Info info, ParameterInfo i_first BOOST_PP_COMMA_IF(N)
              BOOST_PP_ENUM_PARAMS(N, ParameterInfo i)) {
   function_info f(reflections::type_info_handler<TypeInfo,
                   void (*)(BOOST_PP_ENUM_PARAMS(N, Param))>
- ::get_class_type(), info);
+ ::get_class_type(), info, false);
   f.parameter_info_.push_back(i_first);
- BOOST_REFLECTION_PUSH_PARAMETER_INFO(f, N);
- void (*f2)(void *, MemberFunctionPtr BOOST_PP_COMMA_IF(N)
+ BOOST_REFLECTION_PUSH_PARAMETER_INFO(f, N);
+ void (*f2)(void *, impl::MemberFunctionPtr BOOST_PP_COMMA_IF(N)
       BOOST_PP_ENUM_PARAMS(N, Param)) =
       &impl::call_member<T, void BOOST_PP_COMMA_IF(N)
                    BOOST_PP_ENUM_PARAMS(N, Param)>;
- std::pair<MemberFunctionPtr, FunctionPtr>
- in_pair(reinterpret_cast<MemberFunctionPtr>(func),
- reinterpret_cast<FunctionPtr>(f2));
- std::pair<function_info, std::pair<MemberFunctionPtr, FunctionPtr> >
+ std::pair<impl::MemberFunctionPtr, impl::FunctionPtr>
+ in_pair(reinterpret_cast<impl::MemberFunctionPtr>(func),
+ reinterpret_cast<impl::FunctionPtr>(f2));
+ std::pair<function_info, std::pair<impl::MemberFunctionPtr, impl::FunctionPtr> >
     out_pair(f, in_pair);
   reflection_->functions_.insert(out_pair);
+ return *this;
 }
-
+/*
 template <class ParamFirst BOOST_PP_COMMA_IF(N)
 BOOST_PP_ENUM_PARAMS(N, class Param)>
 void add_constructor(instance (*func)(ParamFirst BOOST_PP_COMMA_IF(N)
@@ -97,9 +115,9 @@
       <TypeInfo, instance (*)(ParamFirst BOOST_PP_COMMA_IF(N)
                               BOOST_PP_ENUM_PARAMS(N, Param))>
         ::get_class_type());
- BOOST_REFLECTION_PUSH_PARAMETER_INFO(f, N);
- reflection_->constructors_.insert(std::make_pair<TypeInfo, FunctionPtr>(
- f, reinterpret_cast<FunctionPtr>(func)));
-}
+ BOOST_REFLECTION_PUSH_PARAMETER_INFO(f, N);
+ reflection_->constructors_.insert(std::make_pair<TypeInfo, impl::FunctionPtr>(
+ f, reinterpret_cast<impl::FunctionPtr>(func)));
+}*/
 
 #undef N
\ No newline at end of file

Modified: sandbox/boost/reflection/instance.hpp
==============================================================================
--- sandbox/boost/reflection/instance.hpp (original)
+++ sandbox/boost/reflection/instance.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -14,7 +14,7 @@
 namespace boost {namespace reflections {
 class instance {
 public:
- instance(void * val = 0, void (*destructor)(void * val) = 0)
+ instance(void* val = 0, void (*destructor)(void* val) = 0)
   : val_(val),
     destructor_(destructor) {}
   ~instance() {
@@ -23,8 +23,7 @@
   }
   instance(const instance & first)
   : val_(first.val_),
- destructor_(first.destructor_)
- {
+ destructor_(first.destructor_) {
     if (this != &first) {
       // Check for self assignment
       first.val_ = 0;
@@ -39,14 +38,17 @@
     }
     return *this;
   }
+
 private:
   template <class ReturnValue
   BOOST_PP_COMMA_IF(BOOST_REFLECTION_MAX_FUNCTOR_PARAMS)
   BOOST_PP_ENUM_PARAMS(BOOST_PP_INC
   (BOOST_REFLECTION_MAX_FUNCTOR_PARAMS), class Param)>
   friend class function;
- mutable void * val_;
- void (*destructor_)(void *);
+ template <class DataType>
+ friend class data;
+ mutable void* val_;
+ void (*destructor_)(void* object);
 };
 }}
 #endif

Deleted: sandbox/boost/reflection/method_info.hpp
==============================================================================
--- sandbox/boost/reflection/method_info.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
+++ (empty file)
@@ -1,176 +0,0 @@
-/*
- * Boost.Reflection / method information storage
- *
- * (C) Copyright Mariano G. Consoni 2007
- * Distributed under the Boost Software License, Version 1.0. (See
- * accompanying file LICENSE_1_0.txt or copy at
- * http://www.boost.org/LICENSE_1_0.txt)
- *
- * See http://www.boost.org/ for latest version.
- */
-
-#ifndef BOOST_REFLECTION_METHOD_INFO_HPP
-#define BOOST_REFLECTION_METHOD_INFO_HPP
-
-#include <boost/function.hpp>
-
-#include "parameter_map.hpp"
-
-
-
-namespace boost {
- namespace reflection {
-
-#ifdef BOOST_REFLECTION_USE_PP
-
-#ifndef BOOST_REFLECTION_REFLECTION_PARAMS
-#define BOOST_REFLECTION_REFLECTION_PARAMS(z, n, dummy) \
- BOOST_PP_CAT(MethodParam,n),BOOST_PP_CAT(MethodParamID,n)
-#endif
-
-#ifndef BOOST_REFLECTION_REFLECTION_CLASS_PARAMS
-#define BOOST_REFLECTION_REFLECTION_CLASS_PARAMS(z, n, dummy) \
- BOOST_PP_CAT(class MethodParam,n),BOOST_PP_CAT(class MethodParamID,n)
-#endif
-
- template<class Implementation, class MethodID, \
- class MethodReturnValue, \
- BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( \
- BOOST_PP_ADD(BOOST_PP_INC(BOOST_REFLECTION_MAX_FUNCTOR_PARAMS) \
- ,BOOST_PP_INC(BOOST_REFLECTION_MAX_FUNCTOR_PARAMS)), \
- class P, void) \
- > class method_info;
-
-#define BOOST_REFLECTION_METHOD_INFO(Z, N, _) \
-template<class Implementation, class MethodID, class MethodReturnValue \
- BOOST_PP_COMMA_IF(N) \
- BOOST_PP_ENUM(N, BOOST_REFLECTION_REFLECTION_CLASS_PARAMS, dummy) > \
-class method_info<Implementation, MethodID, MethodReturnValue \
- BOOST_PP_COMMA_IF(N) \
- BOOST_PP_ENUM(N, BOOST_REFLECTION_REFLECTION_PARAMS, dummy) > \
- { \
- public: \
- typedef BOOST_PP_CAT(boost::function,BOOST_PP_INC(N)) \
- <MethodReturnValue, \
- Implementation * \
- BOOST_PP_COMMA_IF(N) \
- BOOST_PP_ENUM_PARAMS(N, MethodParam) > \
- method_type; \
-\
- method_info(MethodID id, method_type f) : id_(id), f_(f) {} \
-\
- MethodReturnValue call(Implementation *imp_ptr \
- BOOST_PP_COMMA_IF(N) \
- BOOST_PP_ENUM_BINARY_PARAMS(N, MethodParam, p)) \
- { \
- return f_(imp_ptr BOOST_PP_COMMA_IF(N) \
- BOOST_PP_ENUM_PARAMS(N, p)); \
- } \
-\
- MethodID get_id(void) const { return id_; } \
-\
- private: \
- MethodID id_; \
- method_type f_; \
- }; \
-/**/
-
-
-BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_REFLECTION_MAX_FUNCTOR_PARAMS), \
- BOOST_REFLECTION_METHOD_INFO, _)
-
-
-#undef BOOST_REFLECTION_METHOD_INFO
-
-#else
-
- template<class Implementation, class MethodID,
- class MethodReturnValue,
- class MethodParam0 = void, class MethodParamID0 = void,
- class MethodParam1 = void, class MethodParamID1 = void,
- class MethodParam2 = void, class MethodParamID2 = void>
- class method_info;
-
-
- template<class Implementation, class MethodID,
- class MethodReturnValue,
- class MethodParam0, class MethodParamID0,
- class MethodParam1, class MethodParamID1>
- class method_info<Implementation, MethodID,
- MethodReturnValue,
- MethodParam0, MethodParamID0,
- MethodParam1, MethodParamID1>
- {
- public:
- typedef boost::function3<MethodReturnValue, Implementation *,
- MethodParam0, MethodParam1> method_type;
-
- method_info(MethodID id, method_type f) : id_(id), f_(f) {}
-
- MethodReturnValue call(Implementation *imp_ptr, MethodParam0 p0,
- MethodParam1 p1)
- {
- return f_(imp_ptr, p0, p1);
- }
-
- MethodID get_id(void) const { return id_; }
-
- private:
- MethodID id_;
- method_type f_;
- };
-
-
- template<class Implementation, class MethodID,
- class MethodReturnValue,
- class MethodParam0, class MethodParamID0>
- class method_info<Implementation, MethodID, MethodReturnValue,
- MethodParam0, MethodParamID0>
- {
- public:
- typedef boost::function2<MethodReturnValue, Implementation *,
- MethodParam0> method_type;
-
- method_info(MethodID id, method_type f) : id_(id), f_(f) {}
-
- MethodReturnValue call(Implementation *imp_ptr, MethodParam0 p0)
- {
- return f_(imp_ptr, p0);
- }
-
- MethodID get_id(void) const { return id_; }
-
- private:
- MethodID id_;
- method_type f_;
- };
-
-
-
- template<class Implementation, class MethodID, class MethodReturnValue>
- class method_info<Implementation, MethodID, MethodReturnValue>
- {
- public:
- typedef boost::function1<MethodReturnValue, Implementation *>
- method_type;
-
- method_info(MethodID id, method_type f) : id_(id), f_(f) {}
-
- MethodReturnValue call(Implementation *imp_ptr)
- {
- return f_(imp_ptr);
- }
-
- MethodID get_id(void) const { return id_; }
-
- private:
- MethodID id_;
- method_type f_;
- };
-
-#endif // BOOST_REFLECTION_USE_PP
-
- } // reflection
-} // boost
-
-#endif // BOOST_REFLECTION_METHOD_INFO_HPP

Added: sandbox/boost/reflection/parameter.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/reflection/parameter.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -0,0 +1,136 @@
+/*
+ * Boost.Reflection / paramater map (store parameter information for calls)
+ *
+ * (C) Copyright Mariano G. Consoni 2007
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org/ for latest version.
+ */
+
+
+#ifndef BOOST_REFLECTION_PARAMETER_HPP
+#define BOOST_REFLECTION_PARAMETER_HPP
+#include <boost/extension/impl/typeinfo.hpp>
+#include <exception>
+#include <map>
+#include <vector>
+namespace boost { namespace reflections {
+using extensions::type_info_handler;
+
+class conversion_not_found_exception : public std::exception {
+public:
+ virtual const char* what() {
+ return "Cannot convert types";
+ }
+};
+template <class TypeInfo = extensions::default_type_info>
+class generic_parameter {
+public:
+ typedef void (*FunctionPtr)();
+ virtual ~generic_parameter() {
+ for (typename std::map<TypeInfo, basic_converter*>::iterator
+ it = converters_.begin();
+ it != converters_.end(); ++it) {
+ delete it->second;
+ }
+ }
+ virtual TypeInfo type() = 0;
+ template <class T>
+ bool can_cast() {
+ TypeInfo i = type_info_handler<TypeInfo, T>::get_class_type();
+ return (converters_.find(i) != converters_.end());
+ }
+ template <class S>
+ S cast() {
+ S dest;
+ TypeInfo i = type_info_handler<TypeInfo, S>::get_class_type();
+ typename std::map<TypeInfo, basic_converter*>::iterator it =
+ converters_.find(i);
+ if (it != converters_.end()) {
+ it->second->convert(value_, reinterpret_cast<void*>(&dest));
+ return dest;
+ }
+ throw conversion_not_found_exception();
+ }
+ template <class S>
+ void cast(S* dest) {
+ *dest = cast<S>();
+ }
+protected:
+ generic_parameter(void* value) : value_(value) {
+ }
+ class basic_converter {
+ public:
+ virtual void convert(void* src, void* dest) = 0;
+ virtual ~basic_converter() {}
+ };
+ std::map<TypeInfo, basic_converter*> converters_;
+private:
+ void* value_;
+};
+
+template <class T, class TypeInfo = extensions::default_type_info>
+ class parameter : public generic_parameter<TypeInfo> {
+public:
+ template <class A, class B>
+ friend class basic_parameter_map;
+
+ virtual TypeInfo type() {
+ return reflections::type_info_handler<TypeInfo, T>::get_class_type();
+ }
+ explicit parameter(T value)
+ : generic_parameter<TypeInfo>(reinterpret_cast<void*>(&value_)),
+ value_(value) {
+ // Add converter for current type.
+ generic_parameter<TypeInfo>::converters_.insert
+ (std::make_pair(reflections::type_info_handler<TypeInfo, T>
+ ::get_class_type(),
+ new default_converter<T>()));
+ }
+ template <class S>
+ void converts_to_with_func(void (*convert_func)(T*, S*)) {
+ generic_parameter<TypeInfo>::converters_.insert
+ (std::make_pair(reflections::type_info_handler<TypeInfo, S>
+ ::get_class_type(),
+ new specialized_converter<S>(convert_func)));
+ }
+ template <class S>
+ void converts_to() {
+ generic_parameter<TypeInfo>::converters_.insert
+ (std::make_pair(reflections::type_info_handler<TypeInfo, S>
+ ::get_class_type(),
+ new default_converter<S>()));
+ }
+private:
+
+ template <class S>
+ class default_converter :
+ public generic_parameter<TypeInfo>::basic_converter {
+ public:
+ virtual void convert(void* val, void* dest) {
+ S* s = reinterpret_cast<S*>(dest);
+ *s = static_cast<S>(*reinterpret_cast<T*>(val));
+ }
+ };
+ template <class S>
+ class specialized_converter :
+ public generic_parameter<TypeInfo>::basic_converter {
+ public:
+ explicit specialized_converter(void (*convert_function)(T*, S*))
+ : convert_function_(convert_function) {
+ }
+ virtual void convert(void* val, void* dest) {
+ S* s = reinterpret_cast<S*>(dest);
+ (*convert_function_)(reinterpret_cast<T*>(val), s);
+ }
+ private:
+ void (*convert_function_)(T*, S*);
+ };
+ T value_;
+};
+}
+}
+
+#endif // BOOST_REFLECTION_PARAMETER_HPP

Modified: sandbox/boost/reflection/parameter_map.hpp
==============================================================================
--- sandbox/boost/reflection/parameter_map.hpp (original)
+++ sandbox/boost/reflection/parameter_map.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -13,128 +13,13 @@
 #ifndef BOOST_REFLECTION_PARAMETER_MAP_HPP
 #define BOOST_REFLECTION_PARAMETER_MAP_HPP
 #include <boost/extension/impl/typeinfo.hpp>
+#include <boost/reflection/parameter.hpp>
 #include <exception>
 #include <map>
+#include <string>
 #include <vector>
-namespace boost { namespace reflections {
-using extensions::type_info_handler;
-
-class conversion_not_found_exception : public std::exception {
-public:
- virtual const char* what() {
- return "Cannot convert types";
- }
-};
-typedef void (*FunctionPtr)();
-template <class TypeInfo = extensions::default_type_info>
-class generic_parameter {
-public:
- virtual ~generic_parameter() {
- for (typename std::map<TypeInfo, basic_converter*>::iterator it = converters_.begin();
- it != converters_.end(); ++it) {
- delete it->second;
- }
- }
- virtual TypeInfo type() = 0;
- template <class T>
- bool can_cast() {
- TypeInfo i = type_info_handler<TypeInfo, T>::get_class_type();
- return (converters_.find(i) != converters_.end());
- }/*
- template <class T>
- T* cast() {
- TypeInfo i = type_info_handler<TypeInfo, T>::get_class_type();
- for (typename vector_type::const_iterator it = converter_.begin();
- it != converters_.end(); ++it) {
- if (it->first == i)
- return true;
- }
- }*/
- template <class S>
- S cast() {
- S dest;
- TypeInfo i = type_info_handler<TypeInfo, S>::get_class_type();
- typename std::map<TypeInfo, basic_converter*>::iterator it = converters_.find(i);
- if (it != converters_.end()) {
- it->second->convert(value_, reinterpret_cast<void*>(&dest));
- return dest;
- }
- throw conversion_not_found_exception();
- }
- template <class S>
- void cast(S* dest) {
- *dest = cast<S>();
- }
-protected:
- generic_parameter(void* value) : value_(value) {
- }
- class basic_converter {
- public:
- virtual void convert(void* src, void* dest) = 0;
- virtual ~basic_converter() {};
- };
- // typedef std::vector<std::pair<TypeInfo, FunctionPtr> > vector_type;
- // vector_type converters_;
- std::map<TypeInfo, basic_converter*> converters_;
-private:
- void* value_;
-};
-
-template <class T, class TypeInfo = extensions::default_type_info>
-class parameter : public generic_parameter<TypeInfo> {
-public:
- template <class A, class B>
- friend class basic_parameter_map;
-
- virtual TypeInfo type() {
- return reflections::type_info_handler<TypeInfo, T>::get_class_type();
- }
- parameter(T value)
- : generic_parameter<TypeInfo>(reinterpret_cast<void*>(&value_)),
- value_(value) {
- // Add converter for current type.
- generic_parameter<TypeInfo>::converters_.insert
- (std::make_pair(reflections::type_info_handler<TypeInfo, T>::get_class_type(),
- new default_converter<T>()));
- }
- template <class S>
- void converts_to_with_func(void (*convert_func)(T*, S*)) {
- generic_parameter<TypeInfo>::converters_.insert
- (std::make_pair(reflections::type_info_handler<TypeInfo, S>::get_class_type(),
- new specialized_converter<S>(convert_func)));
- }
- template <class S>
- void converts_to() {
- generic_parameter<TypeInfo>::converters_.insert
- (std::make_pair(reflections::type_info_handler<TypeInfo, S>::get_class_type(),
- new default_converter<S>()));
- }
-private:
-
- template <class S>
- class default_converter : public generic_parameter<TypeInfo>::basic_converter {
- public:
- virtual void convert(void* val, void* dest) {
- S* s = reinterpret_cast<S*>(dest);
- *s = static_cast<S>(*reinterpret_cast<T*>(val));
- }
- };
- template <class S>
- class specialized_converter : public generic_parameter<TypeInfo>::basic_converter {
- public:
- specialized_converter(void (*convert_function)(T*, S*))
- : convert_function_(convert_function) {
- }
- virtual void convert(void* val, void* dest) {
- S* s = reinterpret_cast<S*>(dest);
- (*convert_function_)(reinterpret_cast<T*>(val), s);
- }
- private:
- void (*convert_function_)(T*, S*);
- };
- T value_;
-};
 
+namespace boost { namespace reflections {
 class parameter_unavailable_exception : public std::exception {
 public:
   virtual const char * what() {
@@ -160,8 +45,10 @@
   template <class D>
   std::vector<generic_parameter<TypeInfo>*> get(Info info) {
     std::vector<generic_parameter<TypeInfo>*> parameters;
- std::pair<typename map_type::iterator, typename map_type::iterator> its = equal_range(info);
- for (typename map_type::iterator current = its->first; current != its->second; ++current) {
+ std::pair<typename map_type::iterator, typename map_type::iterator> its
+ = equal_range(info);
+ for (typename map_type::iterator current = its->first;
+ current != its->second; ++current) {
       generic_parameter<TypeInfo>& p = *current->second;
       if (p.template can_cast<D>()) {
         parameters.push_back(current->second);
@@ -171,8 +58,6 @@
   }
 };
 typedef basic_parameter_map<> parameter_map;
-
-
 }}
 
-#endif // BOOST_REFLECTION_PARAMETER_MAP_HPP
+#endif // BOOST_REFLECTION_PARAMETER_MAP_HPP

Modified: sandbox/boost/reflection/reflection.hpp
==============================================================================
--- sandbox/boost/reflection/reflection.hpp (original)
+++ sandbox/boost/reflection/reflection.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -19,6 +19,8 @@
 #include <boost/preprocessor/iteration/iterate.hpp>
 #include <boost/reflection/constructor.hpp>
 #include <boost/reflection/constructor_info.hpp>
+#include <boost/reflection/data.hpp>
+#include <boost/reflection/data_info.hpp>
 #include <boost/reflection/factory.hpp>
 #include <boost/reflection/function.hpp>
 #include <boost/reflection/function_info.hpp>
@@ -26,133 +28,92 @@
 namespace boost {
 namespace reflections {
 using extensions::type_info_handler;
-typedef void (*FunctionPtr)();
-
-// The basic_function_info class is used as a key in the map
-// of functions available for the current reflection.
-// There are two types - those with ParameterInfo defined, and
-// those without.
-template<class Info, class TypeInfo, class ParameterInfo = void>
-struct basic_function_info {
- // The type of the function pointer in the map.
- TypeInfo type_info_;
- // A description of the function pointer.
- Info info_;
-
- // A description for each parameter of the function.
- // If ParameterInfo=void, this does not appear.
- std::vector<ParameterInfo> parameter_info_;
-
- // Constructors
- basic_function_info(TypeInfo t, Info i) : type_info_(t), info_(i) {
- }
-
- basic_function_info(const basic_function_info & s)
- : type_info_(s.type_info_), info_(s.info_) {
- }
-
- basic_function_info & operator=(basic_function_info & s) {
- type_info_ = s.type_info_;
- info_ = s.info_;
- }
-
- // Less-than operator - for maps.
- friend inline bool operator<(const basic_function_info & t,
- const basic_function_info & s) {
- return t.type_info_ < s.type_info_ ||
- (t.type_info_ == s.type_info_ &&
- t.info_ < s.info_);
- }
-};
-
-// Same as the above, but without ParameterInfo.
-template<class Info, class TypeInfo>
-struct basic_function_info<Info, TypeInfo> {
- // The type of the function pointer in the map.
- TypeInfo type_info_;
- // A description of the function pointer.
- Info info_;
-
- // Constructors.
- basic_function_info(TypeInfo t, Info i) : type_info_(t), info_(i) {
- }
-
- basic_function_info(const basic_function_info & s)
- : type_info_(s.type_info_), info_(s.info_) {
- }
+namespace impl {
+template <class T>
+void destruct(void * val) {
+ delete static_cast<T*>(val);
+}
 
- basic_function_info & operator=(basic_function_info & s) {
- type_info_ = s.type_info_;
- info_ = s.info_;
- }
-
- // Less-than operator - for maps.
- friend inline bool operator<(const basic_function_info & t,
- const basic_function_info & s) {
- return t.type_info_ < s.type_info_ ||
- (t.type_info_ == s.type_info_ &&
- t.info_ < s.info_);
- }
-};
-
-// The basic_constructor_info class is used as a key in the map
-// of constructors available for the current reflection.
-// There are two types - those with ParameterInfo defined, and
-// those without.
-template<class TypeInfo, class ParameterInfo = void>
-struct basic_constructor_info {
- // The type of the function pointer used to construct
- // the object this constructor_info is for.
- TypeInfo type_info_;
-
- // A description for each parameter of the function.
- // If ParameterInfo=void, this does not appear.
- std::vector<ParameterInfo> parameter_info_;
-
- // Constructors.
- basic_constructor_info(TypeInfo t) : type_info_(t) {
- }
-
- basic_constructor_info(const basic_constructor_info & s)
- : type_info_(s.type_info_) {
- }
-
- basic_constructor_info & operator=(basic_constructor_info & s) {
- type_info_ = s.type_info_;
- }
+#define BOOST_PP_ITERATION_LIMITS (0, \
+ BOOST_PP_INC(BOOST_REFLECTION_MAX_FUNCTOR_PARAMS) - 1)
+#define BOOST_PP_FILENAME_1 \
+ <boost/reflection/impl/reflector_free_functions.hpp>
+#include BOOST_PP_ITERATE()
 
- // Less than operator - for maps.
- friend inline bool operator<(const basic_constructor_info & t,
- const basic_constructor_info & s) {
- return t.type_info_ < s.type_info_;
- }
-};
+// This is used to store, indexed by type information,
+// any normal function pointers.
+typedef void (*FunctionPtr)();
 
+} // namespace impl
 
-template<class TypeInfo>
-struct basic_constructor_info<TypeInfo> {
- TypeInfo type_info_;
- basic_constructor_info(TypeInfo t) : type_info_(t)
- {
- }
- basic_constructor_info(const basic_constructor_info & s)
- : type_info_(s.type_info_) {}
- basic_constructor_info & operator=(basic_constructor_info & s) {
- type_info_ = s.type_info_;
- }
- friend inline bool operator<(const basic_constructor_info & t,
- const basic_constructor_info & s) {
- return t.type_info_ < s.type_info_;
- }
-};
 
+// By default, ParameterInfo is not used. Note that using adapters
+// requires ParameterInfo.
 template <class Info = std::string, class ParameterInfo = void,
           class TypeInfo = extensions::default_type_info>
-class basic_reflection
-{
+class basic_reflection {
 public:
- template <class Q, class R, class S, class T>
- friend class reflector;
+ // A reflector is used to add functions and constructors to
+ // a reflected class.
+
+ template <class T>
+ class reflector
+ {
+ public:
+ // Initialize with a pointer to the reflection
+ // this reflector will be reflecting into
+ reflector(basic_reflection<Info, ParameterInfo, TypeInfo>*
+ current_reflection)
+ : reflection_(current_reflection) {
+ }
+
+ // Typedefs for the specific instantiations used by this class.
+ typedef basic_function_info<Info, TypeInfo, ParameterInfo> function_info;
+ typedef basic_constructor_info<TypeInfo, ParameterInfo> constructor_info;
+
+ reflector& constructor() {
+ instance (*ctor_func)()(&impl::construct_instance<T>);
+ reflection_->constructors_.insert(std::make_pair<TypeInfo, impl::FunctionPtr>(
+ reflections::type_info_handler<TypeInfo, instance (*)()>
+ ::get_class_type(), reinterpret_cast<impl::FunctionPtr>(ctor_func)));
+ return *this;
+ }
+
+ template <class S>
+ reflector& data(S T::*data_ptr, Info info) {
+ data_info f(reflections::type_info_handler<TypeInfo, S>
+ ::get_class_type(), info);
+
+ std::pair<impl::MemberPtr, impl::FunctionPtr>
+ p(reinterpret_cast<impl::MemberPtr>(data_ptr),
+ reinterpret_cast<impl::FunctionPtr>(&impl::get_data_from_ptr<T, S>));
+ std::pair<data_info, std::pair<impl::MemberPtr, impl::FunctionPtr> >
+ p2(f, p);
+ reflection_->data_.insert(p2);
+ return *this;
+ }
+ #define BOOST_PP_ITERATION_LIMITS (0, \
+ BOOST_PP_INC(BOOST_REFLECTION_MAX_FUNCTOR_PARAMS) - 1)
+ #define BOOST_PP_FILENAME_1 \
+ <boost/reflection/impl/reflector_parameter_functions.hpp>
+ #include BOOST_PP_ITERATE()
+ reflector& function(void (T::*func)(), Info info) {
+ function_info f(reflections::type_info_handler<TypeInfo,
+ void (*)()>::get_class_type(), info, false);
+ void (*f2)(void *, impl::MemberFunctionPtr) = &impl::call_member<T, void>;
+ std::pair<impl::MemberFunctionPtr, impl::FunctionPtr>
+ in_pair(reinterpret_cast<impl::MemberFunctionPtr>(func),
+ reinterpret_cast<impl::FunctionPtr>(f2));
+ std::pair<function_info,
+ std::pair<impl::MemberFunctionPtr,
+ impl::FunctionPtr> >
+ out_pair(f, in_pair);
+ reflection_->functions_.insert(out_pair);
+ return *this;
+ }
+ private:
+ basic_reflection<Info, ParameterInfo, TypeInfo>* reflection_;
+ };
 #define BOOST_PP_ITERATION_LIMITS (0, \
     BOOST_PP_INC(BOOST_REFLECTION_MAX_FUNCTOR_PARAMS) - 1)
 #define BOOST_PP_FILENAME_1 <boost/reflection/impl/reflection.hpp>
@@ -160,7 +121,7 @@
   instance_constructor<> get_constructor() {
     constructor_info t(reflections::type_info_handler<TypeInfo,
     instance (*)()>::get_class_type());
- typename std::map<constructor_info, FunctionPtr>::iterator it =
+ typename std::map<constructor_info, impl::FunctionPtr>::iterator it =
       constructors_.find(t);
     if (it == constructors_.end()) {
       return instance_constructor<>();
@@ -168,42 +129,148 @@
       return reinterpret_cast<instance (*)()>(it->second);
     }
   }
+
+ template <class T>
+ data<T> get_data(Info info) {
+ // Construct a data_info structure to look up the function in the map.
+ data_info d(reflections::type_info_handler<TypeInfo, T>
+ ::get_class_type(), info);
+
+ // Look up the function.
+ typename std::map<data_info,
+ std::pair<impl::MemberPtr, impl::FunctionPtr> >::iterator it =
+ data_.find(d);
+
+ if (it == data_.end()) {
+ // If it does not exist, return an empty function object.
+ return data<T>();
+ } else {
+ return data<T>
+ // reinterpret_cast is safe, because we looked it up by its type.
+ (it->second.first,
+ reinterpret_cast<T& (*)(void*, impl::MemberPtr)>
+ (it->second.second));
+ }
+ }
+
+ template <class T>
+ reflector<T> reflect() {
+ return reflector<T>(this);
+ }
 private:
   typedef basic_function_info<Info, TypeInfo, ParameterInfo> function_info;
   typedef basic_constructor_info<TypeInfo, ParameterInfo> constructor_info;
- std::map<constructor_info, FunctionPtr> constructors_;
- std::map<function_info,
- std::pair<MemberFunctionPtr, FunctionPtr> > functions_;
+ typedef basic_data_info<Info, TypeInfo> data_info;
+ std::map<constructor_info, impl::FunctionPtr> constructors_;
+ std::map<function_info,
+ std::pair<impl::MemberFunctionPtr, impl::FunctionPtr> > functions_;
+ std::map<data_info,
+ std::pair<impl::MemberPtr, impl::FunctionPtr> > data_;
 };
 template <class Info, class TypeInfo>
 class basic_reflection<Info, void, TypeInfo>
 {
 public:
- template <class Q, class R, class S, class T>
- friend class reflector;
+ template <class T>
+ class reflector
+ {
+ public:
+ // Initialize with a pointer to the reflection
+ // this reflector will be reflecting into
+ reflector(basic_reflection<Info, void, TypeInfo> * current_reflection)
+ : reflection_(current_reflection) {
+ }
+
+ // Typedefs for the specific instantiations used by this class.
+ typedef basic_function_info<Info, TypeInfo> function_info;
+ typedef basic_constructor_info<Info, TypeInfo> constructor_info;
+
+ // Reflect the default constructor (other constructors in
+ // impl/reflector_functions.hpp).
+ reflector& constructor() {
+ instance (*ctor_func)()(&impl::construct_instance<T>);
+ reflection_->constructors_.insert(std::make_pair<TypeInfo, impl::FunctionPtr>(
+ reflections::type_info_handler<TypeInfo, instance (*)()>
+ ::get_class_type(), reinterpret_cast<impl::FunctionPtr>(ctor_func)));
+ return *this;
+ }
+
+ template <class S>
+ reflector& data(S T::*data_ptr, Info info) {
+ data_info f(reflections::type_info_handler<TypeInfo, S>
+ ::get_class_type(), info);
+ S& (*func)(void*, impl::MemberPtr) = &impl::get_data_from_ptr<T, S>;
+ std::pair<impl::MemberPtr, impl::FunctionPtr>
+ p(reinterpret_cast<impl::MemberPtr>(data_ptr),
+ reinterpret_cast<impl::FunctionPtr>(func));
+ std::pair<data_info, std::pair<impl::MemberPtr, impl::FunctionPtr> >
+ p2(f, p);
+ reflection_->data_.insert(p2);
+ return *this;
+ }
+ #define BOOST_PP_ITERATION_LIMITS (0, \
+ BOOST_PP_INC(BOOST_REFLECTION_MAX_FUNCTOR_PARAMS) - 1)
+ #define BOOST_PP_FILENAME_1 \
+ <boost/reflection/impl/reflector_functions.hpp>
+ #include BOOST_PP_ITERATE()
+ private:
+ basic_reflection<Info, void, TypeInfo> * reflection_;
+ };
+
 #define BOOST_PP_ITERATION_LIMITS (0, \
     BOOST_PP_INC(BOOST_REFLECTION_MAX_FUNCTOR_PARAMS) - 1)
 #define BOOST_PP_FILENAME_1 <boost/reflection/impl/reflection.hpp>
 #include BOOST_PP_ITERATE()
- instance_constructor<> get_constructor() {
- constructor_info t(reflections::type_info_handler<TypeInfo,
- instance (*)()>::get_class_type());
- typename std::map<constructor_info, FunctionPtr>::iterator it =
- constructors_.find(t);
- if (it == constructors_.end()) {
- return instance_constructor<>();
- } else {
- return reinterpret_cast<instance (*)()>(it->second);
- }
+ instance_constructor<> get_constructor() {
+ constructor_info t(reflections::type_info_handler<TypeInfo,
+ instance (*)()>::get_class_type());
+ typename std::map<constructor_info, impl::FunctionPtr>::iterator it =
+ constructors_.find(t);
+ if (it == constructors_.end()) {
+ return instance_constructor<>();
+ } else {
+ return reinterpret_cast<instance (*)()>(it->second);
+ }
+ }
+
+ template <class T>
+ data<T> get_data(Info info) {
+ // Construct a data_info structure to look up the function in the map.
+ data_info d(reflections::type_info_handler<TypeInfo, T>
+ ::get_class_type(), info);
+
+ // Look up the function.
+ typename std::map<data_info,
+ std::pair<impl::MemberPtr, impl::FunctionPtr> >::iterator it =
+ data_.find(d);
+
+ if (it == data_.end()) {
+ // If it does not exist, return an empty function object.
+ return data<T>();
     }
+ return data<T>
+ // reinterpret_cast is safe, because we looked it up by its type.
+ (it->second.first,
+ reinterpret_cast<T& (*)(void*, impl::MemberPtr)>
+ (it->second.second));
+ }
+
+ template <class T>
+ reflector<T> reflect() {
+ return reflector<T>(this);
+ }
+
 private:
   typedef basic_function_info<Info, TypeInfo> function_info;
   typedef basic_constructor_info<TypeInfo> constructor_info;
- std::map<constructor_info, FunctionPtr> constructors_;
- std::map<function_info,
- std::pair<MemberFunctionPtr, FunctionPtr> > functions_;
+ typedef basic_data_info<Info, TypeInfo> data_info;
+ std::map<constructor_info, impl::FunctionPtr> constructors_;
+ std::map<function_info,
+ std::pair<impl::MemberFunctionPtr, impl::FunctionPtr> > functions_;
+ std::map<data_info,
+ std::pair<impl::MemberPtr, impl::FunctionPtr> > data_;
 };
 
 typedef basic_reflection<> reflection;
 }}
-#endif // BOOST_REFLECTION_REFLECTION_HPP
+#endif // BOOST_REFLECTION_REFLECTION_HPP

Deleted: sandbox/boost/reflection/reflector.hpp
==============================================================================
--- sandbox/boost/reflection/reflector.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
+++ (empty file)
@@ -1,104 +0,0 @@
-/*
- * Copyright Jeremy Pack 2007
- * Distributed under the Boost Software License, Version 1.0. (See
- * accompanying file LICENSE_1_0.txt or copy at
- * http://www.boost.org/LICENSE_1_0.txt)
- *
- * See http://www.boost.org/ for latest version.
- */
-
-#ifndef BOOST_REFLECTION_REFLECTOR_HPP
-#define BOOST_REFLECTION_REFLECTOR_HPP
-
-#include <boost/preprocessor/iteration/iterate.hpp>
-#include <boost/reflection/common.hpp>
-#include <boost/reflection/factory.hpp>
-#include <boost/reflection/function.hpp>
-#include <boost/reflection/constructor.hpp>
-#include <boost/reflection/instance.hpp>
-#include <boost/reflection/reflection.hpp>
-
-namespace boost {namespace reflections {
-using extensions::type_info_handler;
-namespace impl {
-template <class T>
-void destruct(void * val) {
- delete static_cast<T*>(val);
-}
-
-#define BOOST_PP_ITERATION_LIMITS (0, \
- BOOST_PP_INC(BOOST_REFLECTION_MAX_FUNCTOR_PARAMS) - 1)
-#define BOOST_PP_FILENAME_1 <boost/reflection/impl/reflector_free_functions.hpp>
-#include BOOST_PP_ITERATE()
-
-} // namespace impl
-
-template <class T, class Info = std::string, class ParameterInfo = void,
- class TypeInfo = extensions::default_type_info>
-class reflector
-{
-public:
- // Initialize with a pointer to the reflection
- // this reflector will be reflecting into
- reflector(basic_reflection<Info, ParameterInfo, TypeInfo>
- * current_reflection)
- : reflection_(current_reflection) {
- }
- typedef basic_function_info<Info, TypeInfo, ParameterInfo> function_info;
- typedef basic_constructor_info<TypeInfo, ParameterInfo> constructor_info;
- void reflect_constructor() {
- instance (*ctor_func)()(&impl::construct_instance<T>);
- reflection_->constructors_.insert(std::make_pair<TypeInfo, FunctionPtr>(
- reflections::type_info_handler<TypeInfo, instance (*)()>
- ::get_class_type(), reinterpret_cast<FunctionPtr>(ctor_func)));
- }
-#define BOOST_PP_ITERATION_LIMITS (0, \
- BOOST_PP_INC(BOOST_REFLECTION_MAX_FUNCTOR_PARAMS) - 1)
-#define BOOST_PP_FILENAME_1 <boost/reflection/impl/reflector_parameter_functions.hpp>
-#include BOOST_PP_ITERATE()
- void reflect(void (T::*func)(), Info info) {
- function_info f(reflections::type_info_handler<TypeInfo,
- void (*)()>::get_class_type(), info);
- void (*f2)(void *, MemberFunctionPtr) = &impl::call_member<T, void>; \
- std::pair<MemberFunctionPtr, FunctionPtr>
- in_pair(reinterpret_cast<MemberFunctionPtr>(func),
- reinterpret_cast<FunctionPtr>(f2));
- std::pair<function_info, std::pair<MemberFunctionPtr, FunctionPtr> >
- out_pair(f, in_pair);
- reflection_->functions_.insert(out_pair);
- }
-private:
- basic_reflection<Info, ParameterInfo, TypeInfo> * reflection_;
-};
-
-template <class T, class Info, class TypeInfo>
-class reflector<T, Info, void, TypeInfo>
-{
-public:
- // Initialize with a pointer to the reflection
- // this reflector will be reflecting into
- reflector(basic_reflection<Info, void, TypeInfo> * current_reflection)
- : reflection_(current_reflection) {
- }
- typedef basic_function_info<Info, TypeInfo> function_info;
- typedef basic_constructor_info<Info, TypeInfo> constructor_info;
- void reflect_constructor() {
- instance (*ctor_func)()(&impl::construct_instance<T>);
- reflection_->constructors_.insert(std::make_pair<TypeInfo, FunctionPtr>(
- reflections::type_info_handler<TypeInfo, instance (*)()>
- ::get_class_type(), reinterpret_cast<FunctionPtr>(ctor_func)));
- }
-#define BOOST_PP_ITERATION_LIMITS (0, \
- BOOST_PP_INC(BOOST_REFLECTION_MAX_FUNCTOR_PARAMS) - 1)
-#define BOOST_PP_FILENAME_1 <boost/reflection/impl/reflector_functions.hpp>
-#include BOOST_PP_ITERATE()
-private:
- void add_constructor(instance (*func)()) {
- reflection_->constructors_.insert(std::make_pair<TypeInfo, FunctionPtr>(
- reflections::type_info_handler<TypeInfo, instance (*)()>
- ::get_class_type(), reinterpret_cast<FunctionPtr>(func)));
- }
- basic_reflection<Info, void, TypeInfo> * reflection_;
-};
-}}
-#endif

Modified: sandbox/boost/reflection/static_reflection.hpp
==============================================================================
--- sandbox/boost/reflection/static_reflection.hpp (original)
+++ sandbox/boost/reflection/static_reflection.hpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -43,7 +43,7 @@
     return *static_cast<std::map<Info, \
                         FuncType> * >(holder); \
   }
-
+
 #define BOOST_REFLECTION_FACTORY_MAP_GET_FUNCTION_WITH_INFO(Z, N, _) \
   template <class Info, class ReturnValue \
   BOOST_PP_COMMA_IF(N) \
@@ -58,7 +58,7 @@
     } \
     return it->second; \
   }
-
+
 #define BOOST_REFLECTION_FACTORY_MAP_SET_FUNCTION(Z, N, _) \
   template <class Info, class ReturnValue \
   BOOST_PP_COMMA_IF(N) \
@@ -78,7 +78,7 @@
     return get<Info, ReturnValue BOOST_PP_COMMA_IF(N) \
     BOOST_PP_ENUM_PARAMS(N, Param)>(); \
   }
-
+
 template <class TypeInfo>
 class basic_static_reflection {
 public:

Modified: sandbox/libs/reflection/examples/extension/car_lib.cpp
==============================================================================
--- sandbox/libs/reflection/examples/extension/car_lib.cpp (original)
+++ sandbox/libs/reflection/examples/extension/car_lib.cpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -12,7 +12,6 @@
 #include "../car.hpp"
 #include <boost/extension/impl/decl.hpp>
 #include <boost/reflection/reflection.hpp>
-#include <boost/reflection/reflector.hpp>
 using namespace boost::reflections;
 
 // Although both of these classes are derived from a common
@@ -38,18 +37,11 @@
 extern "C"
 void BOOST_EXTENSION_EXPORT_DECL
 extension_export_car(std::map<std::string, reflection> reflection_map) {
- reflection & first = reflection_map["suv"];
- reflection & second = reflection_map["compact"];
-
- // Create a reflector for each type that is being reflected.
- reflector<suv> suv_reflector(&first);
- reflector<compact> compact_reflector(&second);
-
- // Reflect the constructor with a `const char*` arg
- suv_reflector.reflect_constructor<const char *>();
- compact_reflector.reflect_constructor<const char *>();
-
- // Reflect a function for each
- suv_reflector.reflect<const char *>(&suv::get_type, "get_type");
- compact_reflector.reflect<const char *>(&compact::get_type, "get_type");
+ reflection_map["suv"].reflect<suv>()
+ .constructor<const char*>()
+ .function(&suv::get_type, "get_type");
+
+ reflection_map["compact"].reflect<compact>()
+ .constructor<const char*>()
+ .function(&compact::get_type, "get_type");
 }

Modified: sandbox/libs/reflection/examples/extension/extension.cpp
==============================================================================
--- sandbox/libs/reflection/examples/extension/extension.cpp (original)
+++ sandbox/libs/reflection/examples/extension/extension.cpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -16,7 +16,7 @@
 #include <boost/extension/shared_library.hpp>
 #include <boost/extension/convenience.hpp>
 #include <boost/reflection/reflection.hpp>
-#include <boost/reflection/reflector.hpp>
+#include <boost/reflection/reflection.hpp>
 #include <iostream>
 
 

Modified: sandbox/libs/reflection/examples/tutorial_1/hello_world.cpp
==============================================================================
--- sandbox/libs/reflection/examples/tutorial_1/hello_world.cpp (original)
+++ sandbox/libs/reflection/examples/tutorial_1/hello_world.cpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -12,10 +12,8 @@
 #include <iostream>
 
 #include <boost/reflection/reflection.hpp>
-#include <boost/reflection/reflector.hpp>
 
 using boost::reflections::reflection;
-using boost::reflections::reflector;
 using boost::reflections::instance;
 
 reflection GetReflection();
@@ -52,20 +50,9 @@
 reflection GetReflection() {
   // This reflection will be returned
   reflection r;
-
- // Use a reflector<HelloWorld> which will only reflect out constructors
- // and functions for the HelloWorld class.
- reflector<HelloWorld> current_reflector(&r);
-
- // Reflect an argless constructor
- // To reflect a constructor that takes a "const string&" and an int,
- // call current_reflector.reflect_constructor<const string&, int>().
- current_reflector.reflect_constructor();
-
- // Reflect a member function returning void and having no parameters.
- // To reflect a member returning a float and taking a single int as
- // an argument, use: current_reflector.reflect<float, int>().
- current_reflector.reflect<void>(&HelloWorld::printHelloWorld,
- "print hello world");
+ r.reflect<HelloWorld>()
+ .constructor()
+ .function(&HelloWorld::printHelloWorld,
+ "print hello world");
   return r;
 }
\ No newline at end of file

Modified: sandbox/libs/reflection/test/Jamfile.v2
==============================================================================
--- sandbox/libs/reflection/test/Jamfile.v2 (original)
+++ sandbox/libs/reflection/test/Jamfile.v2 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -33,5 +33,6 @@
   [ run multi_param_test.cpp ]
   [ run basic_static_test.cpp ]
   [ run parameter_info_test.cpp ]
+ [ run data_test.cpp ]
 :
 ;

Modified: sandbox/libs/reflection/test/basic_test.cpp
==============================================================================
--- sandbox/libs/reflection/test/basic_test.cpp (original)
+++ sandbox/libs/reflection/test/basic_test.cpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -16,7 +16,7 @@
 #define BOOST_TEST_MAIN
 #define BOOST_TEST_DYN_LINK 1
 #include <boost/test/unit_test.hpp>
-#include <boost/reflection/reflector.hpp>
+#include <boost/reflection/reflection.hpp>
 
 class car {
 public:
@@ -30,9 +30,9 @@
 BOOST_AUTO_TEST_CASE(argless)
 {
   reflection car_reflection;
- reflector<car> car_reflector(&car_reflection);
- car_reflector.reflect_constructor<int>();
- car_reflector.reflect<int>(&car::start, "start");
+ car_reflection.reflect<car>()
+ .constructor<int>()
+ .function<int>(&car::start, "start");
 // Check for argless constructor
   BOOST_CHECK(car_reflection.get_constructor<int>().valid());
   instance car_instance =
@@ -61,10 +61,10 @@
 BOOST_AUTO_TEST_CASE(single_arg)
 {
   reflection car_reflection;
- reflector<porsche> car_reflector(&car_reflection);
- car_reflector.reflect_constructor<int>();
- car_reflector.reflect(&porsche::start, "start");
- car_reflector.reflect(&porsche::get_year, "get_year");
+ car_reflection.reflect<porsche>()
+ .constructor<int>()
+ .function(&porsche::start, "start")
+ .function(&porsche::get_year, "get_year");
   // Check for argless constructor
   BOOST_CHECK(car_reflection.get_constructor<int>().valid());
   BOOST_CHECK(!car_reflection.get_constructor().valid());

Modified: sandbox/libs/reflection/test/multi_param_test.cpp
==============================================================================
--- sandbox/libs/reflection/test/multi_param_test.cpp (original)
+++ sandbox/libs/reflection/test/multi_param_test.cpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -18,7 +18,7 @@
 #define BOOST_TEST_MAIN
 #define BOOST_TEST_DYN_LINK 1
 #include <boost/test/unit_test.hpp>
-#include <boost/reflection/reflector.hpp>
+#include <boost/reflection/reflection.hpp>
 
 class car {
 public:
@@ -37,10 +37,10 @@
 BOOST_AUTO_TEST_CASE(argless)
 {
   reflection car_reflection;
- reflector<car> car_reflector(&car_reflection);
- car_reflector.reflect_constructor<float, const char *, int>();
- car_reflector.reflect<int, bool, float>(&car::start, "start");
- car_reflector.reflect(&car::get_cost, "get_cost");
+ car_reflection.reflect<car>()
+ .constructor<float, const char *, int>()
+ .function<int, bool, float>(&car::start, "start")
+ .function(&car::get_cost, "get_cost");
   // Check for argless constructor
   BOOST_CHECK((car_reflection.get_constructor<float, const char *, int>
               ().valid()));

Modified: sandbox/libs/reflection/test/parameter_info_test.cpp
==============================================================================
--- sandbox/libs/reflection/test/parameter_info_test.cpp (original)
+++ sandbox/libs/reflection/test/parameter_info_test.cpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -16,7 +16,7 @@
 #define BOOST_TEST_MAIN
 #define BOOST_TEST_DYN_LINK 1
 #include <boost/test/unit_test.hpp>
-#include <boost/reflection/reflector.hpp>
+#include <boost/reflection/reflection.hpp>
 
 class car {
 public:
@@ -28,9 +28,10 @@
 using namespace boost::reflections;
 BOOST_AUTO_TEST_CASE(argless) {
   basic_reflection<std::string, std::string> car_reflection;
- reflector<car, std::string, std::string> car_reflector(&car_reflection);
- car_reflector.reflect_constructor();
- car_reflector.reflect<int>(&car::start, "start", "speed");
+ car_reflection.reflect<car>()
+ .constructor()
+ .function<int>(&car::start, "start", "speed");
+
   // Check for argless constructor
   BOOST_CHECK(car_reflection.get_constructor().valid());
   instance car_instance =

Modified: sandbox/libs/reflection/test/parameters_test.cpp
==============================================================================
--- sandbox/libs/reflection/test/parameters_test.cpp (original)
+++ sandbox/libs/reflection/test/parameters_test.cpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -18,7 +18,7 @@
 #define BOOST_TEST_MAIN
 #define BOOST_TEST_DYN_LINK 1
 #include <boost/test/unit_test.hpp>
-#include <boost/reflection/reflector.hpp>
+#include <boost/reflection/reflection.hpp>
 #include <boost/reflection/parameter_map.hpp>
 using namespace boost::reflections;
 BOOST_AUTO_TEST_CASE(paramter_map) {

Modified: sandbox/libs/reflection/test/shared_library_test.cpp
==============================================================================
--- sandbox/libs/reflection/test/shared_library_test.cpp (original)
+++ sandbox/libs/reflection/test/shared_library_test.cpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -39,7 +39,7 @@
     reflection_map["suv"];
   boost::reflections::reflection & second_reflection =
     reflection_map["compact"];
-
+
   boost::reflections::instance_constructor<const char *> first_constructor =
     first_reflection.get_constructor<const char *>();
   boost::reflections::instance first_instance =
@@ -47,7 +47,7 @@
   boost::reflections::function<const char *> first_function =
     first_reflection.get_function<const char *>("get_type");
   BOOST_CHECK_EQUAL(first_function(first_instance), "It's an SUV.");
-
+
   boost::reflections::instance_constructor<const char *> second_constructor =
     second_reflection.get_constructor<const char *>();
   boost::reflections::instance second_instance =

Modified: sandbox/libs/reflection/test/single_param_test.cpp
==============================================================================
--- sandbox/libs/reflection/test/single_param_test.cpp (original)
+++ sandbox/libs/reflection/test/single_param_test.cpp 2008-05-01 20:51:20 EDT (Thu, 01 May 2008)
@@ -18,7 +18,7 @@
 #define BOOST_TEST_MAIN
 #define BOOST_TEST_DYN_LINK 1
 #include <boost/test/unit_test.hpp>
-#include <boost/reflection/reflector.hpp>
+#include <boost/reflection/reflection.hpp>
 
 class car {
 public:
@@ -37,10 +37,10 @@
 BOOST_AUTO_TEST_CASE(argless)
 {
   reflection car_reflection;
- reflector<car> car_reflector(&car_reflection);
- car_reflector.reflect_constructor<float>();
- car_reflector.reflect<int, bool>(&car::start, "start");
- car_reflector.reflect(&car::get_cost, "get_cost");
+ car_reflection.reflect<car>()
+ .constructor<float>()
+ .function<int, bool>(&car::start, "start")
+ .function<float>(&car::get_cost, "get_cost");
   // Check for argless constructor
   BOOST_CHECK(car_reflection.get_constructor<float>().valid());
   instance car_instance =


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