
Заготовки по С / Динамические структуры / GDSL / Документация
.pdf
|
Hashtable manipulation module |
87 |
|||||||||
|
4.8.2.7 |
|
ushort gdsl_hash_get_lists_max_size ( onst gdsl_hash_t |
|
|||||||
|
|
|
H) |
|
|
|
|
|
|
|
|
|
Get the max number of elements allowed in ea h entry of a hashtable. |
|
|
||||||||
Note: |
|
|
|
|
|
|
|
|
|
|
|
|
re ondition:y: O( 1 ) |
|
|
|
|
|
|
||||
|
Complexitust be |
valid gdsl_hash_t |
|
|
|
||||||
|
H |
The hashtable to use. |
|
|
|
|
|
|
|||
Parameters: |
|
|
|
|
|
|
|
|
|||
Returns: |
|
|
|
|
|
|
(ie. no limit for H's ntries). |
|
|
||
|
0 if no lists max size was set |
|
|
|
|
||||||
|
the max number |
elements forbeforeh entryof the hashtable H, if the fun tion |
|||||||||
|
|
|
hash |
modify()(p. 91) was used with a NEW LISTS MAX |
SIZE |
||||||
|
reather than the a tual one. |
|
|
|
|
||||||
|
dsl_hash_ ll fa t r() |
|
|
|
|
|
|
||||
See also: |
|
get |
longest |
|
list size()(p. 87) |
|
|
||||
|
gdsl_hash |
|
entries |
number()(p. 86) |
|
|
|||||
|
modify()(p. 91) |
|
|
|
|||||||
4.8.2.8 |
|
ushort gdsl |
hash_get_longest_list_size ( onst |
|
|
||||||
|
|
|
gdsl |
hash |
t H) |
|
|
|
|
|
|
|
Get the number of elements of the longest list entry of a hashtable. |
|
|
||||||||
Note: |
|
|
|
|
|
|
|
|
|
|
|
|
Complexity: O( L ), where L = gdsl_hash_get_entries_number(H) |
|
|
||||||||
|
re ondition: |
valid gdsl_hash_t |
|
|
|
||||||
Parameters:ust be |
|
|
|
||||||||
|
H |
The hashtable to use. |
|
|
|
|
|
|
|||
Returns:the umber of elements of the longest list entry of the hashtable H. |
|
|
|||||||||
See also: |
|
ll |
|
(p. 88) |
|
|
|
||||
|
|
_ |
|
size()(p. 87) |
|
|
|||||
|
gdsl_hash |
getfa tor()size()lis |
max |
|
|
||||||
|
|
|
|
|
en ries |
numb r()(p. 86) |
|
|
|||
|
Generated on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen |
|
|

88 |
|
|
|
gdsl Module Do umentation |
||
|
4.8.2.9 |
ulong gdsl hash_get_size ( onst gdsl_hash_t H) |
|
|||
|
Get the size of a hashtable. |
|
|
|||
Note: |
|
|
|
|
||
|
|
Complexity: O( L ), where L = gdsl_hash_get_entries_number(H) |
||||
|
re ondition: |
valid gdsl_hash_t |
||||
Parameters:ust be |
||||||
|
|
H |
The hashtable to get the size from |
|||
|
|
gthealso:.d10sl_umberhashdoubleofllgetelemgdslfa tenlor()ngesttshtriestableofshH number()(notedgetlist size()llH )fa(p.(p. tor86). 87)( onst gdsl_hash_t H) |
||||
SeeReturns:4.8.2 |
|
| | |
|
|||
|
Get the ll fa tor of a hash |
. |
|
|||
Note: |
|
|
|
|
||
|
|
Complexity: O( L ), where L = gdsl_hash_get_entries_number(H) |
||||
|
re ondition: |
valid gdsl_hash_t |
||||
Parameters:ust be |
||||||
|
|
H |
The hashtable to use |
|
|
|
Returns: |
|
|
|
|||
|
|
gdslThealso:.11 llhashgdslfaonsttorhashgetofharH,tablesize()longestentriesomputedgdsl(p. 88)number()hashlistas Hsize()set/ L(p(pname. 86). 87) (gdsl_hash_t H, |
||||
See4.8.2 |
|
|
| | |
|
ChangeSet the namethepreviousofa nameGeneratedNEWof. theonhashNAMET utableJun) H22 to11:15:30a opy2006of NEWfor gdslNAMEby Doxygen.

4.8 Hashtable manipulation module |
89 |
Note:Complexity: O( 1 )
Pre Hondition:ust hashbe valid gdsl_hash_t
arameters:The table to hange the name NEW NAME The new name of H
Returns:the modi ed hashtableinsu ienase of su ess.
NULL in ase of t memory.
See gdslalso:_hash_get_name()(p. 86)
4.8.2.12 gdsl_element_t gdsl_hash_insert (gdsl_hash_t H, void thenofkeyAlloInsertgdslKatetheofanhaatheinelementsnewtualhertionnewVALUEgetgdsleleintolemenislishashimplets)atEhashtablemaxEby.getisOthallingomputedsize(H)enrwise,tries(PUSH)H'sisHusnumber(ALLOCnoti.ngsrereaKEY-organizedhed,F)FfunalledN)tionifasitfollow:isonismodiEequalVALUE.Ifedthehashto.valuzero,TheN
ˆ its2 + 1 |
gdsl_ |
_get_lists_max_size( (say M) is modi ed |
M |
y:.element84)KtoOhed,HASH(.)zero(1modulogdsl)soEif gdslHisFhashneedsaregdslthhashntheminsertedthashofundifygrowgettionget(H)listsintopoin)eniftrimaxHgdsleatrs__passednumber(H)size(H)thehashentgetoryisgdslnot.listsomputedALLOCreamaxhedbyF,or-- |
|||
Note:size(H)ComplexitifalloKEYHASH2isThe()qualisF(pF(reaand |
|
|
|
re ondition: |
valid gdsl_hash_t |
|
|
ust be |
|
||
Parameters: |
|
|
|
H The hashtable to mo ify |
|
||
VALUE The value used to make the new element to insert into H |
|
||
Generated on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen |
|

90 |
|
|
|
gdsl Module Do umentation |
|
|
Returns: |
|
|
|
|
|
|
the |
lement E |
ase of su ess. |
|
|
|
NULLinsertedase of insu ient memory. |
|
||
See also: |
allo ()(p. 84) |
|
|||
|
|
|
remov |
(p. 90) |
|
|
|
|
get size()ntries number()(p. 86) |
||
|
|
|
let |
(p. 90) |
|
|
|
gdsl_hash_modify()(p. 91) |
|
||
4.8.2.13 |
|
(p. 88) |
|
||
gdsl_element_t gdsl_hash_remove (gdsl_hash_t H, |
Note:PRemovSearitreis Complexity:remoondition:h intoanvedelementtheonstfromhashtableO(HharfromMand),aHthenKEYwherehashtableforreturnedthe)M isrst(POP)the.elementaverage.Esizeequalof toH'sKEYlists. If E is found,
arameters:ust be valid gdsl_hash_t |
|
|||
H The hashtable to modify |
|
|||
KEY The key used to nd the element to remov |
||||
Returns: |
|
t |
|
in H ase is found. |
the rst founded |
|
|||
NULL in ase no element equal to KEY is fouind in H. |
||||
See also: |
ins rt() |
. 89) |
|
|
gdsl_hash_delete()(p. |
90) |
|
||
|
sear h() . |
2) |
|
|
4.8.2.14 gdsl_hash_ |
gdsl_hash_delete (gdsl_hash_t H, onst |
found,DRpassedmoveleteanittofromisgdslelementremovedharhe hashfromKEYfromtableGeneratedallo)hashtableHHand()the(ponE. 84),rst.isThudeallofoundedthenJun H22atedis11:15:30lemenreturnedusing2006EH's.equalforFREEgdslto KEYbyF Doxygenfun.If tionEis

