Posted by
Lisa Ann on
Aug 27, 2015; 2:08pm
URL: http://quantlib.414.s1.nabble.com/Tutorial-to-use-ObjectHandler-outside-of-QuantLibXL-tp16776p16855.html
There's still an element which puzzles me: please, consider as example my code above and let MyValueObject class has a double private variable, "_value", whose value has been initialized with constructor and set equal to 10.
Of course, a proper getter has been defined inside MyValueObject class:
const double GetValue() const {return _value};
We've seen that using as instance this function...
void makeObject(
const std::string& objectID,
double value)
{
boost::shared_ptr< ObjectHandler::ValueObject > valueObject(new MyValueObject(objectID, "", false, value));
boost::shared_ptr< ObjectHandler::Object > object(new ObjectHandler::Object(valueObject, false));
ObjectHandler::Repository::instance().storeObject(objectID, object, true);
};
...we are able to store an object in repository by calling...
ObjectHandler::Repository repository;
makeObject("Object1", 10);
Nevertheless, wandering through
ObjectHandler::ValueObject 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().
In ObjectHandler examples objects derived from ObjectHandler::ValueObject seem able to call their getter methods, whilst my pointer doesn't.