28.01.2015 Views

Hermes: A Tutorial and Reference Manual - Researcher - IBM

Hermes: A Tutorial and Reference Manual - Researcher - IBM

Hermes: A Tutorial and Reference Manual - Researcher - IBM

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

281.6.ASimpleServer towritedataabstractionswhichexportaspecicsetofoperationswhile notexposingtheimplementationdetailstothecaller.Therearesomedifferences:<br />

<strong>Hermes</strong>processesareactive.Iftherearemultiplecallers,thecalls arequeued<strong>and</strong>processedserially.Theprocesscanchoosenotto<br />

Icontrolaccessin<strong>Hermes</strong>onaport-by-portbasis.InAdaorin Icanwritedierent<strong>Hermes</strong>processeswiththesameinterface<strong>and</strong> ofthesameprivatetypewiththesamespecication(interface)<strong>and</strong> receivecertaincallsatcertaintimes.Thereisnoneedformonitors dierentprivateparts. orsemaphoresorothermutualexclusionmechanisms.<br />

callGetLinecouldalsocallPutLine<strong>and</strong>Quit.Thisisundesirable, accesstoanobjectautomaticallygivesaccesstoallitsoperations.In thecaseofaboundedbuer,thiswouldmeanthatanyonewhocould object-orientedlanguages,Icontrolaccessonanobjectbasis.Having dierentinternals.InAda,forinstance,Ican'thavetwovariables<br />

totallyordered|thatis,eachelementhasanassociatedposition.Positions thetable,thelastpositionisk1. anorderedtable.Atableissimplyacollectionofvaluesofthesametype aredenotedbyintegers.Therstpositionis0.Iftherearekelementsin (mathematically,abag).Anorderedtableisatablewhoseelementsare TheQueueisanexampleofatypefamilywehaven'tstudiedbefore| <strong>and</strong>infactIdon'twantthereaders<strong>and</strong>writersoftheboundedbuer<br />

Youhavealreadyusedorderedtableswithoutknowingit,sincethepredenedtypeCharstringisanorderedtableofelementsoftypeChar.<br />

toevenhavetoknowthattheQuitoperationexists.<br />

whichisatablewhoseelementsareoftypeT.Inourexample,wewant todeneatypeLinesasanorderedtablewhoseelementsareoftype initionsmoduleBBLocal: Charstring.Thetypedenitionlookslikethis<strong>and</strong>willappearinthedef-<br />

In<strong>Hermes</strong>youc<strong>and</strong>enetablesofanytype|tablesofintegers,tablesof callmessages,etc.Youcanevendenearecursivetabletype|atypeT<br />

fromthetablehavetypestateinit.Noticethatlikeothertypedenitions tablewithaparticularcontent,insertelementsintothetable,removeelementsfromthetable,mergeonetableintoanother,extractorcopyouta<br />

in<strong>Hermes</strong>,<strong>and</strong>unliketypedenitionsinmanyotherlanguages,tabletype aCharstring,<strong>and</strong>thatelementsinsertedinto,removedfrom,orcopied le),<strong>and</strong>nothingabouthowmuchstoragetoallocate. denitionssaynothingabouttherepresentation(e.g.array,linked-list,disk ThedenitionsaysthatLinesisanorderedtable,thateachelementis Lines:orderedtableofCharstringfinitg; Alltablessupportthefollowingoperations:inspectanelementinthe

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!