|
4.8 Hashtable manipulation module |
|
|
91 |
||||||
|
Note: |
|
|
|
|
|
|
|
|
|
|
re ondition:y: O( M ), where M is the average size of H's lists |
|
|
|
||||||
|
Complexitust be |
valid gdsl_hash_t |
|
|
|
|
||||
|
H The hashtable to modify |
|
|
|
|
|||||
Parameters: |
|
|
|
|
|
|
|
|
||
|
KEY The key used to nd the element to remove |
|
|
|
|
|||||
Returns: |
|
|
|
|
|
|
|
|
|
|
|
the modi ed hashtable after removal of E if E was found. |
|
|
|
|
|||||
|
NULL if no elemen equal to KEY was found. |
|
|
|
|
|||||
|
4.8.2.15 gdsl |
insert()ash |
gdsl hash modify (gdsl hash_t |
|
|
|||||
See also: |
|
|
|
|
(p. 89) |
|
|
|
|
|
|
gdsl_hash_ |
|
ar h()(p. 92) |
|
|
|
|
|||
|
|
move()(p. 90) |
|
|
|
|
||||
|
|
H, ushort NEW ENTRIES NB, ushort |
|
|
|
|
||||
|
|
NEW LISTS MAX SIZE) |
|
|
|
|
||||
|
In rease the |
|
ions of |
hashtable. |
NB lists entries |
|||||
|
hashtabledimenH |
|
e-orga ized to hav NEW ENTRIES |
|||||||
|
The grow is neededlimiteda h time an insertion makes an entry listgrot rea h NEW |
- |
||||||||
|
Ea h entry is |
|
|
NEW LISTS MAX SIZE elements. After |
|
to |
||||
|
LISTS MAX SIZE elements. In this ase, H will be reorganized automati ally |
|||||||||
|
this fun tion, all ins |
rtitons into H will make H automati al y |
wing if needed. |
|||||||
|
by gdsl_hash |
|
|
(p. 89). |
|
|
|
|
||
Note: |
|
|
|
|
|
|
|
|
|
|
Pre HComplexitondition:ust bey:maxinsert()O(valid|H|gdsl_hash_t & NEW_ENTRIES_NB |
|
|
|
|||||||
|
en hashri_number(H) & NEW_LISTS_MAX_ IZE |
> |
|
|
|
|||||
|
arameters:theNEWHgetThemodilisLISTSENedtablehashRIESsize(H)tableMAXto modifyNBsize(H)inSIZEaseof su ess |
|
gdsl_hash_- |
|||||||
Returns:P |
|
|
|
|
|
> |
|
|
|
getNULLentriesinaseJunofumber(H)failur , ororinin NEW__ENTRIESLISTSMAXNB_<SIZE=gdsl_hash
Generatedhash_ongetThulists_22max11:15:30 2006inforthesegdsl byases,DoxygenH is not modi ed <= gdsl_-

92 |
|
|
|
|
|
|
gdsl Module Do umentation |
|
|
See also: |
|
|
|
|
|
|
|
|
|
|
|
insert()(p. 89) |
|
|
||
|
|
|
|
en ries_number()(p. 86) |
||||
|
|
|
|
|
fa tor()(p. 88) |
|
||
|
|
|
|
ongest |
list |
size()(p. 87) |
||
|
|
gdsl_hash_get_ ll |
max size()(p. 87) |
|||||
|
4.8.2.16 gdsl_elemenists_t gdsl_ |
_sear h ( onst gdsl_hash_t |
||||||
|
Seararameters:re HComplexity:ondition:h theforustaHhashrstbeparti, elementonstvalidO(ularMhargdslelement),EwhereequalhashKEYintotoMt)KEYisahashtheinaveragetablethehashtable(GET)size of. H's. lists |
|||||||
PNote: |
|
|
|
|
|
|
||
|
|
The |
table to sear |
the |
|
in |
||
|
|
KEY The key to ompare H's elements with |
||||||
Returns: |
lement E if it was found. |
|
||||||
|
|
the founded |
|
|||||
|
|
NULL in ase the sear hed element E was not found. |
||||||
See also: |
|
ins rt() |
. 89) |
|
|
|||
4.8.2.17 |
|
|
|
|||||
elemendelete()_t gdsl_hash_map ( onst gdsl_hash_t H, |
||||||||
|
|
gdsl_hash_ |
remove()(p. 90) |
|
|
|||
|
|
|
(p. 90) |
|
|
|||
|
STOParseelemenComplexitathenll.hashtableelementsgdslwithgdsly: USERO(.mapofhashthe__funDATAhashtablemap()targumen(pMAP.H92). Thestops.FIf,MAPvoidMAPandFreturnsFUSERf n tionitssDATAislastGDSLalledexaminated) MAPonea h- |
|||||||
Note:elemenH's |
|
|
|
|
|
|
Pre Hondition:ust be a valid|HGeneratedgdsl| ) hashontThu& MAPJun 22F11:15:30!= NULL2006 for gdsl by Doxygen

