datatypes.rst 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. Data Types
  2. ==========
  3. Generic Data Type Handling
  4. --------------------------
  5. All data types are combinations of the 25 builtin data types show below. Types
  6. are described in the UA_DataType structure.
  7. .. doxygenstruct:: UA_DataType
  8. :members:
  9. .. c:var:: const UA_DataType UA_TYPES[UA_TYPES_COUNT]
  10. The datatypes defined in the standard are stored in the ``UA_TYPES`` array.
  11. A typical function call is ``UA_Array_new(&data_ptr, 20, &UA_TYPES[UA_TYPES_STRING])``.
  12. .. doxygenfunction:: UA_new
  13. .. doxygenfunction:: UA_init
  14. .. doxygenfunction:: UA_copy
  15. .. doxygenfunction:: UA_deleteMembers
  16. .. doxygenfunction:: UA_delete
  17. For all datatypes, there are also macros with syntactic sugar over calling the
  18. generic functions with a pointer into the ``UA_TYPES`` array.
  19. .. c:function:: <typename>_new()
  20. Allocates the memory for the type and runs _init on the returned variable.
  21. Returns null if no memory could be allocated.
  22. .. c:function:: <typename>_init(<typename> *value)
  23. Sets all members of the type to a default value, usually zero. Arrays (e.g.
  24. for strings) are set to a length of -1.
  25. .. c:function:: <typename>_copy(<typename> *src, <typename> *dst)
  26. Copies a datatype. This performs a deep copy iterating over the members.
  27. Copying into variants with an external data source is not permitted. If
  28. copying fails, a deleteMembers is performed and an error code returned.
  29. .. c:function:: <typename>_deleteMembers(<typename> *value)
  30. Frees the memory of dynamically sized members of a datatype (e.g. arrays).
  31. .. c:function:: <typename>_delete(<typename> *value)
  32. Frees the memory of the datatype and its dynamically allocated members.
  33. Array Handling
  34. --------------
  35. .. doxygenfunction:: UA_Array_new
  36. .. doxygenfunction:: UA_Array_copy
  37. .. doxygenfunction:: UA_Array_delete
  38. Builtin Data Types
  39. ------------------
  40. Number-Types
  41. ^^^^^^^^^^^^
  42. .. doxygentypedef:: UA_Boolean
  43. .. doxygentypedef:: UA_SByte
  44. .. doxygentypedef:: UA_Byte
  45. .. doxygentypedef:: UA_Int16
  46. .. doxygentypedef:: UA_UInt16
  47. .. doxygentypedef:: UA_Int32
  48. .. doxygentypedef:: UA_UInt32
  49. .. doxygentypedef:: UA_Int64
  50. .. doxygentypedef:: UA_UInt64
  51. .. doxygentypedef:: UA_Float
  52. .. doxygentypedef:: UA_Double
  53. UA_String
  54. ^^^^^^^^^
  55. .. doxygenstruct:: UA_String
  56. :members:
  57. .. c:macro:: UA_STRING_NULL
  58. The empty string
  59. .. c:macro:: UA_STRING(CHARS)
  60. Creates an UA_String from an array of ``char``. The characters are not copied
  61. on the heap. Instead, the string points into the existing array.
  62. .. c:macro:: UA_STRING_ALLOC(CHARS)
  63. Creates an UA_String from an array of ``char``. The characters are copied on
  64. the heap.
  65. .. doxygenfunction:: UA_String_equal
  66. .. doxygenfunction:: UA_String_copyprintf
  67. UA_DateTime
  68. ^^^^^^^^^^^
  69. .. doxygentypedef:: UA_DateTime
  70. .. doxygenfunction:: UA_DateTime_now(void)
  71. .. doxygenfunction:: UA_DateTime_toString
  72. .. doxygenfunction:: UA_DateTime_toStruct
  73. UA_Guid
  74. ^^^^^^^
  75. .. doxygenstruct:: UA_Guid
  76. .. doxygenfunction:: UA_Guid_equal
  77. .. doxygenfunction:: UA_Guid_random
  78. UA_ByteString
  79. ^^^^^^^^^^^^^
  80. Bytestring are just a redefinition of strings. The semantic difference is that
  81. ByteStrings may hold non-UTF8 data.
  82. .. doxygentypedef:: UA_ByteString
  83. .. c:macro:: UA_BYTESTRING_NULL
  84. The empty ByteString
  85. .. c:function:: UA_Boolean UA_ByteString_equal(const UA_ByteString *s1, const UA_ByteString *s2)
  86. Compares two ByteStrings.
  87. UA_XmlElement
  88. ^^^^^^^^^^^^^
  89. XmlElements are just a redefinition of strings.
  90. .. doxygentypedef:: UA_XmlElement
  91. UA_NodeId
  92. ^^^^^^^^^
  93. .. doxygenstruct:: UA_NodeId
  94. :members:
  95. .. doxygenfunction:: UA_NodeId_equal
  96. .. doxygenfunction:: UA_NodeId_isNull
  97. .. c:macro:: UA_NODEID_NULL
  98. The null NodeId
  99. .. c:macro:: UA_NODEID_NUMERIC(NSID, NUMERICID)
  100. .. c:macro:: UA_NODEID_STRING(NSID, CHARS)
  101. .. c:macro:: UA_NODEID_STRING_ALLOC(NSID, CHARS)
  102. .. c:macro:: UA_NODEID_GUID(NSID, GUID)
  103. .. c:macro:: UA_NODEID_BYTESTRING(NSID, CHARS)
  104. .. c:macro:: UA_NODEID_BYTESTRING_ALLOC(NSID, CHARS)
  105. UA_ExpandedNodeId
  106. ^^^^^^^^^^^^^^^^^
  107. .. doxygenstruct:: UA_ExpandedNodeId
  108. :members:
  109. .. doxygenfunction:: UA_ExpandedNodeId_isNull
  110. .. c:macro:: UA_EXPANDEDNODEID_NUMERIC(NSID, NUMERICID)
  111. UA_StatusCode
  112. ^^^^^^^^^^^^^
  113. Many functions in open62541 return either ``UA_STATUSCODE_GOOD`` or an error code.
  114. .. doxygentypedef:: UA_StatusCode
  115. UA_QualifiedName
  116. ^^^^^^^^^^^^^^^^
  117. .. doxygenstruct:: UA_QualifiedName
  118. :members:
  119. .. c:macro:: UA_QUALIFIEDNAME(NSID, CHARS)
  120. .. c:macro:: UA_QUALIFIEDNAME_ALLOC(NSID, CHARS)
  121. UA_LocalizedText
  122. ^^^^^^^^^^^^^^^^
  123. .. doxygenstruct:: UA_LocalizedText
  124. :members:
  125. .. c:macro:: UA_LOCALIZEDTEXT(LOCALE, TEXT)
  126. Takes two arrays of ``char`` as the input.
  127. .. c:macro:: UA_LOCALIZEDTEXT_ALLOC(LOCALE, TEXT)
  128. UA_ExtensionObject
  129. ^^^^^^^^^^^^^^^^^^
  130. .. doxygenstruct:: UA_ExtensionObject
  131. :members:
  132. UA_DataValue
  133. ^^^^^^^^^^^^
  134. .. doxygenstruct:: UA_DataValue
  135. :members:
  136. :undoc-members:
  137. UA_Variant
  138. ^^^^^^^^^^
  139. .. doxygenstruct:: UA_Variant
  140. :members:
  141. .. doxygenfunction:: UA_Variant_isScalar
  142. .. doxygenfunction:: UA_Variant_setScalar
  143. .. doxygenfunction:: UA_Variant_setScalarCopy
  144. .. doxygenfunction:: UA_Variant_setArray
  145. .. doxygenfunction:: UA_Variant_setArrayCopy
  146. .. doxygenstruct:: UA_NumericRange
  147. :undoc-members:
  148. .. doxygenfunction:: UA_Variant_setRange
  149. .. doxygenfunction:: UA_Variant_setRangeCopy
  150. UA_DiagnosticInfo
  151. ^^^^^^^^^^^^^^^^^
  152. .. doxygenstruct:: UA_DiagnosticInfo
  153. :members:
  154. :undoc-members: