libSBML C API  libSBML 5.21.2 C API
Loading...
Searching...
No Matches
List.cpp File Reference

Simple, generic list class. More...

Include dependency graph for List.cpp:

Functions

void List_add (List_t *lst, void *item)
 @_tendcond_t
unsigned int List_countIf (const List_t *lst, ListItemPredicate predicate)
 @_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t
List_t * List_create (void)
 @_tcond_t _tdoxygenIgnored_t
void * List_find (const List_t *lst, const void *item1, ListItemComparator comparator)
 @_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t
List_t * List_findIf (const List_t *lst, ListItemPredicate predicate)
 @_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t
void List_free (List_t *lst)
 @_tendcond_t
void * List_get (const List_t *lst, unsigned int n)
 @_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t
void List_prepend (List_t *lst, void *item)
 @_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t
void * List_remove (List_t *lst, unsigned int n)
 @_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t
unsigned int List_size (const List_t *lst)
 @_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t
ListNode_t * ListNode_create (void *item)
 @_tcond_t _tdoxygenLibsbmlInternal_t
void ListNode_free (ListNode_t *node)
 @_tcond_t _tdoxygenLibsbmlInternal_t

Detailed Description

Simple, generic list class.

Author
Ben Bornstein

Function Documentation

◆ List_add()

void List_add ( List_t * lst,
void * item )

@_tendcond_t

@_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t

_tAdds_t _ta_t _tpointer_t _tto_t @_tp_t _titem_t _tto_t _tthe_t _tend_t _tof_t _tthis_t _tList_t_t.

@_tparam_t _tlst_t _tthe_t _tList_t_t _tstructure_t. @_tparam_t _titem_t _tthe_t _titem_t _tto_t _tadd_t _tto_t _tthe_t _tend_t _tof_t _tthe_t _tlist_t.

@_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t

◆ List_countIf()

unsigned int List_countIf ( const List_t * lst,
ListItemPredicate predicate )

@_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t

@_treturn_t _tthe_t _tnumber_t _tof_t _titems_t _tin_t _tthis_t _tList_t_t _tfor_t _twhich_t <_tcode_t>_tpredicate_t(_titem_t)</_tcode_t> _treturns_t _ttrue_t.

@_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t

_tThe_t _ttypedef_t _tfor_t @_tsbmlconstant_t{_tListItemPredicate_t,} _tis_t:

_tint_t (*_tListItemPredicate_t) (_tconst_t _tvoid_t *_titem_t);

_twhere_t _ta_t _treturn_t _tvalue_t _tof_t @_tc_t _t1_t _trepresents_t _ttrue_t _tand_t @_tc_t _t0_t _trepresents_t _tfalse_t.

@_tparam_t _tlst_t _tthe_t _tList_t_t _tstructure_t. @_tparam_t _tpredicate_t _tthe_t _tpredicate_t _tto_t _ttest_t _tthe_t _telements_t _tof_t _tthe_t _tlist_t _tagainst_t.

@_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t

◆ List_create()

List_t * List_create ( void )

@_tcond_t _tdoxygenIgnored_t

_tCreates_t _ta_t _tnew_t _tList_t_t _tand_t _treturns_t _ta_t _tpointer_t _tto_t _tit_t.

@_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t

@_tcond_t _tdoxygenIgnored_t

_tThe_t _tpointer_t _tthat_t _tis_t _treturned_t _tby_t _tthis_t _tfunction_t _tis_t _towned_t _tby_t _tthe_t _tcaller_t, _twho_t _tis_t _tresponsible_t _tfor_t _tdeleting_t _tit_t.

@_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t

◆ List_find()

void * List_find ( const List_t * lst,
const void * item1,
ListItemComparator comparator )

@_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t

_tSearches_t _tthe_t _tList_t_t _tfor_t _tan_t _tentry_t _tthat_t _tmatches_t @_tp_t _titem1_t, _taccording_t _tto_t @_tp_t _tcomparator_t.

@_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t

_tThe_t @_tsbmlconstant_t{_tListItemComparator_t,} _tis_t _ta_t _tpointer_t _tto_t _ta_t _tfunction_t _tused_t _tto_t _tfind_t _ta_t _tmatching_t _tentry_t. _tThe_t _ttypedef_t _tfor_t @_tsbmlconstant_t{_tListItemComparator_t,} _tis_t:

