As a result of intensive (almost excessive) discussions of today, I
would like to spit out a requirement for:
Tagged unions as a basic V4 data type
Let me give one example based on the idea of implementing Sequencer
state sets as (pseudo) record instances:
The sequences will (hopefully) be able to support parametrized states,
i.e. instead of changing global variables and plainly switching to
another state, you can switch to the new state handing in some
parameters. If the current state of a state set is to be represented by
a (pseudo) field of the state set's (pseudo) record, that field's data
has the form of a tagged union, i.e. it is organized like:
state = init state = start state = wait
int i1 double d; char t1;
int i2 int j1; int j3;
Such a field can transparently contain the complete state information,
including any parameters for that state.
Structures (such as the parameter list) are represented by C structures
internally and property catalogs externally (through DA).
The state tag is represented as an enum (both internally and externally).
The DA representation of the tagged union would be a property catalog
that consists of the tag (which is an enum) and the properties that can
vary in type, name and number depending on the tag's value.
Access can be managed by generating DA code that:
- find()s only properties that are present - depending on the tag value
- traverse()s always the tag first, then the matching properties, both
for the reading and writing traversals
The only place where DA has to be extended is for the new method (under
construction) that traverses the property names and natural types. For
that special traversal, the tagged union is very much like an enum, but
with an additional property catalog connected to each of the enum
choices that can be traversed to find out the properties and types
present in that state of the union. ((Delivers a State of the Union
In other words ... A regular plain enum (functionality that is already
implemented) is just a special case of a tagged union: an empty union
with no data properties connected to the state string.
What do you think!?
Ralph Lange Ralph.Lange@bessy.de Tel: +49 30 6392-2117
BESSY Controls Group www.bessy.de Fax: ... -4859
- Re: V4 Data Types: Request for tagged unions Andrew Johnson
- RE: V4 Data Types: Request for tagged unions Jeff Hill
- Navigate by Date:
Re: Fundamental Types document Andrew Johnson
V4 Database Access Ralph Lange
- Navigate by Thread:
Re: Fundamental Types document Benjamin Franksen
Re: V4 Data Types: Request for tagged unions Andrew Johnson