Login  Register

Re: Tutorial to use ObjectHandler outside of QuantLibXL

Posted by Eric Ehlers-3 on Aug 16, 2015; 3:54pm
URL: http://quantlib.414.s1.nabble.com/Tutorial-to-use-ObjectHandler-outside-of-QuantLibXL-tp16776p16785.html

Hi Lisa,

> objects from (e.g. should a financial instrument to be cached inherit
> either from Object and from Observable?), but I am not still able to

Object only.  The Observable class is for use internally by
ObjectHandler.

> If you had to write a very simple main to cache an object and
> retrieve its ID via ObjectHandler, how much would your code be
> different than this?

At first glance the code you provided looks all right to me.

If you have further questions don't hesitate to ask.

Kind Regards,
Eric

On Fri, 14 Aug 2015 04:05:38 -0700 (MST)
Lisa Ann <[hidden email]> wrote:

> Thank you for the hint, Eric.
>
> I've already given a look at:
>
>      account.hpp
> <http://quantlib.org/objecthandler/account_8hpp-example.html>  
>      addindynamic1.cpp
> <http://quantlib.org/objecthandler/addindynamic1_8cpp-example.html>  
>      addindynamic2.cpp
> <http://quantlib.org/objecthandler/addindynamic2_8cpp-example.html>  
>      addinstatic.cpp
> <http://quantlib.org/objecthandler/addinstatic_8cpp-example.html>  
>      example.cpp
> <http://quantlib.org/objecthandler/example_8cpp-example.html>  
>
> I'm currently trying to understand which are the "basic" blocks that
> I need to build my first experiments with ObjectHandler. Wandering
> through  classes
> <http://quantlib.org/objecthandler/annotated.html>  , for example, I
> see several classes that might be good candidates to inherit generic
> objects from (e.g. should a financial instrument to be cached inherit
> either from Object and from Observable?), but I am not still able to
> grasp the basic structure.
>
> If you had to write a very simple main to cache an object and
> retrieve its ID via ObjectHandler, how much would your code be
> different than this?
> __________________________________________________________________
>
> #include <oh/objecthandler.hpp>
>
> class MyObject : public ObjectHandler::Object
> {
> public:
>   MyObject();
>   virtual ~MyObject();
> private:
>   // ...
> }
>
> main()
> {
>   boost::shared_ptr< ObjectHandler::Object> myObject(new MyObject());
>   ObjectHandler::Repository::instance().storeObject("Lisa", myObject,
> false);
>   boost::shared_ptr< ObjectHandler::Object> anotherObj(new
> MyObject());
> ObjectHandler::Repository::instance().retrieveObject(anotherObj,
> "Lisa");
>
>   return 0;
> }
> __________________________________________________________________
>
> Examples are so full of many methods and classes that I'm afraid of
> being missing some pieces along the path...
>
> Thanks
>
>
>
> --
> View this message in context:
> http://quantlib.10058.n7.nabble.com/Tutorial-to-use-ObjectHandler-outside-of-QuantLibXL-tp16776p16780.html
> Sent from the quantlib-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users


------------------------------------------------------------------------------
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users