IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3067


Ignore:
Timestamp:
Jan 19, 2005, 5:46:53 PM (22 years ago)
Author:
Paul Price
Message:

Updates to psList from RHL comments.

Location:
trunk/doc/pslib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/pslib/ChangeLogSDRS.tex

    r2929 r3067  
    1 %%% $Id: ChangeLogSDRS.tex,v 1.55 2005-01-07 22:31:45 price Exp $
     1%%% $Id: ChangeLogSDRS.tex,v 1.56 2005-01-20 03:46:53 price Exp $
    22
    33\subsection{Changes from version 00 to version 01}
     
    409409minimization.
    410410\item Added \code{psPlaneAlloc, psSphereAlloc, psProjectionAlloc}.
    411 \end{itemize}
     411\item \code{psList}:
     412  \begin{itemize}
     413  \item Adopted new names: \code{psListGetAndIncrement,
     414    psListGetAndDecrement} instead of \code{psListGetNext,
     415    psListGetPrev} --- clearer description of functionality.
     416  \item Changed \code{PS_LIST_HEAD = 0} and \code{PS_LIST_TAIL = -1};
     417    negative indices specify an item relative to the end of the list.
     418  \item The action of retrieving data from a list (with one of the
     419    three \code{psListGet} functions) is considered ``borrowing'' the
     420    reference, so no action is performed on the reference counter.
     421    Removed other mentions of reference counters, since these were not
     422    necessary.
     423  \item \code{mutable} boolean in \code{psListIterator} specifies
     424    whether \code{psListAddAfter} or \code{psListAddBefore} may be
     425    used to modify the list through the iterator.  This allows the use
     426    of \code{const psList} in \code{psListIteratorAlloc}.
     427  \end{itemize}
     428
     429\end{itemize}
  • trunk/doc/pslib/psLibSDRS.tex

    r2939 r3067  
    1 %%% $Id: psLibSDRS.tex,v 1.166 2005-01-09 00:50:15 eugene Exp $
     1%%% $Id: psLibSDRS.tex,v 1.167 2005-01-20 03:46:48 price Exp $
    22\documentclass[panstarrs,spec]{panstarrs}
    33
     
    15341534and the first element in the list, pointed to by both
    15351535\code{psList.head} and \code{psList.tail}.  If the data entry is
    1536 \code{NULL}, then an empty list, with both pointers are set to
    1537 \code{NULL} should be created.  The number of iterators in the list is
    1538 initially set to zero.
     1536\code{NULL}, then an empty list, with both pointers set to \code{NULL}
     1537should be created.  The number of iterators in the list is initially
     1538set to zero.
    15391539
    15401540The destructor function for \code{psList} must call \code{psFree} for
     
    15451545removed from a list, they must have their reference counters
    15461546decremented.  The action of retrieving data from a list (with one of
    1547 the three \code{psListGet} functions) also increments the reference
    1548 counter.
     1547the three \code{psListGet} functions) is considered ``borrowing'' the
     1548reference, so no action is performed on the reference counter.
    15491549
    15501550Iteration on the list shall be achieved by means of a list iterator
     
    15561556    bool offEnd;                       ///< Is the iterator off the end?
    15571557    int index;                         ///< Index of iterator, to assist performance
     1558    bool mutable;                      ///< Is it permissible to modify the list?
    15581559} psListIterator;
    15591560\end{verbatim}
     
    15631564using numerical locations.  The boolean member, \code{offEnd},
    15641565indicates whether the iterator has progressed off the end of the list
    1565 (i.e., beyond the last item).
     1566(i.e., beyond the last item).  The boolean \code{mutable} specifies
     1567whether it is permissible to modify the list pointed to by the
     1568iterator.  \code{psListAddBefore} and \code{psListAddAfter} are not
     1569permitted to modify a list that is not \code{mutable} (i.e., only the
     1570\code{psListGetAndIncrement} and \code{psListGetAndDecrement}
     1571operations are permissible for a non-\code{mutable} list).
    15661572
    15671573The corresponding constructor shall be:
    15681574\begin{verbatim}
    1569 psListIterator *psListIteratorAlloc(psList *list, int location);
     1575psListIterator *psListIteratorAlloc(const psList *list, int location, bool mutable);
    15701576\end{verbatim}
    15711577Here, \code{list} is the \code{psList} on which the iterator will
    15721578iterate, and \code{location} is the initial starting point, and may be
    15731579a numerical index or it may be one of the special values:
    1574 \code{PS_LIST_HEAD} or \code{PS_LIST_TAIL}, which are defined as
    1575 negative integers.  Of course, the \code{psListElem} pointed to by the
    1576 iterator shall have its \code{refCounter} incremented.
     1580\code{PS_LIST_HEAD} or \code{PS_LIST_TAIL}, which are defined as 0 and
     1581-1, respectively; a negative index is interpreted as relative to the
     1582end of the list.  The boolean \code{mutable} specifies whether it is
     1583permissible to modify the list pointed to by the iterator.
    15771584
    15781585The destructor for \code{psListIterator} shall, after freeing the
    1579 \code{psListIterator} and decrementing the \code{refCounter} of the
    1580 \code{psListElem} that it pointed to, also reorganise the \code{iter}
    1581 array (replacing the element being removed with the last element) and
     1586\code{psListIterator}, also reorganise the \code{iter} array
     1587(replacing the element being removed with the last element) and
    15821588resizing the array appropriately.
    15831589
     
    15891595Again, the \code{location} may be a numerical index or it may be one
    15901596of the special values: \code{PS_LIST_HEAD} or \code{PS_LIST_TAIL},
    1591 which are defined as negative integers.  The function shall return
    1592 \code{true} if the reset was successful, or \code{false} otherwise.
     1597which are defined as 0 and -1, respectively; a negative index is
     1598interpreted as relative to the end of the list.  The function shall
     1599return \code{true} if the reset was successful, or \code{false}
     1600otherwise.
    15931601
    15941602\begin{verbatim}
     
    16041612warning and add the \code{data} to the tail) or it may be one of the
    16051613special values: \code{PS_LIST_HEAD} or \code{PS_LIST_TAIL}, which are
    1606 defined as negative integers.  The other two functions,
     1614defined as 0 and -1, respectively; a negative index is interpreted as
     1615relative to the end of the list.  The other two functions,
    16071616\code{psListAddAfter} and \code{psListAddBefore} specify that the
    16081617\code{data} shall be added after or before (respectively) the current
     
    16111620\begin{verbatim}
    16121621void *psListGet(psList *list, int location);
    1613 void *psListGetNext(psListIterator *iterator);
    1614 void *psListGetPrevious(psListIterator *iterator);
     1622void *psListGetAndIncrement(psListIterator *iterator);
     1623void *psListGetAndDecrement(psListIterator *iterator);
    16151624\end{verbatim}
    16161625A data item may be retrieved from the list with these functions.  The
    1617 first function, \code{psListGet} simply returns the value specified
    1618 by its \code{location}, which may be a numerical index or it may be
    1619 one of the special values: \code{PS_LIST_HEAD} or \code{PS_LIST_TAIL},
    1620 which are defined as negative integers, allowing \code{location} to
    1621 also be the index of one of the data items.  The other two functions,
    1622 \code{psListGetNext} and \code{psListGetPrevious} return the item
    1623 under the iteration cursor before advancing to the next or previous
    1624 item, respectively.
     1626first function, \code{psListGet} simply returns the value specified by
     1627its \code{location}, which may be a numerical index or it may be one
     1628of the special values: \code{PS_LIST_HEAD = 0} or \code{PS_LIST_TAIL =
     1629-1}; negative indices are interpreted as relative to the end of the
     1630list.  The other two functions, \code{psListGetAndIncrement} and
     1631\code{psListGetAndDecrement} return the item under the iteration
     1632cursor before advancing to the next or previous item, respectively.
    16251633
    16261634In the event that the iteration cursor is at the tail of the list,
    1627 \code{psListGetNext} shall return the tail item and then set the
    1628 \code{cursor} to \code{NULL} and \code{offEnd} to \code{true}.  In the
    1629 event that the iteration cursor is at the head of the list,
    1630 \code{psListGetPrevious} shall return the head item and then set the
    1631 \code{cursor} to \code{NULL} (and \code{offEnd} should already be
     1635\code{psListGetAndIncrement} shall return the tail item and then set
     1636the \code{cursor} to \code{NULL} and \code{offEnd} to \code{true}.  In
     1637the event that the iteration cursor is at the head of the list,
     1638\code{psListGetAndDecrement} shall return the head item and then set
     1639the \code{cursor} to \code{NULL} (and \code{offEnd} should already be
    16321640\code{false}).  In the event that the iteration \code{cursor} is
    1633 \code{NULL}, \code{psListGetNext} and \code{psListGetPrevious} shall
    1634 return \code{NULL}, and advance the iteration \code{cursor} only if
    1635 the intended direction places the cursor back on the list; otherwise a
    1636 warning shall be generated, and no change shall be made.  If
    1637 \code{psListGetPrevious} was called with \code{offEnd} as \code{true},
    1638 then \code{offEnd} shall also be toggled back to \code{false} to
    1639 indicate that the \code{cursor} is no longer off the end of the list.
    1640 When setting the \code{cursor}, the appropriate \code{refCounter}s
    1641 shall be incremented and decremented.
     1641\code{NULL}, \code{psListGetAndIncrement} and
     1642\code{psListGetAndDecrement} shall return \code{NULL}, and advance the
     1643iteration \code{cursor} only if the intended direction places the
     1644cursor back on the list; otherwise a warning shall be generated, and
     1645no change shall be made.  If \code{psListGetAndDecrement} was called
     1646with \code{offEnd} as \code{true}, then \code{offEnd} shall also be
     1647toggled back to \code{false} to indicate that the \code{cursor} is no
     1648longer off the end of the list.
    16421649
    16431650\begin{verbatim}
     
    16481655\code{psListRemove}, the value of \code{location} may be the numerical
    16491656index or it may be one of the special values: \code{PS_LIST_HEAD} or
    1650 \code{PS_LIST_TAIL}, which are defined as negative integers.  For
     1657\code{PS_LIST_TAIL}, which are defined as 0 and -1, respectively; a
     1658negative index is interpreted as relative to the end of the list.  For
    16511659\code{psListRemoveData}, the data item to be removed is identified by
    16521660matching the pointer value with \code{void *data}.  The functions
Note: See TracChangeset for help on using the changeset viewer.