pos

Section: OATH Reference Manual (3O)
Updated: 26 August 1991
Index Return to Main Contents
 

NAME

pos (posA, posG) - a position in a seq  

SYNOPSIS

#include <oath/seq.h>  

DESCRIPTION

The pos is a companion class of seq. It represents a position in the seq. A pos may be incremented, which moves it to the next position in the seq; thereby supporting iteration through the seq. In a seq containing N objs there are N+1 positions, one before each obj and one past the end.

SEQ:: [ O0 O1 O2 O3 O4 O5 O6 O7 ]


        ^    ^    ^    ^    ^    ^    ^    ^    ^


        P0   P1   P2   P3   P4   P5   P6   P7  "Past End"  

DERIVATION

pos : obj

pos is an abstract type.  

STATIC OPERATIONS

posA posA:: isa (objA)
posA::isa(O) returns O if it is truly a pos; otherwise it returns Nil.
 

MEMBER OPERATIONS

int posA:: isPastEnd ()
P.isPastEnd() returns TRUE if the pos P is at the "past end" position. If this is true, then it will be an error to execute *P.
int posA:: operator () ()
P() is the same as !P.isPastEnd().
objA posA:: operator * ()
*P returns the obj in front of the pos P. It is an error if P is "past end".
posA posA:: operator ++ ()
++P moves the pos P to the next position and returns P. If P was "past end", then it will remain at "past end".
posA posA:: operator += (int)
P += I advances the pos P I positions and returns P. P += 1 is the same as ++P. If P is less than I positions from "past end", then it will advance to "past end".
objA posA:: find (objA)
P.find(O) will look for the first obj beyond pos P that is(O). If such an obj is found, then P will be advanced to the position in front of that obj and O will be returned. If not, then P will not move and Nil will be returned.
objA posA:: findEqual (objA)
P.find(O) will look for the first obj beyond pos P that isEqual(O). If such an obj is found, then P will be advanced to the position in front of that obj and O will be returned. If not, then P will not move and Nil will be returned.
posA posA:: reset (posA)
P1.reset(P2) will reset P1 to the same position as P2. It is an error if the two pos are not in the same seq.
posA posA:: reset (int = 0)
P.reset(I) will reset pos P to the I'th position in the seq. [If I is negative, then P is set to "past end".]
seqA posA:: parent ()
P.parent() returns the seq to which it refers.
 

INTERNAL OPERATIONS

virtual int posG:: isPastEnd () const
virtual const objG* posG:: indirection () const
virtual void posG:: increment ()
virtual void posG:: increment (int)
virtual const objG* posG:: find (const objG*)
virtual const objG* posG:: findEqual (const objG*)
virtual void posG:: reset (const posG*)
virtual void posG:: reset (int I)
virtual const seqG* posG:: parent () const
 

SEE ALSO

OATH(3O), obj(3O), seq(3O)  

AUTHOR

Brian M. Kennedy (Computer Science Center, Texas Instruments Incorporated)  

BUGS


 

Index

NAME
SYNOPSIS
DESCRIPTION
DERIVATION
STATIC OPERATIONS
MEMBER OPERATIONS
INTERNAL OPERATIONS
SEE ALSO
AUTHOR
BUGS

This document was created by man2html, using the manual pages.
Time: 20:37:42 GMT, July 24, 2024