Login  Register

Re: ObjectHandler::ohObjectLoad & Usage in standalone C++ Program

Posted by michael_ql on Aug 17, 2016; 11:34pm
URL: http://quantlib.414.s1.nabble.com/ObjectHandler-ohObjectLoad-Usage-in-standalone-C-Program-tp17638p17651.html

I managed to get this working. Here is my code.

                        // Initialise all objects so that we can load from the object factory
                        auto obj1 = ObjectHandler::ProcessorFactory();
                        auto obj2 = QuantLibAddin::SerializationFactory();
                        auto obj3 = ObjectHandler::EnumTypeRegistry();
                        auto obj4 = ObjectHandler::Repository();

                        // Initialize the Enumeration Registry
                        QuantLibAddin::registerEnumeratedTypes();

                        // load object
                        ObjectHandler::SerializationFactory::instance().loadObject(
                                scheduleFileDirectory,
                                scheduleFile,
                                false,
                                true);

                        OH_GET_REFERENCE(ObjectIdLibObjPtr, "sched", QuantLibAddin::Schedule, QuantLib::Schedule)

                        // READ DATES
                        std::vector<Date> dates = ObjectIdLibObjPtr->dates();