QuantLibXL icon indicating copy to clipboard operation
QuantLibXL copied to clipboard

getCallerAddress and operToScalar in setSessionId

Open xuruilong100 opened this issue 3 years ago • 4 comments

I am working on QuantLibAddin1.22 now.

When I use QL_ENABLE_SESSIONS, the compiler tells me there are no implementations about getCallerAddress and operToScalar.

Can I replace getCallerAddress by callerAddress?

And I create operToScalar by myself,

namespace ObjectHandler {
    //! Convert an OPER to a string.
    DLL_API void operToScalar(std::string& value, const OPER& xString) {
        std::string v(xString.val.str);
        value = v;
    }
}

is it right?

In other way, can I just code as follow?

std::string callerAddress = ObjectHandler::FunctionCall::instance().addressString();

xuruilong100 avatar Apr 28 '22 02:04 xuruilong100

That flag QL_ENABLE_SESSIONS is very old and not maintained and you might have to go very far back to find a build in which it functioned properly. Off the top of my head I could not tell you whether your proposed solution is correct, you would need to analyze it yourself.

eehlers avatar Apr 28 '22 09:04 eehlers

That flag QL_ENABLE_SESSIONS is very old and not maintained and you might have to go very far back to find a build in which it functioned properly. Off the top of my head I could not tell you whether your proposed solution is correct, you would need to analyze it yourself.

Hi, I use std::string callerAddress = ObjectHandler::FunctionCall::instance().addressString(); now, and it works well.

For example, what addressString() returns would look like [EuropeanVanillaOption.xlsx]Sheet1!$F$4.

xuruilong100 avatar Apr 29 '22 03:04 xuruilong100

Sounds good!

eehlers avatar Apr 29 '22 08:04 eehlers

That flag QL_ENABLE_SESSIONS is very old and not maintained and you might have to go very far back to find a build in which it functioned properly. Off the top of my head I could not tell you whether your proposed solution is correct, you would need to analyze it yourself.

A little suggestion about QL_ENABLE_SESSIONS.

By QL_ENABLE_SESSIONS, we can set different evaluation dates in different excel files.

But in QuantLibXL-1.22, all objects created by xll are stored and registered with a "name", so every object must have an unique name around all open excel files(we don't use overwrite).

If we register object by a pair, for instance, <sessionID, objName>, an object should have an unique name in just one open excel file. So, every all excel files are independent computation environment.

xuruilong100 avatar May 06 '22 02:05 xuruilong100