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

Repetition of Types and Structures

Repetition is modeled by the class templates repfield and repstruc, depending on whether the repeated class is a Type or a Structure. Each repeatition is numbered from zero onwards. You can access the repeatition by the array reference operator []. This returns a reference to the repeated object, thus you can read and modify the selected object. There is no upper limit for the number repetitions. The following example shows how you would print successive "COMMENT" fields from an NTE segment:

NTEseg nte;
repfield<TXtyp> rcom = nte.getCom();
int i;

for(i = 0; rcom[i].ispresent(); i++)
  {
    cout << (char *)rcom[i];
  }

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