Posted by
eric ehlers on
Jun 03, 2005; 6:04am
URL: http://quantlib.414.s1.nabble.com/Abstract-Factory-Abstract-Virtual-Constructor-Pattern-tp3817p3822.html
Hello
On 6/3/05, Luigi Ballabio <
[hidden email]> 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?
QuantLibAddin currently supports rudimentary mapping of strings to
classes e.g. the option constructor accepts "PUT" to indicate
QuantLib::Option::Put.
The abstract constructor pattern might be impractical because it
requires that additional code be embedded into the classes you want to
create, the prototype pattern (e.g. singleton/map) seems cleaner ...
On 6/3/05, Plamen Neykov <
[hidden email]> wrote:
>
> 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.
... at first glance this looks like a vast improvement on the existing
approach, I'll look at it in more detail and confirm.
Regards,
Eric