Login  Register

Re: Tutorial to use ObjectHandler outside of QuantLibXL

Posted by Eric Ehlers-3 on Sep 01, 2015; 8:48am
URL: http://quantlib.414.s1.nabble.com/Tutorial-to-use-ObjectHandler-outside-of-QuantLibXL-tp16776p16871.html

Hello,

> Nevertheless, wandering through  ObjectHandler::ValueObject
> <http://quantlib.org/objecthandler/class_object_handler_1_1_value_object.html>  
> documentation I've given a try to some methods to retrieve that
> private variable by using MyValueObject::GetValue(), but I've not
> figured out how it can be done: once properties of an object have
> been assigned to a ValueObject by...
>
>   boost::shared_ptr< ObjectHandler::Object > object;
>   ObjectHandler::Repository::instance().retrieveObject(object,
> objectID); boost::shared_ptr< ObjectHandler::ValueObject >
> valueObject = object->properties();
>
> ...I would like to find a way to call MyValueObject::GetValue().

I think you could do

double d = object->properties()->GetValue();

I would not bother with the member variable and the getter, if the
value is in the properties of the value object then you should just be
able to do

double d = object->properties()->getProperty("value");

I have not tested either of those statements and it might be necessary
to monkey around with the syntax a litte.

Kind Regards,
Eric

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