IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4453


Ignore:
Timestamp:
Jul 5, 2005, 1:52:23 PM (21 years ago)
Author:
Paul Price
Message:

Added accessors for the array-like collections. See bug 459.

File:
1 edited

Legend:

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

    r4445 r4453  
    1 %%% $Id: psLibSDRS.tex,v 1.307 2005-07-01 04:30:18 price Exp $
     1%%% $Id: psLibSDRS.tex,v 1.308 2005-07-05 23:52:23 price Exp $
    22\documentclass[panstarrs,spec]{panstarrs}
    33
     
    560560
    561561For array-like collections (specifically, \code{psArray},
    562 \code{psVector}, and \code{psImage}) we allow the user to refer to a
    563 negative index to mean address from the end.  Consequently, the number
    564 of elements in structures should be signed.  It is the responsibility
    565 of these structure allocators (e.g., \code{psArrayAlloc}) to check
    566 that the requested number of elements is not negative (calling
    567 \code{psAbort} otherwise).  All other allocators shall simply use
    568 \code{size_t} where the number of elements is needed (saving the
    569 trouble of checking before passing to psAlloc).
     562\code{psPixels}, \code{psVector}, and \code{psImage}) we allow the
     563user to refer to a negative index in the accessor (e.g.,
     564\code{psArrayGet}) to mean address from the end.  Consequently, the
     565number of elements in structures should be signed (in order to be able
     566to access the full range of allocated values).  It is the
     567responsibility of these structure allocators (e.g.,
     568\code{psArrayAlloc}) to check that the requested number of elements is
     569not negative (calling \code{psAbort} otherwise).  All other allocators
     570shall simply use \code{size_t} where the number of elements is needed
     571(saving the trouble of checking before passing to psAlloc).
    570572
    571573\subsubsection{Callback Routines}
     
    16961698
    16971699These accessor functions are provided as a convenience to the user.
    1698 \code{psArraySet} sets the value of the \code{in} array at the specified
    1699 \code{position} to \code{value}, returning \code{true} if successful.
    1700 \code{psArrayGet} returns the value of the \code{in} array at the
    1701 specified \code{position}.
     1700\code{psArraySet} sets the value of the \code{in} array at the
     1701specified \code{position} to \code{value}, returning \code{true} if
     1702successful.  \code{psArrayGet} returns the value of the \code{in}
     1703array at the specified \code{position}.  A negative \code{position}
     1704means index from the end.
    17021705
    17031706\begin{datatype}
     
    20292032
    20302033typedef struct {
    2031     psU32 n;                    // Number in use
    2032     const psU32 nalloc;         // Number allocated
     2034    long n;                     // Number in use
     2035    const long nalloc;          // Number allocated
    20332036    psPixelCoord *data;         // The pixel coordinates
    20342037    void *lock;                 // Lock for thread safety
     
    20372040
    20382041\begin{prototype}
    2039 psPixels *psPixelsAlloc(psU32 nalloc);
    2040 psPixels *psPixelsRealloc(psPixels *pixels, psU32 nalloc);
     2042psPixels *psPixelsAlloc(long nalloc);
     2043psPixels *psPixelsRealloc(psPixels *pixels, long nalloc);
    20412044\end{prototype}
    20422045
     
    20642067are stored is not important, the values may be sorted, allowing the
    20652068use of a faster algorithm than a linear scan).
     2069
     2070\begin{prototype}
     2071bool psPixelsSet(psPixels *pixels, long position, psPixelCoord value);
     2072psPixelCoord psPixelsGet(const psPixels *pixels, long position);
     2073\end{prototype}
     2074
     2075These accessor functions are provided as a convenience to the user.
     2076\code{psPixelsSet} sets the value of the \code{pixels} array at the
     2077specified \code{position} to \code{value} (a \code{psPixelCoord}
     2078passed by value), returning \code{true} if successful.
     2079\code{psPixelsGet} returns the value of the \code{pixels} array at the
     2080specified \code{position}.  A negative \code{position} means index
     2081from the end.
    20662082
    20672083%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     
    25392555The iterator may be set to a location in the \code{psMetadata} list,
    25402556and the user may get the previous or next item in the list relative to
    2541 that location.  \code{psMetadataGetNext} has the ability to match the
    2542 key using a POSIX \code{regex}, e.g., if the user only wants to
    2543 iterate through \code{IPP.machines.sky} and doesn't want to bother
    2544 with \code{IPP.machines.detector}.  The iterator should iterate over
    2545 every item in the metadata list, even those that are contained in a
     2557that location.  The iterators may be used to return the next key
     2558matching a POSIX \code{regex}, e.g., if the user only wants to iterate
     2559through \code{IPP.machines.sky} and doesn't want to bother with
     2560\code{IPP.machines.detector}.  The iterator should iterate over every
     2561item in the metadata list, even those that are contained in a
    25462562\code{PS_DATA_LIST}.  The value \code{iterator} specifies the iterator
    25472563to be used.  In setting the iterator, the position of the iterator is
     
    31403156The input data is cast to match the vector datatype, allowing for
    31413157integers to be preserved.
     3158
     3159\begin{prototype}
     3160bool psVectorSet(const psVector *input, long position, complex double value);
     3161complex double psVectorGet(const psVector *input, long position);
     3162\end{prototype}
     3163
     3164These accessor functions are provided as a convenience to the user.
     3165\code{psVectorSet} sets the value of the \code{input} vector at the
     3166specified \code{position} to \code{value} (appropriately cast),
     3167returning \code{true} if successful.  \code{psVectorGet} returns the
     3168value of the \code{input} vector at the specified \code{position}.  A
     3169negative \code{position} means index from the end.
    31423170
    31433171%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     
    32383266The input data is cast to match the image datatype, allowing for
    32393267integers to be preserved.
     3268
     3269\begin{prototype}
     3270bool psImageSet(const psImage *image, int x, int y, complex double value);
     3271complex double psImageGet(const psImage *image, int x, int y);
     3272\end{prototype}
     3273
     3274These accessor functions are provided as a convenience to the user.
     3275\code{psImageSet} sets the value of the \code{image} at the specified
     3276\code{x,y} position to \code{value} (appropriately cast), returning
     3277\code{true} if successful.  \code{psImageGet} returns the value of the
     3278\code{image} at the specified \code{x,y} position.  A negative value
     3279for the \code{x,y} position means index from the end.
    32403280
    32413281\subsubsection{Image Regions}
Note: See TracChangeset for help on using the changeset viewer.