mdsplus
mdsplus copied to clipboard
feature: jtraverser2 dynamically convert non-native floating formats
- this is an untested attempt to address issue #2576.
- this is a cheap way to intercept unsupported dtypes converting them to native types.
- it may be more performant to convert only in getValue/setValue/getAtomic ... but requires sub-classes of each Float32/64 and Compex32/64 as well as their Array variants.
- this does not mark DTYPE_F etc. as supported but merely allows to import them from serialized sources.
- this will not preserve the original dtype (mdsip cannot do raw float_x other than FT and FS)
maybe one can test this and/or write an appropriate unit test
Timo, I was testing your changes, but then I realized this will not work, because Float32(b) returns back already the wrong answer.
And indeed, the call:
(Float32)Mds.getLocal().getDescriptor("FS_FLOAT($)", new Float32(b));
does not work.
hm if the data gets into Float32 via deserialization, it should contain the original byte code of a F_Float. the tdicall should use this byte code unchanged and feed it to FS_FLOAT. The returned bytcode for a FS float should deserialize into a Float32 with FS_FLOAT dtype.. well in theory .. I will check where it takes a different turn
it seems the problem is that mdsip supports neither F_FLOAT nor G_FLOAT nor D_FLOAT as argument extension.
mdsconnect('thread://1')
Connected: user
1
mdsvalue('DECOMPILE($)', 1.234G0)
"1.234D0"
As you can see the value was transformed from G_FLOAT (G) to FT_FLOAT (D) when passed down the mdsip protocol. Hence mdsplus-api cannot use the mdsip backend to convert.
@santorofer this time it should work, took me long enough to pick this one up again but here it hopefully is ;)
Hi Timo, no problem. Excellent, I will test it and approve it as soon as I can.