Holds a sequence.
This is the interface for the class Sequence. A sequence contains a single set of variables, all at the same lexical level just like a Structure. Like a Structure, a Sequence may contain other compound types, including other Sequences. Unlike a Structure, a Sequence defines a pattern that is repeated N times for a sequence of N elements. It is useful to think of a Sequence as representing a table of values (like a relational database), with each row of the table corresponding to a Sequence ``instance.'' (This usage can be confusing, since ``instance'' also refers to a particular item of class Sequence.) For example: \begin{verbatim} Sequence { String name; Int32 age; } person; \end{verbatim} This represents a Sequence of ``person'' records, each instance of which contains a name and an age: \begin{verbatim} Fred 34 Ralph 23 Andrea 29 ... \end{verbatim} A Sequence can be arbitrarily long, which is to say that its length is not part of its declaration. A Sequence can contain other Sequences: \begin{verbatim} Sequence { String name; Int32 age; Sequence { String friend; } friend_list; } person; \end{verbatim} This is still represented as a single table, but each row contains the elements of both the main Sequence and the nested one: \begin{verbatim} Fred 34 Norman Fred 34 Andrea Fred 34 Ralph Fred 34 Lisa Ralph 23 Norman Ralph 23 Andrea Ralph 23 Lisa Ralph 23 Marth Ralph 23 Throckmorton Ralph 23 Helga Ralph 23 Millicent Andrea 29 Ralph Andrea 29 Natasha Andrea 29 Norman ... .. ... \end{verbatim} Internally, the Sequence is represented by a singly-linked list. The members of this list are the members of a single Sequence instance: one element in the series. This includes the nested Sequences, as in the above example. The list does {\it not} contain all the elements of the Sequence. You can think of it as containing a single row. Each Sequence also carries a ``level'' number. This can be used to good effect with some data access APIs (such as JGOFS) to record the level of nested Sequences. The top-level Sequence is Level 0, and any Sequences it contains would be Level 1. Any Sequences contained by those Level 1 Sequences would be at Level 2, and so on. The class contains read and set functions for this datum. Because the length of a Sequence is indeterminate, there are changes to the behavior of the functions to read this class of data. The #read()# function for a Sequence is designed to be called repeatedly, each time returning the next item in the Sequence. Similarly, the #deserialize()# function is here meant to be called repeatedly until the end of the Sequence is reached. Similar to a C structure, you refer to members of Sequence elements with a ``.'' notation. For example, if the Sequence has a member Sequence called ``Tom'' and Tom has a member Float32 called ``shoe\_size'', you can refer to Tom's shoe size as ``Tom.shoe\_size''.
Sequence(const Sequence &rhs)
virtual int length()
virtual void set_level(int lvl)
virtual int level()
virtual bool deserialize(XDR *source, DDS *dds, bool reuse = false)
bool seq_read_error()
virtual bool read(const string &dataset, int &error)
virtual void add_var(BaseType *, Part p = nil)
Pix first_var()
void next_var(Pix &p)
BaseType* var(Pix p)
virtual void print_val(ostream &os, string space = "", bool print_decl_p = true)
virtual void print_all_vals(ostream& os, XDR *src, DDS *dds, string space = "", bool print_decl_p = true)
src - The external source from which the data is to come.
This is passed to #deserialize()#.
dds - The Data Descriptor Structure object corresponding to
this dataset. See {\it The DODS User Manual} for information
about this structure. This would have been received from the
server in an earlier transmission.
space - The leading spaces of the output.
print_del_p - If TRUE, prints the declaration of the
Sequence as well as its data.
alphabetic index hierarchy of classes
generated by doc++