![]() |
Copyright © 2008 -2009 Tor Brede Vekterli
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)
Table of Contents
Documentation work in progress
The Factory library is an implementation of the factory patterns outlined by Andrei Alexandrescu in his book Modern C++ Design, but using Boost libraries and with several functional enhancements (for those familiar with the book and its patterns built on top of Loki, there is a section outlining the biggest differences between the two). Only concepts from Loki are used, there is no Loki code in this library.
This library comes with two different flavors of factory patterns, based on what the task at hand requires. They are both flexible and extensible through the use of optional policies, so it should be easy to adapt them to both generic and specific situations.
Patterns
For when you have a single abstract base types whose concrete classes you wish to instantiate at runtime based on some identifier.
For when you have multiple (possibly completely independent) abstract base classes whose concrete classes you wish to instantiate at runtime.
![]() |
Important |
|---|---|
This library has not been officially reviewed, and is not a part of Boost (at least not yet). As such, it is likely that parts of it will be changed around in the future if feedback and/or code issues warrant it. The name Boost.Factory is also not official |
The current version of the code is 1.2.3 and can be downloaded from
http://arcticinteractive.com/static/upload/files/2010/01/factory_1_2_3.zip
Requires Boost libraries 1.37 or higher to compile (might work with Boost 1.36, but untested).
Any and all feedback, tips on code improvements etc. would be greatly appreciated!
![]() |
Tip |
|---|---|
The library package follows the Boost conventions where the headers are
located in the |
If you want to ensure the library works on your compiler, you can run the
accompanying unit tests. Before running the unit tests, you must first ensure
the BOOST_ROOT environment
variable is set and Boost.Build has been set up (which should be the case
if you've compiled Boost from source). Then you can simply cd into the libs/factory/test directory
and run
bjam
Which should compile and run the two test files and hopefully pass them both. If they should happen to fail, feel free to contact me with the error log and compiler vendor/version and I'll take a look at it.
This library uses a lot of template metaprogramming and should require a conforming compiler. Currently only a very few compiler vendors/versions have been tested, so these lists will expand in the future
Compilers known to work:
Compilers known not to work:
Last revised: December 13, 2009 at 23:17:00 +0100 |