Go to the first, previous, next, last section, table of contents.

Repetition and optionality

Repetition

Repetition is modeled by the class repeated, which is defined using the template feature and thus can be easily reused for any class of HL7 objects. The repeated class is a derived class from the class that is to repeat, enhancing the latter merely by a pointer to the next object which is called cdr, thus any repeated object is organized as a linked list. This is a more homogeneous approach than using arrays, since there is often no maximal repetition specified. There are member functions which allow the input and output of repeated object as well as an easy to use access to any member of the list, which is syntactically the same as referencing a member of an array. This could be achieved by overloading the array reference operator []. The assignment operator is as well overloaded in order to make a copy of the list rather than just assigning the reference.

Optionality

Since the HL7 specifications demand a tolerance in respect to missing or unexpected objects, we do not care much about whether a segment is marked as required in the specifications. It is rather up to the application to reject incomplete messages, while unexpected objects tend to be just ignored.


Go to the first, previous, next, last section, table of contents.