Faudes object serialization.
Objects of a class derived from the universal base faudes::Type provide a uniform interface for serialization, which are to be implemented for derived classes.
This is supported by
A token hast value types attached, e.g., type string, number, and/or tag. Tags indicate the beginning or end of a section, must balance, and must be XML compliant. The character data inbetween the tags is interpreted as a sequence of strings and numbers, to e.g. conveniently represent a list of events, transition or states. While the Token class implements reading and writing individual tokens from a C++ stream, the TokenReader and TokenWriter classes keep track of nested sections. Thus, opening a file via a TokenReader allows to scan for a particular section or to loop over all tokens from a particular section.
Tokens by example
Faudes serialisation example
<Generator name="simple machine">
alpha +C+ beta mue lambda
idle busy down
idle alpha busy
busy beta idle
busy mue down
down lambda idle
% this is a comment: it will be ignored by TokenReader
<!-- another comment, will be ignored by TokenReader and other XML parsers -->
TaNameSet< AttributeCFlags > Alphabet
Convenience typedef for event sets with controllability attributes.
Note that the special characters
Technical Note: alternative file format
libFAUDES token formats are intended to be human editable. However, the specific interpretation of the character data between the begin and end elements can not be covered a formal XML document model. The design objective here was a balance between a formal model and human editable data input.
Since the initial design, however, a number of faudes types where inroduced to configure the run-time behaviour of tools like the simulator or hardware access. Theese kind of objects are seldomly edited and we feel that a more rigoruos XML format is required to make use of professional XML editors/tools. Therefore we started in libFAUDES 2.16f to implement an alternative serialization format. Recent versions of libFAUDES still read the old format and provide the utility
Typical user data like generators and alphabets by default continue to use the original file format for token output. However, for applications that require the more rigoruos XML format, the base class Type provides the additional interface XWrite().