From: Marco Costalba (mcostalba_at_[hidden])
Date: 2007-08-31 14:07:37
This is a simple yet interesting object factory.
Main points are:
- Support for many class hierarchies at the same time
- Object constructor arguments with generic type
- Object constructor overloading
- Support for user supplied 'object create' functions
- Dynamic class registering/unregistering
- No RTTI or special library requirements, only an associative
container is used.
- And finally the most important: 100% type safe also at runtime
Especially constructor overloading and runtime type safety are two
niceties you won't find easily googling around.
You can view as HTML page a simple and commented test program here:
A page with the source is here:
Below are the links to the actual files:
I'm sorry if you find the comments a bit "entry level", but they are
intended for a wider audience.
Finally there are a couple of bugs that I won't reveal ;-) they are
not easy to spot and fixing them will complicate the code.
Because this is intended more as a presentation of the ideas then
production code I will fix them when I'll be confident design is
Anyhow I keep a separated test framework with about 40 tests to
exercise the factory under different paths. So I would say this is
Any comment or hint on how to improve the design or implementation
would be very appreciated.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk