custom_datatype.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
  2. * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
  3. typedef struct {
  4. UA_Float x;
  5. UA_Float y;
  6. UA_Float z;
  7. } Point;
  8. /* The datatype description for the Point datatype */
  9. #define Point_padding_y offsetof(Point,y) - offsetof(Point,x) - sizeof(UA_Float)
  10. #define Point_padding_z offsetof(Point,z) - offsetof(Point,y) - sizeof(UA_Float)
  11. static UA_DataTypeMember Point_members[3] = {
  12. /* x */
  13. {
  14. UA_TYPENAME("x") /* .memberName */
  15. UA_TYPES_FLOAT, /* .memberTypeIndex, points into UA_TYPES since namespaceZero is true */
  16. 0, /* .padding */
  17. true, /* .namespaceZero, see .memberTypeIndex */
  18. false /* .isArray */
  19. },
  20. /* y */
  21. {
  22. UA_TYPENAME("y")
  23. UA_TYPES_FLOAT, Point_padding_y, true, false
  24. },
  25. /* z */
  26. {
  27. UA_TYPENAME("z")
  28. UA_TYPES_FLOAT, Point_padding_z, true, false
  29. }
  30. };
  31. static const UA_DataType PointType = {
  32. UA_TYPENAME("Point") /* .typeName */
  33. {1, UA_NODEIDTYPE_NUMERIC, {4242}}, /* .typeId */
  34. sizeof(Point), /* .memSize */
  35. 0, /* .typeIndex, in the array of custom types */
  36. UA_DATATYPEKIND_STRUCTURE, /* .typeKind */
  37. true, /* .pointerFree */
  38. false, /* .overlayable (depends on endianness and
  39. the absence of padding) */
  40. 3, /* .membersSize */
  41. 0, /* .binaryEncodingId, the numeric
  42. identifier used on the wire (the
  43. namespaceindex is from .typeId) */
  44. Point_members
  45. };