Monday, September 5, 2016

STRING Functions

Today's FBDK2 auto-update contains IEC 61499 "Simple (REQ/CNF) FB" implementations of all the standard character string functions defined in IEC 61499, including implementations for both WSTRING (16-bit character strings) and STRING (8-bit character strings) types. WSTRING is implemented as a container for the Java String class, whose instances are immutable, and STRING is implemented as a wrapper for a mutable array of bytes. This gives the latter the following practical advantages:
  • Significantly less object creation and garbage collection overhead
  • Smaller (approaching 50%) payload sizes for PUBLISH/SUBSCRIBE and CLIENT/SERVER packets, with correspondingly smaller encode/decode times.
The tradeoff, of course, is that STRINGs can only represent 256 characters - usually the "C0 Controls and Basic Latin" (0000-007F) and "C1 Controls and Latin-1 Supplement" (0080-00FF) defined in ISO/IEC 10646. For a richer, multilingual character set, WSTRING with its attendant overhead costs must be used.

Documentation for these FB types can be found in the strings folder of the FBNavigator.