From: <jam...@di...> - 2011-09-05 07:41:11
|
Hi I've got a pvData modeling question, I'd like to encode a list of the following C datatype: struct NDAttribute { ELLNODE node; int dataType; char * name; union { int iValue; char * sValue; double dValue; } value; }; So far I'm using the obvious at the cost of some small wasted space without a union (algebraic data type for the ML programmers) in pvData: structure top { structure [] NDAttributeList structure NDAttribute { string name; int dataType; int iValue; string sValue; double dValue; } } Another alternative is to transpose and use the ability to null members of a structure array (if that stays in the spec). This also looks more like an AIDA table: structure top { structure NDAttribute { structure [] NDAttributeList1 structure NDAttribute1 { string name; int dataType; } structure [] NDAttributeListInt structure NDAttributeInt { int Value; } Structure [] NDAttributeListString structure NDAttributeString { int Value; } structure [] NDAttributeListDouble structure NDAttributeDouble { int Value; } } } Or I could define a new pvData schema for each set of attributes and send it with each message. I do want to transfer these messages using puts or monitors however. I think the 1st option is preferable and the wasted space is irrelevant for this application (the rest of the payload is a 30 MB image). Any suggestions? James -- This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail. Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message. Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom |