|
Boost-Commit : |
From: sixtrillion_at_[hidden]
Date: 2007-05-29 00:24:18
Author: sixtrillion
Date: 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
New Revision: 4348
URL: http://svn.boost.org/trac/boost/changeset/4348
Log:
Moving to sandbox from Sourceforge.
Added:
sandbox/boost/extension/
sandbox/boost/extension/basic_factory_map.hpp
sandbox/boost/extension/convenience.hpp
sandbox/boost/extension/counted_factory.hpp
sandbox/boost/extension/counted_factory_map.hpp
sandbox/boost/extension/counted_factorymap.hpp
sandbox/boost/extension/extension.hpp
sandbox/boost/extension/factory.hpp
sandbox/boost/extension/factory_map.hpp
sandbox/boost/extension/factorymap.hpp
sandbox/boost/extension/filesystem.hpp
sandbox/boost/extension/functor.hpp
sandbox/boost/extension/impl/
sandbox/boost/extension/impl/library_impl.hpp
sandbox/boost/extension/impl/linked_library.hpp
sandbox/boost/extension/impl/typeinfo.hpp
sandbox/boost/extension/registry.hpp
sandbox/boost/extension/shared_library.hpp
sandbox/boost/extension/zone.hpp
sandbox/libs/extension/
sandbox/libs/extension/doc/
sandbox/libs/extension/doc/Jamfile.v2
sandbox/libs/extension/doc/appendices.qbk
sandbox/libs/extension/doc/appendix_a.qbk
sandbox/libs/extension/doc/extension.qbk
sandbox/libs/extension/doc/factories.qbk
sandbox/libs/extension/doc/faq.qbk
sandbox/libs/extension/doc/html/
sandbox/libs/extension/doc/html/HTML.manifest
sandbox/libs/extension/doc/html/boost_extension/
sandbox/libs/extension/doc/html/boost_extension/appendices.html
sandbox/libs/extension/doc/html/boost_extension/factories.html
sandbox/libs/extension/doc/html/boost_extension/introduction.html
sandbox/libs/extension/doc/html/boost_extension/performance_analysis.html
sandbox/libs/extension/doc/html/boost_extension/quick_start.html
sandbox/libs/extension/doc/html/boost_extension/quickstart.html
sandbox/libs/extension/doc/html/boost_extension/shared_libraries.html
sandbox/libs/extension/doc/html/boost_extension/tutorial_1.html
sandbox/libs/extension/doc/html/boost_extension/tutorial_2.html
sandbox/libs/extension/doc/html/boost_extension/tutorial_3.html
sandbox/libs/extension/doc/html/boost_extension/tutorial_4.html
sandbox/libs/extension/doc/html/boost_extension/tutorial_5.html
sandbox/libs/extension/doc/html/boost_extension/tutorial_6.html
sandbox/libs/extension/doc/html/boost_extension/tutorials/
sandbox/libs/extension/doc/html/boost_extension/tutorials.html
sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial01.html
sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial02.html
sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial03.html
sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial04.html
sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial05.html
sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial06.html
sandbox/libs/extension/doc/html/boostbook.css
sandbox/libs/extension/doc/html/index.html
sandbox/libs/extension/doc/introduction.qbk
sandbox/libs/extension/doc/performance_analysis.qbk
sandbox/libs/extension/doc/quick_start.qbk
sandbox/libs/extension/doc/shared_libraries.qbk
sandbox/libs/extension/doc/tutorial1.qbk
sandbox/libs/extension/doc/tutorial2.qbk
sandbox/libs/extension/doc/tutorial3.qbk
sandbox/libs/extension/doc/tutorial4.qbk
sandbox/libs/extension/doc/tutorial5.qbk
sandbox/libs/extension/doc/tutorial6.qbk
sandbox/libs/extension/doc/tutorials.qbk
sandbox/libs/extension/examples/
sandbox/libs/extension/examples/Jamfile.v2
sandbox/libs/extension/examples/boost-build.jam
sandbox/libs/extension/examples/hello_world.cpp
sandbox/libs/extension/examples/main.cpp
sandbox/libs/extension/examples/multiple_inheritance/
sandbox/libs/extension/examples/multiple_inheritance/boat.cpp
sandbox/libs/extension/examples/multiple_inheritance/boat.hpp
sandbox/libs/extension/examples/multiple_inheritance/car.cpp
sandbox/libs/extension/examples/multiple_inheritance/car.hpp
sandbox/libs/extension/examples/multiple_inheritance/car_of_the_future.cpp
sandbox/libs/extension/examples/multiple_inheritance/car_of_the_future.hpp
sandbox/libs/extension/examples/multiple_inheritance/computer.cpp
sandbox/libs/extension/examples/multiple_inheritance/computer.hpp
sandbox/libs/extension/examples/multiple_inheritance/flying_car.cpp
sandbox/libs/extension/examples/multiple_inheritance/flying_car.hpp
sandbox/libs/extension/examples/multiple_inheritance/main_mi.cpp
sandbox/libs/extension/examples/multiple_inheritance/plane.cpp
sandbox/libs/extension/examples/multiple_inheritance/plane.hpp
sandbox/libs/extension/examples/multiple_inheritance/vehicle.cpp
sandbox/libs/extension/examples/multiple_inheritance/vehicle.hpp
sandbox/libs/extension/examples/word.hpp
sandbox/libs/extension/fake.cpp
sandbox/libs/extension/scripts/
sandbox/libs/extension/scripts/GenerateHeaders.py
sandbox/libs/extension/test/
sandbox/libs/extension/test/Jamfile.v2
sandbox/libs/extension/test/auto_test_main.cpp
sandbox/libs/extension/test/construction.cpp
sandbox/libs/extension/test/counted_factory_test.cpp
sandbox/libs/extension/test/extension_test.cpp
sandbox/libs/extension/test/factory_test.cpp
sandbox/libs/extension/test/fruit.hpp
sandbox/libs/extension/test/registry_test.cpp
sandbox/libs/extension/test/zone_test.cpp
Added: sandbox/boost/extension/basic_factory_map.hpp
==============================================================================
Added: sandbox/boost/extension/convenience.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/extension/convenience.hpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,33 @@
+/* (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)
+ */
+
+#ifndef BOOST_EXTENSION_CONVENIENCE_HPP
+#define BOOST_EXTENSION_CONVENIENCE_HPP
+
+#include <boost/extension/factory_map.hpp>
+
+namespace boost{namespace extensions{
+
+inline void load_single_library(factory_map & current_zone, const char * library_path, const char * external_function_name)
+{
+ shared_library lib(library_path);
+ if (!lib.open())
+ {
+ return;
+ }
+ functor<void, factory_map &> load_func = lib.get_functor<void, factory_map &>(external_function_name);
+ if (!load_func.is_valid())
+ {
+ return;
+ }
+ load_func(current_zone);
+}
+
+}}
+
+
+
+#endif
Added: sandbox/boost/extension/counted_factory.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/extension/counted_factory.hpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,452 @@
+/* (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)
+*/
+#ifndef BOOST_EXTENSION_COUNTED_FACTORY_HPP
+#define BOOST_EXTENSION_COUNTED_FACTORY_HPP
+#include <string>
+namespace boost{namespace extensions{
+ template <class Interface, class Info, class Param1 = void, class Param2 = void, class Param3 = void, class Param4 = void, class Param5 = void, class Param6 = void>
+class counted_factory
+{
+private:
+ int * counter_;
+ std::string library_;
+ class generic_factory_function
+ {
+ public:
+ virtual ~generic_factory_function(){}
+ virtual Interface * operator()(Param1, Param2, Param3, Param4, Param5, Param6) = 0;
+ virtual generic_factory_function * copy() const = 0;
+ };
+ template <class T>
+ class factory_function : public generic_factory_function
+ {
+ public:
+ class counted_object : public T
+ {
+ private:
+ int * counter_;
+ public:
+ counted_object(int * counter, Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) : T(p1, p2, p3, p4, p5, p6),
+ counter_(counter)
+ {
+ ++(*counter_);
+ }
+ ~counted_object()
+ {
+ --(*counter_);
+ }
+ };
+ virtual ~factory_function(){}
+ virtual Interface * operator()
+ (int * counter, Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)
+ {return new counted_object(counter_, p1, p2, p3, p4, p5, p6);}
+ virtual generic_factory_function * copy() const {return new factory_function<T>;}
+ };
+ std::auto_ptr<generic_factory_function> factory_func_ptr_;
+ Info info_;
+public:
+ const char * library()
+ {
+ return library_.c_str();
+ }
+ template <class Actual>
+ void set_type_special(Actual *){factory_func_ptr_.reset(new factory_function<Actual>());}
+ template <class Actual>
+ void set_type(){factory_func_ptr_ = new factory_function<Actual>();}
+ counted_factory(Info info)
+ :factory_func_ptr_(0),
+ info_(info)
+ {}
+ counted_factory(const counted_factory & first)
+ :factory_func_ptr_(first.factory_func_ptr_->copy()),
+ info_(first.info_)
+ {}
+ Interface * operator()(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)
+ {return create(p1, p2, p3, p4, p5, p6);}
+ Interface * create(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6){return (*factory_func_ptr_)
+ (p1, p2, p3, p4, p5, p6);}
+ Info & get_info(){return info_;}
+};
+template <class Interface, class Info, class Param1, class Param2, class Param3, class Param4, class Param5>
+class counted_factory<Interface, Info, Param1, Param2, Param3, Param4, Param5>
+{
+private:
+ int * counter_;
+ std::string library_;
+ class generic_factory_function
+ {
+ public:
+ virtual ~generic_factory_function(){}
+ virtual Interface * operator()(Param1, Param2, Param3, Param4, Param5) = 0;
+ virtual generic_factory_function * copy() const = 0;
+ };
+ template <class T>
+ class factory_function : public generic_factory_function
+ {
+ public:
+ class counted_object : public T
+ {
+ private:
+ int * counter_;
+ public:
+ counted_object(int * counter, Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) : T(p1, p2, p3, p4, p5),
+ counter_(counter)
+ {
+ ++(*counter_);
+ }
+ ~counted_object()
+ {
+ --(*counter_);
+ }
+ };
+ virtual ~factory_function(){}
+ virtual Interface * operator()
+ (int * counter, Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)
+ {return new counted_object(counter_, p1, p2, p3, p4, p5);}
+ virtual generic_factory_function * copy() const {return new factory_function<T>;}
+ };
+ std::auto_ptr<generic_factory_function> factory_func_ptr_;
+ Info info_;
+public:
+ const char * library()
+ {
+ return library_.c_str();
+ }
+ template <class Actual>
+ void set_type_special(Actual *){factory_func_ptr_.reset(new factory_function<Actual>());}
+ template <class Actual>
+ void set_type(){factory_func_ptr_ = new factory_function<Actual>();}
+ counted_factory(Info info)
+ :factory_func_ptr_(0),
+ info_(info)
+ {}
+ counted_factory(const counted_factory & first)
+ :factory_func_ptr_(first.factory_func_ptr_->copy()),
+ info_(first.info_)
+ {}
+ Interface * operator()(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)
+ {return create(p1, p2, p3, p4, p5);}
+ Interface * create(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5){return (*factory_func_ptr_)
+ (p1, p2, p3, p4, p5);}
+ Info & get_info(){return info_;}
+};
+template <class Interface, class Info, class Param1, class Param2, class Param3, class Param4>
+class counted_factory<Interface, Info, Param1, Param2, Param3, Param4>
+{
+private:
+ int * counter_;
+ std::string library_;
+ class generic_factory_function
+ {
+ public:
+ virtual ~generic_factory_function(){}
+ virtual Interface * operator()(Param1, Param2, Param3, Param4) = 0;
+ virtual generic_factory_function * copy() const = 0;
+ };
+ template <class T>
+ class factory_function : public generic_factory_function
+ {
+ public:
+ class counted_object : public T
+ {
+ private:
+ int * counter_;
+ public:
+ counted_object(int * counter, Param1 p1, Param2 p2, Param3 p3, Param4 p4) : T(p1, p2, p3, p4),
+ counter_(counter)
+ {
+ ++(*counter_);
+ }
+ ~counted_object()
+ {
+ --(*counter_);
+ }
+ };
+ virtual ~factory_function(){}
+ virtual Interface * operator()
+ (int * counter, Param1 p1, Param2 p2, Param3 p3, Param4 p4)
+ {return new counted_object(counter_, p1, p2, p3, p4);}
+ virtual generic_factory_function * copy() const {return new factory_function<T>;}
+ };
+ std::auto_ptr<generic_factory_function> factory_func_ptr_;
+ Info info_;
+public:
+ const char * library()
+ {
+ return library_.c_str();
+ }
+ template <class Actual>
+ void set_type_special(Actual *){factory_func_ptr_.reset(new factory_function<Actual>());}
+ template <class Actual>
+ void set_type(){factory_func_ptr_ = new factory_function<Actual>();}
+ counted_factory(Info info)
+ :factory_func_ptr_(0),
+ info_(info)
+ {}
+ counted_factory(const counted_factory & first)
+ :factory_func_ptr_(first.factory_func_ptr_->copy()),
+ info_(first.info_)
+ {}
+ Interface * operator()(Param1 p1, Param2 p2, Param3 p3, Param4 p4)
+ {return create(p1, p2, p3, p4);}
+ Interface * create(Param1 p1, Param2 p2, Param3 p3, Param4 p4){return (*factory_func_ptr_)
+ (p1, p2, p3, p4);}
+ Info & get_info(){return info_;}
+};
+template <class Interface, class Info, class Param1, class Param2, class Param3>
+class counted_factory<Interface, Info, Param1, Param2, Param3>
+{
+private:
+ int * counter_;
+ std::string library_;
+ class generic_factory_function
+ {
+ public:
+ virtual ~generic_factory_function(){}
+ virtual Interface * operator()(Param1, Param2, Param3) = 0;
+ virtual generic_factory_function * copy() const = 0;
+ };
+ template <class T>
+ class factory_function : public generic_factory_function
+ {
+ public:
+ class counted_object : public T
+ {
+ private:
+ int * counter_;
+ public:
+ counted_object(int * counter, Param1 p1, Param2 p2, Param3 p3) : T(p1, p2, p3),
+ counter_(counter)
+ {
+ ++(*counter_);
+ }
+ ~counted_object()
+ {
+ --(*counter_);
+ }
+ };
+ virtual ~factory_function(){}
+ virtual Interface * operator()
+ (int * counter, Param1 p1, Param2 p2, Param3 p3)
+ {return new counted_object(counter_, p1, p2, p3);}
+ virtual generic_factory_function * copy() const {return new factory_function<T>;}
+ };
+ std::auto_ptr<generic_factory_function> factory_func_ptr_;
+ Info info_;
+public:
+ const char * library()
+ {
+ return library_.c_str();
+ }
+ template <class Actual>
+ void set_type_special(Actual *){factory_func_ptr_.reset(new factory_function<Actual>());}
+ template <class Actual>
+ void set_type(){factory_func_ptr_ = new factory_function<Actual>();}
+ counted_factory(Info info)
+ :factory_func_ptr_(0),
+ info_(info)
+ {}
+ counted_factory(const counted_factory & first)
+ :factory_func_ptr_(first.factory_func_ptr_->copy()),
+ info_(first.info_)
+ {}
+ Interface * operator()(Param1 p1, Param2 p2, Param3 p3)
+ {return create(p1, p2, p3);}
+ Interface * create(Param1 p1, Param2 p2, Param3 p3){return (*factory_func_ptr_)
+ (p1, p2, p3);}
+ Info & get_info(){return info_;}
+};
+template <class Interface, class Info, class Param1, class Param2>
+class counted_factory<Interface, Info, Param1, Param2>
+{
+private:
+ int * counter_;
+ std::string library_;
+ class generic_factory_function
+ {
+ public:
+ virtual ~generic_factory_function(){}
+ virtual Interface * operator()(Param1, Param2) = 0;
+ virtual generic_factory_function * copy() const = 0;
+ };
+ template <class T>
+ class factory_function : public generic_factory_function
+ {
+ public:
+ class counted_object : public T
+ {
+ private:
+ int * counter_;
+ public:
+ counted_object(int * counter, Param1 p1, Param2 p2) : T(p1, p2),
+ counter_(counter)
+ {
+ ++(*counter_);
+ }
+ ~counted_object()
+ {
+ --(*counter_);
+ }
+ };
+ virtual ~factory_function(){}
+ virtual Interface * operator()
+ (int * counter, Param1 p1, Param2 p2)
+ {return new counted_object(counter_, p1, p2);}
+ virtual generic_factory_function * copy() const {return new factory_function<T>;}
+ };
+ std::auto_ptr<generic_factory_function> factory_func_ptr_;
+ Info info_;
+public:
+ const char * library()
+ {
+ return library_.c_str();
+ }
+ template <class Actual>
+ void set_type_special(Actual *){factory_func_ptr_.reset(new factory_function<Actual>());}
+ template <class Actual>
+ void set_type(){factory_func_ptr_ = new factory_function<Actual>();}
+ counted_factory(Info info)
+ :factory_func_ptr_(0),
+ info_(info)
+ {}
+ counted_factory(const counted_factory & first)
+ :factory_func_ptr_(first.factory_func_ptr_->copy()),
+ info_(first.info_)
+ {}
+ Interface * operator()(Param1 p1, Param2 p2)
+ {return create(p1, p2);}
+ Interface * create(Param1 p1, Param2 p2){return (*factory_func_ptr_)
+ (p1, p2);}
+ Info & get_info(){return info_;}
+};
+template <class Interface, class Info, class Param1>
+class counted_factory<Interface, Info, Param1>
+{
+private:
+ int * counter_;
+ std::string library_;
+ class generic_factory_function
+ {
+ public:
+ virtual ~generic_factory_function(){}
+ virtual Interface * operator()(Param1) = 0;
+ virtual generic_factory_function * copy() const = 0;
+ };
+ template <class T>
+ class factory_function : public generic_factory_function
+ {
+ public:
+ class counted_object : public T
+ {
+ private:
+ int * counter_;
+ public:
+ counted_object(int * counter, Param1 p1) : T(p1),
+ counter_(counter)
+ {
+ ++(*counter_);
+ }
+ ~counted_object()
+ {
+ --(*counter_);
+ }
+ };
+ virtual ~factory_function(){}
+ virtual Interface * operator()
+ (int * counter, Param1 p1)
+ {return new counted_object(counter_, p1);}
+ virtual generic_factory_function * copy() const {return new factory_function<T>;}
+ };
+ std::auto_ptr<generic_factory_function> factory_func_ptr_;
+ Info info_;
+public:
+ const char * library()
+ {
+ return library_.c_str();
+ }
+ template <class Actual>
+ void set_type_special(Actual *){factory_func_ptr_.reset(new factory_function<Actual>());}
+ template <class Actual>
+ void set_type(){factory_func_ptr_ = new factory_function<Actual>();}
+ counted_factory(Info info)
+ :factory_func_ptr_(0),
+ info_(info)
+ {}
+ counted_factory(const counted_factory & first)
+ :factory_func_ptr_(first.factory_func_ptr_->copy()),
+ info_(first.info_)
+ {}
+ Interface * operator()(Param1 p1)
+ {return create(p1);}
+ Interface * create(Param1 p1){return (*factory_func_ptr_)
+ (p1);}
+ Info & get_info(){return info_;}
+};
+template <class Interface, class Info>
+class counted_factory<Interface, Info>
+{
+private:
+ int * counter_;
+ std::string library_;
+ class generic_factory_function
+ {
+ public:
+ virtual ~generic_factory_function(){}
+ virtual Interface * operator()() = 0;
+ virtual generic_factory_function * copy() const = 0;
+ };
+ template <class T>
+ class factory_function : public generic_factory_function
+ {
+ public:
+ class counted_object : public T
+ {
+ private:
+ int * counter_;
+ public:
+ counted_object(int * counter) : T(),
+ counter_(counter)
+ {
+ ++(*counter_);
+ }
+ ~counted_object()
+ {
+ --(*counter_);
+ }
+ };
+ virtual ~factory_function(){}
+ virtual Interface * operator()
+ (int * counter)
+ {return new counted_object(counter_);}
+ virtual generic_factory_function * copy() const {return new factory_function<T>;}
+ };
+ std::auto_ptr<generic_factory_function> factory_func_ptr_;
+ Info info_;
+public:
+ const char * library()
+ {
+ return library_.c_str();
+ }
+ template <class Actual>
+ void set_type_special(Actual *){factory_func_ptr_.reset(new factory_function<Actual>());}
+ template <class Actual>
+ void set_type(){factory_func_ptr_ = new factory_function<Actual>();}
+ counted_factory(Info info)
+ :factory_func_ptr_(0),
+ info_(info)
+ {}
+ counted_factory(const counted_factory & first)
+ :factory_func_ptr_(first.factory_func_ptr_->copy()),
+ info_(first.info_)
+ {}
+ Interface * operator()()
+ {return create();}
+ Interface * create(){return (*factory_func_ptr_)
+ ();}
+ Info & get_info(){return info_;}
+};
+}}
+#endif
Added: sandbox/boost/extension/counted_factory_map.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/extension/counted_factory_map.hpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,321 @@
+/* (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)
+ */
+
+#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>
+
+namespace boost{namespace extensions{
+
+
+template <class TypeInfo>
+class basic_counted_factory_map
+{
+protected:
+ class generic_factory_container
+ {
+ public:
+ virtual bool erase(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:
+ virtual bool erase(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(); ++it)
+ {
+ if (strcmp(it->library(), library_name) == 0)
+ erase(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 * current_counter_;
+public:
+ ~basic_counted_factory_map(){
+ for(typename FactoryMap::iterator it = factories_.begin(); it != factories_.end(); ++it)
+ delete it->second;
+ //TODO - test for memory leaks.
+ }
+ 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>();
+ 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_type<Actual>();
+ f.set_type_special((Actual*)0);
+ s.push_back(f);
+ f.set_library(current_library_);
+ f.set_counter(current_counter_);
+ //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>();
+ 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_type<Actual>();
+ f.set_type_special((Actual*)0);
+ s.push_back(f);
+ f.set_library(current_library_);
+ f.set_counter(current_counter_);
+ //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>();
+ 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_type<Actual>();
+ f.set_type_special((Actual*)0);
+ s.push_back(f);
+ f.set_library(current_library_);
+ f.set_counter(current_counter_);
+ //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>();
+ 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_type<Actual>();
+ f.set_type_special((Actual*)0);
+ s.push_back(f);
+ f.set_library(current_library_);
+ f.set_counter(current_counter_);
+ //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>();
+ 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_type<Actual>();
+ f.set_type_special((Actual*)0);
+ s.push_back(f);
+ f.set_library(current_library_);
+ f.set_counter(current_counter_);
+ //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>();
+ 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_type<Actual>();
+ f.set_type_special((Actual*)0);
+ s.push_back(f);
+ f.set_library(current_library_);
+ f.set_counter(current_counter_);
+ //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>();
+ 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_type<Actual>();
+ f.set_type_special((Actual*)0);
+ s.push_back(f);
+ f.set_library(current_library_);
+ f.set_counter(current_counter_);
+ //it->set_type<Actual>();
+ }
+};
+
+typedef basic_counted_factory_map<default_type_info> counted_factory_map;
+}}
+
+#endif
Added: sandbox/boost/extension/counted_factorymap.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/extension/counted_factorymap.hpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,303 @@
+/* (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)
+ */
+
+#ifndef BOOST_EXTENSION_COUNTED_FACTORY_MAP_HPP
+#define BOOST_EXTENSION_COUNTED_FACTORYZONE_HPP
+#include <list>
+#include <memory>
+#include <map>
+#include <boost/extension/counted_factoryfactory.hpp>
+#include <boost/extension/impl/typeinfo.hpp>
+
+namespace boost{namespace extensions{
+
+
+template <class TypeInfo>
+class basic_counted_factory_map
+{
+private:
+ class generic_factory_container
+ {
+ public:
+ 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:
+ factory_container(){}
+ factory_container(basic_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_;
+ //template <class ClassType>
+ //TypeInfo get_class_type();
+public:
+ ~basic_factory_map(){
+ for(typename FactoryMap::iterator it = factories_.begin(); it != factories_.end(); ++it)
+ delete it->second;
+ //TODO - test for memory leaks.
+ }
+ template <class Interface, class Info>
+operator std::list<counted_factory<Interface, Info> > & ()
+ {return this->get<Interface, Info>();}
+ template <class Interface, class Info>
+std::list<factory<Interface, Info> > & get()
+ {
+ TypeInfo current_type =
+ type_info_handler<TypeInfo, 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>();
+ 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_type<Actual>();
+ f.set_type_special((Actual*)0);
+ s.push_back(f);
+ f.set_library(current_library_);
+ //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<factory<Interface, Info, Param1> > & get()
+ {
+ TypeInfo current_type =
+ type_info_handler<TypeInfo, 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>();
+ 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_type<Actual>();
+ f.set_type_special((Actual*)0);
+ s.push_back(f);
+ f.set_library(current_library_);
+ //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<factory<Interface, Info, Param1, Param2> > & get()
+ {
+ TypeInfo current_type =
+ type_info_handler<TypeInfo, 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>();
+ 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_type<Actual>();
+ f.set_type_special((Actual*)0);
+ s.push_back(f);
+ f.set_library(current_library_);
+ //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<factory<Interface, Info, Param1, Param2, Param3> > & get()
+ {
+ TypeInfo current_type =
+ type_info_handler<TypeInfo, 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>();
+ 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_type<Actual>();
+ f.set_type_special((Actual*)0);
+ s.push_back(f);
+ f.set_library(current_library_);
+ //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<factory<Interface, Info, Param1, Param2, Param3, Param4> > & get()
+ {
+ TypeInfo current_type =
+ type_info_handler<TypeInfo, 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>();
+ 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_type<Actual>();
+ f.set_type_special((Actual*)0);
+ s.push_back(f);
+ f.set_library(current_library_);
+ //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<factory<Interface, Info, Param1, Param2, Param3, Param4, Param5> > & get()
+ {
+ TypeInfo current_type =
+ type_info_handler<TypeInfo, 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>();
+ 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_type<Actual>();
+ f.set_type_special((Actual*)0);
+ s.push_back(f);
+ f.set_library(current_library_);
+ //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<factory<Interface, Info, Param1, Param2, Param3, Param4, Param5, Param6> > & get()
+ {
+ TypeInfo current_type =
+ type_info_handler<TypeInfo, 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>();
+ 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_type<Actual>();
+ f.set_type_special((Actual*)0);
+ s.push_back(f);
+ f.set_library(current_library_);
+ //it->set_type<Actual>();
+ }
+};
+
+typedef basic_counted_factory_map<default_type_info> counted_factory_map;
+}}
+
+#endif
Added: sandbox/boost/extension/extension.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/extension/extension.hpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,18 @@
+/* (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)
+ */
+
+#ifndef BOOST_EXTENSION_EXTENSION_HPP
+#define BOOST_EXTENSION_EXTENSION_HPP
+
+#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+# define BOOST_EXTENSION_EXPORT_DECL __declspec(dllexport)
+# define BOOST_EXTENSION_IMPORT_DECL __declspec(dllimport)
+#else
+# define BOOST_EXTENSION_EXPORT_DECL
+# define BOOST_EXTENSION_IMPORT_DECL
+#endif
+
+#endif
\ No newline at end of file
Added: sandbox/boost/extension/factory.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/extension/factory.hpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,305 @@
+/* (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)
+*/
+#ifndef BOOST_EXTENSION_FACTORY_HPP
+#define BOOST_EXTENSION_FACTORY_HPP
+#include <string>
+namespace boost{namespace extensions{
+ 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
+{
+private:
+ class generic_factory_function
+ {
+ public:
+ virtual ~generic_factory_function(){}
+ virtual Interface * operator()(Param1, Param2, Param3, Param4, Param5, Param6) = 0;
+ virtual generic_factory_function * copy() const = 0;
+ };
+ template <class T>
+ class factory_function : public generic_factory_function
+ {
+ public:
+ virtual ~factory_function(){}
+ virtual Interface * operator()
+ (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)
+ {return new T(p1, p2, p3, p4, p5, p6);}
+ virtual generic_factory_function * copy() const {return new factory_function<T>;}
+ };
+ std::auto_ptr<generic_factory_function> factory_func_ptr_;
+ Info info_;
+public:
+ template <class Actual>
+ void set_type_special(Actual *){factory_func_ptr_.reset(new factory_function<Actual>());}
+ template <class Actual>
+ void set_type(){factory_func_ptr_ = new factory_function<Actual>();}
+ factory(Info info)
+ :factory_func_ptr_(0),
+ info_(info)
+ {}
+ factory(const factory & first)
+ :factory_func_ptr_(first.factory_func_ptr_->copy()),
+ info_(first.info_)
+ {}
+ Interface * operator()(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)
+ {return create(p1, p2, p3, p4, p5, p6);}
+ Interface * create(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6){return (*factory_func_ptr_)
+ (p1, p2, p3, p4, p5, p6);}
+ Info & get_info(){return info_;}
+};
+template <class Interface, class Info, class Param1, class Param2, class Param3, class Param4, class Param5>
+class factory<Interface, Info, Param1, Param2, Param3, Param4, Param5>
+{
+private:
+ class generic_factory_function
+ {
+ public:
+ virtual ~generic_factory_function(){}
+ virtual Interface * operator()(Param1, Param2, Param3, Param4, Param5) = 0;
+ virtual generic_factory_function * copy() const = 0;
+ };
+ template <class T>
+ class factory_function : public generic_factory_function
+ {
+ public:
+ virtual ~factory_function(){}
+ virtual Interface * operator()
+ (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)
+ {return new T(p1, p2, p3, p4, p5);}
+ virtual generic_factory_function * copy() const {return new factory_function<T>;}
+ };
+ std::auto_ptr<generic_factory_function> factory_func_ptr_;
+ Info info_;
+public:
+ template <class Actual>
+ void set_type_special(Actual *){factory_func_ptr_.reset(new factory_function<Actual>());}
+ template <class Actual>
+ void set_type(){factory_func_ptr_ = new factory_function<Actual>();}
+ factory(Info info)
+ :factory_func_ptr_(0),
+ info_(info)
+ {}
+ factory(const factory & first)
+ :factory_func_ptr_(first.factory_func_ptr_->copy()),
+ info_(first.info_)
+ {}
+ Interface * operator()(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)
+ {return create(p1, p2, p3, p4, p5);}
+ Interface * create(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5){return (*factory_func_ptr_)
+ (p1, p2, p3, p4, p5);}
+ Info & get_info(){return info_;}
+};
+template <class Interface, class Info, class Param1, class Param2, class Param3, class Param4>
+class factory<Interface, Info, Param1, Param2, Param3, Param4>
+{
+private:
+ class generic_factory_function
+ {
+ public:
+ virtual ~generic_factory_function(){}
+ virtual Interface * operator()(Param1, Param2, Param3, Param4) = 0;
+ virtual generic_factory_function * copy() const = 0;
+ };
+ template <class T>
+ class factory_function : public generic_factory_function
+ {
+ public:
+ virtual ~factory_function(){}
+ virtual Interface * operator()
+ (Param1 p1, Param2 p2, Param3 p3, Param4 p4)
+ {return new T(p1, p2, p3, p4);}
+ virtual generic_factory_function * copy() const {return new factory_function<T>;}
+ };
+ std::auto_ptr<generic_factory_function> factory_func_ptr_;
+ Info info_;
+public:
+ template <class Actual>
+ void set_type_special(Actual *){factory_func_ptr_.reset(new factory_function<Actual>());}
+ template <class Actual>
+ void set_type(){factory_func_ptr_ = new factory_function<Actual>();}
+ factory(Info info)
+ :factory_func_ptr_(0),
+ info_(info)
+ {}
+ factory(const factory & first)
+ :factory_func_ptr_(first.factory_func_ptr_->copy()),
+ info_(first.info_)
+ {}
+ Interface * operator()(Param1 p1, Param2 p2, Param3 p3, Param4 p4)
+ {return create(p1, p2, p3, p4);}
+ Interface * create(Param1 p1, Param2 p2, Param3 p3, Param4 p4){return (*factory_func_ptr_)
+ (p1, p2, p3, p4);}
+ Info & get_info(){return info_;}
+};
+template <class Interface, class Info, class Param1, class Param2, class Param3>
+class factory<Interface, Info, Param1, Param2, Param3>
+{
+private:
+ class generic_factory_function
+ {
+ public:
+ virtual ~generic_factory_function(){}
+ virtual Interface * operator()(Param1, Param2, Param3) = 0;
+ virtual generic_factory_function * copy() const = 0;
+ };
+ template <class T>
+ class factory_function : public generic_factory_function
+ {
+ public:
+ virtual ~factory_function(){}
+ virtual Interface * operator()
+ (Param1 p1, Param2 p2, Param3 p3)
+ {return new T(p1, p2, p3);}
+ virtual generic_factory_function * copy() const {return new factory_function<T>;}
+ };
+ std::auto_ptr<generic_factory_function> factory_func_ptr_;
+ Info info_;
+public:
+ template <class Actual>
+ void set_type_special(Actual *){factory_func_ptr_.reset(new factory_function<Actual>());}
+ template <class Actual>
+ void set_type(){factory_func_ptr_ = new factory_function<Actual>();}
+ factory(Info info)
+ :factory_func_ptr_(0),
+ info_(info)
+ {}
+ factory(const factory & first)
+ :factory_func_ptr_(first.factory_func_ptr_->copy()),
+ info_(first.info_)
+ {}
+ Interface * operator()(Param1 p1, Param2 p2, Param3 p3)
+ {return create(p1, p2, p3);}
+ Interface * create(Param1 p1, Param2 p2, Param3 p3){return (*factory_func_ptr_)
+ (p1, p2, p3);}
+ Info & get_info(){return info_;}
+};
+template <class Interface, class Info, class Param1, class Param2>
+class factory<Interface, Info, Param1, Param2>
+{
+private:
+ class generic_factory_function
+ {
+ public:
+ virtual ~generic_factory_function(){}
+ virtual Interface * operator()(Param1, Param2) = 0;
+ virtual generic_factory_function * copy() const = 0;
+ };
+ template <class T>
+ class factory_function : public generic_factory_function
+ {
+ public:
+ virtual ~factory_function(){}
+ virtual Interface * operator()
+ (Param1 p1, Param2 p2)
+ {return new T(p1, p2);}
+ virtual generic_factory_function * copy() const {return new factory_function<T>;}
+ };
+ std::auto_ptr<generic_factory_function> factory_func_ptr_;
+ Info info_;
+public:
+ template <class Actual>
+ void set_type_special(Actual *){factory_func_ptr_.reset(new factory_function<Actual>());}
+ template <class Actual>
+ void set_type(){factory_func_ptr_ = new factory_function<Actual>();}
+ factory(Info info)
+ :factory_func_ptr_(0),
+ info_(info)
+ {}
+ factory(const factory & first)
+ :factory_func_ptr_(first.factory_func_ptr_->copy()),
+ info_(first.info_)
+ {}
+ Interface * operator()(Param1 p1, Param2 p2)
+ {return create(p1, p2);}
+ Interface * create(Param1 p1, Param2 p2){return (*factory_func_ptr_)
+ (p1, p2);}
+ Info & get_info(){return info_;}
+};
+template <class Interface, class Info, class Param1>
+class factory<Interface, Info, Param1>
+{
+private:
+ class generic_factory_function
+ {
+ public:
+ virtual ~generic_factory_function(){}
+ virtual Interface * operator()(Param1) = 0;
+ virtual generic_factory_function * copy() const = 0;
+ };
+ template <class T>
+ class factory_function : public generic_factory_function
+ {
+ public:
+ virtual ~factory_function(){}
+ virtual Interface * operator()
+ (Param1 p1)
+ {return new T(p1);}
+ virtual generic_factory_function * copy() const {return new factory_function<T>;}
+ };
+ std::auto_ptr<generic_factory_function> factory_func_ptr_;
+ Info info_;
+public:
+ template <class Actual>
+ void set_type_special(Actual *){factory_func_ptr_.reset(new factory_function<Actual>());}
+ template <class Actual>
+ void set_type(){factory_func_ptr_ = new factory_function<Actual>();}
+ factory(Info info)
+ :factory_func_ptr_(0),
+ info_(info)
+ {}
+ factory(const factory & first)
+ :factory_func_ptr_(first.factory_func_ptr_->copy()),
+ info_(first.info_)
+ {}
+ Interface * operator()(Param1 p1)
+ {return create(p1);}
+ Interface * create(Param1 p1){return (*factory_func_ptr_)
+ (p1);}
+ Info & get_info(){return info_;}
+};
+template <class Interface, class Info>
+class factory<Interface, Info>
+{
+private:
+ class generic_factory_function
+ {
+ public:
+ virtual ~generic_factory_function(){}
+ virtual Interface * operator()() = 0;
+ virtual generic_factory_function * copy() const = 0;
+ };
+ template <class T>
+ class factory_function : public generic_factory_function
+ {
+ public:
+ virtual ~factory_function(){}
+ virtual Interface * operator()
+ ()
+ {return new T();}
+ virtual generic_factory_function * copy() const {return new factory_function<T>;}
+ };
+ std::auto_ptr<generic_factory_function> factory_func_ptr_;
+ Info info_;
+public:
+ template <class Actual>
+ void set_type_special(Actual *){factory_func_ptr_.reset(new factory_function<Actual>());}
+ template <class Actual>
+ void set_type(){factory_func_ptr_ = new factory_function<Actual>();}
+ factory(Info info)
+ :factory_func_ptr_(0),
+ info_(info)
+ {}
+ factory(const factory & first)
+ :factory_func_ptr_(first.factory_func_ptr_->copy()),
+ info_(first.info_)
+ {}
+ Interface * operator()()
+ {return create();}
+ Interface * create(){return (*factory_func_ptr_)
+ ();}
+ Info & get_info(){return info_;}
+};
+}}
+#endif
Added: sandbox/boost/extension/factory_map.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/extension/factory_map.hpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,295 @@
+/* (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)
+ */
+
+#ifndef BOOST_EXTENSION_FACTORY_MAP_HPP
+#define BOOST_EXTENSION_FACTORY_MAP_HPP
+#include <list>
+#include <memory>
+#include <map>
+#include <boost/extension/factory.hpp>
+#include <boost/extension/extension.hpp>
+#include <boost/extension/impl/typeinfo.hpp>
+
+namespace boost{namespace extensions{
+
+
+template <class TypeInfo>
+class basic_factory_map
+{
+private:
+ class generic_factory_container
+ {
+ public:
+ 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<factory<Interface, Info, Param1, Param2, Param3, Param4, Param5, Param6> >, public generic_factory_container
+ {
+ public:
+ factory_container(){}
+ factory_container(basic_factory_map & z)
+ :std::list<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_;
+public:
+ ~basic_factory_map(){
+ for(typename FactoryMap::iterator it = factories_.begin(); it != factories_.end(); ++it)
+ delete it->second;
+ //TODO - test for memory leaks.
+ }
+ template <class Interface, class Info>
+operator std::list<factory<Interface, Info> > & ()
+ {return this->get<Interface, Info>();}
+ template <class Interface, class Info>
+std::list<factory<Interface, Info> > & get()
+ {
+ TypeInfo current_type =
+ type_info_handler<TypeInfo, 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>();
+ 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<factory<Interface, Info> > ListType;
+ ListType & s = this->get<Interface, Info>();
+ factory<Interface, Info> f(info);
+ //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<factory<Interface, Info, Param1> > & ()
+ {return this->get<Interface, Info, Param1>();}
+ template <class Interface, class Info, class Param1>
+std::list<factory<Interface, Info, Param1> > & get()
+ {
+ TypeInfo current_type =
+ type_info_handler<TypeInfo, 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>();
+ 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<factory<Interface, Info, Param1> > ListType;
+ ListType & s = this->get<Interface, Info, Param1>();
+ factory<Interface, Info, Param1> f(info);
+ //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<factory<Interface, Info, Param1, Param2> > & ()
+ {return this->get<Interface, Info, Param1, Param2>();}
+ template <class Interface, class Info, class Param1, class Param2>
+std::list<factory<Interface, Info, Param1, Param2> > & get()
+ {
+ TypeInfo current_type =
+ type_info_handler<TypeInfo, 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>();
+ 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<factory<Interface, Info, Param1, Param2> > ListType;
+ ListType & s = this->get<Interface, Info, Param1, Param2>();
+ factory<Interface, Info, Param1, Param2> f(info);
+ //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<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<factory<Interface, Info, Param1, Param2, Param3> > & get()
+ {
+ TypeInfo current_type =
+ type_info_handler<TypeInfo, 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>();
+ 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<factory<Interface, Info, Param1, Param2, Param3> > ListType;
+ ListType & s = this->get<Interface, Info, Param1, Param2, Param3>();
+ factory<Interface, Info, Param1, Param2, Param3> f(info);
+ //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<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<factory<Interface, Info, Param1, Param2, Param3, Param4> > & get()
+ {
+ TypeInfo current_type =
+ type_info_handler<TypeInfo, 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>();
+ 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<factory<Interface, Info, Param1, Param2, Param3, Param4> > ListType;
+ ListType & s = this->get<Interface, Info, Param1, Param2, Param3, Param4>();
+ factory<Interface, Info, Param1, Param2, Param3, Param4> f(info);
+ //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<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<factory<Interface, Info, Param1, Param2, Param3, Param4, Param5> > & get()
+ {
+ TypeInfo current_type =
+ type_info_handler<TypeInfo, 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>();
+ 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<factory<Interface, Info, Param1, Param2, Param3, Param4, Param5> > ListType;
+ ListType & s = this->get<Interface, Info, Param1, Param2, Param3, Param4, Param5>();
+ factory<Interface, Info, Param1, Param2, Param3, Param4, Param5> f(info);
+ //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<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<factory<Interface, Info, Param1, Param2, Param3, Param4, Param5, Param6> > & get()
+ {
+ TypeInfo current_type =
+ type_info_handler<TypeInfo, 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>();
+ 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<factory<Interface, Info, Param1, Param2, Param3, Param4, Param5, Param6> > ListType;
+ ListType & s = this->get<Interface, Info, Param1, Param2, Param3, Param4, Param5, Param6>();
+ factory<Interface, Info, Param1, Param2, Param3, Param4, Param5, Param6> f(info);
+ //f.set_type<Actual>();
+ f.set_type_special((Actual*)0);
+ s.push_back(f);
+ //it->set_type<Actual>();
+ }
+};
+
+typedef basic_factory_map<default_type_info> factory_map;
+}}
+
+#endif
Added: sandbox/boost/extension/factorymap.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/extension/factorymap.hpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,296 @@
+/* (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)
+ */
+
+#ifndef BOOST_EXTENSION_FACTORY_MAP_HPP
+#define BOOST_EXTENSION_FACTORYZONE_HPP
+#include <list>
+#include <memory>
+#include <map>
+#include <boost/extension/factoryfactory.hpp>
+#include <boost/extension/impl/typeinfo.hpp>
+
+namespace boost{namespace extensions{
+
+
+template <class TypeInfo>
+class basic_factory_map
+{
+private:
+ class generic_factory_container
+ {
+ public:
+ 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<factory<Interface, Info, Param1, Param2, Param3, Param4, Param5, Param6> >, public generic_factory_container
+ {
+ public:
+ factory_container(){}
+ factory_container(basic_factory_map & z)
+ :std::list<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_;
+ //template <class ClassType>
+ //TypeInfo get_class_type();
+public:
+ ~basic_factory_map(){
+ for(typename FactoryMap::iterator it = factories_.begin(); it != factories_.end(); ++it)
+ delete it->second;
+ //TODO - test for memory leaks.
+ }
+ template <class Interface, class Info>
+operator std::list<factory<Interface, Info> > & ()
+ {return this->get<Interface, Info>();}
+ template <class Interface, class Info>
+std::list<factory<Interface, Info> > & get()
+ {
+ TypeInfo current_type =
+ type_info_handler<TypeInfo, 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>();
+ 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<factory<Interface, Info> > ListType;
+ ListType & s = this->get<Interface, Info>();
+ factory<Interface, Info> f(info);
+ //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<factory<Interface, Info, Param1> > & ()
+ {return this->get<Interface, Info, Param1>();}
+ template <class Interface, class Info, class Param1>
+std::list<factory<Interface, Info, Param1> > & get()
+ {
+ TypeInfo current_type =
+ type_info_handler<TypeInfo, 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>();
+ 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<factory<Interface, Info, Param1> > ListType;
+ ListType & s = this->get<Interface, Info, Param1>();
+ factory<Interface, Info, Param1> f(info);
+ //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<factory<Interface, Info, Param1, Param2> > & ()
+ {return this->get<Interface, Info, Param1, Param2>();}
+ template <class Interface, class Info, class Param1, class Param2>
+std::list<factory<Interface, Info, Param1, Param2> > & get()
+ {
+ TypeInfo current_type =
+ type_info_handler<TypeInfo, 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>();
+ 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<factory<Interface, Info, Param1, Param2> > ListType;
+ ListType & s = this->get<Interface, Info, Param1, Param2>();
+ factory<Interface, Info, Param1, Param2> f(info);
+ //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<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<factory<Interface, Info, Param1, Param2, Param3> > & get()
+ {
+ TypeInfo current_type =
+ type_info_handler<TypeInfo, 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>();
+ 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<factory<Interface, Info, Param1, Param2, Param3> > ListType;
+ ListType & s = this->get<Interface, Info, Param1, Param2, Param3>();
+ factory<Interface, Info, Param1, Param2, Param3> f(info);
+ //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<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<factory<Interface, Info, Param1, Param2, Param3, Param4> > & get()
+ {
+ TypeInfo current_type =
+ type_info_handler<TypeInfo, 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>();
+ 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<factory<Interface, Info, Param1, Param2, Param3, Param4> > ListType;
+ ListType & s = this->get<Interface, Info, Param1, Param2, Param3, Param4>();
+ factory<Interface, Info, Param1, Param2, Param3, Param4> f(info);
+ //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<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<factory<Interface, Info, Param1, Param2, Param3, Param4, Param5> > & get()
+ {
+ TypeInfo current_type =
+ type_info_handler<TypeInfo, 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>();
+ 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<factory<Interface, Info, Param1, Param2, Param3, Param4, Param5> > ListType;
+ ListType & s = this->get<Interface, Info, Param1, Param2, Param3, Param4, Param5>();
+ factory<Interface, Info, Param1, Param2, Param3, Param4, Param5> f(info);
+ //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<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<factory<Interface, Info, Param1, Param2, Param3, Param4, Param5, Param6> > & get()
+ {
+ TypeInfo current_type =
+ type_info_handler<TypeInfo, 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>();
+ 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<factory<Interface, Info, Param1, Param2, Param3, Param4, Param5, Param6> > ListType;
+ ListType & s = this->get<Interface, Info, Param1, Param2, Param3, Param4, Param5, Param6>();
+ factory<Interface, Info, Param1, Param2, Param3, Param4, Param5, Param6> f(info);
+ //f.set_type<Actual>();
+ f.set_type_special((Actual*)0);
+ s.push_back(f);
+ //it->set_type<Actual>();
+ }
+};
+
+typedef basic_factory_map<default_type_info> factory_map;
+}}
+
+#endif
Added: sandbox/boost/extension/filesystem.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/extension/filesystem.hpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,44 @@
+/* (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)
+ */
+
+#ifndef BOOST_EXTENSION_FILESYSTEM_HPP
+#define BOOST_EXTENSION_FILESYSTEM_HPP
+// These functions require the boost.filesystem library
+#include <boost/filesystem/path.hpp>
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/convenience.hpp>
+#include <boost/extension/factory_map.hpp>
+#include <boost/extension/convenience.hpp>
+
+namespace boost{namespace extensions{
+
+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
+ filesystem::directory_iterator end_file_iter;
+ boost::filesystem::path dir_path(directory);
+ filesystem::directory_iterator file_iter(dir_path);
+ for( ;file_iter!=end_file_iter; ++file_iter)
+ {
+ if (is_directory(*file_iter))
+ {
+ 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(), external_function_name);
+ }
+ }
+}
+
+
+
+
+}}
+
+
+
+#endif
Added: sandbox/boost/extension/functor.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/extension/functor.hpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,221 @@
+/* (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)
+*/
+
+#ifndef BOOST_EXTENSION_FUNCTOR_HPP
+#define BOOST_EXTENSION_FUNCTOR_HPP
+
+#include <boost/extension/impl/linked_library.hpp>
+
+#ifdef BOOST_EXTENSIONS_USE_PP
+
+#include <boost/preprocessor/arithmetic/inc.hpp>
+#include <boost/preprocessor/punctuation/comma_if.hpp>
+#include <boost/preprocessor/repetition.hpp>
+
+#ifndef BOOST_EXTENSIONS_MAX_FUNCTOR_PARAMS
+#define BOOST_EXTENSIONS_MAX_FUNCTOR_PARAMS 6
+#endif
+
+/// functor template specialization macro.
+#define BOOST_EXTENSIONS_FUNCTOR_CLASS(Z, N, _) \
+ 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) > { \
+ private: \
+ typedef ReturnValue (*FunctionType)(BOOST_PP_ENUM_PARAMS(N, Param)); \
+ FunctionType func_; \
+ public: \
+ bool is_valid() const {return func_ != 0;} \
+ functor(FunctionType func) \
+ : func_(func) {} \
+ functor(generic_function_ptr func) \
+ : func_(FunctionType(func)) {} \
+ ReturnValue operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, Param, p)) { \
+ return func_(BOOST_PP_ENUM_PARAMS(N, p)); \
+ } \
+ }; \
+/**/
+
+#endif // ifdef BOOST_EXTENSIONS_USE_PP
+
+
+namespace boost { namespace extensions {
+
+using boost::extensions::impl::generic_function_ptr;
+
+#ifdef BOOST_EXTENSIONS_USE_PP
+
+/// Declaration of functor class template.
+template <class ReturnValue,
+ BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PP_INC(BOOST_EXTENSIONS_MAX_FUNCTOR_PARAMS), class Param, void)>
+ class functor;
+
+/// Functor template specializations.
+BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_EXTENSIONS_MAX_FUNCTOR_PARAMS), BOOST_EXTENSIONS_FUNCTOR_CLASS, _)
+
+#undef BOOST_EXTENSIONS_FUNCTOR_CLASS
+#else
+
+template <class ReturnValue, class Param1 = void, class Param2 = void, class Param3 = void,
+class Param4 = void, class Param5 = void, class Param6 = void>
+class functor {
+private:
+ typedef ReturnValue (*FunctionType)(Param1, Param2, Param3, Param4, Param5, Param6);
+ FunctionType func_;
+
+public:
+ bool is_valid() const {return func_ != 0;}
+
+ functor(FunctionType func)
+ : func_(func)
+ {}
+
+ functor(generic_function_ptr func)
+ : func_(FunctionType(func))
+ {}
+
+ ReturnValue operator()(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)
+ {
+ return func_(p1, p2, p3, p4, p5, p6);
+ }
+};
+
+template <class ReturnValue, class Param1, class Param2, class Param3, class Param4, class Param5>
+class functor<ReturnValue, Param1, Param2, Param3, Param4, Param5>
+{
+private:
+ typedef ReturnValue (*FunctionType)(Param1, Param2, Param3, Param4, Param5);
+ FunctionType func_;
+
+public:
+ bool is_valid() const {return func_ != 0;}
+
+ functor(FunctionType func)
+ :func_(func)
+ {}
+ functor(generic_function_ptr func)
+ :func_(FunctionType(func))
+ {}
+ ReturnValue operator()(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)
+ {
+ return func_(p1, p2, p3, p4, p5);
+ }
+};
+
+template <class ReturnValue, class Param1, class Param2, class Param3, class Param4>
+class functor<ReturnValue, Param1, Param2, Param3, Param4>
+{
+private:
+ typedef ReturnValue (*FunctionType)(Param1, Param2, Param3, Param4);
+ FunctionType func_;
+
+public:
+ bool is_valid() const {return func_ != 0;}
+
+ functor(FunctionType func)
+ :func_(func)
+ {}
+
+ functor(generic_function_ptr func)
+ :func_(FunctionType(func))
+ {}
+
+ ReturnValue operator()(Param1 p1, Param2 p2, Param3 p3, Param4 p4)
+ {
+ return func_(p1, p2, p3, p4);
+ }
+};
+
+template <class ReturnValue, class Param1, class Param2, class Param3>
+class functor<ReturnValue, Param1, Param2, Param3>
+{
+private:
+ typedef ReturnValue (*FunctionType)(Param1, Param2, Param3);
+ FunctionType func_;
+
+public:
+ bool is_valid() const {return func_ != 0;}
+
+ functor(FunctionType func)
+ :func_(func)
+ {}
+ functor(generic_function_ptr func)
+ :func_(FunctionType(func))
+ {}
+ ReturnValue operator()(Param1 p1, Param2 p2, Param3 p3)
+ {
+ return func_(p1, p2, p3);
+ }
+};
+
+template <class ReturnValue, class Param1, class Param2>
+class functor<ReturnValue, Param1, Param2>
+{
+private:
+ typedef ReturnValue (*FunctionType)(Param1, Param2);
+ FunctionType func_;
+
+public:
+ bool is_valid() const {return func_ != 0;}
+
+ functor(FunctionType func)
+ :func_(func)
+ {}
+ functor(generic_function_ptr func)
+ :func_(FunctionType(func))
+ {}
+ ReturnValue operator()(Param1 p1, Param2 p2)
+ {
+ return func_(p1, p2);
+ }
+};
+
+template <class ReturnValue, class Param1>
+class functor<ReturnValue, Param1>
+{
+private:
+ typedef ReturnValue (*FunctionType)(Param1);
+ FunctionType func_;
+
+public:
+ bool is_valid() const {return func_ != 0;}
+ functor(FunctionType func)
+ :func_(func)
+ {}
+ functor(generic_function_ptr func)
+ :func_(FunctionType(func))
+ {}
+ ReturnValue operator()(Param1 p1)
+ {
+ return func_(p1);
+ }
+};
+
+template <class ReturnValue>
+class functor<ReturnValue>
+{
+private:
+ typedef ReturnValue (*FunctionType)();
+ FunctionType func_;
+
+public:
+ bool is_valid() const {return func_ != 0;}
+ functor(FunctionType func)
+ :func_(func)
+ {}
+ functor(generic_function_ptr func)
+ :func_(FunctionType(func))
+ {}
+ ReturnValue operator()()
+ {
+ return func_();
+ }
+};
+
+#endif // ifdef BOOST_EXTENSIONS_USE_PP
+
+}} // ns: boost::extensions
+
+#endif // BOOST_EXTENSION_FUNCTOR_HPP
Added: sandbox/boost/extension/impl/library_impl.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/extension/impl/library_impl.hpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,74 @@
+/* (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)
+ */
+
+#ifndef BOOST_EXTENSION_LIBRARY_IMPL_HPP
+#define BOOST_EXTENSION_LIBRARY_IMPL_HPP
+
+#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0501
+#endif
+
+#ifndef WINDOWS_LEAN_AND_MEAN
+#define WINDOWS_LEAN_AND_MEAN
+#endif
+#include <Windows.h>
+namespace
+{
+ 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 LoadLibrary(libraryName);}
+ inline generic_function_ptr get_function(library_handle handle, const char * function_name){return GetProcAddress(handle, function_name);}
+ inline bool close_shared_library(library_handle handle){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"
+
+#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
+{
+ 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, const char * function_name){return dlsym(handle, function_name);}
+ inline bool close_shared_library(library_handle handle){return dlclose(handle)==0;}
+}
+
+#endif
+
+#endif
Added: sandbox/boost/extension/impl/linked_library.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/extension/impl/linked_library.hpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,104 @@
+#define BOOST_EXTENSIONS_IMPL_NAMESPACE_BEGIN namespace boost{ namespace extensions{ namespace impl {
+#define BOOST_EXTENSIONS_IMPL_NAMESPACE_END }}} // ns: boost::extensions::impl
+
+#ifdef BOOST_WINDOWS
+
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0501
+#endif
+
+#ifndef WINDOWS_LEAN_AND_MEAN
+#define WINDOWS_LEAN_AND_MEAN
+#endif
+
+#include <Windows.h>
+
+#define BOOST_EXTENSION_LIBRARY_EXTENSION "dll"
+
+BOOST_EXTENSIONS_IMPL_NAMESPACE_BEGIN
+
+ 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 LoadLibrary(libraryName);
+ }
+
+ inline generic_function_ptr get_function(library_handle handle, const char * function_name) {
+ return GetProcAddress(handle, function_name);
+ }
+
+ inline bool close_shared_library(library_handle handle){
+ return FreeLibrary(handle) != 0;
+ }
+
+BOOST_EXTENSIONS_IMPL_NAMESPACE_END
+
+#pragma comment(lib, "kernel32.lib")
+
+#else
+
+#ifdef __APPLE__
+
+#define BOOST_EXTENSION_LIBRARY_EXTENSION "dylib"
+
+BOOST_EXTENSIONS_IMPL_NAMESPACE_BEGIN
+
+ 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'));
+ }
+BOOST_EXTENSIONS_IMPL_NAMESPACE_END
+
+#else
+
+#define BOOST_EXTENSION_LIBRARY_EXTENSION "so"
+
+BOOST_EXTENSIONS_IMPL_NAMESPACE_BEGIN
+
+ 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');
+ }
+
+BOOST_EXTENSIONS_IMPL_NAMESPACE_END
+
+#endif
+
+#include <dlfcn.h>
+
+BOOST_EXTENSIONS_IMPL_NAMESPACE_BEGIN
+
+ 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, const char * function_name) {
+ return dlsym(handle, function_name);
+ }
+
+ inline bool close_shared_library(library_handle handle) {
+ return dlclose(handle) == 0;
+ }
+
+BOOST_EXTENSIONS_IMPL_NAMESPACE_END
+#endif
+
+#undef BOOST_EXTENSIONS_IMPL_NAMESPACE_BEGIN
+#undef BOOST_EXTENSIONS_IMPL_NAMESPACE_END
+
Added: sandbox/boost/extension/impl/typeinfo.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/extension/impl/typeinfo.hpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,65 @@
+#ifndef BOOST_EXTENSION_TYPEINFO_HPP
+#define BOOST_EXTENSION_TYPEINFO_HPP
+namespace boost{namespace extensions{
+template <class TypeInfo, class ClassType>
+struct type_info_handler
+{
+ static TypeInfo get_class_type();
+};
+}}
+#ifndef BOOST_EXTENSION_USER_TYPE_INFO_CUSTOM
+#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+ // For DLLs
+# define BOOST_EXTENSION_EXTERNAL extern "C" __declspec(dllexport)
+#include <string>
+#include <typeinfo>
+namespace boost{namespace extensions{
+ typedef std::string default_type_info;
+ template <class ClassType>
+ struct type_info_handler<default_type_info, ClassType>
+ {
+ static default_type_info get_class_type(){return typeid(ClassType).name();}
+ };
+}}
+
+#else
+#ifdef __APPLE__
+#include <typeinfo>
+#include <string>
+/*namespace boost{namespace extensions{
+ typedef basic_factory_map<std::type_info> factory_map;
+ template <>
+ std::type_info basic_factory_map<std::string>::get_class_type()
+ {
+ return typeid(ClassType);
+ }
+}}*/
+namespace boost{namespace extensions{
+ typedef std::string default_type_info;
+ template <class ClassType>
+ struct type_info_handler<default_type_info, ClassType>
+ {
+ static default_type_info get_class_type(){return typeid(ClassType).name();}
+ };
+}}
+
+#else
+#include <string>
+#include <typeinfo>
+namespace boost{namespace extensions{
+ typedef std::string default_type_info;
+ template <class ClassType>
+ struct type_info_handler<default_type_info, ClassType>
+ {
+ static default_type_info get_class_type(){return typeid(ClassType).name();}
+ };
+}}
+
+#endif //Apple
+#endif //Windows
+#endif // BOOST_EXTENSION_USER_TYPE_INFO_CUSTOM
+#ifndef BOOST_EXTENSION_EXTERNAL
+# define BOOST_EXTENSION_EXTERNAL extern "C"
+#endif
+
+#endif
\ No newline at end of file
Added: sandbox/boost/extension/registry.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/extension/registry.hpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,64 @@
+/* (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)
+*/
+#ifndef BOOST_EXTENSION_REGISTRY_HPP
+#define BOOST_EXTENSION_REGISTRY_HPP
+#include <map>
+#include <string>
+#include <boost/extension/counted_factory_map.hpp>
+#include <boost/extension/shared_library.hpp>
+#include <boost/extension/impl/typeinfo.hpp>
+namespace boost{namespace extensions{
+template <class TypeInfo>
+class basic_registry : public basic_counted_factory_map<TypeInfo>
+{
+protected:
+ std::map<std::string, std::pair<shared_library, int> > libraries_;
+ typedef std::map<std::string, std::pair<shared_library, int> >::iterator
+ library_iterator;
+public:
+ ~basic_registry() {
+ for (library_iterator it = libraries_.begin(); it != libraries_.end(); ++it)
+ {
+ it->second.first.close();
+ }
+ }
+ bool open(const char * library_location, const char * function_name =
+ "boost_extension_load_function") {
+ library_iterator it = libraries_.find(library_location);
+ if (it == libraries_.end()) {
+ it = libraries_.insert(std::make_pair(std::string(library_location),
+ std::make_pair(shared_library(library_location, false), int(0)))).first;
+ this->current_library_ = library_location;
+ basic_counted_factory_map<TypeInfo>::current_counter_ = &it->second.second;
+ it->second.first.open();
+ if (it->second.first.is_open() == false) {
+ libraries_.erase(it);
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
+ bool close(const char * library_location) {
+ // This removes all of the factories from this library
+ library_iterator it = libraries_.find(library_location);
+ if (it == libraries_.end())
+ return false;
+ it->second.first.close();
+ for (typename basic_counted_factory_map<TypeInfo>::FactoryMap::iterator it = this->factories_.begin();
+ it != this->factories_.end(); ++it) {
+ it->second->erase(library_location);
+ }
+ libraries_.erase(it);
+ return true;
+ }
+ size_t num_libraries() {
+ return libraries_.size();
+ }
+};
+typedef basic_registry<default_type_info> registry;
+}}
+#endif
Added: sandbox/boost/extension/shared_library.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/extension/shared_library.hpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,218 @@
+/* (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)
+ */
+
+#ifndef BOOST_EXTENSION_LINKED_LIBRARY_HPP
+#define BOOST_EXTENSION_LINKED_LIBRARY_HPP
+#include <boost/extension/impl/library_impl.hpp>
+
+
+namespace boost{namespace extensions{
+template <class ReturnValue, class Param1 = void, class Param2 = void, class Param3 = void, class Param4 = void, class Param5 = void, class Param6 = void>
+class functor
+{
+private:
+ typedef ReturnValue (*FunctionType)(Param1, Param2, Param3, Param4, Param5, Param6);
+ FunctionType func_;
+public:
+ bool is_valid(){return func_ != 0;}
+ functor(FunctionType func)
+ :func_(func)
+ {}
+ functor(generic_function_ptr func)
+ :func_(FunctionType(func))
+ {}
+ ReturnValue operator()(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)
+ {
+ return func_(p1, p2, p3, p4, p5, p6);
+ }
+};
+
+template <class ReturnValue, class Param1, class Param2, class Param3, class Param4, class Param5>
+class functor<ReturnValue, Param1, Param2, Param3, Param4, Param5>
+{
+private:
+ typedef ReturnValue (*FunctionType)(Param1, Param2, Param3, Param4, Param5);
+ FunctionType func_;
+public:
+ bool is_valid(){return func_ != 0;}
+ functor(FunctionType func)
+ :func_(func)
+ {}
+ functor(generic_function_ptr func)
+ :func_(FunctionType(func))
+ {}
+ ReturnValue operator()(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)
+ {
+ return func_(p1, p2, p3, p4, p5);
+ }
+};
+
+template <class ReturnValue, class Param1, class Param2, class Param3, class Param4>
+class functor<ReturnValue, Param1, Param2, Param3, Param4>
+{
+private:
+ typedef ReturnValue (*FunctionType)(Param1, Param2, Param3, Param4);
+ FunctionType func_;
+public:
+ bool is_valid(){return func_ != 0;}
+ functor(FunctionType func)
+ :func_(func)
+ {}
+ functor(generic_function_ptr func)
+ :func_(FunctionType(func))
+ {}
+ ReturnValue operator()(Param1 p1, Param2 p2, Param3 p3, Param4 p4)
+ {
+ return func_(p1, p2, p3, p4);
+ }
+};
+
+template <class ReturnValue, class Param1, class Param2, class Param3>
+class functor<ReturnValue, Param1, Param2, Param3>
+{
+private:
+ typedef ReturnValue (*FunctionType)(Param1, Param2, Param3);
+ FunctionType func_;
+public:
+ bool is_valid(){return func_ != 0;}
+ functor(FunctionType func)
+ :func_(func)
+ {}
+ functor(generic_function_ptr func)
+ :func_(FunctionType(func))
+ {}
+ ReturnValue operator()(Param1 p1, Param2 p2, Param3 p3)
+ {
+ return func_(p1, p2, p3);
+ }
+};
+
+template <class ReturnValue, class Param1, class Param2>
+class functor<ReturnValue, Param1, Param2>
+{
+private:
+ typedef ReturnValue (*FunctionType)(Param1, Param2);
+ FunctionType func_;
+public:
+ bool is_valid(){return func_ != 0;}
+ functor(FunctionType func)
+ :func_(func)
+ {}
+ functor(generic_function_ptr func)
+ :func_(FunctionType(func))
+ {}
+ ReturnValue operator()(Param1 p1, Param2 p2)
+ {
+ return func_(p1, p2);
+ }
+};
+
+template <class ReturnValue, class Param1>
+class functor<ReturnValue, Param1>
+{
+private:
+ typedef ReturnValue (*FunctionType)(Param1);
+ FunctionType func_;
+public:
+ bool is_valid(){return func_ != 0;}
+ functor(FunctionType func)
+ :func_(func)
+ {}
+ functor(generic_function_ptr func)
+ :func_(FunctionType(func))
+ {}
+ ReturnValue operator()(Param1 p1)
+ {
+ return func_(p1);
+ }
+};
+
+template <class ReturnValue>
+class functor<ReturnValue>
+{
+private:
+ typedef ReturnValue (*FunctionType)();
+ FunctionType func_;
+public:
+ bool is_valid(){return func_ != 0;}
+ functor(FunctionType func)
+ :func_(func)
+ {}
+ functor(generic_function_ptr func)
+ :func_(FunctionType(func))
+ {}
+ ReturnValue operator()()
+ {
+ return func_();
+ }
+};
+
+class shared_library
+{
+private:
+ std::string location_;
+ library_handle handle_;
+ bool auto_close_;
+public:
+ bool is_open(){return handle_ != 0;}
+ static bool is_linkable_library(const char * file_name){return is_library(file_name);}
+ bool open(){return (handle_ = load_shared_library(location_.c_str())) != 0;}
+ bool close(){return close_shared_library(handle_);} template <class ReturnValue>
+ functor<ReturnValue>
+ get_functor(const char * function_name)
+ {
+ return functor<ReturnValue>
+ (get_function(handle_, function_name));
+ }
+ template <class ReturnValue, class Param1>
+ functor<ReturnValue, Param1>
+ get_functor(const char * function_name)
+ {
+ return functor<ReturnValue, Param1>
+ (get_function(handle_, function_name));
+ }
+ template <class ReturnValue, class Param1, class Param2>
+ functor<ReturnValue, Param1, Param2>
+ get_functor(const char * function_name)
+ {
+ return functor<ReturnValue, Param1, Param2>
+ (get_function(handle_, function_name));
+ }
+ template <class ReturnValue, class Param1, class Param2, class Param3>
+ functor<ReturnValue, Param1, Param2, Param3>
+ get_functor(const char * function_name)
+ {
+ return functor<ReturnValue, Param1, Param2, Param3>
+ (get_function(handle_, function_name));
+ }
+ template <class ReturnValue, class Param1, class Param2, class Param3, class Param4>
+ functor<ReturnValue, Param1, Param2, Param3, Param4>
+ get_functor(const char * function_name)
+ {
+ return functor<ReturnValue, Param1, Param2, Param3, Param4>
+ (get_function(handle_, function_name));
+ }
+ template <class ReturnValue, class Param1, class Param2, class Param3, class Param4, class Param5>
+ functor<ReturnValue, Param1, Param2, Param3, Param4, Param5>
+ get_functor(const char * function_name)
+ {
+ return functor<ReturnValue, Param1, Param2, Param3, Param4, Param5>
+ (get_function(handle_, function_name));
+ }
+ template <class ReturnValue, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6>
+ functor<ReturnValue, Param1, Param2, Param3, Param4, Param5, Param6>
+ get_functor(const char * function_name)
+ {
+ return functor<ReturnValue, Param1, Param2, Param3, Param4, Param5, Param6>
+ (get_function(handle_, function_name));
+ }
+shared_library(const char * location, bool auto_close = false)
+ :location_(location), handle_(0), auto_close_(auto_close){}
+};
+}}
+
+
+#endif
Added: sandbox/boost/extension/zone.hpp
==============================================================================
--- (empty file)
+++ sandbox/boost/extension/zone.hpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,297 @@
+/* (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)
+ */
+
+#ifndef BOOST_EXTENSION_ZONE_HPP
+#define BOOST_EXTENSION_ZONE_HPP
+#include <list>
+#include <memory>
+#include <map>
+#include <boost/extension/factory.hpp>
+
+
+namespace boost{namespace extensions{
+
+template <class TypeInfo>
+class basic_factory_map
+{
+private:
+ class generic_factory_container
+ {
+ public:
+ 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<factory<Interface, Info, Param1, Param2, Param3, Param4, Param5, Param6> >, public generic_factory_container
+ {
+ public:
+ factory_container(){}
+ factory_container(factory_map & z)
+ :std::list<factory<Interface, Info, Param1, Param2> >(z.get<Interface, Param1, Param2, Param3, Param4, Param5, Param6>()){}
+ virtual ~factory_container(){}
+ };
+ typedef std::map<TypeInfo, generic_factory_container *> FactoryMap;
+ FactoryMap factories_;
+ template <class ClassType>
+ TypeInfo get_class_type();
+public:
+ ~factory_map(){
+ for(FactoryMap::iterator it = factories_.begin(); it != factories_.end(); ++it)
+ delete it->second;
+ //TODO - test for memory leaks.
+ }
+ /*template <class Actual, class Interface, class Param1 = void,
+ class Param2 = void, class param3 = void, class Param4 = void,
+ class Param5 = void, class Param6 = void>
+ extension & add(){}
+ template <class Actual, class Interface, class Param1,
+ class Param2, class param3, class Param4, class Param5>
+ extension & add(){}
+ template <class Actual, class Interface, class Param1,
+ class Param2, class param3, class Param4>
+ extension & add(){}
+ template <class Actual, class Interface, class Param1,
+ class Param2, class param3>
+ extension & add(){}
+ template <class Actual, class Interface, class Param1, class Param2>
+ extension & add(){}
+ template <class Actual, class Interface, class Param1>
+ extension & add(){}
+ template <class Actual, class Interface>
+ extension & add(){}*/
+
+
+ /*template <class Interface, class Param1 = void,
+ class Param2 = void, class param3 = void, class Param4 = void,
+ class Param5 = void, class Param6 = void>
+ const std::set<factory<Interface, Param1, Param2, Param3, Param4, Param5, Param6> & get(){}*/
+ template <class Interface, class Info, class Param1, class Param2>
+ operator std::list<factory<Interface, Info, Param1, Param2> > & ()
+ {return this->get<Interface, Info, Param1, Param2>();}
+
+ template <class Interface, class Info>
+ std::list<factory<Interface, Info> > & get()
+ {
+ type_info current_type =
+ type_info::get_type_info<factory<Interface, Info> >();
+ FactoryMap::iterator it =
+ factories_.find(current_type);
+
+ if (it == factories_.end())
+ {
+ factory_container<Interface, Info> * ret =
+ new factory_container<Interface, Info>();
+ 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<factory<Interface, Info> > ListType;
+ ListType & s = this->get<Interface, Info>();
+ factory<Interface, Info> f(info);
+ //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>
+ std::list<factory<Interface, Info, Param1> > & get()
+ {
+ const std::type_info * current_type_ptr
+ = &typeid(factory<Interface, Info, Param1>);
+ FactoryMap::iterator it =
+ factories_.find(current_type_ptr);
+
+ if (it == factories_.end())
+ {
+ factory_container<Interface, Info, Param1> * ret
+ = new factory_container<Interface, Info, Param1>();
+ factories_[current_type_ptr] = ret;
+ return *ret;
+ }
+ else
+ {
+ return dynamic_cast<factory_container<Interface, Info, Param1> &>(*(it->second));
+ }
+ }
+ template <class Actual, class Interface, class Info, class Param1>
+ void add(Info info)
+ {
+ typedef std::list<factory<Interface, Info, Param1> > ListType;
+ ListType & s = this->get<Interface, Info, Param1>();
+ factory<Interface, Info, Param1> f(info);
+ //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>
+ std::list<factory<Interface, Info, Param1, Param2> > & get()
+ {
+ const std::type_info * current_type_ptr
+ = &typeid(factory<Interface, Info, Param1, Param2>);
+ FactoryMap::iterator it =
+ factories_.find(current_type_ptr);
+
+ if (it == factories_.end())
+ {
+ factory_container<Interface, Info, Param1, Param2> * ret
+ = new factory_container<Interface, Info, Param1, Param2>();
+ factories_[current_type_ptr] = ret;
+ return *ret;
+ }
+ else
+ {
+ return dynamic_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<factory<Interface, Info, Param1, Param2> > ListType;
+ ListType & s = this->get<Interface, Info, Param1, Param2>();
+ factory<Interface, Info, Param1, Param2> f(info);
+ //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>
+ std::list<factory<Interface, Info, Param1, Param2, Param3> > & get()
+ {
+ const std::type_info * current_type_ptr
+ = &typeid(factory<Interface, Info, Param1, Param2, Param3>);
+ FactoryMap::iterator it =
+ factories_.find(current_type_ptr);
+
+ if (it == factories_.end())
+ {
+ factory_container<Interface, Info, Param1, Param2, Param3> * ret
+ = new factory_container<Interface, Info, Param1, Param2, Param3>();
+ factories_[current_type_ptr] = ret;
+ return *ret;
+ }
+ else
+ {
+ return dynamic_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<factory<Interface, Info, Param1, Param2, Param3> > ListType;
+ ListType & s = this->get<Interface, Info, Param1, Param2, Param3>();
+ factory<Interface, Info, Param1, Param2, Param3> f(info);
+ //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>
+ std::list<factory<Interface, Info, Param1, Param2, Param3, Param4> > & get()
+ {
+ const std::type_info * current_type_ptr
+ = &typeid(factory<Interface, Info, Param1, Param2, Param3, Param4>);
+ FactoryMap::iterator it =
+ factories_.find(current_type_ptr);
+
+ if (it == factories_.end())
+ {
+ factory_container<Interface, Info, Param1, Param2, Param3, Param4> * ret
+ = new factory_container<Interface, Info, Param1, Param2, Param3, Param4>();
+ factories_[current_type_ptr] = ret;
+ return *ret;
+ }
+ else
+ {
+ return dynamic_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<factory<Interface, Info, Param1, Param2, Param3, Param4> > ListType;
+ ListType & s = this->get<Interface, Info, Param1, Param2, Param3, Param4>();
+ factory<Interface, Info, Param1, Param2, Param3, Param4> f(info);
+ //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>
+ std::list<factory<Interface, Info, Param1, Param2, Param3, Param4, Param5> > & get()
+ {
+ const std::type_info * current_type_ptr
+ = &typeid(factory<Interface, Info, Param1, Param2, Param3, Param4, Param5>);
+ FactoryMap::iterator it =
+ factories_.find(current_type_ptr);
+
+ if (it == factories_.end())
+ {
+ factory_container<Interface, Info, Param1, Param2, Param3, Param4, Param5> * ret
+ = new factory_container<Interface, Info, Param1, Param2, Param3, Param4, Param5>();
+ factories_[current_type_ptr] = ret;
+ return *ret;
+ }
+ else
+ {
+ return dynamic_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<factory<Interface, Info, Param1, Param2, Param3, Param4, Param5> > ListType;
+ ListType & s = this->get<Interface, Info, Param1, Param2, Param3, Param4, Param5>();
+ factory<Interface, Info, Param1, Param2, Param3, Param4, Param5> f(info);
+ //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>
+ std::list<factory<Interface, Info, Param1, Param2, Param3, Param4, Param5, Param6> > & get()
+ {
+ const std::type_info * current_type_ptr
+ = &typeid(factory<Interface, Info, Param1, Param2, Param3, Param4, Param5, Param6>);
+ FactoryMap::iterator it =
+ factories_.find(current_type_ptr);
+
+ 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>();
+ factories_[current_type_ptr] = ret;
+ return *ret;
+ }
+ else
+ {
+ return dynamic_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<factory<Interface, Info, Param1, Param2, Param3, Param4, Param5, Param6> > ListType;
+ ListType & s = this->get<Interface, Info, Param1, Param2, Param3, Param4, Param5, Param6>();
+ factory<Interface, Info, Param1, Param2, Param3, Param4, Param5, Param6> f(info);
+ //f.set_type<Actual>();
+ f.set_type_special((Actual*)0);
+ s.push_back(f);
+ //it->set_type<Actual>();
+ }
+};
+
+
+}}
+#include <boost/extension/impl/typeinfo.hpp>
+#endif
Added: sandbox/libs/extension/doc/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/Jamfile.v2 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,17 @@
+using quickbook ;
+xml extension : extension.qbk : : :
+ <xsl:param>toc.max.depth=5
+ <xsl:param>toc.section.depth=5
+ <xsl:param>chunk.section.depth=5 ;
+boostbook standalone
+ :
+ extension
+ :
+ <xsl:param>generate.section.toc.level=3
+ <xsl:param>chunk.first.sections=1
+ <xsl:param>admon.graphics=1
+
+ ;
+
+install html : ../../../doc/html/boostbook.css ;
+install ../ : ../../../boost.png ;
Added: sandbox/libs/extension/doc/appendices.qbk
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/appendices.qbk 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,3 @@
+[section:appendices Appendices]
+[include appendix_a.qbk]
+[endsect]
\ No newline at end of file
Added: sandbox/libs/extension/doc/appendix_a.qbk
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/appendix_a.qbk 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,29 @@
+[section:appendix_a Appendix A - Windows Export and Import Declarations]
+On the Windows platform, special export declarations are required to make
+functions or classes in a .dll file accessible to the outside world. For
+normal usage of Boost.Extension, the only place this is required is in the
+one function that is exported from each .dll. The Hello World sample program
+illustrates how this is done using `BOOST_EXTENSION_EXPORT`.
+
+For implementation inheritance across shared libraries, such as that in the
+Multiple Inheritance sample, each class that is not header-only that needs to be
+exported must have these declarations included. To make it more difficult,
+they must be different depending on whether the class is being imported into or
+exported from the current module. The Multiple Inheritance sample shows how this
+is done.
+
+[h3 Warning]
+Now for a word of warning that many of you will ignore: In the great majority
+of cases, even if non-header-only implementation inheritance across shared
+libraries seems like a good idea, there is probably a better solution. Although
+it certainly has its uses, it can cause problems like the following:
+
+
+* Version problems - if the original implementation changes at all, every
+dependent shared library must be recompiled with the new implementation.
+* Tight coupling between shared libraries. One of the primary reasons for using
+shared libraries is to decrease coupling, and promote reuse.
+* It can lead to overly complicated, over-designed class hierarchies.
+
+
+[endsect]
\ No newline at end of file
Added: sandbox/libs/extension/doc/extension.qbk
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/extension.qbk 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,25 @@
+[library Boost.Extension
+ [quickbook 1.3]
+ [version 1.0]
+ [copyright 2007 Jeremy Pack]
+ [purpose Factory management and facilities for using shared libraries]
+ [license
+ 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 http://www.boost.org/LICENSE_1_0.txt])
+ ]
+ [category Programming Interfaces]
+ [last-revision $Date: 2007/4/30 12:00:00 $]
+]
+
+
+[def __linked_library [link boost_extension.linked_library linked_library]]
+[def __zone [link boost_extension.factory_map factory_map]]
+[def __factory [link boost_extension.factory factory]]
+
+[include introduction.qbk]
+[include tutorials.qbk]
+[include factories.qbk]
+[include shared_libraries.qbk]
+[include performance_analysis.qbk]
+[include appendices.qbk]
\ No newline at end of file
Added: sandbox/libs/extension/doc/factories.qbk
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/factories.qbk 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,5 @@
+[section:factories Factories]
+
+Insert content here.
+
+[endsect]
\ No newline at end of file
Added: sandbox/libs/extension/doc/faq.qbk
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/faq.qbk 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,27 @@
+[section:faq FAQ]
+
+Question: What if I have multiple versions of the same interface (I've added new
+member functions as they've become necessary), and I want to keep track of which
+version is implemented by different plugins?
+
+Answer: The simplest way is to change the name of your interface (or the
+namespace it is in) each time its contents change. This is actually what I would
+recommend. However, it is also possible to include such information as part
+of the `factory`. A `factory` can contain arbitrary information about the plugin
+that it loads through the Info type. In the `hello_world` sample, the `Info`
+type is an `int`, and the `hello` class has a number (it could be a version) of
+1, and the `world` class has a version of 2. In the multiple_inheritance sample,
+this type is a string. This will be detailed in greater detail in this
+documentation.
+
+Question: What if I want to have a library close automatically when I've
+destroyed all of the plugins in it?
+
+Answer: Wait for the `registry` class - which is almost done. It will take care
+of it. It is possible to do this with a `factory_map` currently, but the
+`registry` class will automate the process.
+
+Question:
+
+
+[endsect]
\ No newline at end of file
Added: sandbox/libs/extension/doc/html/HTML.manifest
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/html/HTML.manifest 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,14 @@
+index.html
+boost_extension/introduction.html
+boost_extension/tutorials.html
+boost_extension/tutorials/tutorial01.html
+boost_extension/tutorials/tutorial02.html
+boost_extension/tutorials/tutorial03.html
+boost_extension/tutorials/tutorial04.html
+boost_extension/tutorials/tutorial05.html
+boost_extension/tutorials/tutorial06.html
+boost_extension/factories.html
+boost_extension/shared_libraries.html
+boost_extension/performance_analysis.html
+boost_extension/appendices.html
+boost_extension/appendices/appendix_a.html
Added: sandbox/libs/extension/doc/html/boost_extension/appendices.html
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/html/boost_extension/appendices.html 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,39 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Appendices</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<link rel="start" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="up" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="prev" href="performance_analysis.html" title="Performance Analysis">
+<link rel="next" href="appendices/appendix_a.html" title="Appendix A - Windows Export and Import Declarations">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%">
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="performance_analysis.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="appendices/appendix_a.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_extension.appendices"></a> Appendices</h2></div></div></div>
+<div class="toc"><dl><dt><span class="section"> Appendix A - Windows Export and Import Declarations</span></dt></dl></div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="performance_analysis.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="appendices/appendix_a.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/libs/extension/doc/html/boost_extension/factories.html
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/html/boost_extension/factories.html 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Factories</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<link rel="start" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="up" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="prev" href="tutorials/tutorial06.html" title="Tutorial 6">
+<link rel="next" href="shared_libraries.html" title="Shared Libraries">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%">
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorials/tutorial06.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="shared_libraries.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_extension.factories"></a> Factories</h2></div></div></div>
+<p>
+ Insert content here.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorials/tutorial06.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="shared_libraries.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/libs/extension/doc/html/boost_extension/introduction.html
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/html/boost_extension/introduction.html 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,72 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Introduction</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<link rel="start" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="up" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="prev" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="next" href="tutorials.html" title="Tutorials">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%">
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../index.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="tutorials.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_extension.introduction"></a> Introduction</h2></div></div></div>
+<p>
+ Wrappers for loading classes from linked libraries to extend the functionality
+ of a program. Created to ease the creation of plugins.
+ </p>
+<p>
+ The Boost.Extension library has been developed to ease the development of plugins
+ and similar extensions to software. Classes can be made available from linked
+ libraries and loaded automatically by the application.
+ </p>
+<p>
+ The documentation is completely incomplete. Sorry. Look at tutorial #1 for
+ examples of basic usage, and tutorial #2 for examples of advanced usage.
+ </p>
+<p>
+ Note the following:
+ </p>
+<div class="orderedlist"><ol type="1">
+<li>
+ Multiple and virtual inheritance are supported
+ </li>
+<li>
+ No macros are currently used (besides those required by Windows for exported
+ functions)
+ </li>
+<li>
+ Only one external function required per shared library to export classes
+ </li>
+<li>
+ RTTI is used by default, but it is possible to use user-defined type identifications.
+ </li>
+<li>
+ Classes do not need to be modified to be loadable
+ </li>
+</ol></div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../index.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="tutorials.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/libs/extension/doc/html/boost_extension/performance_analysis.html
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/html/boost_extension/performance_analysis.html 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Performance Analysis</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<link rel="start" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="up" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="prev" href="shared_libraries.html" title="Shared Libraries">
+<link rel="next" href="appendices.html" title="Appendices">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%">
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="shared_libraries.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="appendices.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_extension.performance_analysis"></a> Performance Analysis</h2></div></div></div>
+<p>
+ Insert content here.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="shared_libraries.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="appendices.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/libs/extension/doc/html/boost_extension/quick_start.html
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/html/boost_extension/quick_start.html 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Quick Start</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<link rel="start" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="up" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="prev" href="introduction.html" title="Introduction">
+<link rel="next" href="tutorials.html" title="Tutorials">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%">
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="introduction.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="tutorials.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_extension.quick_start"></a> Quick Start</h2></div></div></div>
+<p>
+ Quick start stuff.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="introduction.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="tutorials.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/libs/extension/doc/html/boost_extension/quickstart.html
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/html/boost_extension/quickstart.html 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,40 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>QuickStart</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<link rel="start" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="up" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="prev" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%">
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../index.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_extension.quickstart"></a>QuickStart</h2></div></div></div>
+<p>
+ Quick Start stuff.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../index.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a>
+</div>
+</body>
+</html>
Added: sandbox/libs/extension/doc/html/boost_extension/shared_libraries.html
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/html/boost_extension/shared_libraries.html 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Shared Libraries</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<link rel="start" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="up" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="prev" href="factories.html" title="Factories">
+<link rel="next" href="performance_analysis.html" title="Performance Analysis">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%">
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="factories.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="performance_analysis.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_extension.shared_libraries"></a> Shared Libraries</h2></div></div></div>
+<p>
+ Insert content here.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="factories.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="performance_analysis.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/libs/extension/doc/html/boost_extension/tutorial_1.html
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/html/boost_extension/tutorial_1.html 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Tutorial 1</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<link rel="start" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="up" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="prev" href="performance_analysis.html" title="Performance Analysis">
+<link rel="next" href="tutorial_2.html" title="Tutorial 2">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%">
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="performance_analysis.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="tutorial_2.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_extension.tutorial_1"></a>Tutorial 1</h2></div></div></div>
+<p>
+ Insert content here.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="performance_analysis.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="tutorial_2.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/libs/extension/doc/html/boost_extension/tutorial_2.html
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/html/boost_extension/tutorial_2.html 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Tutorial 2</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<link rel="start" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="up" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="prev" href="tutorial_1.html" title="Tutorial 1">
+<link rel="next" href="tutorial_3.html" title="Tutorial 3">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%">
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial_1.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="tutorial_3.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_extension.tutorial_2"></a>Tutorial 2</h2></div></div></div>
+<p>
+ Insert content here.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial_1.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="tutorial_3.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/libs/extension/doc/html/boost_extension/tutorial_3.html
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/html/boost_extension/tutorial_3.html 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Tutorial 3</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<link rel="start" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="up" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="prev" href="tutorial_2.html" title="Tutorial 2">
+<link rel="next" href="tutorial_4.html" title="Tutorial 4">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%">
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial_2.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="tutorial_4.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_extension.tutorial_3"></a>Tutorial 3</h2></div></div></div>
+<p>
+ Insert content here.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial_2.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="tutorial_4.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/libs/extension/doc/html/boost_extension/tutorial_4.html
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/html/boost_extension/tutorial_4.html 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Tutorial 4</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<link rel="start" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="up" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="prev" href="tutorial_3.html" title="Tutorial 3">
+<link rel="next" href="tutorial_5.html" title="Tutorial 5">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%">
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial_3.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="tutorial_5.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_extension.tutorial_4"></a>Tutorial 4</h2></div></div></div>
+<p>
+ Insert content here.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial_3.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="tutorial_5.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/libs/extension/doc/html/boost_extension/tutorial_5.html
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/html/boost_extension/tutorial_5.html 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Tutorial 5</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<link rel="start" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="up" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="prev" href="tutorial_4.html" title="Tutorial 4">
+<link rel="next" href="tutorial_6.html" title="Tutorial 6">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%">
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial_4.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="tutorial_6.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_extension.tutorial_5"></a>Tutorial 5</h2></div></div></div>
+<p>
+ Insert content here.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial_4.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="tutorial_6.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/libs/extension/doc/html/boost_extension/tutorial_6.html
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/html/boost_extension/tutorial_6.html 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,40 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Tutorial 6</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<link rel="start" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="up" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="prev" href="tutorial_5.html" title="Tutorial 5">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%">
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial_5.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_extension.tutorial_6"></a>Tutorial 6</h2></div></div></div>
+<p>
+ Insert content here.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial_5.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a>
+</div>
+</body>
+</html>
Added: sandbox/libs/extension/doc/html/boost_extension/tutorials.html
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/html/boost_extension/tutorials.html 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,54 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Tutorials</title>
+<link rel="stylesheet" href="../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<link rel="start" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="up" href="../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="prev" href="introduction.html" title="Introduction">
+<link rel="next" href="tutorials/tutorial01.html" title="Tutorial 1">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%">
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="introduction.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="tutorials/tutorial01.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_extension.tutorials"></a>Tutorials</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"> Tutorial 1</span></dt>
+<dt><span class="section"> Tutorial 2</span></dt>
+<dt><span class="section"> Tutorial 3</span></dt>
+<dt><span class="section"> Tutorial 4</span></dt>
+<dt><span class="section"> Tutorial 5</span></dt>
+<dt><span class="section"> Tutorial 6</span></dt>
+</dl></div>
+<p>
+ Only the first and second tutorials are currently complete. The first tutorial
+ is a basic hello world example. The second tutorial is a more complex example
+ involving multiple inheritance, virtual inheritance, and inheritance across
+ shared libraries. The tutorial code can be found in the examples folder. They
+ all share the same Jamfile, but the Jamfile contents are separated out for
+ each tutorial.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="introduction.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="tutorials/tutorial01.html"><img src="../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial01.html
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial01.html 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,173 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Tutorial 1</title>
+<link rel="stylesheet" href="../../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<link rel="start" href="../../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="up" href="../tutorials.html" title="Tutorials">
+<link rel="prev" href="../tutorials.html" title="Tutorials">
+<link rel="next" href="tutorial02.html" title="Tutorial 2">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%">
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../tutorials.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorials.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="tutorial02.html"><img src="../../images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_extension.tutorials.tutorial01"></a> Tutorial 1</h3></div></div></div>
+<p>
+ Create a class that we will later subclass and put it into a header file
+ called word.hpp.
+</p>
+<pre class="programlisting">
+<span class="keyword">class</span> <span class="identifier">word</span>
+<span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">virtual</span> <span class="special">~</span><span class="identifier">word</span><span class="special">(){}</span>
+ <span class="keyword">virtual</span> <span class="keyword">const</span> <span class="keyword">char</span> <span class="special">*</span> <span class="identifier">get_val</span><span class="special">(){</span><span class="keyword">return</span> <span class="string">""</span><span class="special">;}</span>
+<span class="special">};</span>
+</pre>
+<p>
+ This file will be included by both the shared library in which classes implement
+ this interface, and in the executable that will load these implementations.
+ The destructor ought to be virtual, just to ensure proper deletion. We create
+ one virtual function. We could actually add data to this class as well.
+ </p>
+<p>
+ Now create a file called hello_world.cpp. This will be compiled into a shared
+ library:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="preprocessor">#include</span> <span class="string">"word.hpp"</span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">extension</span><span class="special">/</span><span class="identifier">factory_map</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+
+<span class="keyword">class</span> <span class="identifier">world</span> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">word</span>
+<span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">virtual</span> <span class="keyword">const</span> <span class="keyword">char</span> <span class="special">*</span> <span class="identifier">get_val</span><span class="special">(){</span><span class="keyword">return</span> <span class="string">"world!"</span><span class="special">;}</span>
+<span class="special">};</span>
+<span class="keyword">class</span> <span class="identifier">hello</span> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">word</span>
+<span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">virtual</span> <span class="keyword">const</span> <span class="keyword">char</span> <span class="special">*</span> <span class="identifier">get_val</span><span class="special">(){</span><span class="keyword">return</span> <span class="string">"hello"</span><span class="special">;}</span>
+<span class="special">};</span>
+</pre>
+<p>
+ Now we have two classes that are derived from word, and that both implement
+ the virtual function get_val. All that's left is to declare them for exporting.
+ Normally, we just put one function in the entire shared library that exports
+ all exportable classes in the library.
+</p>
+<pre class="programlisting">
+<span class="keyword">extern</span> <span class="string">"C"</span> <span class="keyword">void</span> <span class="identifier">BOOST_EXTENSION_EXPORT_DECL</span> <span class="identifier">extension_export_word</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">extensions</span><span class="special">::</span><span class="identifier">factory_map</span> <span class="special">&</span> <span class="identifier">fm</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="identifier">fm</span><span class="special">.</span><span class="identifier">add</span><span class="special"><</span><span class="identifier">hello</span><span class="special">,</span> <span class="identifier">word</span><span class="special">,</span> <span class="keyword">int</span><span class="special">>(</span><span class="number">1</span><span class="special">);</span>
+ <span class="identifier">fm</span><span class="special">.</span><span class="identifier">add</span><span class="special"><</span><span class="identifier">world</span><span class="special">,</span> <span class="identifier">word</span><span class="special">,</span> <span class="keyword">int</span><span class="special">>(</span><span class="number">2</span><span class="special">);</span>
+<span class="special">}</span>
+</pre>
+<p>
+ <code class="computeroutput"><span class="keyword">extern</span> <span class="string">"C"</span></code>
+ is required to keep the function name from being mangled. <code class="computeroutput"><span class="identifier">BOOST_EXTENSION_EXPORT_DECL</span></code>
+ is only necessary on Windows - on other platforms it does nothing. On Windows,
+ it declares that the function should be exported. This is the default in
+ shared libraries on other platforms.
+ </p>
+<p>
+ The <code class="computeroutput"><span class="identifier">factory_map</span><span class="special">::</span><span class="identifier">add</span></code> function takes three template arguments:
+ the class to export, the interface that it is being exported as, and what
+ type of info is used to identify it (which can be an arbitrary type). The
+ argument is the value for that identification info.
+ </p>
+<p>
+ Now we can write the executable.
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">extension</span><span class="special">/</span><span class="identifier">factory_map</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">extension</span><span class="special">/</span><span class="identifier">shared_library</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">extension</span><span class="special">/</span><span class="identifier">convenience</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="string">"word.hpp"</span>
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">extensions</span><span class="special">;</span>
+ <span class="comment">// Create the factory_map object - it will hold all of the available
+</span> <span class="comment">// constructors. Multiple factory_maps can be constructed.
+</span> <span class="identifier">factory_map</span> <span class="identifier">fm</span><span class="special">;</span>
+ <span class="comment">// load the shared library with
+</span> <span class="identifier">load_single_library</span><span class="special">(</span><span class="identifier">fm</span><span class="special">,</span> <span class="string">"libHelloWorldLib.extension"</span><span class="special">,</span> <span class="string">"extension_export_word"</span><span class="special">);</span>
+ <span class="comment">// Get a reference to the list of constructors for words.
+</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">list</span><span class="special"><</span><span class="identifier">factory</span><span class="special"><</span><span class="identifier">word</span><span class="special">,</span> <span class="keyword">int</span><span class="special">></span> <span class="special">></span> <span class="special">&</span> <span class="identifier">factory_list</span> <span class="special">=</span> <span class="identifier">fm</span><span class="special">.</span><span class="identifier">get</span><span class="special"><</span><span class="identifier">word</span><span class="special">,</span> <span class="keyword">int</span><span class="special">>();</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">factory_list</span><span class="special">.</span><span class="identifier">size</span><span class="special">()</span> <span class="special"><</span> <span class="number">2</span><span class="special">)</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Error - the classes were not found."</span><span class="special">;</span>
+ <span class="keyword">for</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">list</span><span class="special"><</span><span class="identifier">factory</span><span class="special"><</span><span class="identifier">word</span><span class="special">,</span> <span class="keyword">int</span><span class="special">></span> <span class="special">>::</span><span class="identifier">iterator</span> <span class="identifier">current_word</span> <span class="special">=</span> <span class="identifier">factory_list</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span>
+ <span class="identifier">current_word</span> <span class="special">!=</span> <span class="identifier">factory_list</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span> <span class="special">++</span><span class="identifier">current_word</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="comment">// Using auto_ptr to avoid needing delete. Using smart_ptrs is recommended.
+</span> <span class="comment">// Note that this has a zero argument constructor - currently constructors
+</span> <span class="comment">// with up to six arguments can be used.
+</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">auto_ptr</span><span class="special"><</span><span class="identifier">word</span><span class="special">></span> <span class="identifier">word_ptr</span><span class="special">(</span><span class="identifier">current_word</span><span class="special">-></span><span class="identifier">create</span><span class="special">());</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">word_ptr</span><span class="special">-></span><span class="identifier">get_val</span><span class="special">()</span> <span class="special"><<</span> <span class="string">" "</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"\n"</span><span class="special">;</span>
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ Now we just need to write the build file. You may have noticed above that
+ the name of the library is assumed to be libHelloWorld.extension - we'll
+ need to rename whatever shared library is compiled to that. Boost.Build can
+ do this automatically.
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="identifier">import</span> <span class="identifier">type</span> <span class="special">:</span> <span class="identifier">change</span><span class="special">-</span><span class="identifier">generated</span><span class="special">-</span><span class="identifier">target</span><span class="special">-</span><span class="identifier">suffix</span> <span class="special">;</span>
+<span class="identifier">import</span> <span class="identifier">type</span> <span class="special">:</span> <span class="identifier">change</span><span class="special">-</span><span class="identifier">generated</span><span class="special">-</span><span class="identifier">target</span><span class="special">-</span><span class="identifier">prefix</span> <span class="special">;</span>
+<span class="identifier">type</span><span class="special">.</span><span class="identifier">change</span><span class="special">-</span><span class="identifier">generated</span><span class="special">-</span><span class="identifier">target</span><span class="special">-</span><span class="identifier">suffix</span> <span class="identifier">SHARED_LIB</span> <span class="special">:</span> <span class="special">:</span> <span class="identifier">extension</span> <span class="special">;</span>
+<span class="identifier">type</span><span class="special">.</span><span class="identifier">change</span><span class="special">-</span><span class="identifier">generated</span><span class="special">-</span><span class="identifier">target</span><span class="special">-</span><span class="identifier">prefix</span> <span class="identifier">SHARED_LIB</span> <span class="special">:</span> <span class="special">:</span> <span class="identifier">lib</span> <span class="special">;</span>
+<span class="identifier">import</span> <span class="identifier">os</span> <span class="special">;</span>
+
+<span class="identifier">local</span> <span class="identifier">BOOST_ROOT</span> <span class="special">=</span> <span class="special">[</span> <span class="identifier">os</span><span class="special">.</span><span class="identifier">environ</span> <span class="identifier">BOOST_ROOT</span> <span class="special">]</span> <span class="special">;</span>
+<span class="identifier">project</span>
+ <span class="special">:</span> <span class="identifier">requirements</span>
+ <span class="special"><</span><span class="identifier">include</span><span class="special">>../../../</span>
+ <span class="special"><</span><span class="identifier">include</span><span class="special">></span>#<span class="special">(</span><span class="identifier">BOOST_ROOT</span><span class="special">)</span>
+ <span class="special">:</span>
+ <span class="special">;</span>
+
+<span class="identifier">exe</span> <span class="identifier">HelloWorld</span> <span class="special">:</span> <span class="identifier">main</span><span class="special">.</span><span class="identifier">cpp</span> <span class="special">;</span>
+<span class="identifier">lib</span> <span class="identifier">HelloWorldLib</span> <span class="special">:</span> <span class="identifier">hello_world</span><span class="special">.</span><span class="identifier">cpp</span> <span class="special">:</span> <span class="special"><</span><span class="identifier">link</span><span class="special">></span><span class="identifier">shared</span> <span class="special">;</span>
+<span class="identifier">install</span> <span class="special">../</span><span class="identifier">bin</span> <span class="special">:</span> <span class="identifier">HelloWorld</span> <span class="identifier">HelloWorldLib</span> <span class="special">;</span>
+</pre>
+<p>
+ If you use another build system, you'll need to make sure that the output
+ shared library (dll, so, dylib etc.) is renamed correctly.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../tutorials.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorials.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="tutorial02.html"><img src="../../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial02.html
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial02.html 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,175 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Tutorial 2</title>
+<link rel="stylesheet" href="../../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<link rel="start" href="../../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="up" href="../tutorials.html" title="Tutorials">
+<link rel="prev" href="tutorial01.html" title="Tutorial 1">
+<link rel="next" href="tutorial03.html" title="Tutorial 3">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%">
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial01.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorials.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="tutorial03.html"><img src="../../images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_extension.tutorials.tutorial02"></a> Tutorial 2</h3></div></div></div>
+<p>
+ This tutorial shows more advanced class loading. The example described here
+ is contrived, and such a convoluted design is not used as an example of good
+ object-oriented program, but as a way to illustrate some of the possibilities
+ with this library.
+ </p>
+<p>
+ Let's design a class hierarchy based on the following:
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li>
+ There is a vehicle class
+ </li>
+<li>
+ There is a computer class
+ </li>
+<li>
+ A car is a vehicle
+ </li>
+<li>
+ A boat is a vehicle
+ </li>
+<li>
+ A plane is a vehicle
+ </li>
+<li>
+ A flying_car is a plane and a car
+ </li>
+<li>
+ A car_of_the_future is a flying_car, a boat, and a computer.
+ </li>
+</ul></div>
+<p>
+ In addition, we are not going to have any of these classes be interfaces.
+ They will each have an implementation in a .cpp file. This will require multiple
+ inheritance, as well as virtual inheritance (because otherwise a car_of_the_future
+ would consist of three separate vehicle base classes!).
+ </p>
+<p>
+ In addition, each class will be compiled into a separate shared library.
+ This is not necessary, certainly, but will serve to illustrate some of the
+ more advanced capabilities of the library, as well as some of the techniques
+ necessary in this situation.
+ </p>
+<p>
+ To begin with, let's look at the Jamfile:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="identifier">import</span> <span class="identifier">type</span> <span class="special">:</span> <span class="identifier">change</span><span class="special">-</span><span class="identifier">generated</span><span class="special">-</span><span class="identifier">target</span><span class="special">-</span><span class="identifier">suffix</span> <span class="special">;</span>
+<span class="identifier">import</span> <span class="identifier">type</span> <span class="special">:</span> <span class="identifier">change</span><span class="special">-</span><span class="identifier">generated</span><span class="special">-</span><span class="identifier">target</span><span class="special">-</span><span class="identifier">prefix</span> <span class="special">;</span>
+<span class="identifier">type</span><span class="special">.</span><span class="identifier">change</span><span class="special">-</span><span class="identifier">generated</span><span class="special">-</span><span class="identifier">target</span><span class="special">-</span><span class="identifier">suffix</span> <span class="identifier">SHARED_LIB</span> <span class="special">:</span> <span class="special">:</span> <span class="identifier">extension</span> <span class="special">;</span>
+<span class="identifier">type</span><span class="special">.</span><span class="identifier">change</span><span class="special">-</span><span class="identifier">generated</span><span class="special">-</span><span class="identifier">target</span><span class="special">-</span><span class="identifier">prefix</span> <span class="identifier">SHARED_LIB</span> <span class="special">:</span> <span class="special">:</span> <span class="identifier">lib</span> <span class="special">;</span>
+</pre>
+<p>
+ </p>
+<p>
+ First we must rename the generated libraries (this is required for cross-platform
+ use - but the prefix and suffix are arbitrary).
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="identifier">lib</span> <span class="identifier">Vehicle</span> <span class="special">:</span> <span class="identifier">multiple_inheritance</span><span class="special">/</span><span class="identifier">vehicle</span><span class="special">.</span><span class="identifier">cpp</span> <span class="special">:</span> <span class="special"><</span><span class="identifier">link</span><span class="special">></span><span class="identifier">shared</span> <span class="special">;</span>
+<span class="identifier">lib</span> <span class="identifier">Car</span> <span class="special">:</span> <span class="identifier">multiple_inheritance</span><span class="special">/</span><span class="identifier">car</span><span class="special">.</span><span class="identifier">cpp</span> <span class="identifier">Vehicle</span> <span class="special">:</span> <span class="special"><</span><span class="identifier">link</span><span class="special">></span><span class="identifier">shared</span> <span class="special">;</span>
+</pre>
+<p>
+ </p>
+<p>
+ Notice here that the Car library is linked to the Vehicle library - this
+ is necessary because the Car class needs the implementation of the Vehicle
+ class. This is unrelated to the Boost.Extension library, but just a standard
+ requirement when inheriting from shared library classes. The same will be
+ done with the other shared libraries.
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="identifier">lib</span> <span class="identifier">Plane</span> <span class="special">:</span> <span class="identifier">multiple_inheritance</span><span class="special">/</span><span class="identifier">plane</span><span class="special">.</span><span class="identifier">cpp</span> <span class="identifier">Vehicle</span> <span class="special">:</span> <span class="special"><</span><span class="identifier">link</span><span class="special">></span><span class="identifier">shared</span> <span class="special">;</span>
+<span class="identifier">lib</span> <span class="identifier">Boat</span> <span class="special">:</span> <span class="identifier">multiple_inheritance</span><span class="special">/</span><span class="identifier">boat</span><span class="special">.</span><span class="identifier">cpp</span> <span class="identifier">Vehicle</span> <span class="special">:</span> <span class="special"><</span><span class="identifier">link</span><span class="special">></span><span class="identifier">shared</span> <span class="special">;</span>
+<span class="identifier">lib</span> <span class="identifier">Computer</span> <span class="special">:</span> <span class="identifier">multiple_inheritance</span><span class="special">/</span><span class="identifier">computer</span><span class="special">.</span><span class="identifier">cpp</span> <span class="special">:</span> <span class="special"><</span><span class="identifier">link</span><span class="special">></span><span class="identifier">shared</span> <span class="special">;</span>
+<span class="identifier">lib</span> <span class="identifier">FlyingCar</span> <span class="special">:</span> <span class="identifier">multiple_inheritance</span><span class="special">/</span><span class="identifier">flying_car</span><span class="special">.</span><span class="identifier">cpp</span> <span class="identifier">Plane</span> <span class="identifier">Car</span> <span class="identifier">Vehicle</span> <span class="special">:</span> <span class="special"><</span><span class="identifier">link</span><span class="special">></span><span class="identifier">shared</span> <span class="special">;</span>
+<span class="identifier">lib</span> <span class="identifier">CarOfTheFuture</span> <span class="special">:</span>
+ <span class="identifier">multiple_inheritance</span><span class="special">/</span><span class="identifier">car_of_the_future</span><span class="special">.</span><span class="identifier">cpp</span>
+ <span class="identifier">Plane</span> <span class="identifier">Car</span> <span class="identifier">Vehicle</span>
+ <span class="identifier">FlyingCar</span> <span class="identifier">Computer</span> <span class="identifier">Boat</span>
+ <span class="special">:</span>
+ <span class="special"><</span><span class="identifier">link</span><span class="special">></span><span class="identifier">shared</span>
+<span class="special">;</span>
+
+<span class="identifier">install</span> <span class="special">../</span><span class="identifier">bin</span> <span class="special">:</span>
+ <span class="identifier">HelloWorld</span> <span class="identifier">HelloWorldLib</span> <span class="identifier">Vehicle</span> <span class="identifier">Boat</span> <span class="identifier">FlyingCar</span>
+ <span class="identifier">CarOfTheFuture</span> <span class="identifier">MultipleInheritance</span>
+ <span class="special">:</span>
+ <span class="special">;</span>
+</pre>
+<p>
+ </p>
+<p>
+ Refer to the examples/multiple_inheritance folder for the source code of
+ these classes. Only the most complex will be described here - the rest are
+ similar.
+ </p>
+<p>
+ On the Windows platform, there are special declarations that are required
+ when a dll must use a class that is defined in another dll. For interface
+ only classes this is unnecessary, and is not needed on other platforms. The
+ macros BOOST_EXTENSION_IMPORT_DECL and BOOST_EXTENSION_EXPORT_DECL can be
+ used to insert the proper declaration. This is detailed in the appendix.
+ </p>
+<p>
+
+</p>
+<pre class="programlisting">
+<span class="preprocessor">#define</span> <span class="identifier">BOOST_EXTENSION_FLYING_CAR_DECL</span> <span class="identifier">BOOST_EXTENSION_IMPORT_DECL</span>
+<span class="preprocessor">#define</span> <span class="identifier">BOOST_EXTENSION_BOAT_DECL</span> <span class="identifier">BOOST_EXTENSION_IMPORT_DECL</span>
+<span class="preprocessor">#define</span> <span class="identifier">BOOST_EXTENSION_COMPUTER_DECL</span> <span class="identifier">BOOST_EXTENSION_IMPORT_DECL</span>
+<span class="preprocessor">#include</span> <span class="string">"flying_car.hpp"</span>
+<span class="preprocessor">#include</span> <span class="string">"boat.hpp"</span>
+<span class="preprocessor">#include</span> <span class="string">"computer.hpp"</span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">typeinfo</span><span class="special">></span>
+<span class="keyword">class</span> <span class="identifier">BOOST_EXTENSION_CAR_OF_THE_FUTURE_DECL</span>
+ <span class="identifier">car_of_the_future</span> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">flying_car</span><span class="special">,</span> <span class="keyword">public</span> <span class="identifier">boat</span><span class="special">,</span> <span class="keyword">public</span> <span class="identifier">computer</span>
+<span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="identifier">car_of_the_future</span><span class="special">(</span><span class="keyword">void</span><span class="special">){</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"\nCreated a Car of the Future"</span><span class="special">;}</span>
+ <span class="special">~</span><span class="identifier">car_of_the_future</span><span class="special">(</span><span class="keyword">void</span><span class="special">){</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"\nDestroyed a Car of the Future"</span><span class="special">;}</span>
+ <span class="keyword">virtual</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">list_capabilities</span><span class="special">(</span><span class="keyword">void</span><span class="special">);</span>
+<span class="special">};</span>
+</pre>
+<p>
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial01.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorials.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="tutorial03.html"><img src="../../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial03.html
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial03.html 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Tutorial 3</title>
+<link rel="stylesheet" href="../../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<link rel="start" href="../../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="up" href="../tutorials.html" title="Tutorials">
+<link rel="prev" href="tutorial02.html" title="Tutorial 2">
+<link rel="next" href="tutorial04.html" title="Tutorial 4">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%">
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial02.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorials.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="tutorial04.html"><img src="../../images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_extension.tutorials.tutorial03"></a> Tutorial 3</h3></div></div></div>
+<p>
+ Insert content here.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial02.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorials.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="tutorial04.html"><img src="../../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial04.html
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial04.html 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Tutorial 4</title>
+<link rel="stylesheet" href="../../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<link rel="start" href="../../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="up" href="../tutorials.html" title="Tutorials">
+<link rel="prev" href="tutorial03.html" title="Tutorial 3">
+<link rel="next" href="tutorial05.html" title="Tutorial 5">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%">
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial03.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorials.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="tutorial05.html"><img src="../../images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_extension.tutorials.tutorial04"></a> Tutorial 4</h3></div></div></div>
+<p>
+ Insert content here.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial03.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorials.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="tutorial05.html"><img src="../../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial05.html
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial05.html 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Tutorial 5</title>
+<link rel="stylesheet" href="../../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<link rel="start" href="../../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="up" href="../tutorials.html" title="Tutorials">
+<link rel="prev" href="tutorial04.html" title="Tutorial 4">
+<link rel="next" href="tutorial06.html" title="Tutorial 6">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%">
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial04.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorials.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="tutorial06.html"><img src="../../images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_extension.tutorials.tutorial05"></a> Tutorial 5</h3></div></div></div>
+<p>
+ Insert content here.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial04.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorials.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="tutorial06.html"><img src="../../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial06.html
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/html/boost_extension/tutorials/tutorial06.html 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Tutorial 6</title>
+<link rel="stylesheet" href="../../boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<link rel="start" href="../../index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="up" href="../tutorials.html" title="Tutorials">
+<link rel="prev" href="tutorial05.html" title="Tutorial 5">
+<link rel="next" href="../factories.html" title="Factories">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%">
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial05.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorials.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="../factories.html"><img src="../../images/next.png" alt="Next"></a>
+</div>
+<div class="section" lang="en">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_extension.tutorials.tutorial06"></a> Tutorial 6</h3></div></div></div>
+<p>
+ Insert content here.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><small>Copyright © 2007 Jeremy Pack</small></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial05.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorials.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="../factories.html"><img src="../../images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
Added: sandbox/libs/extension/doc/html/boostbook.css
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/html/boostbook.css 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,354 @@
+/*=============================================================================
+ Copyright (c) 2002 2004 Joel de Guzman, Eric Niebler, Rene Rivera
+ http://spirit.sourceforge.net/
+
+ Use, modification and distribution is subject to 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)
+=============================================================================*/
+
+/* CSS based on w3c documentation which I like a lot, and the classic Spirit
+documentation. */
+
+/* Body defaults */
+body
+{
+ padding: 2em 1em 2em 1em;
+ margin: 1em 1em 1em 1em;
+ font-family: sans-serif;
+}
+
+/* Paragraphs */
+p
+{
+ text-align: justify;
+}
+
+pre.synopsis
+{
+ margin: 1pc 4% 0pc 4%;
+ padding: 0.5pc 0.5pc 0.5pc 0.5pc;
+}
+
+/* Headings */
+h1, h2, h3, h4, h5, h6 { text-align: left; margin-top: 2pc; }
+h1 { font: 170% sans-serif }
+h2 { font: bold 140% sans-serif }
+h3 { font: 120% sans-serif }
+h4 { font: bold 100% sans-serif }
+h5 { font: italic 100% sans-serif }
+h6 { font: italic 100% sans-serif }
+
+/* Unordered lists */
+ul
+{
+ text-align: justify;
+}
+
+/* Links */
+a
+{
+ text-decoration: none; /* no underline */
+}
+
+a:hover
+{
+ text-decoration: underline;
+}
+
+/* Top page title */
+title, h1.title, h2.title, h3.title,
+ h4.title, h5.title, h6.title,
+ .refentrytitle
+{
+ font-weight: bold;
+ font-size: 2pc;
+ margin-bottom: 1pc;
+}
+
+/* Spirit style navigation */
+.spirit-nav
+{
+ text-align: right;
+}
+
+.spirit-nav a
+{
+ color: white;
+ padding-left: 0.5em;
+}
+
+.spirit-nav img
+{
+ border-width: 0px;
+}
+
+/* Program listing box */
+.programlisting, .screen
+{
+ display: block;
+ margin-left: 4%;
+ margin-right: 4%;
+ padding: 0.5pc 0.5pc 0.5pc 0.5pc;
+}
+
+/* Table of contents */
+.toc
+{
+ margin: 1pc 4% 0pc 4%;
+ padding: 0.5pc 0.5pc 0.5pc 0.5pc;
+}
+
+.boost-toc
+{
+ float: right;
+ padding: 0.5pc;
+}
+
+/* Tables */
+.table-title, div.table p.title
+{
+ margin-left: 4%;
+ padding-right: 0.5em;
+ padding-left: 0.5em;
+ font-size: 120%;
+}
+
+.informaltable table, .table table
+{
+ width: 92%;
+ margin-left: 4%;
+ margin-right: 4%;
+}
+
+div.informaltable table, div.table table
+{
+ padding: 4px 4px 4px 4px;
+}
+
+div.informaltable table tr td, div.table table tr td
+{
+ padding: 0.5em 0.5em 0.5em 0.5em;
+ text-align: justify;
+}
+
+div.informaltable table tr th, div.table table tr th
+{
+ padding: 0.5em 0.5em 0.5em 0.5em;
+ border: 1pt solid white;
+}
+
+/* screen & programlisting, when used in a table cell, do not
+ need the extra padding and margin normally used */
+
+td .screen, td .programlisting
+{
+ display: block;
+ margin-left: 0%;
+ margin-right: 0%;
+ padding: 0.5pc 0.5pc 0.5pc 0.5pc;
+}
+
+/* inlined images */
+.inlinemediaobject
+{
+ padding: 0.5em 0.5em 0.5em 0.5em;
+}
+
+/* tone down the title of Parameter lists */
+div.variablelist p.title
+{
+ font-weight: bold;
+ font-size: 100%;
+ text-align: left;
+}
+
+/* tabularize parameter lists */
+div.variablelist dl dt
+{
+ float: left;
+ clear: left;
+ display: block;
+ font-style: italic;
+}
+
+div.variablelist dl dd
+{
+ display: block;
+ clear: right;
+ padding-left: 8pc;
+}
+
+/* title of books and articles in bibliographies */
+span.title
+{
+ font-style: italic;
+}
+
+/* tips, notes and warnings done in Spirit style */
+div.tip, div.note, div.warning
+{
+ position: relative;
+ padding: 0.5em;
+ border: 0.5pt solid white;
+}
+
+div.tip .title, div.note .title, div.warning .title
+{
+ display: block;
+ font: bold xx-small sans-serif;
+ margin: 0;
+ padding: 0;
+ position: absolute;
+ left: -4em;
+ top: 0em;
+ height: 25px;
+ width: 24px;
+ text-indent: 32px;
+ overflow: hidden;
+ z-index: 2;
+}
+
+div.tip .title
+{
+ background: url(images/tip.png);
+}
+
+div.note .title
+{
+ background: url(images/note.png);
+}
+
+div.warning .title
+{
+ background: url(images/caution.png);
+}
+
+@media screen
+{
+ a
+ {
+ color: #005a9c;
+ }
+
+ a:visited
+ {
+ color: #9c5a9c;
+ }
+
+ /* Syntax Highlighting */
+ .keyword { color: #0000AA; font-weight: bold; }
+ .identifier {}
+ .special { color: #707070; }
+ .preprocessor { color: #402080; font-weight: bold; }
+ .char { color: teal; }
+ .comment { color: #800000; }
+ .string { color: teal; }
+ .number { color: teal; }
+ .copyright { color: #666666; font-size: small; }
+ .white_bkd { background-color: #FFFFFF; }
+ .dk_grey_bkd { background-color: #999999; }
+
+ pre.synopsis
+ {
+ background-color: #f3f3f3;
+ }
+
+ .programlisting, .screen
+ {
+ background-color: #f3f3f3;
+ }
+
+ /* Table of contents */
+ .toc
+ {
+ background-color: #f3f3f3;
+ }
+
+ div.informaltable table tr td, div.table table tr td
+ {
+ background-color: #F3F3F3;
+ border: 1pt solid white;
+ }
+
+ div.informaltable table tr th, div.table table tr th
+ {
+ background-color: #e4e4e4;
+ }
+
+ div.tip, div.note, div.warning
+ {
+ background-color: #F3F3F3;
+ }
+
+ span.highlight
+ {
+ color: #00A000;
+ }
+}
+
+@media print
+{
+ a
+ {
+ color: black;
+ }
+
+ a:visited
+ {
+ color: black;
+ }
+
+ .spirit-nav
+ {
+ display: none;
+ }
+
+ /* Syntax Highlighting */
+ .keyword
+ {
+ font-weight: bold;
+ }
+
+ pre.synopsis
+ {
+ border: 1px solid gray;
+ }
+
+ .programlisting, .screen
+ {
+ border: 1px solid gray;
+ }
+
+ /* Table of contents */
+ .toc
+ {
+ border: 1px solid gray;
+ }
+
+ .informaltable table, .table table
+ {
+ border: 1px solid gray;
+ border-collapse: collapse;
+ }
+
+ div.informaltable table tr td, div.table table tr td
+ {
+ border: 1px solid gray;
+ }
+
+ div.informaltable table tr th, div.table table tr th
+ {
+ border: 1px solid gray;
+ }
+
+ div.tip, div.note, div.warning
+ {
+ border: 1px solid gray;
+ }
+
+ span.highlight
+ {
+ font-weight: bold;
+ }
+}
Added: sandbox/libs/extension/doc/html/index.html
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/html/index.html 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,61 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Chapter 1. Boost.Extension 1.0</title>
+<link rel="stylesheet" href="boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
+<link rel="start" href="index.html" title="Chapter 1. Boost.Extension 1.0">
+<link rel="next" href="boost_extension/introduction.html" title="Introduction">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%">
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</table>
+<hr>
+<div class="spirit-nav"><a accesskey="n" href="boost_extension/introduction.html"><img src="images/next.png" alt="Next"></a></div>
+<div class="chapter" lang="en">
+<div class="titlepage"><div>
+<div><h2 class="title">
+<a name="boost_extension"></a>Chapter 1. Boost.Extension 1.0</h2></div>
+<div><p class="copyright">Copyright © 2007 Jeremy Pack</p></div>
+<div><div class="legalnotice">
+<a name="id965072"></a><p>
+ 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)
+ </p>
+</div></div>
+</div></div>
+<div class="toc">
+<p><b>Table of Contents</b></p>
+<dl>
+<dt><span class="section"> Introduction</span></dt>
+<dt><span class="section">Tutorials</span></dt>
+<dd><dl>
+<dt><span class="section"> Tutorial 1</span></dt>
+<dt><span class="section"> Tutorial 2</span></dt>
+<dt><span class="section"> Tutorial 3</span></dt>
+<dt><span class="section"> Tutorial 4</span></dt>
+<dt><span class="section"> Tutorial 5</span></dt>
+<dt><span class="section"> Tutorial 6</span></dt>
+</dl></dd>
+<dt><span class="section"> Factories</span></dt>
+<dt><span class="section"> Shared Libraries</span></dt>
+<dt><span class="section"> Performance Analysis</span></dt>
+<dt><span class="section"> Appendices</span></dt>
+<dd><dl><dt><span class="section"> Appendix A - Windows Export and Import Declarations</span></dt></dl></dd>
+</dl>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"><small><p>Last revised: April 30, 2007 at 12:00:00 GMT</p></small></td>
+<td align="right"><small></small></td>
+</tr></table>
+<hr>
+<div class="spirit-nav"><a accesskey="n" href="boost_extension/introduction.html"><img src="images/next.png" alt="Next"></a></div>
+</body>
+</html>
Added: sandbox/libs/extension/doc/introduction.qbk
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/introduction.qbk 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,23 @@
+[section:introduction Introduction]
+Wrappers for loading classes from linked libraries to extend the functionality
+of a program. Created to ease the creation of plugins.
+
+The Boost.Extension library has been developed to ease the development of
+plugins and similar extensions to software. Classes can be made available from
+linked libraries and loaded automatically by the application.
+
+The documentation is completely incomplete. Sorry. Look at tutorial #1 for
+examples of basic usage, and tutorial #2 for examples of advanced usage.
+
+Note the following:
+
+
+
+# Multiple and virtual inheritance are supported
+# No macros are currently used (besides those required by Windows for exported functions)
+# Only one external function required per shared library to export classes
+# RTTI is used by default, but it is possible to use user-defined type identifications.
+# Classes do not need to be modified to be loadable
+
+
+[endsect]
Added: sandbox/libs/extension/doc/performance_analysis.qbk
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/performance_analysis.qbk 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,5 @@
+[section:performance_analysis Performance Analysis]
+
+Insert content here.
+
+[endsect]
\ No newline at end of file
Added: sandbox/libs/extension/doc/quick_start.qbk
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/quick_start.qbk 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,6 @@
+[section:quick_start Quick Start]
+
+For basic usage of the library, the tutorials
+
+[endsect]
+
Added: sandbox/libs/extension/doc/shared_libraries.qbk
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/shared_libraries.qbk 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,5 @@
+[section:shared_libraries Shared Libraries]
+
+Insert content here.
+
+[endsect]
\ No newline at end of file
Added: sandbox/libs/extension/doc/tutorial1.qbk
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/tutorial1.qbk 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,98 @@
+[section:tutorial01 Tutorial 1]
+
+Create a class that we will later subclass and put it into a header file called word.hpp.
+``
+class word
+{
+public:
+ virtual ~word(){}
+ virtual const char * get_val(){return "";}
+};
+``
+This file will be included by both the shared library in which classes implement this interface, and in the executable that will load these implementations. The destructor ought to be virtual, just to ensure proper deletion. We create one virtual function. We could actually add data to this class as well.
+
+Now create a file called hello_world.cpp. This will be compiled into a shared library:
+
+``
+#include "word.hpp"
+#include <boost/extension/factory_map.hpp>
+
+class world : public word
+{
+public:
+ virtual const char * get_val(){return "world!";}
+};
+class hello : public word
+{
+public:
+ virtual const char * get_val(){return "hello";}
+};
+``
+Now we have two classes that are derived from word, and that both implement the virtual function get_val. All that's left is to declare them for exporting. Normally, we just put one function in the entire shared library that exports all exportable classes in the library.
+``
+extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export_word(boost::extensions::factory_map & fm)
+{
+ fm.add<hello, word, int>(1);
+ fm.add<world, word, int>(2);
+}
+``
+`extern "C"` is required to keep the function name from being mangled. `BOOST_EXTENSION_EXPORT_DECL` is only necessary on Windows - on other platforms it does nothing. On Windows, it declares that the function should be exported. This is the default in shared libraries on other platforms.
+
+The `factory_map::add` function takes three template arguments: the class to export, the interface that it is being exported as, and what type of info is used to identify it (which can be an arbitrary type). The argument is the value for that identification info.
+
+Now we can write the executable.
+
+``
+#include <boost/extension/factory_map.hpp>
+#include <boost/extension/shared_library.hpp>
+#include <iostream>
+#include <boost/extension/convenience.hpp>
+#include "word.hpp"
+int main()
+{
+ using namespace boost::extensions;
+ // Create the factory_map object - it will hold all of the available
+ // constructors. Multiple factory_maps can be constructed.
+ factory_map fm;
+ // load the shared library with
+ load_single_library(fm, "libHelloWorldLib.extension", "extension_export_word");
+ // Get a reference to the list of constructors for words.
+ std::list<factory<word, int> > & factory_list = fm.get<word, int>();
+ if (factory_list.size() < 2)
+ std::cout << "Error - the classes were not found.";
+ for (std::list<factory<word, int> >::iterator current_word = factory_list.begin();
+ current_word != factory_list.end(); ++current_word)
+ {
+ // Using auto_ptr to avoid needing delete. Using smart_ptrs is recommended.
+ // Note that this has a zero argument constructor - currently constructors
+ // with up to six arguments can be used.
+ std::auto_ptr<word> word_ptr(current_word->create());
+ std::cout << word_ptr->get_val() << " ";
+ }
+ std::cout << "\n";
+ return 0;
+}
+``
+Now we just need to write the build file. You may have noticed above that the name of the library is assumed to be libHelloWorld.extension - we'll need to rename whatever shared library is compiled to that. Boost.Build can do this automatically.
+
+``
+import type : change-generated-target-suffix ;
+import type : change-generated-target-prefix ;
+type.change-generated-target-suffix SHARED_LIB : : extension ;
+type.change-generated-target-prefix SHARED_LIB : : lib ;
+import os ;
+
+local BOOST_ROOT = [ os.environ BOOST_ROOT ] ;
+project
+ : requirements
+ <include>../../../
+ <include>$(BOOST_ROOT)
+ :
+ ;
+
+exe HelloWorld : main.cpp ;
+lib HelloWorldLib : hello_world.cpp : <link>shared ;
+install ../bin : HelloWorld HelloWorldLib ;
+``
+If you use another build system, you'll need to make sure that the output shared library (dll, so, dylib etc.) is renamed correctly.
+[endsect]
\ No newline at end of file
Added: sandbox/libs/extension/doc/tutorial2.qbk
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/tutorial2.qbk 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,109 @@
+[section:tutorial02 Tutorial 2]
+
+This tutorial shows more advanced class loading. The example described here is
+contrived, and such a convoluted design is not used as an example of good object-oriented
+program, but as a way to illustrate some of the possibilities with this library.
+
+Let's design a class hierarchy based on the following:
+
+
+* There is a vehicle class
+* There is a computer class
+* A car is a vehicle
+* A boat is a vehicle
+* A plane is a vehicle
+* A flying_car is a plane and a car
+* A car_of_the_future is a flying_car, a boat, and a computer.
+
+
+In addition, we are not going to have any of these classes be interfaces. They will each
+have an implementation in a .cpp file. This will require multiple inheritance, as well
+as virtual inheritance (because otherwise a car_of_the_future would consist of three
+separate vehicle base classes!).
+
+
+In addition, each class will be compiled into a separate shared library. This is not
+necessary, certainly, but will serve to illustrate some of the more advanced capabilities
+of the library, as well as some of the techniques necessary in this situation.
+
+
+To begin with, let's look at the Jamfile:
+
+
+``
+import type : change-generated-target-suffix ;
+import type : change-generated-target-prefix ;
+type.change-generated-target-suffix SHARED_LIB : : extension ;
+type.change-generated-target-prefix SHARED_LIB : : lib ;
+``
+
+
+First we must rename the generated libraries (this is required for cross-platform use -
+but the prefix and suffix are arbitrary).
+
+
+``
+lib Vehicle : multiple_inheritance/vehicle.cpp : <link>shared ;
+lib Car : multiple_inheritance/car.cpp Vehicle : <link>shared ;
+``
+
+
+Notice here that the Car library is linked to the Vehicle library - this is necessary
+because the Car class needs the implementation of the Vehicle class. This is unrelated
+to the Boost.Extension library, but just a standard requirement when inheriting from
+shared library classes. The same will be done with the other shared libraries.
+
+
+``
+lib Plane : multiple_inheritance/plane.cpp Vehicle : <link>shared ;
+lib Boat : multiple_inheritance/boat.cpp Vehicle : <link>shared ;
+lib Computer : multiple_inheritance/computer.cpp : <link>shared ;
+lib FlyingCar : multiple_inheritance/flying_car.cpp Plane Car Vehicle : <link>shared ;
+lib CarOfTheFuture :
+ multiple_inheritance/car_of_the_future.cpp
+ Plane Car Vehicle
+ FlyingCar Computer Boat
+ :
+ <link>shared
+;
+
+install ../bin :
+ HelloWorld HelloWorldLib Vehicle Boat FlyingCar
+ CarOfTheFuture MultipleInheritance
+ :
+ ;
+``
+
+
+Refer to the examples/multiple_inheritance folder for the source code of these classes. Only
+the most complex will be described here - the rest are similar.
+
+
+On the Windows platform, there are special declarations that are required when a dll must use a class
+that is defined in another dll. For interface only classes this is unnecessary, and is not needed on
+other platforms. The macros BOOST_EXTENSION_IMPORT_DECL and BOOST_EXTENSION_EXPORT_DECL can be used
+to insert the proper declaration. This is detailed in the appendix.
+
+
+``
+#define BOOST_EXTENSION_FLYING_CAR_DECL BOOST_EXTENSION_IMPORT_DECL
+#define BOOST_EXTENSION_BOAT_DECL BOOST_EXTENSION_IMPORT_DECL
+#define BOOST_EXTENSION_COMPUTER_DECL BOOST_EXTENSION_IMPORT_DECL
+#include "flying_car.hpp"
+#include "boat.hpp"
+#include "computer.hpp"
+#include <iostream>
+#include <typeinfo>
+class BOOST_EXTENSION_CAR_OF_THE_FUTURE_DECL
+ car_of_the_future : public flying_car, public boat, public computer
+{
+public:
+ car_of_the_future(void){std::cout << "\nCreated a Car of the Future";}
+ ~car_of_the_future(void){std::cout << "\nDestroyed a Car of the Future";}
+ virtual std::string list_capabilities(void);
+};
+``
+
+
+
+[endsect]
\ No newline at end of file
Added: sandbox/libs/extension/doc/tutorial3.qbk
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/tutorial3.qbk 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,5 @@
+[section:tutorial03 Tutorial 3]
+
+Insert content here.
+
+[endsect]
\ No newline at end of file
Added: sandbox/libs/extension/doc/tutorial4.qbk
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/tutorial4.qbk 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,5 @@
+[section:tutorial04 Tutorial 4]
+
+Insert content here.
+
+[endsect]
\ No newline at end of file
Added: sandbox/libs/extension/doc/tutorial5.qbk
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/tutorial5.qbk 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,5 @@
+[section:tutorial05 Tutorial 5]
+
+Insert content here.
+
+[endsect]
\ No newline at end of file
Added: sandbox/libs/extension/doc/tutorial6.qbk
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/tutorial6.qbk 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,5 @@
+[section:tutorial06 Tutorial 6]
+
+Insert content here.
+
+[endsect]
\ No newline at end of file
Added: sandbox/libs/extension/doc/tutorials.qbk
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/doc/tutorials.qbk 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,14 @@
+[section Tutorials]
+[include tutorial1.qbk]
+[include tutorial2.qbk]
+[include tutorial3.qbk]
+[include tutorial4.qbk]
+[include tutorial5.qbk]
+[include tutorial6.qbk]
+Only the first and second tutorials are currently complete. The first tutorial
+is a basic hello world example. The second tutorial is a more complex example
+involving multiple inheritance, virtual inheritance, and inheritance across
+shared libraries.
+The tutorial code can be found in the examples folder. They all share the same
+Jamfile, but the Jamfile contents are separated out for each tutorial.
+[endsect]
\ No newline at end of file
Added: sandbox/libs/extension/examples/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/examples/Jamfile.v2 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,46 @@
+import type : change-generated-target-suffix ;
+import type : change-generated-target-prefix ;
+type.change-generated-target-suffix SHARED_LIB : : extension ;
+type.change-generated-target-prefix SHARED_LIB : : lib ;
+import os ;
+
+local BOOST_ROOT = [ os.environ BOOST_ROOT ] ;
+project
+ : requirements
+ <include>../../../
+ <include>$(BOOST_ROOT)
+ <find-static-library>dl
+ :
+ ;
+
+exe HelloWorld : main.cpp ;
+lib HelloWorldLib : hello_world.cpp : <link>shared ;
+
+lib Vehicle : multiple_inheritance/vehicle.cpp : <link>shared ;
+lib Car : multiple_inheritance/car.cpp Vehicle : <link>shared ;
+lib Plane : multiple_inheritance/plane.cpp Vehicle : <link>shared ;
+lib Boat : multiple_inheritance/boat.cpp Vehicle : <link>shared ;
+lib Computer : multiple_inheritance/computer.cpp : <link>shared ;
+lib FlyingCar : multiple_inheritance/flying_car.cpp Plane Car Vehicle : <link>shared ;
+lib CarOfTheFuture :
+ multiple_inheritance/car_of_the_future.cpp
+ Plane Car Vehicle
+ FlyingCar Computer Boat
+ :
+ <link>shared
+;
+exe MultipleInheritance : multiple_inheritance/main_mi.cpp Computer Vehicle ;
+stage ../stage :
+ HelloWorld HelloWorldLib Vehicle Car
+ Plane Boat Computer FlyingCar
+ CarOfTheFuture MultipleInheritance ;
+
+install ../bin :
+ HelloWorld HelloWorldLib Vehicle Boat FlyingCar
+ CarOfTheFuture MultipleInheritance
+ :
+ <install-dependencies>on
+ <install-type>EXE
+ <install-type>SHARED_LIB
+ <install-type>LIB
+ ;
Added: sandbox/libs/extension/examples/boost-build.jam
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/examples/boost-build.jam 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,17 @@
+#~ Copyright (C) 2002-2003, David Abrahams.
+#~ Copyright (C) 2002-2003, Vladimir Prus.
+#~ Copyright (C) 2003, Rene Rivera.
+#~ Use, modification and distribution are subject to 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)
+
+BOOST_ROOT = $(.boost-build-file:D) ;
+if --v2 in $(ARGV)
+{
+ JAMFILE = [Jj]amfile.v2 ;
+ boost-build tools/build/v2 ;
+}
+else
+{
+ boost-build tools/build/v1 ;
+}
Added: sandbox/libs/extension/examples/hello_world.cpp
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/examples/hello_world.cpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,24 @@
+/* (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)
+ */
+
+#include "word.hpp"
+#include <boost/extension/factory_map.hpp>
+
+class world : public word
+{
+public:
+ virtual const char * get_val(){return "world!";}
+};
+class hello : public word
+{
+public:
+ virtual const char * get_val(){return "hello";}
+};
+extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export_word(boost::extensions::factory_map & fm)
+{
+ fm.add<hello, word, int>(1);
+ fm.add<world, word, int>(2);
+}
\ No newline at end of file
Added: sandbox/libs/extension/examples/main.cpp
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/examples/main.cpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,35 @@
+/* (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)
+ */
+
+#include <boost/extension/factory_map.hpp>
+#include <boost/extension/shared_library.hpp>
+#include <iostream>
+#include <boost/extension/convenience.hpp>
+#include "word.hpp"
+int main()
+{
+ using namespace boost::extensions;
+ // Create the factory_map object - it will hold all of the available
+ // constructors. Multiple factory_maps can be constructed.
+ factory_map fm;
+ // load the shared library with
+ load_single_library(fm, "libHelloWorldLib.extension", "extension_export_word");
+ // Get a reference to the list of constructors for words.
+ std::list<factory<word, int> > & factory_list = fm.get<word, int>();
+ if (factory_list.size() < 2)
+ std::cout << "Error - the classes were not found.";
+ for (std::list<factory<word, int> >::iterator current_word = factory_list.begin();
+ current_word != factory_list.end(); ++current_word)
+ {
+ // Using auto_ptr to avoid needing delete. Using smart_ptrs is recommended.
+ // Note that this has a zero argument constructor - currently constructors
+ // with up to six arguments can be used.
+ std::auto_ptr<word> word_ptr(current_word->create());
+ std::cout << word_ptr->get_val() << " ";
+ }
+ std::cout << "\n";
+ return 0;
+}
\ No newline at end of file
Added: sandbox/libs/extension/examples/multiple_inheritance/boat.cpp
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/examples/multiple_inheritance/boat.cpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,26 @@
+
+/* The following lines are only necessary because when
+are linking to this dll at compile time with another
+dll on Windows. As such, standard __declspec stuff
+is required.
+
+This example is something of a special case - normally
+these types of macros are not necessary for classes
+- see the FAQ.
+ */
+#include <boost/extension/extension.hpp>
+#define BOOST_EXTENSION_BOAT_DECL BOOST_EXTENSION_EXPORT_DECL
+#include "boat.hpp"
+#include <boost/extension/factory_map.hpp>
+
+
+std::string boat::list_capabilities()
+{
+ return "\nIt floats on water.";
+}
+
+extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export(boost::extensions::factory_map & z)
+{
+ z.add<boat, vehicle, std::string>("A boat exported as a vehicle");
+ z.add<boat, boat, std::string>("A boat exported as a boat");
+}
\ No newline at end of file
Added: sandbox/libs/extension/examples/multiple_inheritance/boat.hpp
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/examples/multiple_inheritance/boat.hpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,18 @@
+#ifndef BOOST_EXTENSION_BOAT_HPP
+#define BOOST_EXTENSION_BOAT_HPP
+// See the FAQ for info about why the following is necessary
+// here, but usually isn't.
+#define BOOST_EXTENSION_VEHICLE_DECL BOOST_EXTENSION_IMPORT_DECL
+#include "vehicle.hpp"
+#include <iostream>
+#include <typeinfo>
+
+class BOOST_EXTENSION_BOAT_DECL boat : virtual public vehicle
+{
+public:
+ boat(void){std::cout << "\nCreated a Boat";}
+ virtual ~boat(void){std::cout << "\nDestroyed a Boat";}
+ virtual std::string list_capabilities(void);
+};
+
+#endif
\ No newline at end of file
Added: sandbox/libs/extension/examples/multiple_inheritance/car.cpp
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/examples/multiple_inheritance/car.cpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,26 @@
+/* The following lines are only necessary because when
+are linking to this dll at compile time with another
+dll on Windows. As such, standard __declspec stuff
+is required.
+
+This example is something of a special case - normally
+these types of macros are not necessary for classes
+- see the FAQ.
+ */
+
+#include <boost/extension/extension.hpp>
+#define BOOST_EXTENSION_CAR_DECL BOOST_EXTENSION_EXPORT_DECL
+
+
+#include "car.hpp"
+#include <boost/extension/factory_map.hpp>
+std::string car::list_capabilities()
+{
+ return "\nIt travels on roads.";
+}
+
+extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export(boost::extensions::factory_map & z)
+{
+ z.add<car, vehicle, std::string>("A car exported as a vehicle");
+ z.add<car, car, std::string>("A car exported as a car");
+}
\ No newline at end of file
Added: sandbox/libs/extension/examples/multiple_inheritance/car.hpp
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/examples/multiple_inheritance/car.hpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,17 @@
+#ifndef BOOST_EXTENSION_CAR_HPP
+#define BOOST_EXTENSION_CAR_HPP
+// See the FAQ for info about why the following is necessary
+// here, but usually isn't.
+#define BOOST_EXTENSION_VEHICLE_DECL BOOST_EXTENSION_IMPORT_DECL
+#include "vehicle.hpp"
+#include <iostream>
+#include <typeinfo>
+class BOOST_EXTENSION_CAR_DECL car : virtual public vehicle
+{
+public:
+ car(void){std::cout << "\nCreated a Car";}
+ virtual ~car(void){std::cout << "\nDestroyed a Car";}
+ virtual std::string list_capabilities(void);
+};
+
+#endif
\ No newline at end of file
Added: sandbox/libs/extension/examples/multiple_inheritance/car_of_the_future.cpp
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/examples/multiple_inheritance/car_of_the_future.cpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,38 @@
+/* The following lines are only necessary because when
+are linking to this dll at compile time with another
+dll on Windows. As such, standard __declspec stuff
+is required.
+
+This example is something of a special case - normally
+these types of macros are not necessary for classes
+- see the FAQ.
+ */
+#include <boost/extension/extension.hpp>
+#define BOOST_EXTENSION_CAR_OF_THE_FUTURE_DECL BOOST_EXTENSION_EXPORT_DECL
+
+#include "car_of_the_future.hpp"
+#include <boost/extension/factory_map.hpp>
+
+std::string car_of_the_future::list_capabilities()
+{
+ return boat::list_capabilities() + flying_car::list_capabilities() +
+ computer::list_capabilities() + "\nCosts an arm and a leg";
+}
+
+extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export(boost::extensions::factory_map & z)
+{
+ z.add<car_of_the_future, vehicle, std::string>
+ ("A car of the future exported as a vehicle");
+ z.add<car_of_the_future, car, std::string>
+ ("A car of the future exported as a car");
+ z.add<car_of_the_future, plane, std::string>
+ ("A car of the future exported as a plane");
+ z.add<car_of_the_future, flying_car, std::string>
+ ("A car of the future exported as a flying car");
+ z.add<car_of_the_future, boat, std::string>
+ ("A car of the future exported as a boat");
+ z.add<car_of_the_future, computer, std::string>
+ ("A car of the future exported as a computer");
+ z.add<car_of_the_future, car_of_the_future, std::string>
+ ("A car of the future exported as a car of the future");
+}
\ No newline at end of file
Added: sandbox/libs/extension/examples/multiple_inheritance/car_of_the_future.hpp
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/examples/multiple_inheritance/car_of_the_future.hpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,22 @@
+#ifndef BOOST_EXTENSION_CAR_OF_THE_FUTURE_HPP
+#define BOOST_EXTENSION_CAR_OF_THE_FUTURE_HPP
+// See the FAQ for info about why the following is necessary
+// here, but usually isn't.
+#define BOOST_EXTENSION_FLYING_CAR_DECL BOOST_EXTENSION_IMPORT_DECL
+#define BOOST_EXTENSION_BOAT_DECL BOOST_EXTENSION_IMPORT_DECL
+#define BOOST_EXTENSION_COMPUTER_DECL BOOST_EXTENSION_IMPORT_DECL
+#include "flying_car.hpp"
+#include "boat.hpp"
+#include "computer.hpp"
+#include <iostream>
+#include <typeinfo>
+class BOOST_EXTENSION_CAR_OF_THE_FUTURE_DECL
+ car_of_the_future : public flying_car, public boat, public computer
+{
+public:
+ car_of_the_future(void){std::cout << "\nCreated a Car of the Future";}
+ ~car_of_the_future(void){std::cout << "\nDestroyed a Car of the Future";}
+ virtual std::string list_capabilities(void);
+};
+
+#endif
\ No newline at end of file
Added: sandbox/libs/extension/examples/multiple_inheritance/computer.cpp
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/examples/multiple_inheritance/computer.cpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,25 @@
+/* The following lines are only necessary because when
+are linking to this dll at compile time with another
+dll on Windows. As such, standard __declspec stuff
+is required.
+
+This example is something of a special case - normally
+these types of macros are not necessary for classes
+- see the FAQ.
+ */
+#include <boost/extension/extension.hpp>
+#define BOOST_EXTENSION_COMPUTER_DECL BOOST_EXTENSION_EXPORT_DECL
+
+
+#include "computer.hpp"
+#include <boost/extension/factory_map.hpp>
+
+std::string computer::list_capabilities()
+{
+ return "\nIt computes.";
+}
+
+extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export(boost::extensions::factory_map & z)
+{
+ z.add<computer, computer, std::string>("\nA computer exported as a computer");
+}
\ No newline at end of file
Added: sandbox/libs/extension/examples/multiple_inheritance/computer.hpp
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/examples/multiple_inheritance/computer.hpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,14 @@
+#ifndef BOOST_EXTENSION_COMPUTER_HPP
+#define BOOST_EXTENSION_COMPUTER_HPP
+#include <boost/extension/extension.hpp>
+#include <iostream>
+#include <typeinfo>
+class BOOST_EXTENSION_COMPUTER_DECL computer
+{
+public:
+ computer(void){std::cout << "\nCreated a Computer";}
+ virtual ~computer(void){std::cout << "\nDestroyed a Computer";}
+ virtual std::string list_capabilities(void);
+};
+
+#endif
\ No newline at end of file
Added: sandbox/libs/extension/examples/multiple_inheritance/flying_car.cpp
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/examples/multiple_inheritance/flying_car.cpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,28 @@
+/* The following lines are only necessary because when
+are linking to this dll at compile time with another
+dll on Windows. As such, standard __declspec stuff
+is required.
+
+This example is something of a special case - normally
+these types of macros are not necessary for classes
+- see the FAQ.
+ */
+#include <boost/extension/extension.hpp>
+#define BOOST_EXTENSION_FLYING_CAR_DECL BOOST_EXTENSION_EXPORT_DECL
+
+
+#include "flying_car.hpp"
+#include <boost/extension/factory_map.hpp>
+
+std::string flying_car::list_capabilities()
+{
+ return car::list_capabilities() + plane::list_capabilities() + "\nIt takes off from your driveway";
+}
+
+extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export(boost::extensions::factory_map & z)
+{
+ z.add<flying_car, vehicle, std::string>("A flying car exported as a vehicle");
+ z.add<flying_car, plane, std::string>("A flying car exported as a plane");
+ z.add<flying_car, car, std::string>("A flying car exported as a car");
+ z.add<flying_car, flying_car, std::string>("A flying car exported as a flying car");
+}
\ No newline at end of file
Added: sandbox/libs/extension/examples/multiple_inheritance/flying_car.hpp
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/examples/multiple_inheritance/flying_car.hpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,19 @@
+#ifndef BOOST_EXTENSION_FLYING_CAR_HPP
+#define BOOST_EXTENSION_FLYING_CAR_HPP
+// See the FAQ for info about why the following is necessary
+// here, but usually isn't.
+#define BOOST_EXTENSION_PLANE_DECL BOOST_EXTENSION_IMPORT_DECL
+#define BOOST_EXTENSION_CAR_DECL BOOST_EXTENSION_IMPORT_DECL
+#include "car.hpp"
+#include "plane.hpp"
+#include <iostream>
+#include <typeinfo>
+class BOOST_EXTENSION_FLYING_CAR_DECL flying_car : public car, public plane
+{
+public:
+ flying_car(void):vehicle(){std::cout << "\nCreated a Flying Car";}
+ ~flying_car(void){std::cout << "\nDestroyed a Flying Car";}
+ virtual std::string list_capabilities(void);
+};
+
+#endif
\ No newline at end of file
Added: sandbox/libs/extension/examples/multiple_inheritance/main_mi.cpp
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/examples/multiple_inheritance/main_mi.cpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,75 @@
+/* (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)
+*/
+
+#include <boost/extension/factory_map.hpp>
+#include <boost/extension/shared_library.hpp>
+// See the FAQ for info about why the following is necessary
+// here, but usually isn't.
+#define BOOST_EXTENSION_VEHICLE_DECL BOOST_EXTENSION_IMPORT_DECL
+#define BOOST_EXTENSION_COMPUTER_DECL BOOST_EXTENSION_IMPORT_DECL
+#include "vehicle.hpp"
+#include "computer.hpp"
+#include <iostream>
+#include <boost/extension/convenience.hpp>
+// #include <boost/extension/filesystem.hpp>
+int main()
+{
+ using namespace boost::extensions;
+ // Create the factory_map object - it will hold all of the available
+ // constructors. Multiple zones can be constructed.
+ factory_map twilight;
+ // Load the constructors and information into the factory_map.
+ load_single_library(twilight, "libVehicle.extension", "extension_export");
+ load_single_library(twilight, "libCar.extension", "extension_export");
+ load_single_library(twilight, "libComputer.extension", "extension_export");
+ load_single_library(twilight, "libBoat.extension", "extension_export");
+ load_single_library(twilight, "libFlyingCar.extension", "extension_export");
+ load_single_library(twilight, "libCarOfTheFuture.extension", "extension_export");
+ load_single_library(twilight, "libPlane.extension", "extension_export");
+ // load_all_libraries(twilight, "./", "extension_export_word");
+ // Get a reference to the list of constructors.
+ // Note that the factories can be copied just fine - meaning that the factory list
+ // can be copied from the factory_map object into a different data structure, and the factory_map
+ // can be destroyed.
+ std::cout << "\n>>>>>>>>>>>>\nComputers:\n>>>>>>>>>>>>>>>>>>>";
+ std::list<factory<computer, std::string> > & factory_list = twilight.get<computer, std::string>();
+ if (factory_list.size() < 1)
+ std::cout << "Error - no computers were found.";
+ for (std::list<factory<computer, std::string> >::iterator comp = factory_list.begin();
+ comp != factory_list.end(); ++comp)
+ {
+ // Using auto_ptr to avoid needing delete. Using smart_ptrs is recommended.
+ // Note that this has a zero argument constructor - currently constructors
+ // with up to six arguments can be used.
+ std::auto_ptr<computer> computer_ptr(comp->create());
+ std::cout << "\n--------\nLoaded the class described as: ";
+ std::cout << comp->get_info();
+ std::cout << "\n\nIt claims the following capabilities: ";
+ std::cout << computer_ptr->list_capabilities() << "\n";
+ }
+ std::cout << "\n\n";
+
+
+
+ std::cout << "\n>>>>>>>>>>>>\nVehicles:\n>>>>>>>>>>>>>>>>>>>";
+ std::list<factory<vehicle, std::string> > & factory_list2 = twilight.get<vehicle, std::string>();
+ if (factory_list2.size() < 1)
+ std::cout << "Error - no vehicles were found.";
+ for (std::list<factory<vehicle, std::string> >::iterator comp = factory_list2.begin();
+ comp != factory_list2.end(); ++comp)
+ {
+ // Using auto_ptr to avoid needing delete. Using smart_ptrs is recommended.
+ // Note that this has a zero argument constructor - currently constructors
+ // with up to six arguments can be used.
+ std::auto_ptr<vehicle> computer_ptr(comp->create());
+ std::cout << "\n--------\nLoaded the class described as: ";
+ std::cout << comp->get_info();
+ std::cout << "\n\nIt claims the following capabilities: ";
+ std::cout << computer_ptr->list_capabilities() << "\n";
+ }
+ std::cout << "\n\n";
+ return 0;
+}
\ No newline at end of file
Added: sandbox/libs/extension/examples/multiple_inheritance/plane.cpp
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/examples/multiple_inheritance/plane.cpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,26 @@
+/* The following lines are only necessary because when
+are linking to this dll at compile time with another
+dll on Windows. As such, standard __declspec stuff
+is required.
+
+This example is something of a special case - normally
+these types of macros are not necessary for classes
+- see the FAQ.
+ */
+#include <boost/extension/extension.hpp>
+#define BOOST_EXTENSION_PLANE_DECL BOOST_EXTENSION_EXPORT_DECL
+
+
+#include "plane.hpp"
+#include <boost/extension/factory_map.hpp>
+
+std::string plane::list_capabilities()
+{
+ return "\nIt flies in the air.";
+}
+
+extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export(boost::extensions::factory_map & z)
+{
+ z.add<plane, vehicle, std::string>("A plane exported as a vehicle");
+ z.add<plane, plane, std::string>("A plane exported as a plane");
+}
\ No newline at end of file
Added: sandbox/libs/extension/examples/multiple_inheritance/plane.hpp
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/examples/multiple_inheritance/plane.hpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,17 @@
+#ifndef BOOST_EXTENSION_PLANE_HPP
+#define BOOST_EXTENSION_PLANE_HPP
+// See the FAQ for info about why the following is necessary
+// here, but usually isn't.
+#define BOOST_EXTENSION_VEHICLE_DECL BOOST_EXTENSION_IMPORT_DECL
+#include "vehicle.hpp"
+#include <iostream>
+#include <typeinfo>
+class BOOST_EXTENSION_PLANE_DECL plane : virtual public vehicle
+{
+public:
+ plane(void){std::cout << "\nCreated a Plane";}
+ ~plane(void){std::cout << "\nDestroyed a Plane";}
+ virtual std::string list_capabilities(void);
+};
+
+#endif
\ No newline at end of file
Added: sandbox/libs/extension/examples/multiple_inheritance/vehicle.cpp
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/examples/multiple_inheritance/vehicle.cpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,24 @@
+/* The following lines are only necessary because when
+are linking to this dll at compile time with another
+dll on Windows. As such, standard __declspec stuff
+is required.
+
+This example is something of a special case - normally
+these types of macros are not necessary for classes
+- see the FAQ.
+ */
+#include <boost/extension/extension.hpp>
+#define BOOST_EXTENSION_VEHICLE_DECL BOOST_EXTENSION_EXPORT_DECL
+
+#include "vehicle.hpp"
+#include <boost/extension/factory_map.hpp>
+
+std::string vehicle::list_capabilities()
+{
+ return "\nIt is some sort of vehicle.";
+}
+
+extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export(boost::extensions::factory_map & z)
+{
+ z.add<vehicle, vehicle, std::string>("A vehicle exported as a vehicle");
+}
\ No newline at end of file
Added: sandbox/libs/extension/examples/multiple_inheritance/vehicle.hpp
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/examples/multiple_inheritance/vehicle.hpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,14 @@
+#ifndef BOOST_EXTENSION_VEHICLE_HPP
+#define BOOST_EXTENSION_VEHICLE_HPP
+#include <boost/extension/extension.hpp>
+#include <iostream>
+#include <typeinfo>
+class BOOST_EXTENSION_VEHICLE_DECL vehicle
+{
+public:
+ vehicle(void){std::cout << "\nCreated a Vehicle";}
+ virtual ~vehicle(void){std::cout << "\nDestroyed a Vehicle";}
+ virtual std::string list_capabilities(void);
+};
+
+#endif
\ No newline at end of file
Added: sandbox/libs/extension/examples/word.hpp
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/examples/word.hpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,12 @@
+/* (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)
+ */
+
+class word
+{
+public:
+ virtual ~word(){}
+ virtual const char * get_val(){return "";}
+};
\ No newline at end of file
Added: sandbox/libs/extension/fake.cpp
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/fake.cpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,5 @@
+/// This file is used to create empty library
+/// for MSVC Extension.Test project dependency.
+/// It is useful to test header files.
+
+//#include <boost/extension/factory_map.hpp>
Added: sandbox/libs/extension/scripts/GenerateHeaders.py
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/scripts/GenerateHeaders.py 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,467 @@
+# Copyright 2007 Jeremy Pack
+# Use for generation of factory.h and shared_library.h
+
+import sys
+
+class header_generator:
+ def __init__(self, max_params):
+ self.max_params = max_params
+
+ def generate(self):
+ self.generate_factory_hpp()
+ self.generate_counted_factory_hpp()
+ self.generate_shared_library_hpp()
+ self.generate_factory_map_hpp("factory", "", "")
+ self.generate_factory_map_hpp("counted_factory",
+ "\n f.set_library(current_library_);\n f.set_counter(current_counter_);",
+ "\n std::string current_library_;\n int * current_counter_;",
+ "\n virtual bool erase(const char * library_name) = 0;", """
+ virtual bool erase(const char * library_name)
+ {
+ for (iterator it = begin(); it != end(); ++it)
+ {
+ if (strcmp(it->library(), library_name) == 0)
+ erase(it);
+ }
+ return size() == 0;
+ }""")
+
+ def template_header(self, start_string, start, count, add_void):
+ if add_void:
+ v = " = void"
+ else:
+ v = ""
+ center = ", ".join(start + ["class Param" + str(i) + v
+ for i in range(1, count + 1)])
+ out_str = "".join([start_string, center, ">\n"])
+ return out_str
+
+ def nameless_param_list(self, count, start):
+ return ", ".join(start + ["Param" + str(i) for i in range(1, count+1)])
+
+ def param_names(self, count, start):
+ return ", ".join(start + ["p" + str(i) for i in range(1, count+1)])
+
+ def named_param_list(self, count, start):
+ return ", ".join(start + ["".join(["Param", str(i), " p", str(i)])
+ for i in range(1, count+1)])
+
+ def generate_factory_hpp(self):
+ out = open('../../../boost/extension/factory.hpp', mode='w')
+ out.write("""/* (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)
+*/
+#ifndef BOOST_EXTENSION_FACTORY_HPP
+#define BOOST_EXTENSION_FACTORY_HPP
+#include <string>
+namespace boost{namespace extensions{
+ """)
+ for i in range(self.max_params, -1, -1):
+ out.write(self.template_header('template <',
+ ['class Interface', 'class Info'],
+ i, i == self.max_params))
+ if i != self.max_params:
+ factory_template = ("".join(["<",
+ self.nameless_param_list(i, ["Interface", "Info"]),
+ ">\n"]))
+ else:
+ factory_template = "\n"
+ out.write("".join(["class factory",
+ factory_template,
+ """{
+private:
+ class generic_factory_function
+ {
+ public:
+ virtual ~generic_factory_function(){}
+ virtual Interface * operator()(""",
+ self.nameless_param_list(i, []),
+ """) = 0;
+ virtual generic_factory_function * copy() const = 0;
+ };
+ template <class T>
+ class factory_function : public generic_factory_function
+ {
+ public:
+ virtual ~factory_function(){}
+ virtual Interface * operator()
+ (""",
+ self.named_param_list(i, []),
+ """)
+ {return new T(""",
+ self.param_names(i, []),
+ """);}
+ virtual generic_factory_function * copy() const {return new factory_function<T>;}
+ };
+ std::auto_ptr<generic_factory_function> factory_func_ptr_;
+ Info info_;
+public:
+ template <class Actual>
+ void set_type_special(Actual *){factory_func_ptr_.reset(new factory_function<Actual>());}
+ template <class Actual>
+ void set_type(){factory_func_ptr_ = new factory_function<Actual>();}
+ factory(Info info)
+ :factory_func_ptr_(0),
+ info_(info)
+ {}
+ factory(const factory & first)
+ :factory_func_ptr_(first.factory_func_ptr_->copy()),
+ info_(first.info_)
+ {}
+ Interface * operator()(""",
+ self.named_param_list(i, []),
+ """)
+ {return create(""",
+ self.param_names(i, []),
+ """);}
+ Interface * create(""",
+ self.named_param_list(i, []),
+ """){return (*factory_func_ptr_)
+ (""",
+ self.param_names(i, []),
+ """);}
+ Info & get_info(){return info_;}
+};
+"""]))
+ # For loop over!
+ out.write("""}}
+#endif
+""")
+
+ def generate_counted_factory_hpp(self):
+ out = open('../../../boost/extension/counted_factory.hpp', mode='w')
+ out.write("""/* (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)
+*/
+#ifndef BOOST_EXTENSION_COUNTED_FACTORY_HPP
+#define BOOST_EXTENSION_COUNTED_FACTORY_HPP
+#include <string>
+namespace boost{namespace extensions{
+ """)
+ for i in range(self.max_params, -1, -1):
+ out.write(self.template_header('template <',
+ ['class Interface', 'class Info'],
+ i, i == self.max_params))
+ if i != self.max_params:
+ factory_template = ("".join(["<",
+ self.nameless_param_list(i, ["Interface", "Info"]),
+ ">\n"]))
+ else:
+ factory_template = "\n"
+ out.write("".join(["class counted_factory",
+ factory_template,
+ """{
+private:
+ int * counter_;
+ std::string library_;
+ class generic_factory_function
+ {
+ public:
+ virtual ~generic_factory_function(){}
+ virtual Interface * operator()(""",
+ self.nameless_param_list(i, []),
+ """) = 0;
+ virtual generic_factory_function * copy() const = 0;
+ };
+ template <class T>
+ class factory_function : public generic_factory_function
+ {
+ public:
+ class counted_object : public T
+ {
+ private:
+ int * counter_;
+ public:
+ counted_object(""",
+ self.named_param_list(i, ["int * counter"]),
+ """) : T(""",
+ self.param_names(i, []),"""),
+ counter_(counter)
+ {
+ ++(*counter_);
+ }
+ ~counted_object()
+ {
+ --(*counter_);
+ }
+ };
+ virtual ~factory_function(){}
+ virtual Interface * operator()
+ (""",
+ self.named_param_list(i, ["int * counter"]),
+ """)
+ {return new counted_object(""",
+ self.param_names(i, ["counter_"]),
+ """);}
+ virtual generic_factory_function * copy() const {return new factory_function<T>;}
+ };
+ std::auto_ptr<generic_factory_function> factory_func_ptr_;
+ Info info_;
+public:
+ const char * library()
+ {
+ return library_.c_str();
+ }
+ template <class Actual>
+ void set_type_special(Actual *){factory_func_ptr_.reset(new factory_function<Actual>());}
+ template <class Actual>
+ void set_type(){factory_func_ptr_ = new factory_function<Actual>();}
+ counted_factory(Info info)
+ :factory_func_ptr_(0),
+ info_(info)
+ {}
+ counted_factory(const counted_factory & first)
+ :factory_func_ptr_(first.factory_func_ptr_->copy()),
+ info_(first.info_)
+ {}
+ Interface * operator()(""",
+ self.named_param_list(i, []),
+ """)
+ {return create(""",
+ self.param_names(i, []),
+ """);}
+ Interface * create(""",
+ self.named_param_list(i, []),
+ """){return (*factory_func_ptr_)
+ (""",
+ self.param_names(i, []),
+ """);}
+ Info & get_info(){return info_;}
+};
+"""]))
+ # For loop over!
+ out.write("""}}
+#endif
+""")
+
+
+ def generate_shared_library_hpp(self):
+ out = open('../../../boost/extension/shared_library.hpp', mode='w')
+ out.write("""/* (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)
+ */
+
+#ifndef BOOST_EXTENSION_LINKED_LIBRARY_HPP
+#define BOOST_EXTENSION_LINKED_LIBRARY_HPP
+#include <boost/extension/impl/library_impl.hpp>
+
+
+namespace boost{namespace extensions{
+""")
+ for i in range(self.max_params, -1, -1):
+ out.write(self.template_header('template <',
+ ['class ReturnValue'],
+ i, i == self.max_params))
+ if i != self.max_params:
+ functor_template = ("".join(["<",
+ self.nameless_param_list(i, ["ReturnValue"]),
+ ">\n"]))
+ else:
+ functor_template = "\n"
+ out.write("".join(["class functor",
+ functor_template,
+ """{
+private:
+ typedef ReturnValue (*FunctionType)(""",
+ self.nameless_param_list(i, []),
+ """);
+ FunctionType func_;
+public:
+ bool is_valid(){return func_ != 0;}
+ functor(FunctionType func)
+ :func_(func)
+ {}
+ functor(generic_function_ptr func)
+ :func_(FunctionType(func))
+ {}
+ ReturnValue operator()(""",
+ self.named_param_list(i, []),
+ """)
+ {
+ return func_(""",
+ self.param_names(i, []),
+ """);
+ }
+};
+
+"""]))
+ # end for loop
+ out.write("""class shared_library
+{
+private:
+ std::string location_;
+ library_handle handle_;
+ bool auto_close_;
+public:
+ bool is_open(){return handle_ != 0;}
+ static bool is_linkable_library(const char * file_name){return is_library(file_name);}
+ bool open(){return (handle_ = load_shared_library(location_.c_str())) != 0;}
+ bool close(){return close_shared_library(handle_);}""")
+ for i in range(0, self.max_params + 1):
+ out.write(self.template_header(' template <',
+ ['class ReturnValue'],
+ i, False))
+ functor_template = ("".join(["functor<",
+ self.nameless_param_list(i, ["ReturnValue"]),
+ ">\n"]))
+ out.write("".join([" ",
+ functor_template,
+ " get_functor(",
+ "const char * function_name",
+ """)
+ {
+ return """,
+ functor_template,
+ """ (get_function(handle_, function_name));
+ }
+"""]))
+ # end for loop
+ out.write("""shared_library(const char * location, bool auto_close = false)
+ :location_(location), handle_(0), auto_close_(auto_close){}
+};
+}}
+
+
+#endif
+""")
+
+ def generate_factory_map_hpp(self, factory_type, factory_type_add, new_members,
+ generic_factory_container_additions = "",
+ factory_container_additions = ""):
+ out = open(''.join(['../../../boost/extension/',factory_type,'_map.hpp']), mode='w')
+ out.write(''.join(["""/* (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)
+ */
+
+#ifndef BOOST_EXTENSION_""",factory_type.upper(),"""_MAP_HPP
+#define BOOST_EXTENSION_""",factory_type.upper(),"""_MAP_HPP
+#include <list>
+#include <memory>
+#include <map>
+#include <boost/extension/""",factory_type,""".hpp>
+#include <boost/extension/extension.hpp>
+#include <boost/extension/impl/typeinfo.hpp>
+
+namespace boost{namespace extensions{
+
+
+template <class TypeInfo>
+class basic_""",factory_type,"""_map
+{
+private:
+ class generic_factory_container
+ {
+ public:""", generic_factory_container_additions, """
+ 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<""",factory_type,"""<Interface, Info, Param1, Param2, Param3, Param4, Param5, Param6> >, public generic_factory_container
+ {
+ public:""", factory_container_additions, """
+ factory_container(){}
+ factory_container(basic_""", factory_type, """_map & z)
+ :std::list<""",factory_type,"""<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_;""", new_members,"""
+public:
+ ~basic_""", factory_type, """_map(){
+ for(typename FactoryMap::iterator it = factories_.begin(); it != factories_.end(); ++it)
+ delete it->second;
+ //TODO - test for memory leaks.
+ }
+"""]))
+ for i in range(0, self.max_params + 1):
+ out.write("".join([self.template_header(' template <',
+ ['class Interface', 'class Info'],
+ i, False),
+ "operator std::list<",factory_type,"<",
+ self.nameless_param_list(i, ["Interface", "Info"]),
+ """> > & ()
+ {return this->get<""",
+ self.nameless_param_list(i, ["Interface", "Info"]),
+ """>();}
+""",
+ self.template_header(' template <',
+ ['class Interface', 'class Info'],
+ i, False),
+ "std::list<", factory_type, "<",
+ self.nameless_param_list(i, ["Interface", "Info"]),
+ """> > & get()
+ {
+ TypeInfo current_type =
+ type_info_handler<TypeInfo, """, factory_type, """<""",
+ self.nameless_param_list(i, ["Interface", "Info"]),
+ """> >::get_class_type();
+ typename FactoryMap::iterator it =
+ factories_.find(current_type);
+
+ if (it == factories_.end())
+ {
+ factory_container<""",
+ self.nameless_param_list(i, ["Interface", "Info"]),
+ """> * ret =
+ new factory_container<""",
+ self.nameless_param_list(i, ["Interface", "Info"]),
+ """>();
+ factories_[current_type] = ret;
+ return *ret;
+ }
+ else
+ {
+ // Change to dynamic if this fails
+ return static_cast<factory_container<""",
+ self.nameless_param_list(i, ["Interface", "Info"]),
+ """> &>(*(it->second));
+ }
+ }
+""",
+ self.template_header('template <',
+ ['class Actual', 'class Interface', 'class Info'],
+ i, False),
+ """void add(Info info)
+ {
+ typedef std::list<""",factory_type,"""<""",
+ self.nameless_param_list(i, ["Interface", "Info"]),
+ """> > ListType;
+ ListType & s = this->get<""",
+ self.nameless_param_list(i, ["Interface", "Info"]),
+ """>();
+ """,factory_type,"""<""",
+ self.nameless_param_list(i, ["Interface", "Info"]),
+ """> f(info);
+ //f.set_type<Actual>();
+ f.set_type_special((Actual*)0);
+ s.push_back(f);""",factory_type_add,"""
+ //it->set_type<Actual>();
+ }
+"""]))
+ # end for loop
+ out.write(''.join(["""};
+
+typedef basic_""",factory_type,"""_map<default_type_info> """,factory_type,"""_map;
+}}
+
+#endif
+"""]))
+
+
+def main(argv):
+ if len(argv) > 1:
+ max_params = int(argv[1])
+ else:
+ max_params = 6
+ gen = header_generator(max_params)
+ gen.generate()
+
+if __name__=='__main__':
+ main(sys.argv)
\ No newline at end of file
Added: sandbox/libs/extension/test/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/test/Jamfile.v2 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,23 @@
+using testing ;
+import os ;
+local BOOST_ROOT = [ os.environ BOOST_ROOT ] ;
+project
+ : requirements
+ <library>$(BOOST_ROOT)libs/test/build//boost_unit_test_framework/<link>shared
+ # <source>auto_test_main.cpp
+ <include>../../../
+ <include>$(BOOST_ROOT)
+ <define>BOOST_TEST_NO_AUTO_LINK=1
+ :
+ ;
+
+
+test-suite extension_tests_all
+: [ run factory_test.cpp ]
+ [ run zone_test.cpp ]
+ [ run construction.cpp ]
+ [ run extension_test.cpp ]
+ [ run counted_factory_test.cpp ]
+ [ run registry_test.cpp ]
+:
+;
\ No newline at end of file
Added: sandbox/libs/extension/test/auto_test_main.cpp
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/test/auto_test_main.cpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,12 @@
+/*******************************************************
+ * @file auto_test_main.cpp
+ * @brief
+ * @author Vladimir Volod'ko
+ * @date 2007/03/23
+ *******************************************************/
+
+/// This file is used for ability to build all test case files in one executable.
+/// One may link any test case file with this file to build separate test case executable.
+
+#define BOOST_TEST_MAIN
+#include <boost/test/unit_test.hpp>
Added: sandbox/libs/extension/test/construction.cpp
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/test/construction.cpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,31 @@
+/* (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)
+ */
+
+#include <boost/extension/factory_map.hpp>
+#include <boost/extension/factory.hpp>
+#include <boost/extension/shared_library.hpp>
+#define BOOST_TEST_MAIN
+#include <boost/test/unit_test.hpp>
+
+
+
+using namespace boost::extensions;
+
+BOOST_AUTO_TEST_CASE(zone_construction)
+{
+ factory_map z;
+
+}
+BOOST_AUTO_TEST_CASE(factory_construction)
+{
+ //factory f;
+
+}
+BOOST_AUTO_TEST_CASE(linked_library_construction)
+{
+ shared_library l((std::string("liblocal") + ".extension").c_str());
+
+}
Added: sandbox/libs/extension/test/counted_factory_test.cpp
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/test/counted_factory_test.cpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,17 @@
+/* (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)
+*/
+
+#include <boost/extension/counted_factory_map.hpp>
+
+#define BOOST_TEST_MAIN
+#include <boost/test/unit_test.hpp>
+
+using namespace boost::extensions;
+
+BOOST_AUTO_TEST_CASE(counted_factory_map_construction)
+{
+ counted_factory_map fm;
+}
\ No newline at end of file
Added: sandbox/libs/extension/test/extension_test.cpp
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/test/extension_test.cpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,29 @@
+/* (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)
+ */
+
+#include <boost/extension/factory_map.hpp>
+#include <boost/extension/factory.hpp>
+
+#define BOOST_TEST_MAIN
+#include <boost/test/unit_test.hpp>
+
+
+using namespace boost::extensions;
+
+BOOST_AUTO_TEST_CASE(zone_construction)
+{
+ factory_map z;
+}
+BOOST_AUTO_TEST_CASE(factory_construction)
+{
+ //factory f;
+
+}
+BOOST_AUTO_TEST_CASE(extension_construction)
+{
+ // extension e;
+
+}
Added: sandbox/libs/extension/test/factory_test.cpp
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/test/factory_test.cpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,60 @@
+/* (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)
+ */
+
+#include <boost/extension/factory_map.hpp>
+#include <boost/extension/factory.hpp>
+#define BOOST_TEST_MAIN
+#include <boost/test/unit_test.hpp>
+
+#include "fruit.hpp"
+#include <vector>
+#include <list>
+using namespace boost::extensions;
+void setup_zone(factory_map & z)
+{
+ z.add<apple, fruit, std::string, int, int>("round fruit");
+ z.add<banana, fruit, std::string, int, int>("long fruit");
+ z.add<nectarine, fruit, std::string, int, int>("small fruit");
+
+}
+BOOST_AUTO_TEST_CASE(construct_from_zone)
+{
+ factory_map z;
+ setup_zone(z);
+ std::vector<factory<fruit, std::string, int, int> > f1(z.get<fruit, std::string, int, int>().begin(), z.get<fruit, std::string, int, int>().end());
+ std::list<factory<fruit, std::string, int, int> > f2(z.get<fruit, std::string, int, int>().begin(), z.get<fruit, std::string, int, int>().end());
+ std::list<factory<fruit, std::string, int, int> > f3(z);
+ std::list<factory<fruit, std::string, int, int> > f4 = z;
+ BOOST_CHECK_EQUAL(f1.size(), f2.size());
+ BOOST_CHECK_EQUAL(f1.size(), f3.size());
+ BOOST_CHECK_EQUAL(f2.size(), f4.size());
+ BOOST_CHECK_EQUAL(f1.size(), size_t(3));
+}
+BOOST_AUTO_TEST_CASE(factory_construction)
+{
+ factory_map z;
+ setup_zone(z);
+ std::vector<factory<fruit, std::string, int, int> > f1(z.get<fruit, std::string, int, int>().begin(), z.get<fruit, std::string, int, int>().end());
+ std::vector<factory<fruit, std::string, int, int> >::iterator it = f1.begin();
+ std::auto_ptr<fruit> first(it->create(0, 1));
+ std::auto_ptr<fruit> second((++it)->create(0, 1));
+ std::auto_ptr<fruit> third((++it)->create(0, 1));
+ BOOST_CHECK_EQUAL((first->get_cost()), 21);
+ BOOST_CHECK_EQUAL((second->get_cost()), 7);
+ BOOST_CHECK_EQUAL((third->get_cost()), 18);
+ BOOST_CHECK_EQUAL(typeid(*first.get()).name(), typeid(apple).name());
+ BOOST_CHECK_EQUAL(typeid(*second.get()).name(), typeid(banana).name());
+ BOOST_CHECK_EQUAL(typeid(*third.get()).name(), typeid(nectarine).name());
+ BOOST_CHECK(typeid(*third.get()).name() != typeid(banana).name());
+ BOOST_CHECK(typeid(*third.get()).name() != typeid(banana).name());
+ //factory<fruit> f;
+
+}
+BOOST_AUTO_TEST_CASE(extension_construction)
+{
+ //extension e;
+
+}
Added: sandbox/libs/extension/test/fruit.hpp
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/test/fruit.hpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,72 @@
+/* (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)
+ */
+
+#ifndef BOOST_EXTENSION_TEST_FRUIT_HPP
+#define BOOST_EXTENSION_TEST_FRUIT_HPP
+
+class fruit
+{
+public:
+ fruit(int a = 0, int b = 0){}
+ virtual ~fruit(){}
+ virtual int get_cost(){return 5;}
+};
+class banana : public fruit
+{
+public:
+ banana(int a = 0, int b = 0){}
+
+ virtual int get_cost(){return 7;}
+};
+class nectarine : public fruit
+{
+public:
+ nectarine(int a = 0, int b = 0){}
+
+ virtual int get_cost(){return 18;}
+};
+class apple : public fruit
+{
+public:
+ apple(int a = 0, int b = 0){}
+
+ virtual int get_cost(){return 21;}
+ static bool meets_requirements(int val){return val == 8;}
+};
+
+class vegetable
+{
+private:
+ float f_;
+public:
+ virtual ~vegetable(){}
+ vegetable(float f):f_(f){}
+ virtual float get_weight(){return f_ * 2.0f;}
+};
+
+//I know it's not really a vegetable - but it as used as one
+class tomato : public fruit, public vegetable
+{
+public:
+ virtual ~tomato(){}
+ tomato(float f, int a, int b):fruit(a, b),vegetable(f){}
+ tomato(float f):fruit(0, 0), vegetable(f){}
+ tomato(int a, int b):fruit(a, b), vegetable(0){}
+ virtual float get_weight(){return 1.5 * vegetable::get_weight();}
+};
+class vegetable_info
+{
+private:
+ std::string name_;
+ int num_calories_;
+public:
+ vegetable_info(const char * name, int calories)
+ :name_(name), num_calories_(calories){}
+ int get_calories(){return num_calories_;}
+ const char * get_name(){return name_.c_str();}
+
+};
+#endif
\ No newline at end of file
Added: sandbox/libs/extension/test/registry_test.cpp
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/test/registry_test.cpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,22 @@
+/* (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)
+*/
+
+#include <boost/extension/registry.hpp>
+
+#define BOOST_TEST_MAIN
+#include <boost/test/unit_test.hpp>
+
+using namespace boost::extensions;
+
+BOOST_AUTO_TEST_CASE(registry_construction)
+{
+ registry reg;
+ BOOST_CHECK_EQUAL(reg.num_libraries(), size_t(0));
+ reg.open("../bin/libbasic_reg.extension");
+ BOOST_CHECK_EQUAL(reg.num_libraries(), size_t(1));
+ reg.close("../bin/libbasic_reg.extension");
+ BOOST_CHECK_EQUAL(reg.num_libraries(), size_t(0));
+}
\ No newline at end of file
Added: sandbox/libs/extension/test/zone_test.cpp
==============================================================================
--- (empty file)
+++ sandbox/libs/extension/test/zone_test.cpp 2007-05-29 00:24:11 EDT (Tue, 29 May 2007)
@@ -0,0 +1,66 @@
+/* (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)
+ */
+
+#include <boost/extension/factory_map.hpp>
+#include <boost/extension/factory.hpp>
+#define BOOST_TEST_MAIN
+
+#include <boost/test/unit_test.hpp>
+
+#include "fruit.hpp"
+using namespace boost::extensions;
+
+BOOST_AUTO_TEST_CASE(add_one)
+{
+ factory_map z;
+ BOOST_CHECK_EQUAL((z.get<fruit, std::string, int, int>().size()), size_t(0));
+ z.add<apple, fruit, std::string, int, int>("A round fruit");
+ BOOST_CHECK_EQUAL((z.get<fruit, std::string, int, int>().size()), size_t(1));
+ BOOST_CHECK_EQUAL((z.get<apple, std::string, int, int>().size()), size_t(0));
+
+}
+BOOST_AUTO_TEST_CASE(add_multiple)
+{
+ factory_map z;
+ BOOST_CHECK_EQUAL((z.get<fruit, std::string, int, int>().size()), size_t(0));
+ z.add<apple, fruit, std::string, int, int>("A round fruit");
+ BOOST_CHECK_EQUAL((z.get<fruit, std::string, int, int>().size()), size_t(1));
+ BOOST_CHECK_EQUAL((z.get<apple, std::string, int, int>().size()), size_t(0));
+ z.add<banana, fruit, std::string, int, int>("A fruit that is not round");
+ BOOST_CHECK_EQUAL((z.get<fruit, std::string, int, int>().size()), size_t(2));
+ BOOST_CHECK_EQUAL((z.get<apple, std::string, int, int>().size()), size_t(0));
+ z.add<apple, apple, std::string, int, int>("A round fruit");
+ BOOST_CHECK_EQUAL((z.get<fruit, std::string, int, int>().size()), size_t(2));
+ BOOST_CHECK_EQUAL((z.get<apple, std::string, int, int>().size()), size_t(1));
+}
+BOOST_AUTO_TEST_CASE(readd)
+{
+ factory_map z;
+ BOOST_CHECK_EQUAL((z.get<fruit, std::string, int, int>().size()), size_t(0));
+ z.add<apple, fruit, std::string, int, int>("A round fruit");
+ BOOST_CHECK_EQUAL((z.get<fruit, std::string, int, int>().size()), size_t(1));
+ BOOST_CHECK_EQUAL((z.get<apple, std::string, int, int>().size()), size_t(0));
+ z.add<apple, fruit, std::string, int, int>("A round fruit");
+ BOOST_CHECK_EQUAL((z.get<fruit, std::string, int, int>().size()), size_t(2));
+ BOOST_CHECK_EQUAL((z.get<apple, std::string, int, int>().size()), size_t(0));
+ z.add<apple, apple, std::string, int, int>("A round fruit");
+ BOOST_CHECK_EQUAL((z.get<fruit, std::string, int, int>().size()), size_t(2));
+ BOOST_CHECK_EQUAL((z.get<apple, std::string, int, int>().size()), size_t(1));
+
+}
+BOOST_AUTO_TEST_CASE(different_base)
+{
+ factory_map z;
+ BOOST_CHECK_EQUAL((z.get<vegetable, vegetable_info, float>().size()), size_t(0));
+ z.add<apple, fruit, std::string, int, int>("A round fruit");
+ z.add<tomato, fruit, std::string, int, int>("A round fruit that isn't very sweet");
+ z.add<tomato, vegetable, vegetable_info, float>(vegetable_info("Tomato", 112));
+ BOOST_CHECK_EQUAL((z.get<fruit, std::string, int, int>().size()), size_t(2));
+ BOOST_CHECK_EQUAL((z.get<vegetable, vegetable_info, float>().size()), size_t(1));
+ BOOST_CHECK_EQUAL((z.get<vegetable, vegetable_info, float>().begin()->get_info().get_calories()),
+ 112);
+}
+
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