_tint_t (*_tListItemComparator_t) (_tvoid_t *_titem1_t, _tvoid_t *_titem2_t);

_tThe_t _treturn_t _tvalue_t _tsemantics_t _tare_t _tthe_t _tsame_t _tas_t _tfor_t _tstrcmp_t: <_tul_t> <_tli_t> -_t1_t _titem1_t < _titem2_t, <_tli_t> _t0_t _titem1_t == _titem_t _t2_t <_tli_t> _t1_t _titem1_t > _titem2_t </_tul_t>

@_tparam_t _tlst_t _tthe_t _tList_t_t _tstructure_t. @_tparam_t _titem1_t _tthe_t _titem_t _tto_t _tlook_t _tfor_t. @_tparam_t _tcomparator_t _tthe_t _tpointer_t _tto_t _tthe_t _tfunction_t _tused_t _tto_t _tfind_t _tthe_t _titem_t.

@_treturn_t _tthe_t _tfirst_t _toccurrence_t _tof_t _tan_t _tentry_t _tmatching_t @_tp_t _titem1_t _tin_t _tthis_t _tList_t_t _tor_t @_tc_t _tNULL_t _tif_t _titem_t _twas_t _tnot_t _tfound_t.

_tThe_t _tpointer_t _tthat_t _tis_t _treturned_t _tby_t _tthis_t _tfunction_t _tis_t _tnot_t _towned_t _tby_t _tthe_t _tcaller_t, _tbut_t _tmay_t _tbe_t _tqueried_t _tand_t _tmodified_t.

@_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t

◆ List_findIf()

List_t * List_findIf ( const List_t * lst,
ListItemPredicate predicate )

@_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t

_tCreate_t _tand_t _treturn_t _ta_t _tnew_t _tList_t_t _twith_t _tthe_t _tsubset_t _tof_t _titems_t _tfor_t _twhich_t <_tcode_t>_tpredicate_t(_titem_t)</_tcode_t> _treturns_t _ttrue_t.

@_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t

_tThe_t _treturned_t _tlist_t _tmay_t _tbe_t _tempty_t.

_tThe_t _tcaller_t _towns_t _tthe_t _treturned_t _tlist_t (_tbut_t _tnot_t _tits_t _tconstituent_t _titems_t) _tand_t _tis_t _tresponsible_t _tfor_t _tfreeing_t _tit_t _twith_t _tList_free_t().

@_tparam_t _tlst_t _tthe_t _tList_t_t _tstructure_t. @_tparam_t _tpredicate_t _tthe_t _tpredicate_t _tto_t _ttest_t _tthe_t _telements_t _tof_t _tthe_t _tlist_t _tagainst_t.

@_treturn_t _ta_t _tnew_t _tList_t_t _tcontaining_t (_tpointers_t _tto_t) _tall_t _titems_t _tin_t _tthis_t _tList_t_t _tfor_t _twhich_t <_tcode_t>_tpredicate_t(_titem_t)</_tcode_t> _twas_t _ttrue_t.

@_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t

◆ List_free()

void List_free ( List_t * lst)

@_tendcond_t

@_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t

_tFrees_t _tthe_t _tgiven_t _tList_t_t.

_tThis_t _tfunction_t _tdoes_t _tnot_t _tfree_t _tList_t_t _titems_t. _tIt_t _tfrees_t _tonly_t _tthe_t _tList_t_t _tstructure_t _tand_t _tits_t _tconstituent_t _tinternal_t _tstructures_t (_tif_t _tany_t).

_tPresumably_t, _tyou_t _teither_t _ti_t) _thave_t _tpointers_t _tto_t _tthe_t _tindividual_t _tlist_t _titems_t _telsewhere_t _tin_t _tyour_t _tprogram_t _tand_t _tyou_t _twant_t _tto_t _tkeep_t _tthem_t _taround_t _tfor_t _tawhile_t _tlonger_t _tor_t _tii_t) _tthe_t _tlist_t _thas_t _tno_t _titems_t ( _tList_size_t() == @_tc_t _t0_t ). _tIf_t _tneither_t _tare_t _ttrue_t, _ttry_t _tList_freeItems_t() _tinstead_t.

