DevUInt support in PyTango
|
|
---|---|
Hi all We've been running around in circles with DevInt and DevUInt while working on tango-simlib with Pogo, PythonHL and PyTango. It seems like the root cause is that some of the XMI files we started testing with tango-simlib had "pogoDsl:IntType" and "pogoDsl:UIntType" which causes different problems down the line in different places. (See "Some findings" below). Not sure where these originated from. My questions are: what is the status of Int and UInt types, is it supported, is it being deprecated, what is the best way to manage this. The simplest for us for know is probably to just find all the pogoDsl:IntType and pogoDsl:UIntType 's in the XMI files and replace them with a fully supported type to avoid the problems. Lize === Some findings === The online tango docs don't list it under attributes, but do list it under C++ specific types. Similarly, the current Tang_92.pdf book does not include it in the list of basic datatypes in section 4.4 (p 34), but does in the C++ types in section A.11.5. (The book also include DevEnum, which is missing from the online docs.) The DevInt type seems to have been around for a long time - the tangoCpp repo has had it for at least 7 years. PyTango wraps the C++ library and does have a PyTango.DevInt type (e.g. here), but does not have PyTango.DevUInt. However, the PyTango docs don't mention it: http://pytango.readthedocs.io/en/latest/data_types.html, and DevInt is commented out in PyTango tgutils.h, and has no DevUInt, suggesting it shouldn't be used. POGO has mention of the type. Interestingly, if the the xmi file has <dataType xsi:type="pogoDsl:IntType"/>, it shows as DevLong on the POGO GUI. So they are doing some mapping internally. |
|
|
---|---|
That is: we can replace the UInt/Ints in XMI files we are generating/using. But tango-simlib has to be more resilient: and the current solution is to do the same that Pogo does and map UInt to ULong and Int to Long if encountered in the XMI files. https://github.com/tango-controls/pogo/blob/8bf0a50/org.tango.pogo.pogo_gui/src/org/tango/pogo/pogo_gui/tools/OAWutils.java#L607-L654 |
|
|
---|---|
My quick take on this is your findings are correct - DevInt and DevUInt are supported in C++ and not in PyTango. I think your proposal to replace UInt and ULong with Int and Long are the right solution. I think we need to somehow make this clearer in their use in Pogo and the documentation. I don't think we can drop the support for unsigned types in C++ because they are used by a number of classes. On the philosophical side I never completely understood why Python and Java did not provide support for unsigned. I think it resulted from them using objects to implement these basic types and not hardware related types. Gosling is even on record saying that he thinks most C programmers don't fully understand unsigned types … Andy |
|
|
---|---|
Hi Lize, I don't really know how Pogo manages the tango types, but here's a related issue on the pytango issue tracker: issue #138. AndyPytango actually does for spectrum and images, as long as numpy is used (which should become mandatory sooner or later). |