Enum Registry

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Enum Registry

andrea-110
Hi,

I've found an enum registry in the object handler to convert strings to "enums"

        QuantLib::Currency CurrencyEnum =
            ObjectHandler::Create<QuantLib::Currency>()(CurrencyCpp);

and the registry is populated from an xml file.

Is there a way to get the same feature without ObjectHandler? Using only the core QuantLib?

Or, what is the minimum set of classes required to get tis feature?
I have to admit I am still a bit lost in the ObjectHandler/gensrc world.

Andrea


------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Enum Registry

Luigi Ballabio
On Fri, 2010-11-12 at 21:45 +0000, Andrea wrote:
> I've found an enum registry in the object handler to convert strings
> to "enums" [...] and the registry is populated from an xml file.
>
> Is there a way to get the same feature without ObjectHandler? Using
> only the core QuantLib?

No, there isn't.  But I think it should be easy to implement the
registry with a std::map<std::string, enum> or something like it (I'm
not sure about the XML part, though---I'm not familiar with XML
libraries in C++.)

Luigi



--

Glendower: I can call spirits from the vasty deep.
Hotspur: Why, so can I, or so can any man;
But will they come when you do call for them?
-- King Henry the Fourth Part I, Act III, Scene I



------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Enum Registry

andrea-110
Luigi Ballabio <luigi.ballabio <at> gmail.com> writes:

>
> On Fri, 2010-11-12 at 21:45 +0000, Andrea wrote:
> > I've found an enum registry in the object handler to convert strings
> > to "enums" [...] and the registry is populated from an xml file.
> >
> > Is there a way to get the same feature without ObjectHandler? Using
> > only the core QuantLib?
>
> No, there isn't.  But I think it should be easy to implement the
> registry with a std::map<std::string, enum> or something like it (I'm
> not sure about the XML part, though---I'm not familiar with XML
> libraries in C++.)
>
> Luigi
>

A little macro will make it simple to register the options.

I was thinking that this is a feature that deserves to be in the core library
and not only in the addins.
Moreover the effort to fill the xml is exactly the same as writing the C++ code
with the registration.

And, all the environments where QL is exposed via SWIG could used it (mind you
in Java one can use relfection).
Almost all clients with user input will need something similar.

What do you think?


------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Enum Registry

Luigi Ballabio
On Mon, 2010-11-15 at 16:44 +0000, Andrea wrote:

> > No, there isn't.  But I think it should be easy to implement the
> > registry with a std::map<std::string, enum> or something like it (I'm
> > not sure about the XML part, though---I'm not familiar with XML
> > libraries in C++.)
> >
> A little macro will make it simple to register the options.
>
> I was thinking that this is a feature that deserves to be in the core library
> and not only in the addins.
> Moreover the effort to fill the xml is exactly the same as writing the C++ code
> with the registration.

No, I don't think it belongs to the core library; it's more on the
application level.  And most certainly I wouldn't force XML on anyone :)
I would leave it to the user to choose where and how to store the
information depending on the way her application is built.

Luigi


--

Present to inform, not to impress; if you inform, you will impress.
-- Fred Brooks



------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users