Changeset 3067
- Timestamp:
- Jan 19, 2005, 5:46:53 PM (22 years ago)
- Location:
- trunk/doc/pslib
- Files:
-
- 2 edited
-
ChangeLogSDRS.tex (modified) (2 diffs)
-
psLibSDRS.tex (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/pslib/ChangeLogSDRS.tex
r2929 r3067 1 %%% $Id: ChangeLogSDRS.tex,v 1.5 5 2005-01-07 22:31:45price Exp $1 %%% $Id: ChangeLogSDRS.tex,v 1.56 2005-01-20 03:46:53 price Exp $ 2 2 3 3 \subsection{Changes from version 00 to version 01} … … 409 409 minimization. 410 410 \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.16 6 2005-01-09 00:50:15 eugene Exp $1 %%% $Id: psLibSDRS.tex,v 1.167 2005-01-20 03:46:48 price Exp $ 2 2 \documentclass[panstarrs,spec]{panstarrs} 3 3 … … 1534 1534 and the first element in the list, pointed to by both 1535 1535 \code{psList.head} and \code{psList.tail}. If the data entry is 1536 \code{NULL}, then an empty list, with both pointers are set to1537 \code{NULL} should be created. The number of iterators in the list is 1538 initiallyset to zero.1536 \code{NULL}, then an empty list, with both pointers set to \code{NULL} 1537 should be created. The number of iterators in the list is initially 1538 set to zero. 1539 1539 1540 1540 The destructor function for \code{psList} must call \code{psFree} for … … 1545 1545 removed from a list, they must have their reference counters 1546 1546 decremented. The action of retrieving data from a list (with one of 1547 the three \code{psListGet} functions) also increments the reference1548 counter.1547 the three \code{psListGet} functions) is considered ``borrowing'' the 1548 reference, so no action is performed on the reference counter. 1549 1549 1550 1550 Iteration on the list shall be achieved by means of a list iterator … … 1556 1556 bool offEnd; ///< Is the iterator off the end? 1557 1557 int index; ///< Index of iterator, to assist performance 1558 bool mutable; ///< Is it permissible to modify the list? 1558 1559 } psListIterator; 1559 1560 \end{verbatim} … … 1563 1564 using numerical locations. The boolean member, \code{offEnd}, 1564 1565 indicates 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 1567 whether it is permissible to modify the list pointed to by the 1568 iterator. \code{psListAddBefore} and \code{psListAddAfter} are not 1569 permitted to modify a list that is not \code{mutable} (i.e., only the 1570 \code{psListGetAndIncrement} and \code{psListGetAndDecrement} 1571 operations are permissible for a non-\code{mutable} list). 1566 1572 1567 1573 The corresponding constructor shall be: 1568 1574 \begin{verbatim} 1569 psListIterator *psListIteratorAlloc( psList *list, int location);1575 psListIterator *psListIteratorAlloc(const psList *list, int location, bool mutable); 1570 1576 \end{verbatim} 1571 1577 Here, \code{list} is the \code{psList} on which the iterator will 1572 1578 iterate, and \code{location} is the initial starting point, and may be 1573 1579 a 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 1582 end of the list. The boolean \code{mutable} specifies whether it is 1583 permissible to modify the list pointed to by the iterator. 1577 1584 1578 1585 The 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 1582 1588 resizing the array appropriately. 1583 1589 … … 1589 1595 Again, the \code{location} may be a numerical index or it may be one 1590 1596 of 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. 1597 which are defined as 0 and -1, respectively; a negative index is 1598 interpreted as relative to the end of the list. The function shall 1599 return \code{true} if the reset was successful, or \code{false} 1600 otherwise. 1593 1601 1594 1602 \begin{verbatim} … … 1604 1612 warning and add the \code{data} to the tail) or it may be one of the 1605 1613 special values: \code{PS_LIST_HEAD} or \code{PS_LIST_TAIL}, which are 1606 defined as negative integers. The other two functions, 1614 defined as 0 and -1, respectively; a negative index is interpreted as 1615 relative to the end of the list. The other two functions, 1607 1616 \code{psListAddAfter} and \code{psListAddBefore} specify that the 1608 1617 \code{data} shall be added after or before (respectively) the current … … 1611 1620 \begin{verbatim} 1612 1621 void *psListGet(psList *list, int location); 1613 void *psListGet Next(psListIterator *iterator);1614 void *psListGet Previous(psListIterator *iterator);1622 void *psListGetAndIncrement(psListIterator *iterator); 1623 void *psListGetAndDecrement(psListIterator *iterator); 1615 1624 \end{verbatim} 1616 1625 A 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. 1626 first function, \code{psListGet} simply returns the value specified by 1627 its \code{location}, which may be a numerical index or it may be one 1628 of 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 1630 list. The other two functions, \code{psListGetAndIncrement} and 1631 \code{psListGetAndDecrement} return the item under the iteration 1632 cursor before advancing to the next or previous item, respectively. 1625 1633 1626 1634 In the event that the iteration cursor is at the tail of the list, 1627 \code{psListGet Next} shall return the tail item and then set the1628 \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{psListGet Previous} shall return the head item and then set the1631 \code{cursor} to \code{NULL} (and \code{offEnd} should already be1635 \code{psListGetAndIncrement} shall return the tail item and then set 1636 the \code{cursor} to \code{NULL} and \code{offEnd} to \code{true}. In 1637 the event that the iteration cursor is at the head of the list, 1638 \code{psListGetAndDecrement} shall return the head item and then set 1639 the \code{cursor} to \code{NULL} (and \code{offEnd} should already be 1632 1640 \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 1643 iteration \code{cursor} only if the intended direction places the 1644 cursor back on the list; otherwise a warning shall be generated, and 1645 no change shall be made. If \code{psListGetAndDecrement} was called 1646 with \code{offEnd} as \code{true}, then \code{offEnd} shall also be 1647 toggled back to \code{false} to indicate that the \code{cursor} is no 1648 longer off the end of the list. 1642 1649 1643 1650 \begin{verbatim} … … 1648 1655 \code{psListRemove}, the value of \code{location} may be the numerical 1649 1656 index 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 1658 negative index is interpreted as relative to the end of the list. For 1651 1659 \code{psListRemoveData}, the data item to be removed is identified by 1652 1660 matching the pointer value with \code{void *data}. The functions
Note:
See TracChangeset
for help on using the changeset viewer.
