IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 922


Ignore:
Timestamp:
Jun 8, 2004, 9:38:45 AM (22 years ago)
Author:
eugene
Message:

minor changes regarding Callbacks and psStats

File:
1 edited

Legend:

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

    r842 r922  
    1 %%% $Id: psLibSDRS.tex,v 1.50 2004-06-03 03:14:54 eugene Exp $
     1%%% $Id: psLibSDRS.tex,v 1.51 2004-06-08 19:38:45 eugene Exp $
    22\documentclass[panstarrs]{panstarrs}
    33
     
    362362The callback functions are defined in terms of specific callback
    363363types, specified below.  The callbacks are set using functions with
    364 names of the form \code{psCallbackSet}.  In all cases, the
    365 `\code{Set}' routine takes a pointer to the desired callback function
    366 and returns a pointer to the one that was previously installed. The
    367 defaults for each of these callbacks is \code{NULL}, in which case the
    368 corresponding callback is skipped.  If the function pointer passed to
    369 the functions above is \code{NULL}, the default behavior is set.  We
    370 discuss the use of each of the four callbacks below.
     364names of the form \code{psCallbackSet}.  In all cases, the \code{Set}
     365routine takes a pointer to the desired callback function and returns a
     366pointer to the one that was previously installed. The default
     367functions for each of these callbacks is listed below:
     368%
     369\begin{itemize}
     370\item \code{psMemExhaustedCallbackDefault}
     371\item \code{psMemProblemCallbackDefault}
     372\item \code{psMemAllocateCallbackDefault}
     373\item \code{psMemFreeCallbackDefault}
     374\end{itemize}
     375%
     376and have the behavior of immediately returning \code{NULL}, as if the
     377callback had been skipped.  If the function pointer passed to the
     378functions above is \code{NULL}, the callback must be reset to the
     379default callback function.  The named default callbacks may be used in
     380within a debugger to catch these conditions by breaking when the
     381functions are called.  We discuss the use of each of the four
     382callbacks below.
    371383
    372384\subsubsubsection{\tt psMemExhaustedCallback}
     
    10141026\subsection{Abort}
    10151027
    1016 \code{psAbort}, must call \code{psMsgLog} with a
    1017 level of \code{PS_LOG_ABORT}, and then call \code{abort}.
     1028\code{psAbort}, must call \code{psLogMsgV} with a level of
     1029\code{PS_LOG_ABORT}, and then call \code{abort}.
    10181030
    10191031\begin{verbatim}
     
    12321244
    12331245\subsection{Doubly-linked lists}
    1234 \label{sec:psDlist}
    1235 
    1236 \PS{} supports doubly linked lists through a type \code{psDlist}:
     1246\label{sec:psList}
     1247
     1248\PS{} supports doubly linked lists through a type \code{psList}:
    12371249%
    12381250\begin{verbatim}
    12391251typedef struct {
    12401252   int n;                               ///< number of elements on list
    1241    psDlistElem *head;                   ///< first element on list (may be NULL)
    1242    psDlistElem *tail;                   ///< last element on list (may be NULL)
    1243    psDlistElem *iter;                   ///< iteration cursor
    1244 } psDlist;
    1245 \end{verbatim}
    1246 %
    1247 The type \code{psDlist} represents the container of the list.  It has
     1253   psListElem *head;                   ///< first element on list (may be NULL)
     1254   psListElem *tail;                   ///< last element on list (may be NULL)
     1255   psListElem *iter;                   ///< iteration cursor
     1256} psList;
     1257\end{verbatim}
     1258%
     1259The type \code{psList} represents the container of the list.  It has
    12481260a pointer to the first element in the linked list (\code{head}), a
    12491261pointer to the last element in the list (\code{tail}), an entry for
     
    12511263number of elements in the list (\code{n}).
    12521264
    1253 The elements of the list are defined by the type \code{psDlistElem}:
    1254 %
    1255 \begin{verbatim}
    1256 typedef struct psDlistElem {
    1257    struct psDlistElem *prev;            ///< previous link in list
    1258    struct psDlistElem *next;            ///< next link in list
     1265The elements of the list are defined by the type \code{psListElem}:
     1266%
     1267\begin{verbatim}
     1268typedef struct psListElem {
     1269   struct psListElem *prev;            ///< previous link in list
     1270   struct psListElem *next;            ///< next link in list
    12591271   void *data;                          ///< real data item
    1260 } psDlistElem;
     1272} psListElem;
    12611273\end{verbatim}
    12621274%
     
    12671279
    12681280\begin{verbatim}
    1269 psDlist *psDlistAlloc(void *data);
     1281psList *psListAlloc(void *data);
    12701282\end{verbatim}
    12711283Create a list.  This function may take a pointer to a data item, or it
    1272 may take \code{NULL}.  The allocator creates both the \code{psDlist}
     1284may take \code{NULL}.  The allocator creates both the \code{psList}
    12731285and the first element in the list, pointed to by both
    1274 \code{psDlist.head} and \code{psDlist.tail}.  If the data entry is
     1286\code{psList.head} and \code{psList.tail}.  If the data entry is
    12751287\code{NULL}, then an empty list, with both pointers are set to
    12761288\code{NULL} should be created.
    12771289
    12781290\begin{verbatim}
    1279 psDlist *psDlistAdd(psDlist *list, void *data, int where);
     1291psList *psListAdd(psList *list, void *data, int where);
    12801292\end{verbatim}
    12811293Add an entry to the list with this function, which takes a pointer to
    12821294the list and also returns a pointer to the list.  The returned pointer
    1283 must be used as the value of \code{psDlist} may have changed.  The
     1295must be used as the value of \code{psList} may have changed.  The
    12841296value of \code{where} specifies if the specified data item should be
    12851297placed on the front of the list (\code{PS_DLIST_HEAD}), at the end of
     
    12901302
    12911303\begin{verbatim}
    1292 void *psDlistGet(psDlist *list, int which);
     1304void *psListGet(psList *list, int which);
    12931305\end{verbatim}
    12941306A data item may be retrieved from the list with this function.  The
     
    13001312
    13011313\begin{verbatim}
    1302 void *psDlistRemove(psDlist *list, void *data, int which);
     1314void *psListRemove(psList *list, void *data, int which);
    13031315\end{verbatim}
    13041316A data item may be removed from the list with this function.  The
     
    13111323*data}.
    13121324
    1313 All data items placed onto lists (\code{psDlistAdd}) must have their
     1325All data items placed onto lists (\code{psListAdd}) must have their
    13141326reference counters (section \ref{secMemRefcounter}) incremented.  When
    1315 elements are removed from a list with \code{psDlistRemove}, they must
     1327elements are removed from a list with \code{psListRemove}, they must
    13161328have their reference counters decremented. The action of retrieving
    1317 data from a list (with \code{psDlistGet}) must not affect their
     1329data from a list (with \code{psListGet}) must not affect their
    13181330reference counter.
    13191331
    13201332\begin{verbatim}
    1321 void psDlistFree(psDlist *list, void (*elemFree)(void *));
     1333void psListFree(psList *list, void (*elemFree)(void *));
    13221334\end{verbatim}
    13231335A complete list may be freed with this destructor.  If the element
     
    13271339
    13281340\begin{verbatim}
    1329 psVector *psDlistToVector(psDlist *dlist);
    1330 psDlist *psVectorToDlist(psVector *vector);
     1341psVector *psListToVector(psList *dlist);
     1342psList *psVectorToDlist(psVector *vector);
    13311343\end{verbatim}
    13321344These two functions are available to convert between the
    1333 \code{psDlist} and \code{psVector} containers.  These functions do not
     1345\code{psList} and \code{psVector} containers.  These functions do not
    13341346free the elements or destroy the input collection.  Rather, they
    13351347increment the reference counter for each of the elements.
    13361348
    13371349\begin{verbatim}
    1338 void psDlistSetIterator(psDlist *list, int where, int which);
    1339 void *psDlistGetNext(psDlist *list, int which);
    1340 void *psDlistGetPrev(psDlist *list, int which);
     1350void psListSetIterator(psList *list, int where, int which);
     1351void *psListGetNext(psList *list, int which);
     1352void *psListGetPrev(psList *list, int which);
    13411353\end{verbatim}
    13421354Iteration over all elements of the list using the iteration cursor
     
    13481360returning the data item from the resulting list entry, or returning
    13491361\code{NULL} at the end of the list.  Explicit traversal of the list
    1350 using the \code{psDlistElem}s \code{prev} and \code{next} pointers is
     1362using the \code{psListElem}s \code{prev} and \code{next} pointers is
    13511363also supported.
    13521364
    13531365\begin{verbatim}
    1354 psDlist *psDlistSort(psDlist *list, int (*compare)(const void *a, const void *b) );
    1355 \end{verbatim}
    1356 A list may be sorted using \code{psDlistSort}, which requires the
     1366psList *psListSort(psList *list, int (*compare)(const void *a, const void *b) );
     1367\end{verbatim}
     1368A list may be sorted using \code{psListSort}, which requires the
    13571369specification of a comparison function to specify how the objects on
    13581370the list should be sorted.  The motivation is primarily to be able to
     
    14491461The function
    14501462\begin{verbatim}
    1451 psDlist *psHashKeylist(psHast *table);
     1463psList *psHashKeylist(psHast *table);
    14521464\end{verbatim}
    14531465returns the complete list of defined keys associated with the
     
    19801992is derived from the statistics of the pixels at that direction
    19811993coordinate.  The statistic used to derive the output vector value is
    1982 specified by \code{stats}.  This function must be defined for the
    1983 following types: \code{psU8}, \code{psU16}, \code{psF32}, \code{psF64}.
     1994specified by \code{stats}.  Only one of the statistics choices may be
     1995specified, otherwise the function must return an error.  This function
     1996must be defined for the following types: \code{psU8}, \code{psU16},
     1997\code{psF32}, \code{psF64}.
    19841998
    19851999\begin{verbatim}
     
    19892003\end{verbatim}
    19902004Extract pixels from an image along a line to a vector (array of
    1991 floats).  The vector \code{(xs,ys)} - \code{(xe,ye)} forms the basis of
    1992 the output vector.  Pixels are considered in a rectangular region of
    1993 width \code{dw} about this vector.  The input region is collapsed in
    1994 the perpendicular direction, and each element of the output vector
     2005floats).  The vector \code{(xs,ys)} - \code{(xe,ye)} forms the basis
     2006of the output vector.  Pixels are considered in a rectangular region
     2007of width \code{dw} about this vector.  The input region is collapsed
     2008in the perpendicular direction, and each element of the output vector
    19952009represents pixel-sized boxes, where the value is derived from the
    19962010statistics of the pixels interpolated along the perpendicular
    19972011direction.  The statistic used to derive the output vector value is
    1998 specified by \code{stats}.  This function must be defined for the
    1999 following types: \code{psU8}, \code{psU16}, \code{psF32}, \code{psF64}
     2012specified by \code{stats}.  Only one of the statistics choices may be
     2013specified, otherwise the function must return an error.  This function
     2014must be defined for the following types: \code{psU8}, \code{psU16},
     2015\code{psF32}, \code{psF64}
    20002016
    20012017\begin{verbatim}
     
    20082024the image pixel coordinate \code{x,y}, and have width \code{dr}.  The
    20092025number of annuli is $radius / dr$.  The statistic used to derive the
    2010 output vector value is specified by \code{stats}.  This function must be defined for the
    2011 following types: \code{psU8}, \code{psU16}, \code{psF32}, \code{psF64}.
     2026output vector value is specified by \code{stats}.  Only one of the
     2027statistics choices may be specified, otherwise the function must
     2028return an error.  This function must be defined for the following
     2029types: \code{psU8}, \code{psU16}, \code{psF32}, \code{psF64}.
    20122030
    20132031\subsubsection{Image Geometry Manipulation}
     
    20232041Each pixel in the output image is derived from the statistics of the
    20242042corresponding set of input image pixels based on the statistics
    2025 specified by \code{stats}.  This function must be defined for the
    2026 following types: \code{psU8}, \code{psU16}, \code{psS8}, \code{psS16},
    2027 \code{psF32}, \code{psF64}, \code{psC32}, \code{psC64}.
     2043specified by \code{stats}.  Only one of the statistics choices may be
     2044specified, otherwise the function must return an error.  This function
     2045must be defined for the following types: \code{psU8}, \code{psU16},
     2046\code{psS8}, \code{psS16}, \code{psF32}, \code{psF64}, \code{psC32},
     2047\code{psC64}.
    20282048
    20292049\begin{verbatim}
     
    21622182\code{+Inf} or \code{-Inf} values are set to the specified value.
    21632183Returns the number of clipped pixels.  This function must be defined
    2164 for the following types: \code{psU8}, \code{psU16}, \code{psS8},
    2165 \code{psS16}, \code{psF32}, \code{psF64}, \code{psC32}, \code{psC64}.
     2184for the following types: \code{psF32}, \code{psF64}, \code{psC32},
     2185\code{psC64}.
    21662186
    21672187\begin{verbatim}
     
    21782198This function must be defined for the following types: \code{psU8},
    21792199\code{psU16}, \code{psS8}, \code{psS16}, \code{psF32}, \code{psF64},
    2180 \code{psC32}, \code{psC64}.
     2200\code{psC32}, \code{psC64}.  The two input images must have the same
     2201datatype and the output image must be constructed with that same
     2202datatype.
    21812203
    21822204%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     
    23942416\end{verbatim}
    23952417
    2396 The output from a FFT and power spectrum shall be of the same size as
     2418The output from a FFT and power spectrum must be of the same size as
    23972419the input.  In the future, if this adversely affects performance, this
    23982420will be revised so that the redundant information will be neglected.
     
    26002622    } data;                             ///< value of metadata
    26012623    char *comment;                      ///< optional comment ("", not NULL)
    2602     psDlist *restrict items;            ///< list of psMetadataItems with the same name
     2624    psList *restrict items;            ///< list of psMetadataItems with the same name
    26032625} psMetadataItem;
    26042626\end{verbatim}
     
    26432665\begin{verbatim}
    26442666typedef struct {
    2645     psDlist *restrict list;             ///< list of psMetadataItem
     2667    psList *restrict list;             ///< list of psMetadataItem
    26462668    psHash *restrict table;             ///< hash table of the same metadata
    26472669} psMetadata;
     
    31193141    const int nx, ny;                ///< Image binning
    31203142    psImage *image;                  ///< imaging area of cell
    3121     psDlist *objects;                ///< objects derived from cell
     3143    psList *objects;                ///< objects derived from cell
    31223144    psMetadata *md;                  ///< Readout-level metadata
    31233145} psReadout;
Note: See TracChangeset for help on using the changeset viewer.