4.8 |
|
table manipulation module |
93 |
||
|
HashThe hashtable to map |
|
|
||
Parameters: |
map fun tion. |
|
|
||
|
MAP F |
|
|
||
|
USER_DATheA User's datas passed to MAP_F |
|
|||
Returns: |
|
for whi h MAP_F returns GDSL_MAP_STOP. |
|
||
|
the rst elemen |
|
|||
|
NULL when the parsing is done. |
( onst gdsl_hash_t H, |
|
||
4.8.2.18 |
gdsl_hash_ |
|
|||
|
|
voidgdsl_write_fun writeWRITE_F, FILE OUTPUT_FILE, |
|||
WritetionComplexity:allthe.theAdditionnalelemementsO(USERofts USERtheofahashtableDATADATA) HargumentotoOUTPUTle.tould_beFILE,passedusingtoWRITE__FF. |
|||||
Note:fun |
|
|
|
|
PreParameters:H!=HWRITEondition:NULLTheustbehashtableaFvalidThe|Hgdsltowrite| )writehashfun. tiont&.OUTPUT_FILE != NULL & WRITE_F
OUTPUT |
FILE The le where to write H's elements. |
|
USER DATA User's datas passed to WRITE F. |
||
See also: |
write xml()(p. 93) |
|
gdsl_hash_dump()(p. 94) |
_xml ( onst gdsl_hash_t H, |
|
4.8.2.19 |
gdsl_hash_ |
voidgdsl_write_fun writeWRITE_F, FILE OUTPUT_FILE,
WRITEtoguagGeneratedriteOUTPUT.theIfFonWRITEelements.ontentThuFILEJunofUSER.Fofa22Additionnal!=hashtablethe11:15:30NULL,hashDATA2006tabletothenUSER) forHleusesgdslintotoDAbyWRITEOUTPUTXMLADoxygenargumen.F FILE,towriteouldintoH'sbeXMLpassedelementslanto-