@_tparam_t _tlst_t _tthe_t _tList_t_t _tstructure_t.

@_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t

Examples
printRegisteredPackages.c.

◆ List_get()

void * List_get ( const List_t * lst,
unsigned int n )

@_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t

_tReturns_t _tthe_t _tnth_t _titem_t _tin_t _tthis_t _tList_t_t.

@_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t

_tIf_t _tn_t > _tList_size_t() _treturns_t _tNULL_t.

@_tparam_t _tlst_t _tthe_t _tList_t_t _tstructure_t. @_tparam_t _tn_t _tthe_t _tindex_t _tof_t _tthe_t _titem_t _tto_t _tfind_t.

@_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t

Examples
printRegisteredPackages.c.

◆ List_prepend()

void List_prepend ( List_t * lst,
void * item )

@_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t

_tAdds_t _titem_t _tto_t _tthe_t _tbeginning_t _tof_t _tthis_t _tList_t_t.

@_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t

@_tparam_t _tlst_t _tthe_t _tList_t_t _tstructure_t. @_tparam_t _titem_t _tthe_t _titem_t _tto_t _tadd_t _tto_t _tthe_t _tlist_t.

@_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t

◆ List_remove()

void * List_remove ( List_t * lst,
unsigned int n )

@_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t

_tRemoves_t _tthe_t _tnth_t _titem_t _tfrom_t _tthis_t _tList_t_t _tand_t _treturns_t _ta_t _tpointer_t _tto_t _tit_t.

@_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t

_tIf_t _tn_t > _tList_size_t() _treturns_t _tNULL_t.

@_tparam_t _tlst_t _tthe_t _tList_t_t _tstructure_t. @_tparam_t _tn_t _tthe_t _tindex_t _tof_t _tthe_t _titem_t _tto_t _tremove_t.

_tUnlike_t _tother_t '_tremove_t' _tfunctions_t _tin_t _tlibsbml_t, _tthe_t _tcaller_t _tdoes_t _tnot_t _town_t _tthe_t _treturned_t _titem_t: _tit_t _tcontinues_t _tto_t _tbe_t _towned_t _tby_t _twhoever_t _towned_t _tit_t _tbefore_t _tbeing_t _tput_t _ton_t _tthe_t _tList_t_t. _tIt_t _tmay_t _tbe_t _tqueried_t _tor_t _tchanged_t _tby_t _tthe_t _tcaller_t, _tlike_t _tother_t _telements_t _tof_t _tthe_t _tList_t_t.

@_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t

◆ List_size()

unsigned int List_size ( const List_t * lst)

@_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t

_tThe_t _tnumber_t _tof_t _telements_t _tin_t @_tp_t _tlst_t.

@_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t

@_tparam_t _tlst_t _tthe_t _tList_t_t _tstructure_t.

@_treturn_t _tthe_t _tnumber_t _tof_t _telements_t _tin_t _tthe_t _tgiven_t _tList_t_t.

@_tif_t _tconly_t @_tmemberof_t _tList_t_t @_tendif_t

Examples
printRegisteredPackages.c.

◆ ListNode_create()

ListNode_t * ListNode_create ( void * item)

@_tcond_t _tdoxygenLibsbmlInternal_t

_tCreates_t _ta_t _tnew_t _tListNode_t_t (_twith_t @_tp_t _titem_t) _tand_t _treturns_t _ta_t _tpointer_t _tto_t _tthe_t _tnode_t.

@_tparam_t _titem_t _tthe_t _titem_t _tto_t _tcreate_t _ta_t _tListNode_t_t _tfor_t.

_tThe_t _tpointer_t _tthat_t _tis_t _treturned_t _tby_t _tthis_t _tfunction_t _tis_t _towned_t _tby_t _tthe_t _tcaller_t, _twho_t _tis_t _tresponsible_t _tfor_t _tdeleting_t _tit_t.

@_tif_t _tconly_t @_tmemberof_t _tListNode_t_t @_tendif_t

◆ ListNode_free()

void ListNode_free ( ListNode_t * node)

@_tcond_t _tdoxygenLibsbmlInternal_t

_tFrees_t _tthe_t _tgiven_t _tListNode_t_t.

@_tparam_t _tnode_t _tthe_t _tListNode_t_t _tstructure_t.

@_tmemberof_t _tListNode_t_t