/[ascend]/trunk/base/generic/general/list.h
ViewVC logotype

Diff of /trunk/base/generic/general/list.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1186 by johnpye, Mon Jan 8 11:25:33 2007 UTC revision 1187 by johnpye, Sun Jan 21 06:03:58 2007 UTC
# Line 302  ASC_DLLSPEC void gl_append_ptr(struct gl Line 302  ASC_DLLSPEC void gl_append_ptr(struct gl
302   *  gl_append_list() are the only procedures that will expand the   *  gl_append_list() are the only procedures that will expand the
303   *  length and/or the capacity of a list.  ptr is always stored in   *  length and/or the capacity of a list.  ptr is always stored in
304   *  position gl_length(list)+1.  The specified list may not be   *  position gl_length(list)+1.  The specified list may not be
305   *  NULL, and the list must be expandable (checked by assertion).<br><br>   *  NULL, and the list must be expandable (checked by assertion).
306   *   *
307   *  Because any pointer type is convertible to a void pointer, you   *  Because any pointer type is convertible to a void pointer, you
308   *  pass in a pointer to your data structure.  It stores whatever pointer   *  pass in a pointer to your data structure.  It stores whatever pointer
309   *  you give it.<br><br>   *  you give it.
310   *   *
311   *  Example:                                                       <pre>   *  Example:                                                       <pre>
312   *      struct data_t *item;   *      struct data_t *item;
313   *      item = (struct data_t *)malloc(sizeof(struct data_t));   *      item = (struct data_t *)malloc(sizeof(struct data_t));
314   *      various assignments to item->   *      \* ...various assignments to 'item'... *\
315   *      gl_append_ptr(list,item);   * This stores item             </pre>   *      gl_append_ptr(list,item); \* store the item *\             </pre>
316   *   *
317   *  Complexity: worst case O(n)  <br>   *  Complexity: worst case O(n)
318   *  where n is the capacity of the list.  Normally it is O(1).  It is   *  where n is the capacity of the list.  Normally it is O(1).  It is
319   *  only when the list capacity is increased that it takes O(n).  This   *  only when the list capacity is increased that it takes O(n).  This
320   *  may also be an over estimate.   *  may also be an over estimate.
# Line 331  ASC_DLLSPEC void gl_fast_append_ptr(stru Line 331  ASC_DLLSPEC void gl_fast_append_ptr(stru
331   *  the list length or check it.  ptr is always stored in position   *  the list length or check it.  ptr is always stored in position
332   *  gl_length(list)+1.   Only use this function in situations where   *  gl_length(list)+1.   Only use this function in situations where
333   *  you are absolutely sure the gl_length(list) < list->capacity.   *  you are absolutely sure the gl_length(list) < list->capacity.
334   *  The specified list may not be NULL (checked by assertion).<br><br>   *  The specified list may not be NULL (checked by assertion).
335   *   *
336   *  Because any pointer type is convertible to a void pointer, you   *  Because any pointer type is convertible to a void pointer, you
337   *  pass in a pointer to your data structure.  It stores whatever pointer   *  pass in a pointer to your data structure.  It stores whatever pointer
338   *  you give it.<br><br>   *  you give it.
339   *   *
340   *  Example: See gl_append_ptr.<br>   *  Example: See gl_append_ptr.<
341   *  Intended use is that you create a list of the size you know you   *  Intended use is that you create a list of the size you know you
342   *  need (but may want to expand at a later time) and then call this.   *  need (but may want to expand at a later time) and then call this.
343   *  This is faster than gl_store().<br><br>   *  This is faster than gl_store().
344   *   *
345   *  Complexity: O(1)   *  Complexity: O(1)
346   *   *

Legend:
Removed from v.1186  
changed lines
  Added in v.1187

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22