94 |
gdsl Module Do umentation |
|
|
Note: |
|
|
HComplexitondition:Theust hashbey:FtablevalidO(FILETheHtogdslwrite)Thewritehashfun.le tionwheret &. OUTPUTtowriteH'sFILEelements!=NULL. |
|
Parameters:reOUTPUTWRITE |
| | |
USER_DATA User's datas passed to WRITE_F.
See gdslalso:_hash_write()dump()(p(p..93)94)
4.8.2.20 gdsl_hash_dump ( onst gdsl_hash_t H, gdslvoid_write_fun _t WRITE_F, FILE OUTPUT_FILE,
Note:tionnalDumpULL,ComplexitthethenUSERinternalstruusesy:DAtureO(WRITEUSERstruAofargumenttheturehashtableFDATAoftoawritehashtableould) HH'sbetopassedelemenOUTPUTtoatoles.toWRITOUTPUTFILE. IfF.WRITEFILE._AddiF!=-
Parameters:reWRITEOUTPUTHondition:Theust hashbeFtablevalidFILEThe|Htogdslwrite| )Thewritehashfunle tionwheret & OUTPUTtowriteH'sFILEelements!=NULL
USER_DATA User's datas passed to WRITE_F
See gdslalso:_hash_write()(pxml(. 93)(p. 93)
Generated on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen

.9 Heap m nipulation module |
95 |
|
4.9 |
Heap manipulation module |
|
T |
|
|
Funypedefsˆˆ gdslttionsGDSLheapheapapttypegdslgdsl. __heapheap__tallo ( onst har
|
ateoyALLOCCOMPaheapnwheap.F)F,free.ushgdsl(gdsl(gdslfreeheapheapfun t( H)onstH)FREE NAME,F,gdslgdslompareallo _- |
||||||
|
gdsl |
|
|
|
|
|
|
|
voidfunDestrCr |
|
|
|
|
|
|
|
Flush |
he . |
|
|
|
|
|
|
Getelementhargdslthe topsizenamegdslheapofofoftheapgdslget.. . heapsizeget(namegetonst gdsltop ( heaponstgdslgdsltheapH)heapt H)t H) |
|
|||||
|
gdslulongonst |
|
|
|
|
|
|
|
bool gdsl_ |
is |
empty ( onst gdsl_heap_t H) |
|
|
||
ˆ |
Che k if ahe |
is empty. |
_set_name (gdsl_heap_t H, onst har |
||||
gdsl heap_t gdsl |
|
||||||
ˆ gdslNEWSet elementheNAME)namethe oftopa hegdslheap. heap_set_top (gdsl_heap_t |
H, |
void |
|||||
ˆ gdslVALUE)Substituteelemen _ |
elementgdsl_of heapinsertby a lesser(gdslone. heap_t |
H, |
void |
Generatedˆ gdslVALUE)InsertonelemenThuanJunelement22 11:15:30gdslinto aheap2006 (PUSH)forremovegdsl .by Doxygentop (gdsl_heap_t H)

96 |
R |
the top element from a he |
gdsl Module Do umentation |
||
|
(POP). |
|
|||
|
Deletemovethe |
from he . |
top (gdsl_heap_t H) |
||
|
ˆ gdsl |
h ap_ gdsl heap delete |
|||
|
ele entop_elementgdsl_heap_map_forward ( onst gdsl_heap_t |
ˆH,voidWRITEgdslParsegdsl_amF,heapFILE. funwrite (MAPonst_gdslF, voidheapUSERt H,DATA)gdsl write_fun _t
ˆvoidfun gdslrite WRITEallheapthe elementsF,writeOUTPUTFILEof axmlheapFILE,(toonsta voidgdslle. USERheap__DATA)t H, gdsl_write_-
ˆvoidfunW_gdslWRITEthe heapontentF,ofdumpFILEa heap(OUTPUTtoonsta legdslintoFILE,XMLheap.voidt USERH,gdslDATA)write_-
4..99..11.1 DumpTtypedefthe internalstruDot struumentationheaptureOUTPUTof a heap toFILE,a le. void USER_DATA)
GDSLThisDebut4.9.nitionby2ypeheaptheFunisatfunvoluntarylinetionstion.54 ofDoopaquethislegdslumentationmodule.Variablesheapgdsl. .h. heapof this_kindt ould'nt be dire tly used,
CreateAlloTherespbe.9.2funate.1tively,toa tionnewNULLagdslFREEewheapallointersheaptoheapallo, free.Fuse, datagdslandALLOCthefuntgdsldefaultstruomparesomparet tureF,heALLOCones:FREEelementswhiallofunhFFn,andin(megdsltheonstCOMPCOMPisheapsetfreehar.toTheseFFfuna)NAMEouldopypointbeofters,NAMEusedouldto.
ˆ the default ALLOC F simply returns its argument FREE F doe nothing
Generat d on Thu Jun 22 11:15:30 2006 for gdsl by Doxygen