Login  Register

Re: Abstract Factory/Abstract(Virtual) Constructor Pattern

Posted by Plamen Neykov on Jun 03, 2005; 3:48am
URL: http://quantlib.414.s1.nabble.com/Abstract-Factory-Abstract-Virtual-Constructor-Pattern-tp10814p10818.html

Hi Luigi,

thanks for the answer - actually I've followed your advice and created a
singleton class which does the creation - via a map<...> I'm attaching here
the source just for your info - I also think it is really better placed in
the QuantLibAddin ..... I'll take this to Eric.

Thanks,
Plamen

P.S. I've attached the files with the hope that some one will make some
comments and suggestions  ;-)

P.P.S. If someone wonders how it is used here an example:
QuantLib::Currency crr =
EnumTypeFactory::instance().create<QuantLib::Currency>(crrID);

QuantLib::Compounding comp =
EnumTypeFactory::instance().create<QuantLib::Compounding>(compounding)


On Friday 03 June 2005 11:15, Luigi Ballabio wrote:

> On 06/01/2005 05:07:29 PM, Plamen Neykov wrote:
> > I was thinking more about using the following pattern (or at least
> > some parts of it, like the class registration mechanism):
> > http://www.cs.wustl.edu/~schmidt/europlop-96/papers/paper26.ps
>
> I see. Hmm, I don't think this is in the scope of a
> library---especially since one can't know how it will be used (shared
> library, statically linked...)
>
> However, it could be in the scope of the ObjectHandler thing Eric
> Ehlers is developing. Eric, any comments?
>
> Later,
> Luigi
>
> ----------------------------------------
>
> There are two ways to write error-free programs; only the third one
> works.
> -- unknown

enumfactory.cpp (1K) Download Attachment
enumfactory.hpp (1K) Download Attachment
attachment2 (189 bytes) Download Attachment