home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / nihcl-3.0 / doc / readme.nihcl < prev    next >
LaTeX Document  |  1993-01-01  |  43.9 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: LaTeX Document (document/latex).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LaTeX Document (document/latex) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file C++ source text default
99% file LaTeX document text default
98% file LaTeX document, ASCII text default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/281 LaTeX (Subdocument) default
100% detectItEasy Format: Plain text[LF] default
100% xdgMime text/x-matlab default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 25 20 4e 6f 74 65 3a 20 | 74 68 69 73 20 66 69 6c |% Note: |this fil|
|00000010| 65 20 68 61 73 20 62 65 | 65 6e 20 6d 6f 64 69 66 |e has be|en modif|
|00000020| 69 65 64 20 62 79 20 74 | 68 65 20 46 72 65 65 20 |ied by t|he Free |
|00000030| 53 6f 66 74 77 61 72 65 | 20 46 6f 75 6e 64 61 74 |Software| Foundat|
|00000040| 69 6f 6e 0a 5c 62 65 67 | 69 6e 64 61 74 61 7b 74 |ion.\beg|indata{t|
|00000050| 65 78 74 2c 20 32 36 38 | 37 31 39 33 35 36 7d 0a |ext, 268|719356}.|
|00000060| 5c 74 65 78 74 64 73 76 | 65 72 73 69 6f 6e 7b 31 |\textdsv|ersion{1|
|00000070| 32 7d 0a 5c 74 65 6d 70 | 6c 61 74 65 7b 64 65 66 |2}.\temp|late{def|
|00000080| 61 75 6c 74 7d 0a 5c 64 | 65 66 69 6e 65 7b 65 78 |ault}.\d|efine{ex|
|00000090| 61 6d 70 6c 65 0a 6d 65 | 6e 75 3a 5b 52 65 67 69 |ample.me|nu:[Regi|
|000000a0| 6f 6e 7e 34 2c 45 78 61 | 6d 70 6c 65 7e 31 32 5d |on~4,Exa|mple~12]|
|000000b0| 0a 61 74 74 72 3a 5b 4c | 65 66 74 4d 61 72 67 69 |.attr:[L|eftMargi|
|000000c0| 6e 20 4c 65 66 74 4d 61 | 72 67 69 6e 20 49 6e 63 |n LeftMa|rgin Inc|
|000000d0| 68 20 33 32 37 36 38 5d | 0a 61 74 74 72 3a 5b 4a |h 32768]|.attr:[J|
|000000e0| 75 73 74 69 66 69 63 61 | 74 69 6f 6e 20 4c 65 66 |ustifica|tion Lef|
|000000f0| 74 4a 75 73 74 69 66 69 | 65 64 20 50 6f 69 6e 74 |tJustifi|ed Point|
|00000100| 20 30 5d 0a 61 74 74 72 | 3a 5b 46 6f 6e 74 46 61 | 0].attr|:[FontFa|
|00000110| 63 65 20 46 69 78 65 64 | 46 61 63 65 20 49 6e 74 |ce Fixed|Face Int|
|00000120| 20 53 65 74 5d 0a 61 74 | 74 72 3a 5b 46 6f 6e 74 | Set].at|tr:[Font|
|00000130| 46 61 6d 69 6c 79 20 41 | 6e 64 79 54 79 70 65 20 |Family A|ndyType |
|00000140| 49 6e 74 20 30 5d 0a 61 | 74 74 72 3a 5b 46 6f 6e |Int 0].a|ttr:[Fon|
|00000150| 74 53 69 7a 65 20 50 72 | 65 76 69 6f 75 73 46 6f |tSize Pr|eviousFo|
|00000160| 6e 74 53 69 7a 65 20 50 | 6f 69 6e 74 20 2d 32 5d |ntSize P|oint -2]|
|00000170| 7d 0a 5c 64 65 66 69 6e | 65 7b 64 65 73 63 72 69 |}.\defin|e{descri|
|00000180| 70 74 69 6f 6e 0a 6d 65 | 6e 75 3a 5b 52 65 67 69 |ption.me|nu:[Regi|
|00000190| 6f 6e 7e 34 2c 44 65 73 | 63 72 69 70 74 69 6f 6e |on~4,Des|cription|
|000001a0| 7e 31 31 5d 0a 61 74 74 | 72 3a 5b 4c 65 66 74 4d |~11].att|r:[LeftM|
|000001b0| 61 72 67 69 6e 20 4c 65 | 66 74 4d 61 72 67 69 6e |argin Le|ftMargin|
|000001c0| 20 43 6d 20 31 32 30 32 | 32 32 5d 0a 61 74 74 72 | Cm 1202|22].attr|
|000001d0| 3a 5b 49 6e 64 65 6e 74 | 20 4c 65 66 74 4d 61 72 |:[Indent| LeftMar|
|000001e0| 67 69 6e 20 43 6d 20 2d | 33 36 39 39 31 5d 7d 0a |gin Cm -|36991]}.|
|000001f0| 5c 64 65 66 69 6e 65 7b | 63 6f 64 65 0a 6d 65 6e |\define{|code.men|
|00000200| 75 3a 5b 52 65 67 69 6f | 6e 2c 43 6f 64 65 5d 0a |u:[Regio|n,Code].|
|00000210| 61 74 74 72 3a 5b 46 6f | 6e 74 46 61 63 65 20 46 |attr:[Fo|ntFace F|
|00000220| 69 78 65 64 46 61 63 65 | 20 49 6e 74 20 53 65 74 |ixedFace| Int Set|
|00000230| 5d 0a 61 74 74 72 3a 5b | 46 6f 6e 74 46 61 6d 69 |].attr:[|FontFami|
|00000240| 6c 79 20 41 6e 64 79 54 | 79 70 65 20 49 6e 74 20 |ly AndyT|ype Int |
|00000250| 30 5d 7d 0a 5c 64 65 66 | 69 6e 65 7b 74 79 70 65 |0]}.\def|ine{type|
|00000260| 0a 7d 0a 5c 66 6f 72 6d | 61 74 6e 6f 74 65 7b 2e |.}.\form|atnote{.|
|00000270| 64 73 20 43 6c 20 52 65 | 6c 65 61 73 65 20 4e 6f |ds Cl Re|lease No|
|00000280| 74 65 73 0a 0a 2e 73 6f | 20 6e 69 68 63 6c 6d 61 |tes...so| nihclma|
|00000290| 63 2e 74 72 7d 0a 0a 5c | 62 65 67 69 6e 64 61 74 |c.tr}..\|begindat|
|000002a0| 61 7b 6c 6f 6f 6b 7a 2c | 20 32 36 38 37 31 35 33 |a{lookz,| 2687153|
|000002b0| 34 34 7d 0a 68 69 64 64 | 65 6e 0a 5c 65 6e 64 64 |44}.hidd|en.\endd|
|000002c0| 61 74 61 7b 6c 6f 6f 6b | 7a 2c 20 32 36 38 37 31 |ata{look|z, 26871|
|000002d0| 35 33 34 34 7d 0a 5c 76 | 69 65 77 7b 6c 6f 6f 6b |5344}.\v|iew{look|
|000002e0| 7a 76 69 65 77 2c 32 36 | 38 37 31 35 33 34 34 2c |zview,26|8715344,|
|000002f0| 33 2c 30 2c 30 7d 0a 0a | 5c 73 65 63 74 69 6f 6e |3,0,0}..|\section|
|00000300| 7b 49 4e 54 52 4f 44 55 | 43 54 49 4f 4e 0a 0a 7d |{INTRODU|CTION..}|
|00000310| 0a 54 68 65 73 65 20 61 | 72 65 20 74 68 65 20 72 |.These a|re the r|
|00000320| 65 6c 65 61 73 65 20 6e | 6f 74 65 73 20 66 6f 72 |elease n|otes for|
|00000330| 20 52 65 76 69 73 69 6f | 6e 20 33 2e 30 20 6f 66 | Revisio|n 3.0 of|
|00000340| 20 74 68 65 20 4e 49 48 | 20 43 6c 61 73 73 20 4c | the NIH| Class L|
|00000350| 69 62 72 61 72 79 2e 0a | 54 68 69 73 20 72 65 6c |ibrary..|This rel|
|00000360| 65 61 73 65 20 63 6f 6e | 74 61 69 6e 73 20 74 68 |ease con|tains th|
|00000370| 65 20 66 6f 6c 6c 6f 77 | 69 6e 67 20 63 6c 61 73 |e follow|ing clas|
|00000380| 73 65 73 3a 0a 0a 0a 5c | 62 6f 6c 64 7b 4e 49 48 |ses:...\|bold{NIH|
|00000390| 43 4c 7d 2d 2d 2d 4c 69 | 62 72 61 72 79 20 53 74 |CL}---Li|brary St|
|000003a0| 61 74 69 63 20 4d 65 6d | 62 65 72 20 56 61 72 69 |atic Mem|ber Vari|
|000003b0| 61 62 6c 65 73 20 61 6e | 64 20 46 75 6e 63 74 69 |ables an|d Functi|
|000003c0| 6f 6e 73 0a 0a 20 20 20 | 20 5c 62 6f 6c 64 7b 4f |ons.. | \bold{O|
|000003d0| 62 6a 65 63 74 7d 2d 2d | 2d 52 6f 6f 74 20 6f 66 |bject}--|-Root of|
|000003e0| 20 74 68 65 20 4e 49 48 | 20 43 6c 61 73 73 20 4c | the NIH| Class L|
|000003f0| 69 62 72 61 72 79 20 49 | 6e 68 65 72 69 74 61 6e |ibrary I|nheritan|
|00000400| 63 65 20 54 72 65 65 0a | 0a 20 20 20 20 20 20 20 |ce Tree.|. |
|00000410| 20 5c 62 6f 6c 64 7b 42 | 69 74 73 65 74 7d 2d 2d | \bold{B|itset}--|
|00000420| 2d 53 65 74 20 6f 66 20 | 53 6d 61 6c 6c 20 49 6e |-Set of |Small In|
|00000430| 74 65 67 65 72 73 20 28 | 6c 69 6b 65 20 50 61 73 |tegers (|like Pas|
|00000440| 63 61 6c 27 73 20 74 79 | 70 65 20 53 45 54 29 0a |cal's ty|pe SET).|
|00000450| 0a 20 20 20 20 20 20 20 | 20 5c 62 6f 6c 64 7b 43 |. | \bold{C|
|00000460| 6c 61 73 73 7d 2d 2d 2d | 43 6c 61 73 73 20 44 65 |lass}---|Class De|
|00000470| 73 63 72 69 70 74 6f 72 | 0a 0a 20 20 20 20 20 20 |scriptor|.. |
|00000480| 20 20 5c 62 6f 6c 64 7b | 43 6f 6c 6c 65 63 74 69 | \bold{|Collecti|
|00000490| 6f 6e 7d 2d 2d 2d 41 62 | 73 74 72 61 63 74 20 43 |on}---Ab|stract C|
|000004a0| 6c 61 73 73 20 66 6f 72 | 20 43 6f 6c 6c 65 63 74 |lass for| Collect|
|000004b0| 69 6f 6e 73 0a 0a 20 20 | 20 20 20 20 20 20 20 20 |ions.. | |
|000004c0| 20 20 5c 62 6f 6c 64 7b | 41 72 72 61 79 63 68 61 | \bold{|Arraycha|
|000004d0| 72 7d 2d 2d 2d 42 79 74 | 65 20 41 72 72 61 79 0a |r}---Byt|e Array.|
|000004e0| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 5c 62 6f |. | \bo|
|000004f0| 6c 64 7b 41 72 72 61 79 | 4f 62 7d 2d 2d 2d 41 72 |ld{Array|Ob}---Ar|
|00000500| 72 61 79 20 6f 66 20 4f | 62 6a 65 63 74 20 50 6f |ray of O|bject Po|
|00000510| 69 6e 74 65 72 73 0a 0a | 20 20 20 20 20 20 20 20 |inters..| |
|00000520| 20 20 20 20 5c 62 6f 6c | 64 7b 42 61 67 7d 2d 2d | \bol|d{Bag}--|
|00000530| 2d 55 6e 6f 72 64 65 72 | 65 64 20 43 6f 6c 6c 65 |-Unorder|ed Colle|
|00000540| 63 74 69 6f 6e 20 6f 66 | 20 4f 62 6a 65 63 74 73 |ction of| Objects|
|00000550| 0a 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 5c 62 |.. | \b|
|00000560| 6f 6c 64 7b 53 65 71 43 | 6c 74 6e 7d 2d 2d 2d 41 |old{SeqC|ltn}---A|
|00000570| 62 73 74 72 61 63 74 20 | 43 6c 61 73 73 20 66 6f |bstract |Class fo|
|00000580| 72 20 4f 72 64 65 72 65 | 64 2c 20 49 6e 64 65 78 |r Ordere|d, Index|
|00000590| 65 64 20 43 6f 6c 6c 65 | 63 74 69 6f 6e 73 0a 0a |ed Colle|ctions..|
|000005a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000005b0| 5c 62 6f 6c 64 7b 48 65 | 61 70 7d 2d 2d 2d 4d 69 |\bold{He|ap}---Mi|
|000005c0| 6e 2d 4d 61 78 20 48 65 | 61 70 20 6f 66 20 4f 62 |n-Max He|ap of Ob|
|000005d0| 6a 65 63 74 20 50 6f 69 | 6e 74 65 72 73 0a 0a 20 |ject Poi|nters.. |
|000005e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 5c | | \|
|000005f0| 62 6f 6c 64 7b 4c 69 6e | 6b 65 64 4c 69 73 74 7d |bold{Lin|kedList}|
|00000600| 2d 2d 2d 53 69 6e 67 6c | 79 2d 4c 69 6e 6b 65 64 |---Singl|y-Linked|
|00000610| 20 4c 69 73 74 0a 0a 20 | 20 20 20 20 20 20 20 20 | List.. | |
|00000620| 20 20 20 20 20 20 20 5c | 62 6f 6c 64 7b 4f 72 64 | \|bold{Ord|
|00000630| 65 72 65 64 43 6c 74 6e | 7d 2d 2d 2d 4f 72 64 65 |eredCltn|}---Orde|
|00000640| 72 65 64 20 43 6f 6c 6c | 65 63 74 69 6f 6e 20 6f |red Coll|ection o|
|00000650| 66 20 4f 62 6a 65 63 74 | 20 50 6f 69 6e 74 65 72 |f Object| Pointer|
|00000660| 73 0a 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |s.. | |
|00000670| 20 20 20 20 20 20 20 5c | 62 6f 6c 64 7b 53 6f 72 | \|bold{Sor|
|00000680| 74 65 64 43 6c 74 6e 7d | 2d 2d 2d 53 6f 72 74 65 |tedCltn}|---Sorte|
|00000690| 64 20 43 6f 6c 6c 65 63 | 74 69 6f 6e 0a 0a 20 20 |d Collec|tion.. |
|000006a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000006b0| 20 20 20 20 20 20 5c 62 | 6f 6c 64 7b 4b 65 79 53 | \b|old{KeyS|
|000006c0| 6f 72 74 43 6c 74 6e 7d | 2d 2d 2d 4b 65 79 65 64 |ortCltn}|---Keyed|
|000006d0| 20 53 6f 72 74 65 64 20 | 43 6f 6c 6c 65 63 74 69 | Sorted |Collecti|
|000006e0| 6f 6e 0a 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |on.. | |
|000006f0| 20 20 20 20 5c 62 6f 6c | 64 7b 53 74 61 63 6b 7d | \bol|d{Stack}|
|00000700| 2d 2d 2d 53 74 61 63 6b | 20 6f 66 20 4f 62 6a 65 |---Stack| of Obje|
|00000710| 63 74 20 50 6f 69 6e 74 | 65 72 73 0a 0a 20 20 20 |ct Point|ers.. |
|00000720| 20 20 20 20 20 20 20 20 | 20 5c 62 6f 6c 64 7b 53 | | \bold{S|
|00000730| 65 74 7d 2d 2d 2d 55 6e | 6f 72 64 65 72 65 64 20 |et}---Un|ordered |
|00000740| 43 6f 6c 6c 65 63 74 69 | 6f 6e 20 6f 66 20 4e 6f |Collecti|on of No|
|00000750| 6e 2d 44 75 70 6c 69 63 | 61 74 65 20 4f 62 6a 65 |n-Duplic|ate Obje|
|00000760| 63 74 73 0a 0a 20 20 20 | 20 20 20 20 20 20 20 20 |cts.. | |
|00000770| 20 20 20 20 20 5c 62 6f | 6c 64 7b 44 69 63 74 69 | \bo|ld{Dicti|
|00000780| 6f 6e 61 72 79 7d 2d 2d | 2d 53 65 74 20 6f 66 20 |onary}--|-Set of |
|00000790| 41 73 73 6f 63 69 61 74 | 69 6f 6e 73 0a 0a 20 20 |Associat|ions.. |
|000007a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000007b0| 20 20 5c 62 6f 6c 64 7b | 49 64 65 6e 74 44 69 63 | \bold{|IdentDic|
|000007c0| 74 7d 2d 2d 2d 44 69 63 | 74 69 6f 6e 61 72 79 20 |t}---Dic|tionary |
|000007d0| 4b 65 79 65 64 20 62 79 | 20 4f 62 6a 65 63 74 20 |Keyed by| Object |
|000007e0| 41 64 64 72 65 73 73 0a | 0a 20 20 20 20 20 20 20 |Address.|. |
|000007f0| 20 20 20 20 20 20 20 20 | 20 5c 62 6f 6c 64 7b 49 | | \bold{I|
|00000800| 64 65 6e 74 53 65 74 7d | 2d 2d 2d 53 65 74 20 4b |dentSet}|---Set K|
|00000810| 65 79 65 64 20 62 79 20 | 4f 62 6a 65 63 74 20 41 |eyed by |Object A|
|00000820| 64 64 72 65 73 73 0a 0a | 20 20 20 20 20 20 20 20 |ddress..| |
|00000830| 5c 62 6f 6c 64 7b 44 61 | 74 65 7d 2d 2d 2d 47 72 |\bold{Da|te}---Gr|
|00000840| 65 67 6f 72 69 61 6e 20 | 43 61 6c 65 6e 64 61 72 |egorian |Calendar|
|00000850| 20 44 61 74 65 0a 0a 20 | 20 20 20 20 20 20 20 5c | Date.. | \|
|00000860| 62 6f 6c 64 7b 46 44 53 | 65 74 7d 2d 2d 2d 53 65 |bold{FDS|et}---Se|
|00000870| 74 20 6f 66 20 46 69 6c | 65 20 44 65 73 63 72 69 |t of Fil|e Descri|
|00000880| 70 74 6f 72 73 20 66 6f | 72 20 55 73 65 20 77 69 |ptors fo|r Use wi|
|00000890| 74 68 20 5c 63 6f 64 65 | 7b 73 65 6c 65 63 74 28 |th \code|{select(|
|000008a0| 32 29 7d 20 0a 53 79 73 | 74 65 6d 20 43 61 6c 6c |2)} .Sys|tem Call|
|000008b0| 0a 0a 20 20 20 20 20 20 | 20 20 5c 62 6f 6c 64 7b |.. | \bold{|
|000008c0| 46 6c 6f 61 74 7d 2d 2d | 2d 46 6c 6f 61 74 69 6e |Float}--|-Floatin|
|000008d0| 67 20 50 6f 69 6e 74 20 | 4e 75 6d 62 65 72 0a 0a |g Point |Number..|
|000008e0| 20 20 20 20 20 20 20 20 | 5c 62 6f 6c 64 7b 46 72 | |\bold{Fr|
|000008f0| 61 63 74 69 6f 6e 7d 2d | 2d 2d 52 61 74 69 6f 6e |action}-|--Ration|
|00000900| 61 6c 20 41 72 69 74 68 | 6d 65 74 69 63 0a 0a 20 |al Arith|metic.. |
|00000910| 20 20 20 20 20 20 20 5c | 62 6f 6c 64 7b 49 6e 74 | \|bold{Int|
|00000920| 65 67 65 72 7d 2d 2d 2d | 49 6e 74 65 67 65 72 20 |eger}---|Integer |
|00000930| 4e 75 6d 62 65 72 20 4f | 62 6a 65 63 74 0a 0a 20 |Number O|bject.. |
|00000940| 20 20 20 20 20 20 20 5c | 62 6f 6c 64 7b 49 74 65 | \|bold{Ite|
|00000950| 72 61 74 6f 72 7d 2d 2d | 2d 43 6f 6c 6c 65 63 74 |rator}--|-Collect|
|00000960| 69 6f 6e 20 49 74 65 72 | 61 74 6f 72 0a 0a 20 20 |ion Iter|ator.. |
|00000970| 20 20 20 20 20 20 5c 62 | 6f 6c 64 7b 4c 69 6e 6b | \b|old{Link|
|00000980| 7d 2d 2d 2d 41 62 73 74 | 72 61 63 74 20 43 6c 61 |}---Abst|ract Cla|
|00000990| 73 73 20 66 6f 72 20 4c | 69 6e 6b 65 64 4c 69 73 |ss for L|inkedLis|
|000009a0| 74 20 4c 69 6e 6b 73 0a | 0a 20 20 20 20 20 20 20 |t Links.|. |
|000009b0| 20 20 20 20 20 5c 62 6f | 6c 64 7b 4c 69 6e 6b 4f | \bo|ld{LinkO|
|000009c0| 62 7d 2d 2d 2d 4c 69 6e | 6b 20 43 6f 6e 74 61 69 |b}---Lin|k Contai|
|000009d0| 6e 69 6e 67 20 4f 62 6a | 65 63 74 20 50 6f 69 6e |ning Obj|ect Poin|
|000009e0| 74 65 72 0a 0a 20 20 20 | 20 20 20 20 20 20 20 20 |ter.. | |
|000009f0| 20 5c 62 6f 6c 64 7b 50 | 72 6f 63 65 73 73 7d 2d | \bold{P|rocess}-|
|00000a00| 2d 2d 43 6f 2d 72 6f 75 | 74 69 6e 65 20 50 72 6f |--Co-rou|tine Pro|
|00000a10| 63 65 73 73 20 4f 62 6a | 65 63 74 0a 0a 20 20 20 |cess Obj|ect.. |
|00000a20| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 5c 62 6f | | \bo|
|00000a30| 6c 64 7b 48 65 61 70 50 | 72 6f 63 7d 2d 2d 2d 50 |ld{HeapP|roc}---P|
|00000a40| 72 6f 63 65 73 73 20 77 | 69 74 68 20 53 74 61 63 |rocess w|ith Stac|
|00000a50| 6b 20 69 6e 20 46 72 65 | 65 20 53 74 6f 72 65 0a |k in Fre|e Store.|
|00000a60| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00000a70| 20 5c 62 6f 6c 64 7b 53 | 74 61 63 6b 50 72 6f 63 | \bold{S|tackProc|
|00000a80| 7d 2d 2d 2d 50 72 6f 63 | 65 73 73 20 77 69 74 68 |}---Proc|ess with|
|00000a90| 20 53 74 61 63 6b 20 6f | 6e 20 5c 63 6f 64 65 7b | Stack o|n \code{|
|00000aa0| 6d 61 69 6e 28 29 7d 20 | 53 74 61 63 6b 0a 0a 20 |main()} |Stack.. |
|00000ab0| 20 20 20 20 20 20 20 5c | 62 6f 6c 64 7b 4c 6f 6f | \|bold{Loo|
|00000ac0| 6b 75 70 4b 65 79 7d 2d | 2d 2d 41 62 73 74 72 61 |kupKey}-|--Abstra|
|00000ad0| 63 74 20 43 6c 61 73 73 | 20 66 6f 72 20 44 69 63 |ct Class| for Dic|
|00000ae0| 74 69 6f 6e 61 72 79 20 | 41 73 73 6f 63 69 61 74 |tionary |Associat|
|00000af0| 69 6f 6e 73 0a 0a 20 20 | 20 20 20 20 20 20 20 20 |ions.. | |
|00000b00| 20 20 5c 62 6f 6c 64 7b | 41 73 73 6f 63 7d 2d 2d | \bold{|Assoc}--|
|00000b10| 2d 41 73 73 6f 63 69 61 | 74 69 6f 6e 20 6f 66 20 |-Associa|tion of |
|00000b20| 4f 62 6a 65 63 74 20 50 | 6f 69 6e 74 65 72 73 0a |Object P|ointers.|
|00000b30| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 5c 62 6f |. | \bo|
|00000b40| 6c 64 7b 41 73 73 6f 63 | 49 6e 74 7d 2d 2d 2d 41 |ld{Assoc|Int}---A|
|00000b50| 73 73 6f 63 69 61 74 69 | 6f 6e 20 6f 66 20 4f 62 |ssociati|on of Ob|
|00000b60| 6a 65 63 74 20 50 6f 69 | 6e 74 65 72 20 77 69 74 |ject Poi|nter wit|
|00000b70| 68 20 49 6e 74 65 67 65 | 72 0a 0a 20 20 20 20 20 |h Intege|r.. |
|00000b80| 20 20 20 5c 62 6f 6c 64 | 7b 4e 69 6c 7d 2d 2d 2d | \bold|{Nil}---|
|00000b90| 54 68 65 20 4e 69 6c 20 | 4f 62 6a 65 63 74 0a 0a |The Nil |Object..|
|00000ba0| 20 20 20 20 20 20 20 20 | 5c 62 6f 6c 64 7b 50 6f | |\bold{Po|
|00000bb0| 69 6e 74 7d 2d 2d 2d 58 | 2d 59 20 43 6f 6f 72 64 |int}---X|-Y Coord|
|00000bc0| 69 6e 61 74 65 20 50 61 | 69 72 0a 0a 20 20 20 20 |inate Pa|ir.. |
|00000bd0| 20 20 20 20 5c 62 6f 6c | 64 7b 52 61 6e 64 6f 6d | \bol|d{Random|
|00000be0| 7d 2d 2d 2d 52 61 6e 64 | 6f 6d 20 4e 75 6d 62 65 |}---Rand|om Numbe|
|00000bf0| 72 20 47 65 6e 65 72 61 | 74 6f 72 0a 0a 20 20 20 |r Genera|tor.. |
|00000c00| 20 20 20 20 20 5c 62 6f | 6c 64 7b 52 61 6e 67 65 | \bo|ld{Range|
|00000c10| 7d 2d 2d 2d 52 61 6e 67 | 65 20 6f 66 20 49 6e 74 |}---Rang|e of Int|
|00000c20| 65 67 65 72 73 0a 0a 20 | 20 20 20 20 20 20 20 5c |egers.. | \|
|00000c30| 62 6f 6c 64 7b 52 65 63 | 74 61 6e 67 6c 65 7d 2d |bold{Rec|tangle}-|
|00000c40| 2d 2d 52 65 63 74 61 6e | 67 6c 65 20 4f 62 6a 65 |--Rectan|gle Obje|
|00000c50| 63 74 0a 0a 20 20 20 20 | 20 20 20 20 5c 62 6f 6c |ct.. | \bol|
|00000c60| 64 7b 53 63 68 65 64 75 | 6c 65 72 7d 2d 2d 2d 43 |d{Schedu|ler}---C|
|00000c70| 6f 2d 72 6f 75 74 69 6e | 65 20 50 72 6f 63 65 73 |o-routin|e Proces|
|00000c80| 73 20 53 63 68 65 64 75 | 6c 65 72 0a 0a 20 20 20 |s Schedu|ler.. |
|00000c90| 20 20 20 20 20 5c 62 6f | 6c 64 7b 53 65 6d 61 70 | \bo|ld{Semap|
|00000ca0| 68 6f 72 65 7d 2d 2d 2d | 50 72 6f 63 65 73 73 20 |hore}---|Process |
|00000cb0| 53 79 6e 63 68 72 6f 6e | 69 7a 61 74 69 6f 6e 0a |Synchron|ization.|
|00000cc0| 0a 20 20 20 20 20 20 20 | 20 5c 62 6f 6c 64 7b 53 |. | \bold{S|
|00000cd0| 68 61 72 65 64 51 75 65 | 75 65 7d 2d 2d 2d 53 68 |haredQue|ue}---Sh|
|00000ce0| 61 72 65 64 20 51 75 65 | 75 65 20 6f 66 20 4f 62 |ared Que|ue of Ob|
|00000cf0| 6a 65 63 74 73 0a 0a 20 | 20 20 20 20 20 20 20 5c |jects.. | \|
|00000d00| 62 6f 6c 64 7b 53 74 72 | 69 6e 67 7d 2d 2d 2d 43 |bold{Str|ing}---C|
|00000d10| 68 61 72 61 63 74 65 72 | 20 53 74 72 69 6e 67 0a |haracter| String.|
|00000d20| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 5c 62 6f |. | \bo|
|00000d30| 6c 64 7b 52 65 67 65 78 | 7d 2d 2d 2d 52 65 67 75 |ld{Regex|}---Regu|
|00000d40| 6c 61 72 20 45 78 70 72 | 65 73 73 69 6f 6e 0a 0a |lar Expr|ession..|
|00000d50| 20 20 20 20 20 20 20 20 | 5c 62 6f 6c 64 7b 54 69 | |\bold{Ti|
|00000d60| 6d 65 7d 2d 2d 2d 54 69 | 6d 65 20 6f 66 20 44 61 |me}---Ti|me of Da|
|00000d70| 79 0a 0a 20 20 20 20 20 | 20 20 20 5c 62 6f 6c 64 |y.. | \bold|
|00000d80| 7b 56 65 63 74 6f 72 7d | 2d 2d 2d 41 62 73 74 72 |{Vector}|---Abstr|
|00000d90| 61 63 74 20 43 6c 61 73 | 73 20 66 6f 72 20 56 65 |act Clas|s for Ve|
|00000da0| 63 74 6f 72 73 0a 0a 20 | 20 20 20 20 20 20 20 20 |ctors.. | |
|00000db0| 20 20 20 5c 62 6f 6c 64 | 7b 42 69 74 56 65 63 7d | \bold|{BitVec}|
|00000dc0| 2d 2d 2d 42 69 74 20 56 | 65 63 74 6f 72 0a 0a 20 |---Bit V|ector.. |
|00000dd0| 20 20 20 20 20 20 20 20 | 20 20 20 5c 62 6f 6c 64 | | \bold|
|00000de0| 7b 42 79 74 65 56 65 63 | 7d 2d 2d 2d 42 79 74 65 |{ByteVec|}---Byte|
|00000df0| 20 56 65 63 74 6f 72 0a | 0a 20 20 20 20 20 20 20 | Vector.|. |
|00000e00| 20 20 20 20 20 5c 62 6f | 6c 64 7b 53 68 6f 72 74 | \bo|ld{Short|
|00000e10| 56 65 63 7d 2d 2d 2d 53 | 68 6f 72 74 20 49 6e 74 |Vec}---S|hort Int|
|00000e20| 65 67 65 72 20 56 65 63 | 74 6f 72 0a 0a 20 20 20 |eger Vec|tor.. |
|00000e30| 20 20 20 20 20 20 20 20 | 20 5c 62 6f 6c 64 7b 49 | | \bold{I|
|00000e40| 6e 74 56 65 63 7d 2d 2d | 2d 49 6e 74 65 67 65 72 |ntVec}--|-Integer|
|00000e50| 20 56 65 63 74 6f 72 0a | 0a 20 20 20 20 20 20 20 | Vector.|. |
|00000e60| 20 20 20 20 20 5c 62 6f | 6c 64 7b 4c 6f 6e 67 56 | \bo|ld{LongV|
|00000e70| 65 63 7d 2d 2d 2d 4c 6f | 6e 67 20 49 6e 74 65 67 |ec}---Lo|ng Integ|
|00000e80| 65 72 20 56 65 63 74 6f | 72 0a 0a 20 20 20 20 20 |er Vecto|r.. |
|00000e90| 20 20 20 20 20 20 20 5c | 62 6f 6c 64 7b 46 6c 6f | \|bold{Flo|
|00000ea0| 61 74 56 65 63 7d 2d 2d | 2d 46 6c 6f 61 74 69 6e |atVec}--|-Floatin|
|00000eb0| 67 20 50 6f 69 6e 74 20 | 56 65 63 74 6f 72 0a 0a |g Point |Vector..|
|00000ec0| 20 20 20 20 20 20 20 20 | 20 20 20 20 5c 62 6f 6c | | \bol|
|00000ed0| 64 7b 44 6f 75 62 6c 65 | 56 65 63 7d 2d 2d 2d 44 |d{Double|Vec}---D|
|00000ee0| 6f 75 62 6c 65 2d 50 72 | 65 63 69 73 69 6f 6e 20 |ouble-Pr|ecision |
|00000ef0| 46 6c 6f 61 74 69 6e 67 | 20 50 6f 69 6e 74 20 56 |Floating| Point V|
|00000f00| 65 63 74 6f 72 0a 0a 20 | 20 20 20 5c 62 6f 6c 64 |ector.. | \bold|
|00000f10| 7b 4f 49 4f 69 66 64 7d | 2d 2d 2d 46 69 6c 65 20 |{OIOifd}|---File |
|00000f20| 44 65 73 63 72 69 70 74 | 6f 72 20 4f 62 6a 65 63 |Descript|or Objec|
|00000f30| 74 20 49 2f 4f 20 5c 74 | 79 70 65 7b 5c 63 6f 64 |t I/O \t|ype{\cod|
|00000f40| 65 7b 72 65 61 64 46 72 | 6f 6d 28 29 7d 7d 20 0a |e{readFr|om()}} .|
|00000f50| 46 6f 72 6d 61 74 74 69 | 6e 67 0a 0a 20 20 20 20 |Formatti|ng.. |
|00000f60| 5c 62 6f 6c 64 7b 4f 49 | 4f 69 6e 7d 2d 2d 2d 41 |\bold{OI|Oin}---A|
|00000f70| 62 73 74 72 61 63 74 20 | 43 6c 61 73 73 20 66 6f |bstract |Class fo|
|00000f80| 72 20 4f 62 6a 65 63 74 | 20 49 2f 4f 20 5c 74 79 |r Object| I/O \ty|
|00000f90| 70 65 7b 5c 63 6f 64 65 | 7b 72 65 61 64 46 72 6f |pe{\code|{readFro|
|00000fa0| 6d 28 29 7d 7d 20 0a 46 | 6f 72 6d 61 74 74 69 6e |m()}} .F|ormattin|
|00000fb0| 67 0a 0a 20 20 20 20 20 | 20 20 20 5c 62 6f 6c 64 |g.. | \bold|
|00000fc0| 7b 4f 49 4f 69 73 74 72 | 65 61 6d 7d 2d 2d 2d 41 |{OIOistr|eam}---A|
|00000fd0| 62 73 74 72 61 63 74 20 | 43 6c 61 73 73 20 66 6f |bstract |Class fo|
|00000fe0| 72 20 53 74 72 65 61 6d | 20 4f 62 6a 65 63 74 20 |r Stream| Object |
|00000ff0| 49 2f 4f 20 0a 5c 74 79 | 70 65 7b 5c 63 6f 64 65 |I/O .\ty|pe{\code|
|00001000| 7b 72 65 61 64 46 72 6f | 6d 28 29 7d 7d 20 46 6f |{readFro|m()}} Fo|
|00001010| 72 6d 61 74 74 69 6e 67 | 0a 0a 20 20 20 20 20 20 |rmatting|.. |
|00001020| 20 20 20 20 20 20 5c 62 | 6f 6c 64 7b 4f 49 4f 6e | \b|old{OIOn|
|00001030| 69 68 69 6e 7d 2d 2d 2d | 53 74 72 65 61 6d 20 4f |ihin}---|Stream O|
|00001040| 62 6a 65 63 74 20 49 2f | 4f 20 5c 74 79 70 65 7b |bject I/|O \type{|
|00001050| 5c 63 6f 64 65 7b 72 65 | 61 64 46 72 6f 6d 28 29 |\code{re|adFrom()|
|00001060| 7d 7d 20 0a 46 6f 72 6d | 61 74 74 69 6e 67 0a 0a |}} .Form|atting..|
|00001070| 20 20 20 20 5c 62 6f 6c | 64 7b 4f 49 4f 6f 66 64 | \bol|d{OIOofd|
|00001080| 7d 2d 2d 2d 46 69 6c 65 | 20 44 65 73 63 72 69 70 |}---File| Descrip|
|00001090| 74 6f 72 20 4f 62 6a 65 | 63 74 20 49 2f 4f 20 5c |tor Obje|ct I/O \|
|000010a0| 74 79 70 65 7b 5c 63 6f | 64 65 7b 73 74 6f 72 65 |type{\co|de{store|
|000010b0| 4f 6e 28 29 7d 7d 20 0a | 46 6f 72 6d 61 74 74 69 |On()}} .|Formatti|
|000010c0| 6e 67 0a 0a 20 20 20 20 | 5c 62 6f 6c 64 7b 4f 49 |ng.. |\bold{OI|
|000010d0| 4f 6f 75 74 7d 2d 2d 2d | 41 62 73 74 72 61 63 74 |Oout}---|Abstract|
|000010e0| 20 43 6c 61 73 73 20 66 | 6f 72 20 4f 62 6a 65 63 | Class f|or Objec|
|000010f0| 74 20 49 2f 4f 20 5c 74 | 79 70 65 7b 5c 63 6f 64 |t I/O \t|ype{\cod|
|00001100| 65 7b 73 74 6f 72 65 4f | 6e 28 29 7d 7d 20 0a 46 |e{storeO|n()}} .F|
|00001110| 6f 72 6d 61 74 74 69 6e | 67 0a 0a 20 20 20 20 20 |ormattin|g.. |
|00001120| 20 20 20 5c 62 6f 6c 64 | 7b 4f 49 4f 6f 73 74 72 | \bold|{OIOostr|
|00001130| 65 61 6d 7d 2d 2d 2d 41 | 62 73 74 72 61 63 74 20 |eam}---A|bstract |
|00001140| 43 6c 61 73 73 20 66 6f | 72 20 53 74 72 65 61 6d |Class fo|r Stream|
|00001150| 20 4f 62 6a 65 63 74 20 | 49 2f 4f 20 0a 5c 74 79 | Object |I/O .\ty|
|00001160| 70 65 7b 5c 63 6f 64 65 | 7b 73 74 6f 72 65 4f 6e |pe{\code|{storeOn|
|00001170| 28 29 7d 7d 20 46 6f 72 | 6d 61 74 74 69 6e 67 0a |()}} For|matting.|
|00001180| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 5c 62 6f |. | \bo|
|00001190| 6c 64 7b 4f 49 4f 6e 69 | 68 6f 75 74 7d 2d 2d 2d |ld{OIOni|hout}---|
|000011a0| 53 74 72 65 61 6d 20 4f | 62 6a 65 63 74 20 49 2f |Stream O|bject I/|
|000011b0| 4f 20 5c 74 79 70 65 7b | 5c 63 6f 64 65 7b 73 74 |O \type{|\code{st|
|000011c0| 6f 72 65 4f 6e 28 29 7d | 7d 20 0a 46 6f 72 6d 61 |oreOn()}|} .Forma|
|000011d0| 74 74 69 6e 67 0a 0a 20 | 20 20 20 5c 62 6f 6c 64 |tting.. | \bold|
|000011e0| 7b 52 65 61 64 46 72 6f | 6d 54 62 6c 7d 2d 2d 2d |{ReadFro|mTbl}---|
|000011f0| 54 61 62 6c 65 73 20 75 | 73 65 64 20 62 79 20 4f |Tables u|sed by O|
|00001200| 62 6a 65 63 74 20 49 2f | 4f 20 5c 74 79 70 65 7b |bject I/|O \type{|
|00001210| 5c 63 6f 64 65 7b 72 65 | 61 64 46 72 6f 6d 28 29 |\code{re|adFrom()|
|00001220| 7d 7d 0a 0a 20 20 20 20 | 5c 62 6f 6c 64 7b 53 74 |}}.. |\bold{St|
|00001230| 6f 72 65 4f 6e 54 62 6c | 7d 2d 2d 2d 54 61 62 6c |oreOnTbl|}---Tabl|
|00001240| 65 73 20 75 73 65 64 20 | 62 79 20 4f 62 6a 65 63 |es used |by Objec|
|00001250| 74 20 49 2f 4f 20 5c 74 | 79 70 65 7b 5c 63 6f 64 |t I/O \t|ype{\cod|
|00001260| 65 7b 73 74 6f 72 65 4f | 6e 28 29 7d 7d 0a 0a 0a |e{storeO|n()}}...|
|00001270| 0a 5c 73 65 63 74 69 6f | 6e 7b 43 48 41 4e 47 45 |.\sectio|n{CHANGE|
|00001280| 53 20 42 45 54 57 45 45 | 4e 20 4f 4f 50 53 20 56 |S BETWEE|N OOPS V|
|00001290| 32 52 32 20 41 4e 44 20 | 4e 49 48 43 4c 20 52 33 |2R2 AND |NIHCL R3|
|000012a0| 2e 30 0a 0a 0a 7d 54 68 | 69 73 20 73 65 63 74 69 |.0...}Th|is secti|
|000012b0| 6f 6e 20 68 69 67 68 6c | 69 67 68 74 73 20 74 68 |on highl|ights th|
|000012c0| 65 20 6d 6f 73 74 20 73 | 69 67 6e 69 66 69 63 61 |e most s|ignifica|
|000012d0| 6e 74 20 63 68 61 6e 67 | 65 73 20 74 68 61 74 20 |nt chang|es that |
|000012e0| 68 61 76 65 20 62 65 65 | 6e 20 6d 61 64 65 20 0a |have bee|n made .|
|000012f0| 73 69 6e 63 65 20 74 68 | 65 20 70 72 65 76 69 6f |since th|e previo|
|00001300| 75 73 20 72 65 6c 65 61 | 73 65 2e 20 20 49 74 20 |us relea|se. It |
|00001310| 69 73 20 62 79 20 6e 6f | 20 73 74 72 65 74 63 68 |is by no| stretch|
|00001320| 20 6f 66 20 74 68 65 20 | 69 6d 61 67 69 6e 61 74 | of the |imaginat|
|00001330| 69 6f 6e 20 63 6f 6d 70 | 6c 65 74 65 2e 0a 0a 0a |ion comp|lete....|
|00001340| 5c 73 75 62 73 65 63 74 | 69 6f 6e 7b 4c 69 62 72 |\subsect|ion{Libr|
|00001350| 61 72 79 20 6e 61 6d 65 | 20 63 68 61 6e 67 65 64 |ary name| changed|
|00001360| 20 66 72 6f 6d 20 22 4f | 4f 50 53 22 20 74 6f 20 | from "O|OPS" to |
|00001370| 22 4e 49 48 20 43 6c 61 | 73 73 20 4c 69 62 72 61 |"NIH Cla|ss Libra|
|00001380| 72 79 22 20 28 4e 49 48 | 43 4c 29 0a 0a 7d 0a 53 |ry" (NIH|CL)..}.S|
|00001390| 69 6e 63 65 20 74 68 65 | 72 65 27 73 20 74 6f 6f |ince the|re's too|
|000013a0| 20 6d 61 6e 79 20 74 68 | 69 6e 67 73 20 63 61 6c | many th|ings cal|
|000013b0| 6c 65 64 20 22 4f 4f 50 | 53 22 20 74 68 65 73 65 |led "OOP|S" these|
|000013c0| 20 64 61 79 73 2c 20 77 | 65 27 76 65 20 63 68 61 | days, w|e've cha|
|000013d0| 6e 67 65 64 20 74 68 65 | 20 6e 61 6d 65 20 0a 6f |nged the| name .o|
|000013e0| 66 20 6f 75 72 20 6c 69 | 62 72 61 72 79 20 74 6f |f our li|brary to|
|000013f0| 20 74 68 65 20 22 4e 49 | 48 20 43 6c 61 73 73 20 | the "NI|H Class |
|00001400| 4c 69 62 72 61 72 79 22 | 2e 20 20 41 6c 6c 20 66 |Library"|. All f|
|00001410| 69 6c 65 20 61 6e 64 20 | 43 2b 2b 20 6e 61 6d 65 |ile and |C++ name|
|00001420| 73 20 63 6f 6e 74 61 69 | 6e 69 6e 67 20 0a 22 4f |s contai|ning ."O|
|00001430| 4f 50 53 22 20 68 61 76 | 65 20 62 65 65 6e 20 63 |OPS" hav|e been c|
|00001440| 68 61 6e 67 65 64 2c 20 | 6f 66 74 65 6e 20 6a 75 |hanged, |often ju|
|00001450| 73 74 20 62 79 20 73 75 | 62 73 74 69 74 75 74 69 |st by su|bstituti|
|00001460| 6e 67 20 22 4e 49 48 43 | 4c 22 20 66 6f 72 20 22 |ng "NIHC|L" for "|
|00001470| 4f 4f 50 53 22 2e 0a 0a | 0a 5c 73 75 62 73 65 63 |OOPS"...|.\subsec|
|00001480| 74 69 6f 6e 7b 43 6c 61 | 73 73 20 4e 49 48 43 4c |tion{Cla|ss NIHCL|
|00001490| 0a 0a 7d 0a 57 69 74 68 | 20 74 68 65 20 69 6e 74 |..}.With| the int|
|000014a0| 72 6f 64 75 63 74 69 6f | 6e 20 6f 66 20 73 74 61 |roductio|n of sta|
|000014b0| 74 69 63 20 6d 65 6d 62 | 65 72 20 66 75 6e 63 74 |tic memb|er funct|
|000014c0| 69 6f 6e 73 20 61 6e 64 | 20 28 75 73 65 66 75 6c |ions and| (useful|
|000014d0| 29 20 73 74 61 74 69 63 | 20 6d 65 6d 62 65 72 20 |) static| member |
|000014e0| 0a 76 61 72 69 61 62 6c | 65 73 20 69 6e 20 52 32 |.variabl|es in R2|
|000014f0| 2e 30 2c 20 69 74 20 69 | 73 20 6e 6f 77 20 70 6f |.0, it i|s now po|
|00001500| 73 73 69 62 6c 65 20 74 | 6f 20 65 6c 69 6d 69 6e |ssible t|o elimin|
|00001510| 61 74 65 20 6d 6f 73 74 | 20 67 6c 6f 62 61 6c 20 |ate most| global |
|00001520| 6e 61 6d 65 73 2e 20 20 | 49 6e 20 0a 52 33 2e 30 |names. |In .R3.0|
|00001530| 2c 20 77 65 27 76 65 20 | 67 61 74 68 65 72 65 64 |, we've |gathered|
|00001540| 20 6d 61 6e 79 20 70 72 | 65 76 69 6f 75 73 6c 79 | many pr|eviously|
|00001550| 20 67 6c 6f 62 61 6c 20 | 66 75 6e 63 74 69 6f 6e | global |function|
|00001560| 73 20 61 6e 64 20 76 61 | 72 69 61 62 6c 65 73 20 |s and va|riables |
|00001570| 61 6e 64 20 6d 61 64 65 | 20 0a 74 68 65 6d 20 73 |and made| .them s|
|00001580| 74 61 74 69 63 20 6d 65 | 6d 62 65 72 73 20 6f 66 |tatic me|mbers of|
|00001590| 20 61 20 6e 65 77 20 63 | 6c 61 73 73 2c 20 5c 63 | a new c|lass, \c|
|000015a0| 6f 64 65 7b 4e 49 48 43 | 4c 7d 2c 20 77 68 69 63 |ode{NIHC|L}, whic|
|000015b0| 68 20 69 73 20 74 68 65 | 20 62 61 73 65 20 63 6c |h is the| base cl|
|000015c0| 61 73 73 20 6f 66 20 0a | 5c 63 6f 64 65 7b 4f 62 |ass of .|\code{Ob|
|000015d0| 6a 65 63 74 7d 2e 20 20 | 48 65 72 65 27 73 20 61 |ject}. |Here's a|
|000015e0| 20 6c 69 73 74 20 6f 66 | 20 74 68 65 20 70 75 62 | list of| the pub|
|000015f0| 6c 69 63 20 66 75 6e 63 | 74 69 6f 6e 73 3a 0a 0a |lic func|tions:..|
|00001600| 0a 5c 65 78 61 6d 70 6c | 65 7b 73 74 61 74 69 63 |.\exampl|e{static|
|00001610| 20 63 6c 61 73 73 20 4e | 49 48 43 4c 20 5c 7b 0a | class N|IHCL \{.|
|00001620| 0a 2f 2f 20 2e 2e 2e 0a | 0a 70 75 62 6c 69 63 3a |.// ....|.public:|
|00001630| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 2f 2f 20 | | // |
|00001640| 73 74 61 74 69 63 20 6d | 65 6d 62 65 72 20 66 75 |static m|ember fu|
|00001650| 6e 63 74 69 6f 6e 73 0a | 0a 20 20 20 20 73 74 61 |nctions.|. sta|
|00001660| 74 69 63 20 75 6e 73 69 | 67 6e 65 64 20 63 68 61 |tic unsi|gned cha|
|00001670| 72 20 63 68 61 72 42 69 | 74 4d 61 73 6b 28 69 6e |r charBi|tMask(in|
|00001680| 74 20 69 29 3b 0a 0a 20 | 20 20 20 73 74 61 74 69 |t i);.. | stati|
|00001690| 63 20 75 6e 73 69 67 6e | 65 64 20 73 68 6f 72 74 |c unsign|ed short|
|000016a0| 20 73 68 6f 72 74 42 69 | 74 4d 61 73 6b 28 69 6e | shortBi|tMask(in|
|000016b0| 74 20 69 29 3b 0a 0a 20 | 20 20 20 73 74 61 74 69 |t i);.. | stati|
|000016c0| 63 20 75 6e 73 69 67 6e | 65 64 20 69 6e 74 20 69 |c unsign|ed int i|
|000016d0| 6e 74 42 69 74 4d 61 73 | 6b 28 69 6e 74 20 69 29 |ntBitMas|k(int i)|
|000016e0| 3b 0a 0a 20 20 20 20 73 | 74 61 74 69 63 20 75 6e |;.. s|tatic un|
|000016f0| 73 69 67 6e 65 64 20 63 | 68 61 72 20 62 69 74 43 |signed c|har bitC|
|00001700| 6f 75 6e 74 28 69 6e 74 | 20 69 29 3b 0a 0a 20 20 |ount(int| i);.. |
|00001710| 20 20 73 74 61 74 69 63 | 20 75 6e 73 69 67 6e 65 | static| unsigne|
|00001720| 64 20 63 68 61 72 20 62 | 69 74 52 65 76 65 72 73 |d char b|itRevers|
|00001730| 65 28 69 6e 74 20 69 29 | 3b 0a 0a 20 20 20 20 73 |e(int i)|;.. s|
|00001740| 74 61 74 69 63 20 76 6f | 69 64 20 69 6e 69 74 69 |tatic vo|id initi|
|00001750| 61 6c 69 7a 65 28 29 3b | 20 20 20 20 20 20 20 20 |alize();| |
|00001760| 20 20 20 2f 2f 20 6c 69 | 62 72 61 72 79 20 69 6e | // li|brary in|
|00001770| 69 74 69 61 6c 69 7a 61 | 74 69 6f 6e 0a 0a 20 20 |itializa|tion.. |
|00001780| 20 20 73 74 61 74 69 63 | 20 62 6f 6f 6c 20 69 6e | static| bool in|
|00001790| 69 74 69 61 6c 69 7a 65 | 64 28 29 3b 20 20 20 20 |itialize|d(); |
|000017a0| 20 20 20 20 20 20 2f 2f | 20 6c 69 62 72 61 72 79 | //| library|
|000017b0| 20 69 6e 69 74 69 61 6c | 69 7a 65 64 3f 0a 0a 20 | initial|ized?.. |
|000017c0| 20 20 20 73 74 61 74 69 | 63 20 76 6f 69 64 20 73 | stati|c void s|
|000017d0| 65 74 45 72 72 6f 72 28 | 69 6e 74 20 65 72 72 6f |etError(|int erro|
|000017e0| 72 2c 20 69 6e 74 20 73 | 65 76 20 2e 2e 2e 29 3b |r, int s|ev ...);|
|000017f0| 0a 0a 5c 7d 20 4e 49 48 | 43 4c 5f 69 6e 69 74 3b |..\} NIH|CL_init;|
|00001800| 0a 0a 7d 0a 53 69 6e 63 | 65 20 61 6c 6c 20 4e 49 |..}.Sinc|e all NI|
|00001810| 48 20 4c 69 62 72 61 72 | 79 20 63 6c 61 73 73 65 |H Librar|y classe|
|00001820| 73 20 69 6e 68 65 72 69 | 74 20 74 68 65 73 65 20 |s inheri|t these |
|00001830| 6d 65 6d 62 65 72 73 2c | 20 74 68 65 69 72 20 6d |members,| their m|
|00001840| 65 6d 62 65 72 20 66 75 | 6e 63 74 69 6f 6e 73 20 |ember fu|nctions |
|00001850| 0a 63 61 6e 20 75 73 65 | 20 74 68 65 73 65 20 6e |.can use| these n|
|00001860| 61 6d 65 73 20 77 69 74 | 68 6f 75 74 20 6e 65 65 |ames wit|hout nee|
|00001870| 64 69 6e 67 20 74 6f 20 | 73 70 65 63 69 66 79 20 |ding to |specify |
|00001880| 61 20 73 63 6f 70 65 20 | 71 75 61 6c 69 66 69 65 |a scope |qualifie|
|00001890| 72 2c 20 65 78 63 65 70 | 74 20 74 6f 20 0a 72 65 |r, excep|t to .re|
|000018a0| 73 6f 6c 76 65 20 61 6d | 62 69 67 75 69 74 69 65 |solve am|biguitie|
|000018b0| 73 2e 20 20 48 6f 77 65 | 76 65 72 2c 20 6e 6f 6e |s. Howe|ver, non|
|000018c0| 2d 6d 65 6d 62 65 72 20 | 66 75 6e 63 74 69 6f 6e |-member |function|
|000018d0| 73 20 61 6e 64 20 6d 65 | 6d 62 65 72 20 66 75 6e |s and me|mber fun|
|000018e0| 63 74 69 6f 6e 73 20 6f | 66 20 0a 63 6c 61 73 73 |ctions o|f .class|
|000018f0| 65 73 20 6e 6f 74 20 64 | 65 72 69 76 65 64 20 66 |es not d|erived f|
|00001900| 72 6f 6d 20 5c 63 6f 64 | 65 7b 4e 49 48 43 4c 7d |rom \cod|e{NIHCL}|
|00001910| 20 63 61 6e 20 61 63 63 | 65 73 73 20 74 68 65 6d | can acc|ess them|
|00001920| 20 77 69 74 68 20 74 68 | 65 20 5c 63 6f 64 65 7b | with th|e \code{|
|00001930| 4e 49 48 43 4c 7d 20 0a | 73 63 6f 70 65 20 71 75 |NIHCL} .|scope qu|
|00001940| 61 6c 69 66 69 65 72 3b | 20 66 6f 72 20 65 78 61 |alifier;| for exa|
|00001950| 6d 70 6c 65 3a 0a 0a 0a | 5c 65 78 61 6d 70 6c 65 |mple:...|\example|
|00001960| 7b 4e 49 48 43 4c 3a 3a | 73 65 74 45 72 72 6f 72 |{NIHCL::|setError|
|00001970| 28 45 52 52 4f 52 5f 43 | 4f 44 45 2c 20 44 45 46 |(ERROR_C|ODE, DEF|
|00001980| 41 55 4c 54 29 3b 0a 0a | 7d 0a 5c 73 75 62 73 65 |AULT);..|}.\subse|
|00001990| 63 74 69 6f 6e 7b 4f 70 | 74 69 6f 6e 61 6c 20 73 |ction{Op|tional s|
|000019a0| 75 70 70 6f 72 74 20 66 | 6f 72 20 6d 75 6c 74 69 |upport f|or multi|
|000019b0| 70 6c 65 20 69 6e 68 65 | 72 69 74 61 6e 63 65 0a |ple inhe|ritance.|
|000019c0| 0a 7d 0a 54 68 65 20 4e | 49 48 20 43 6c 61 73 73 |.}.The N|IH Class|
|000019d0| 20 4c 69 62 72 61 72 79 | 20 63 61 6e 20 62 65 20 | Library| can be |
|000019e0| 63 6f 6d 70 69 6c 65 64 | 20 74 6f 20 73 75 70 70 |compiled| to supp|
|000019f0| 6f 72 74 20 4d 75 6c 74 | 69 70 6c 65 20 49 6e 68 |ort Mult|iple Inh|
|00001a00| 65 72 69 74 61 6e 63 65 | 20 28 4d 49 29 20 62 79 |eritance| (MI) by|
|00001a10| 20 0a 64 65 66 69 6e 69 | 6e 67 20 74 68 65 20 70 | .defini|ng the p|
|00001a20| 72 65 70 72 6f 63 65 73 | 73 6f 72 20 73 79 6d 62 |reproces|sor symb|
|00001a30| 6f 6c 20 5c 74 79 70 65 | 77 72 69 74 65 72 7b 4d |ol \type|writer{M|
|00001a40| 49 7d 2e 20 20 5c 69 74 | 61 6c 69 63 7b 41 6c 6c |I}. \it|alic{All|
|00001a50| 20 63 6c 61 73 73 65 73 | 20 6c 69 6e 6b 65 64 20 | classes| linked |
|00001a60| 0a 74 6f 67 65 74 68 65 | 72 20 69 6e 20 61 20 70 |.togethe|r in a p|
|00001a70| 72 6f 67 72 61 6d 20 6d | 75 73 74 20 61 6c 6c 20 |rogram m|ust all |
|00001a80| 68 61 76 65 20 62 65 65 | 6e 20 63 6f 6d 70 69 6c |have bee|n compil|
|00001a90| 65 64 20 77 69 74 68 20 | 74 68 65 20 73 61 6d 65 |ed with |the same|
|00001aa0| 20 5c 74 79 70 65 77 72 | 69 74 65 72 7b 4d 49 7d | \typewr|iter{MI}|
|00001ab0| 20 0a 6f 70 74 69 6f 6e | 20 73 65 74 74 69 6e 67 | .option| setting|
|00001ac0| 7d 2e 20 20 54 68 65 20 | 6d 61 6a 6f 72 20 65 66 |}. The |major ef|
|00001ad0| 66 65 63 74 20 6f 66 20 | 74 68 69 73 20 73 77 69 |fect of |this swi|
|00001ae0| 74 63 68 20 69 73 20 74 | 68 61 74 20 61 6c 6c 20 |tch is t|hat all |
|00001af0| 63 6c 61 73 73 65 73 20 | 64 65 72 69 76 65 64 20 |classes |derived |
|00001b00| 0a 66 72 6f 6d 20 5c 63 | 6f 64 65 7b 4f 62 6a 65 |.from \c|ode{Obje|
|00001b10| 63 74 7d 20 73 70 65 63 | 69 66 79 20 69 74 20 61 |ct} spec|ify it a|
|00001b20| 73 20 61 20 76 69 72 74 | 75 61 6c 20 62 61 73 65 |s a virt|ual base|
|00001b30| 20 63 6c 61 73 73 2e 20 | 20 53 69 6e 63 65 20 43 | class. | Since C|
|00001b40| 2b 2b 20 64 6f 65 73 20 | 6e 6f 74 20 0a 70 65 72 |++ does |not .per|
|00001b50| 6d 69 74 20 61 20 70 6f | 69 6e 74 65 72 20 74 6f |mit a po|inter to|
|00001b60| 20 61 20 76 69 72 74 75 | 61 6c 20 62 61 73 65 20 | a virtu|al base |
|00001b70| 63 6c 61 73 73 20 74 6f | 20 62 65 20 63 61 73 74 |class to| be cast|
|00001b80| 20 64 6f 77 6e 20 74 6f | 20 61 20 70 6f 69 6e 74 | down to| a point|
|00001b90| 65 72 20 74 6f 20 61 20 | 0a 64 65 72 69 76 65 64 |er to a |.derived|
|00001ba0| 20 63 6c 61 73 73 2c 20 | 74 68 65 20 6e 65 77 20 | class, |the new |
|00001bb0| 5c 63 6f 64 65 7b 44 45 | 43 4c 41 52 45 5f 4d 45 |\code{DE|CLARE_ME|
|00001bc0| 4d 42 45 52 53 7d 20 6d | 61 63 72 6f 20 64 65 66 |MBERS} m|acro def|
|00001bd0| 69 6e 65 73 20 61 6e 20 | 6f 76 65 72 6c 6f 61 64 |ines an |overload|
|00001be0| 65 64 20 0a 66 61 6d 69 | 6c 79 20 6f 66 20 73 74 |ed .fami|ly of st|
|00001bf0| 61 74 69 63 20 6d 65 6d | 62 65 72 20 66 75 6e 63 |atic mem|ber func|
|00001c00| 74 69 6f 6e 73 20 6e 61 | 6d 65 64 20 5c 63 6f 64 |tions na|med \cod|
|00001c10| 65 7b 63 61 73 74 44 6f | 77 6e 28 29 7d 20 74 68 |e{castDo|wn()} th|
|00001c20| 61 74 20 63 61 6e 20 70 | 65 72 66 6f 72 6d 20 0a |at can p|erform .|
|00001c30| 74 68 69 73 20 63 6f 6e | 76 65 72 73 69 6f 6e 2e |this con|version.|
|00001c40| 20 28 49 66 20 5c 63 6f | 64 65 7b 4d 49 7d 20 69 | (If \co|de{MI} i|
|00001c50| 73 20 6e 6f 74 20 65 6e | 61 62 6c 65 64 2c 20 5c |s not en|abled, \|
|00001c60| 63 6f 64 65 7b 63 61 73 | 74 44 6f 77 6e 28 29 7d |code{cas|tDown()}|
|00001c70| 20 62 65 63 6f 6d 65 73 | 20 61 6e 20 0a 6f 72 64 | becomes| an .ord|
|00001c80| 69 6e 61 72 79 20 70 6f | 69 6e 74 65 72 20 63 61 |inary po|inter ca|
|00001c90| 73 74 2e 29 0a 0a 0a 54 | 68 65 20 5c 63 6f 64 65 |st.)...T|he \code|
|00001ca0| 7b 63 61 73 74 44 6f 77 | 6e 28 29 7d 20 66 75 6e |{castDow|n()} fun|
|00001cb0| 63 74 69 6f 6e 73 20 61 | 6c 6c 20 63 61 6c 6c 20 |ctions a|ll call |
|00001cc0| 74 68 65 20 66 75 6e 63 | 74 69 6f 6e 20 5c 63 6f |the func|tion \co|
|00001cd0| 64 65 7b 5f 63 61 73 74 | 44 6f 77 6e 28 29 7d 20 |de{_cast|Down()} |
|00001ce0| 74 6f 20 0a 70 65 72 66 | 6f 72 6d 20 74 68 65 20 |to .perf|orm the |
|00001cf0| 70 6f 69 6e 74 65 72 20 | 63 6f 6e 76 65 72 73 69 |pointer |conversi|
|00001d00| 6f 6e 2e 20 20 49 66 20 | 61 20 63 6c 61 73 73 20 |on. If |a class |
|00001d10| 68 61 73 20 6f 6e 6c 79 | 20 61 20 73 69 6e 67 6c |has only| a singl|
|00001d20| 65 20 62 61 73 65 20 63 | 6c 61 73 73 2c 20 69 74 |e base c|lass, it|
|00001d30| 20 0a 75 73 65 73 20 74 | 68 65 20 5c 63 6f 64 65 | .uses t|he \code|
|00001d40| 7b 44 45 46 49 4e 45 5f | 43 4c 41 53 53 7d 20 61 |{DEFINE_|CLASS} a|
|00001d50| 6e 64 20 5c 63 6f 64 65 | 7b 44 45 46 49 4e 45 5f |nd \code|{DEFINE_|
|00001d60| 41 42 53 54 52 41 43 54 | 5f 43 4c 41 53 53 7d 20 |ABSTRACT|_CLASS} |
|00001d70| 70 72 65 70 72 6f 63 65 | 73 73 6f 72 20 0a 6d 61 |preproce|ssor .ma|
|00001d80| 63 72 6f 73 20 61 73 20 | 62 65 66 6f 72 65 2c 20 |cros as |before, |
|00001d90| 61 6e 64 20 74 68 65 73 | 65 20 67 65 6e 65 72 61 |and thes|e genera|
|00001da0| 74 65 20 61 6e 20 20 69 | 6d 70 6c 65 6d 65 6e 74 |te an i|mplement|
|00001db0| 61 74 69 6f 6e 20 6f 66 | 20 5c 63 6f 64 65 7b 5f |ation of| \code{_|
|00001dc0| 63 61 73 74 44 6f 77 6e | 28 29 7d 20 0a 73 75 69 |castDown|()} .sui|
|00001dd0| 74 61 62 6c 65 20 66 6f | 72 20 74 68 65 20 73 69 |table fo|r the si|
|00001de0| 6e 67 6c 65 20 69 6e 68 | 65 72 69 74 61 6e 63 65 |ngle inh|eritance|
|00001df0| 20 63 61 73 65 2e 20 20 | 49 66 20 61 20 63 6c 61 | case. |If a cla|
|00001e00| 73 73 20 68 61 73 20 6d | 75 6c 74 69 70 6c 65 20 |ss has m|ultiple |
|00001e10| 62 61 73 65 20 0a 63 6c | 61 73 73 65 73 2c 20 69 |base .cl|asses, i|
|00001e20| 74 20 75 73 65 73 20 74 | 68 65 20 6e 65 77 20 5c |t uses t|he new \|
|00001e30| 63 6f 64 65 7b 44 45 46 | 49 4e 45 5f 43 4c 41 53 |code{DEF|INE_CLAS|
|00001e40| 53 5f 4d 49 7d 20 61 6e | 64 20 0a 5c 63 6f 64 65 |S_MI} an|d .\code|
|00001e50| 7b 44 45 46 49 4e 45 5f | 41 42 53 54 52 41 43 54 |{DEFINE_|ABSTRACT|
|00001e60| 5f 43 4c 41 53 53 5f 4d | 49 7d 20 6d 61 63 72 6f |_CLASS_M|I} macro|
|00001e70| 73 2c 20 77 68 69 63 68 | 20 64 6f 20 5c 69 74 61 |s, which| do \ita|
|00001e80| 6c 69 63 7b 6e 6f 74 7d | 20 67 65 6e 65 72 61 74 |lic{not}| generat|
|00001e90| 65 20 0a 5c 63 6f 64 65 | 7b 5f 63 61 73 74 44 6f |e .\code|{_castDo|
|00001ea0| 77 6e 28 29 7d 2d 2d 2d | 74 68 65 20 63 6c 61 73 |wn()}---|the clas|
|00001eb0| 73 20 70 72 6f 76 69 64 | 65 72 20 6d 75 73 74 20 |s provid|er must |
|00001ec0| 73 75 70 70 6c 79 20 61 | 20 64 65 66 69 6e 69 74 |supply a| definit|
|00001ed0| 69 6f 6e 20 61 73 20 64 | 65 73 63 72 69 62 65 64 |ion as d|escribed|
|00001ee0| 20 0a 69 6e 20 5c 63 6f | 64 65 7b 54 65 6d 70 6c | .in \co|de{Templ|
|00001ef0| 61 74 65 5f 63 7d 2e 0a | 0a 0a 41 6c 6c 20 5c 63 |ate_c}..|..All \c|
|00001f00| 6f 64 65 7b 72 65 61 64 | 46 72 6f 6d 28 29 7d 20 |ode{read|From()} |
|00001f10| 63 6f 6e 73 74 72 75 63 | 74 6f 72 73 20 6d 75 73 |construc|tors mus|
|00001f20| 74 20 73 70 65 63 69 66 | 79 20 74 68 65 20 5c 63 |t specif|y the \c|
|00001f30| 6f 64 65 7b 72 65 61 64 | 46 72 6f 6d 28 29 7d 20 |ode{read|From()} |
|00001f40| 0a 63 6f 6e 73 74 72 75 | 63 74 6f 72 20 66 6f 72 |.constru|ctor for|
|00001f50| 20 74 68 65 20 76 69 72 | 74 75 61 6c 20 62 61 73 | the vir|tual bas|
|00001f60| 65 20 63 6c 61 73 73 20 | 5c 63 6f 64 65 7b 4f 62 |e class |\code{Ob|
|00001f70| 6a 65 63 74 7d 20 69 6e | 20 74 68 65 69 72 20 69 |ject} in| their i|
|00001f80| 6e 69 74 69 61 6c 69 7a | 61 74 69 6f 6e 20 0a 6c |nitializ|ation .l|
|00001f90| 69 73 74 73 20 77 68 65 | 6e 20 5c 63 6f 64 65 7b |ists whe|n \code{|
|00001fa0| 4d 49 7d 20 69 73 20 65 | 6e 61 62 6c 65 64 2e 20 |MI} is e|nabled. |
|00001fb0| 20 53 65 65 20 5c 63 6f | 64 65 7b 54 65 6d 70 6c | See \co|de{Templ|
|00001fc0| 61 74 65 5f 68 7d 20 66 | 6f 72 20 64 65 74 61 69 |ate_h} f|or detai|
|00001fd0| 6c 73 2e 0a 0a 0a 49 66 | 20 79 6f 75 20 75 73 65 |ls....If| you use|
|00001fe0| 20 76 69 72 74 75 61 6c | 20 62 61 73 65 20 63 6c | virtual| base cl|
|00001ff0| 61 73 73 65 73 20 69 6e | 20 63 6f 6e 6a 75 6e 63 |asses in| conjunc|
|00002000| 74 69 6f 6e 20 77 69 74 | 68 20 74 68 65 20 4e 49 |tion wit|h the NI|
|00002010| 48 20 43 6c 61 73 73 20 | 4c 69 62 72 61 72 79 2c |H Class |Library,|
|00002020| 20 79 6f 75 20 0a 6d 75 | 73 74 20 74 61 6b 65 20 | you .mu|st take |
|00002030| 63 61 72 65 20 77 68 65 | 6e 20 69 6d 70 6c 65 6d |care whe|n implem|
|00002040| 65 6e 74 69 6e 67 20 74 | 68 65 20 5c 63 6f 64 65 |enting t|he \code|
|00002050| 7b 64 65 65 70 43 6f 70 | 79 28 29 7d 20 61 6e 64 |{deepCop|y()} and|
|00002060| 20 5c 63 6f 64 65 7b 73 | 74 6f 72 65 4f 6e 28 29 | \code{s|toreOn()|
|00002070| 7d 20 0a 6f 70 65 72 61 | 74 69 6f 6e 73 20 74 68 |} .opera|tions th|
|00002080| 61 74 20 61 20 76 69 72 | 74 75 61 6c 20 62 61 73 |at a vir|tual bas|
|00002090| 65 20 63 6c 61 73 73 27 | 73 20 6d 65 6d 62 65 72 |e class'|s member|
|000020a0| 20 76 61 72 69 61 62 6c | 65 73 20 61 72 65 20 6f | variabl|es are o|
|000020b0| 6e 6c 79 20 64 65 65 70 | 65 6e 65 64 20 6f 72 20 |nly deep|ened or |
|000020c0| 0a 73 74 6f 72 65 64 20 | 6f 6e 63 65 2e 20 20 54 |.stored |once. T|
|000020d0| 68 65 20 6c 69 62 72 61 | 72 79 20 70 72 6f 76 69 |he libra|ry provi|
|000020e0| 64 65 73 20 74 68 65 20 | 66 75 6e 63 74 69 6f 6e |des the |function|
|000020f0| 73 20 5c 63 6f 64 65 7b | 64 65 65 70 65 6e 56 42 |s \code{|deepenVB|
|00002100| 61 73 65 28 29 7d 20 61 | 6e 64 20 0a 5c 63 6f 64 |ase()} a|nd .\cod|
|00002110| 65 7b 73 74 6f 72 65 56 | 42 61 73 65 4f 6e 28 29 |e{storeV|BaseOn()|
|00002120| 7d 20 74 6f 20 68 65 6c | 70 20 77 69 74 68 20 74 |} to hel|p with t|
|00002130| 68 69 73 2e 20 20 43 61 | 6c 6c 20 5c 63 6f 64 65 |his. Ca|ll \code|
|00002140| 7b 64 65 65 70 65 6e 56 | 42 61 73 65 28 29 7d 20 |{deepenV|Base()} |
|00002150| 69 6e 73 74 65 61 64 20 | 6f 66 20 0a 5c 63 6f 64 |instead |of .\cod|
|00002160| 65 7b 64 65 65 70 65 6e | 53 68 61 6c 6c 6f 77 43 |e{deepen|ShallowC|
|00002170| 6f 70 79 28 29 7d 20 74 | 6f 20 64 65 65 70 65 6e |opy()} t|o deepen|
|00002180| 20 74 68 65 20 6d 65 6d | 62 65 72 20 76 61 72 69 | the mem|ber vari|
|00002190| 61 62 6c 65 73 20 6f 66 | 20 61 20 76 69 72 74 75 |ables of| a virtu|
|000021a0| 61 6c 20 62 61 73 65 20 | 0a 63 6c 61 73 73 2c 20 |al base |.class, |
|000021b0| 61 6e 64 20 63 61 6c 6c | 20 5c 63 6f 64 65 7b 73 |and call| \code{s|
|000021c0| 74 6f 72 65 56 42 61 73 | 65 4f 6e 28 29 7d 20 69 |toreVBas|eOn()} i|
|000021d0| 6e 73 74 65 61 64 20 6f | 66 20 5c 63 6f 64 65 7b |nstead o|f \code{|
|000021e0| 73 74 6f 72 65 72 28 29 | 7d 20 74 6f 20 73 74 6f |storer()|} to sto|
|000021f0| 72 65 20 74 68 65 20 0a | 6d 65 6d 62 65 72 20 76 |re the .|member v|
|00002200| 61 72 69 61 62 6c 65 73 | 20 6f 66 20 61 20 76 69 |ariables| of a vi|
|00002210| 72 74 75 61 6c 20 62 61 | 73 65 20 63 6c 61 73 73 |rtual ba|se class|
|00002220| 2e 0a 0a 0a 5c 73 75 62 | 73 65 63 74 69 6f 6e 7b |....\sub|section{|
|00002230| 5c 63 6f 64 65 7b 44 45 | 43 4c 41 52 45 5f 4d 45 |\code{DE|CLARE_ME|
|00002240| 4d 42 45 52 53 7d 20 20 | 6d 61 63 72 6f 0a 0a 7d |MBERS} |macro..}|
|00002250| 0a 54 68 65 20 6e 65 77 | 20 44 45 43 4c 41 52 45 |.The new| DECLARE|
|00002260| 5f 4d 45 4d 42 45 52 53 | 20 70 72 65 70 72 6f 63 |_MEMBERS| preproc|
|00002270| 65 73 73 6f 72 20 6d 61 | 63 72 6f 20 67 65 6e 65 |essor ma|cro gene|
|00002280| 72 61 74 65 73 20 74 68 | 65 20 64 65 63 6c 61 72 |rates th|e declar|
|00002290| 61 74 69 6f 6e 73 20 66 | 6f 72 20 74 68 65 20 0a |ations f|or the .|
|000022a0| 63 6c 61 73 73 20 64 65 | 73 63 72 69 70 74 6f 72 |class de|scriptor|
|000022b0| 20 61 6e 64 20 6d 6f 73 | 74 20 6f 66 20 74 68 65 | and mos|t of the|
|000022c0| 20 6d 65 6d 62 65 72 20 | 66 75 6e 63 74 69 6f 6e | member |function|
|000022d0| 73 20 74 68 61 74 20 61 | 6c 6c 20 4e 49 48 20 4c |s that a|ll NIH L|
|000022e0| 69 62 72 61 72 79 20 63 | 6c 61 73 73 65 73 20 0a |ibrary c|lasses .|
|000022f0| 6d 75 73 74 20 70 72 6f | 76 69 64 65 2c 20 69 6e |must pro|vide, in|
|00002300| 63 6c 75 64 69 6e 67 3a | 0a 0a 0a 5c 65 78 61 6d |cluding:|...\exam|
|00002310| 70 6c 65 7b 70 72 69 76 | 61 74 65 3a 0a 0a 09 73 |ple{priv|ate:...s|
|00002320| 74 61 74 69 63 20 43 6c | 61 73 73 20 63 6c 61 73 |tatic Cl|ass clas|
|00002330| 73 44 65 73 63 3b 09 09 | 2f 2f 20 63 6c 61 73 73 |sDesc;..|// class|
|00002340| 20 64 65 73 63 72 69 70 | 74 6f 72 0a 0a 70 75 62 | descrip|tor..pub|
|00002350| 6c 69 63 3a 0a 0a 5c 69 | 74 61 6c 69 63 7b 09 63 |lic:..\i|talic{.c|
|00002360| 6c 61 73 73 6e 61 6d 65 | 7d 2a 20 63 61 73 74 44 |lassname|}* castD|
|00002370| 6f 77 6e 28 4f 62 6a 65 | 63 74 2a 29 3b 0a 0a 09 |own(Obje|ct*);...|
|00002380| 63 6f 6e 73 74 20 5c 69 | 74 61 6c 69 63 7b 63 6c |const \i|talic{cl|
|00002390| 61 73 73 6e 61 6d 65 7d | 2a 20 63 61 73 74 44 6f |assname}|* castDo|
|000023a0| 77 6e 28 63 6f 6e 73 74 | 20 4f 62 6a 65 63 74 2a |wn(const| Object*|
|000023b0| 29 3b 0a 0a 09 5c 69 74 | 61 6c 69 63 7b 63 6c 61 |);...\it|alic{cla|
|000023c0| 73 73 6e 61 6d 65 7d 26 | 20 63 61 73 74 44 6f 77 |ssname}&| castDow|
|000023d0| 6e 28 4f 62 6a 65 63 74 | 26 29 3b 0a 0a 09 63 6f |n(Object|&);...co|
|000023e0| 6e 73 74 20 5c 69 74 61 | 6c 69 63 7b 63 6c 61 73 |nst \ita|lic{clas|
|000023f0| 73 6e 61 6d 65 7d 26 20 | 63 61 73 74 44 6f 77 6e |sname}& |castDown|
|00002400| 28 63 6f 6e 73 74 20 4f | 62 6a 65 63 74 26 29 3b |(const O|bject&);|
|00002410| 0a 0a 09 73 74 61 74 69 | 63 20 63 6f 6e 73 74 20 |...stati|c const |
|00002420| 43 6c 61 73 73 2a 20 64 | 65 73 63 28 29 3b 09 09 |Class* d|esc();..|
|00002430| 2f 2f 20 72 65 74 75 72 | 6e 20 63 6c 61 73 73 20 |// retur|n class |
|00002440| 64 65 73 63 72 69 70 74 | 6f 72 0a 0a 09 73 74 61 |descript|or...sta|
|00002450| 74 69 63 20 5c 69 74 61 | 6c 69 63 7b 63 6c 61 73 |tic \ita|lic{clas|
|00002460| 73 6e 61 6d 65 7d 2a 20 | 72 65 61 64 46 72 6f 6d |sname}* |readFrom|
|00002470| 28 4f 49 4f 69 6e 26 29 | 3b 0a 0a 09 73 74 61 74 |(OIOin&)|;...stat|
|00002480| 69 63 20 5c 69 74 61 6c | 69 63 7b 63 6c 61 73 73 |ic \ital|ic{class|
|00002490| 6e 61 6d 65 7d 2a 20 72 | 65 61 64 46 72 6f 6d 28 |name}* r|eadFrom(|
|000024a0| 4f 49 4f 69 66 64 26 29 | 3b 0a 0a 09 5c 69 74 61 |OIOifd&)|;...\ita|
|000024b0| 6c 69 63 7b 63 6c 61 73 | 73 6e 61 6d 65 7d 28 4f |lic{clas|sname}(O|
|000024c0| 49 4f 69 6e 26 29 3b 09 | 09 09 2f 2f 20 72 65 61 |IOin&);.|..// rea|
|000024d0| 64 46 72 6f 6d 28 29 20 | 63 6f 6e 73 74 72 75 63 |dFrom() |construc|
|000024e0| 74 6f 72 73 0a 0a 09 5c | 69 74 61 6c 69 63 7b 63 |tors...\|italic{c|
|000024f0| 6c 61 73 73 6e 61 6d 65 | 7d 28 4f 49 4f 6f 75 74 |lassname|}(OIOout|
|00002500| 26 29 3b 0a 0a 09 76 69 | 72 74 75 61 6c 20 63 6f |&);...vi|rtual co|
|00002510| 6e 73 74 20 43 6c 61 73 | 73 2a 20 69 73 41 28 29 |nst Clas|s* isA()|
|00002520| 20 63 6f 6e 73 74 3b 0a | 0a 09 76 69 72 74 75 61 | const;.|..virtua|
|00002530| 6c 20 4f 62 6a 65 63 74 | 2a 20 73 68 61 6c 6c 6f |l Object|* shallo|
|00002540| 77 43 6f 70 79 28 29 20 | 63 6f 6e 73 74 3b 0a 0a |wCopy() |const;..|
|00002550| 09 76 69 72 74 75 61 6c | 20 76 6f 69 64 2a 20 5f |.virtual| void* _|
|00002560| 63 61 73 74 64 6f 77 6e | 28 63 6f 6e 73 74 20 43 |castdown|(const C|
|00002570| 6c 61 73 73 26 29 20 63 | 6f 6e 73 74 3b 0a 0a 70 |lass&) c|onst;..p|
|00002580| 72 6f 74 65 63 74 65 64 | 3a 0a 0a 20 20 20 76 6f |rotected|:.. vo|
|00002590| 69 64 20 64 65 65 70 65 | 6e 56 42 61 73 65 28 29 |id deepe|nVBase()|
|000025a0| 3b 0a 0a 09 76 6f 69 64 | 20 73 74 6f 72 65 56 42 |;...void| storeVB|
|000025b0| 61 73 65 4f 6e 28 4f 49 | 4f 6f 66 64 26 29 20 63 |aseOn(OI|Oofd&) c|
|000025c0| 6f 6e 73 74 3b 09 2f 2f | 20 73 74 6f 72 65 20 76 |onst;.//| store v|
|000025d0| 69 72 74 75 61 6c 20 62 | 61 73 65 20 63 6c 61 73 |irtual b|ase clas|
|000025e0| 73 0a 0a 09 76 6f 69 64 | 20 73 74 6f 72 65 56 42 |s...void| storeVB|
|000025f0| 61 73 65 4f 6e 28 4f 49 | 4f 6f 75 74 26 29 20 63 |aseOn(OI|Oout&) c|
|00002600| 6f 6e 73 74 3b 0a 0a 70 | 72 69 76 61 74 65 3a 0a |onst;..p|rivate:.|
|00002610| 0a 09 73 74 61 74 69 63 | 20 4f 62 6a 65 63 74 2a |..static| Object*|
|00002620| 20 72 65 61 64 65 72 28 | 4f 49 4f 69 6e 26 20 73 | reader(|OIOin& s|
|00002630| 74 72 6d 29 3b 0a 0a 09 | 73 74 61 74 69 63 20 4f |trm);...|static O|
|00002640| 62 6a 65 63 74 2a 20 72 | 65 61 64 65 72 28 4f 49 |bject* r|eader(OI|
|00002650| 4f 69 66 64 26 20 66 64 | 29 3b 0a 0a 7d 0a 54 68 |Oifd& fd|);..}.Th|
|00002660| 65 20 44 45 43 4c 41 52 | 45 5f 4d 45 4d 42 45 52 |e DECLAR|E_MEMBER|
|00002670| 53 20 6d 61 63 72 6f 20 | 74 61 6b 65 73 20 61 20 |S macro |takes a |
|00002680| 73 69 6e 67 6c 65 20 61 | 72 67 75 6d 65 6e 74 2c |single a|rgument,|
|00002690| 20 74 68 65 20 6e 61 6d | 65 20 6f 66 20 74 68 65 | the nam|e of the|
|000026a0| 20 63 6c 61 73 73 20 62 | 65 69 6e 67 20 0a 64 65 | class b|eing .de|
|000026b0| 63 6c 61 72 65 64 2e 0a | 0a 0a 5c 73 75 62 73 65 |clared..|..\subse|
|000026c0| 63 74 69 6f 6e 7b 4e 65 | 77 20 69 6d 70 6c 65 6d |ction{Ne|w implem|
|000026d0| 65 6e 74 61 74 69 6f 6e | 20 6f 66 20 50 72 6f 63 |entation| of Proc|
|000026e0| 65 73 73 20 63 6c 61 73 | 73 65 73 0a 0a 7d 0a 49 |ess clas|ses..}.I|
|000026f0| 6e 20 52 33 2e 30 2c 20 | 63 6c 61 73 73 20 5c 63 |n R3.0, |class \c|
|00002700| 6f 64 65 7b 50 72 6f 63 | 65 73 73 7d 20 68 61 73 |ode{Proc|ess} has|
|00002710| 20 74 77 6f 20 64 65 72 | 69 76 65 64 20 63 6c 61 | two der|ived cla|
|00002720| 73 73 65 73 2c 20 5c 63 | 6f 64 65 7b 53 74 61 63 |sses, \c|ode{Stac|
|00002730| 6b 50 72 6f 63 7d 20 61 | 6e 64 20 0a 5c 63 6f 64 |kProc} a|nd .\cod|
|00002740| 65 7b 48 65 61 70 50 72 | 6f 63 7d 2c 20 77 68 69 |e{HeapPr|oc}, whi|
|00002750| 63 68 20 73 65 72 76 65 | 20 61 73 20 74 68 65 20 |ch serve| as the |
|00002760| 62 61 73 65 20 63 6c 61 | 73 73 65 73 20 66 6f 72 |base cla|sses for|
|00002770| 20 63 6c 69 65 6e 74 20 | 70 72 6f 63 65 73 73 65 | client |processe|
|00002780| 73 2e 20 0a 20 5c 63 6f | 64 65 7b 53 74 61 63 6b |s. . \co|de{Stack|
|00002790| 50 72 6f 63 7d 20 61 6e | 64 20 5c 63 6f 64 65 7b |Proc} an|d \code{|
|000027a0| 48 65 61 70 50 72 6f 63 | 7d 20 64 69 66 66 65 72 |HeapProc|} differ|
|000027b0| 20 69 6e 20 77 68 65 72 | 65 20 61 20 70 72 6f 63 | in wher|e a proc|
|000027c0| 65 73 73 27 73 20 73 74 | 61 63 6b 20 69 73 20 0a |ess's st|ack is .|
|000027d0| 6c 6f 63 61 74 65 64 20 | 77 68 65 6e 20 74 68 65 |located |when the|
|000027e0| 20 70 72 6f 63 65 73 73 | 20 69 73 20 72 75 6e 6e | process| is runn|
|000027f0| 69 6e 67 3a 20 61 20 5c | 63 6f 64 65 7b 53 74 61 |ing: a \|code{Sta|
|00002800| 63 6b 50 72 6f 63 7d 20 | 68 61 73 20 69 74 73 20 |ckProc} |has its |
|00002810| 73 74 61 63 6b 20 6c 6f | 63 61 74 65 64 20 0a 6f |stack lo|cated .o|
|00002820| 6e 20 74 68 65 20 72 65 | 61 6c 20 73 74 61 63 6b |n the re|al stack|
|00002830| 20 69 6e 20 74 68 65 20 | 73 74 61 63 6b 20 73 65 | in the |stack se|
|00002840| 67 6d 65 6e 74 2c 20 77 | 68 69 6c 65 20 61 20 5c |gment, w|hile a \|
|00002850| 63 6f 64 65 7b 48 65 61 | 70 50 72 6f 63 7d 20 68 |code{Hea|pProc} h|
|00002860| 61 73 20 69 74 73 20 73 | 74 61 63 6b 20 0a 69 6e |as its s|tack .in|
|00002870| 20 74 68 65 20 66 72 65 | 65 20 73 74 6f 72 61 67 | the fre|e storag|
|00002880| 65 20 61 72 65 61 20 69 | 6e 20 74 68 65 20 64 61 |e area i|n the da|
|00002890| 74 61 20 73 65 67 6d 65 | 6e 74 2e 20 20 41 20 63 |ta segme|nt. A c|
|000028a0| 6f 6e 74 65 78 74 20 73 | 77 69 74 63 68 20 6f 66 |ontext s|witch of|
|000028b0| 20 61 20 0a 5c 63 6f 64 | 65 7b 53 74 61 63 6b 50 | a .\cod|e{StackP|
|000028c0| 72 6f 63 7d 20 69 6e 76 | 6f 6c 76 65 73 20 63 6f |roc} inv|olves co|
|000028d0| 70 79 69 6e 67 20 74 68 | 65 20 61 63 74 69 76 65 |pying th|e active|
|000028e0| 20 70 61 72 74 20 6f 66 | 20 74 68 65 20 63 75 72 | part of| the cur|
|000028f0| 72 65 6e 74 20 70 72 6f | 63 65 73 73 27 73 20 0a |rent pro|cess's .|
|00002900| 73 74 61 63 6b 20 69 6e | 74 6f 20 61 20 73 61 76 |stack in|to a sav|
|00002910| 65 20 61 72 65 61 2c 20 | 74 68 65 6e 20 63 6f 70 |e area, |then cop|
|00002920| 79 69 6e 67 20 74 68 65 | 20 73 61 76 65 64 20 73 |ying the| saved s|
|00002930| 74 61 63 6b 20 6f 66 20 | 74 68 65 20 6e 65 77 20 |tack of |the new |
|00002940| 70 72 6f 63 65 73 73 20 | 6f 6e 74 6f 20 0a 74 68 |process |onto .th|
|00002950| 65 20 72 65 61 6c 20 73 | 74 61 63 6b 2e 20 20 41 |e real s|tack. A|
|00002960| 20 63 6f 6e 74 65 78 74 | 20 73 77 69 74 63 68 20 | context| switch |
|00002970| 6f 66 20 61 20 5c 63 6f | 64 65 7b 48 65 61 70 50 |of a \co|de{HeapP|
|00002980| 72 6f 63 7d 20 69 6e 76 | 6f 6c 76 65 73 20 73 69 |roc} inv|olves si|
|00002990| 6d 70 6c 79 20 0a 72 65 | 73 65 74 74 69 6e 67 20 |mply .re|setting |
|000029a0| 74 68 65 20 70 72 6f 63 | 65 73 73 6f 72 27 73 20 |the proc|essor's |
|000029b0| 73 74 61 63 6b 20 70 6f | 69 6e 74 65 72 20 61 6e |stack po|inter an|
|000029c0| 64 20 66 72 61 6d 65 20 | 70 6f 69 6e 74 65 72 20 |d frame |pointer |
|000029d0| 72 65 67 69 73 74 65 72 | 73 20 74 6f 20 70 6f 69 |register|s to poi|
|000029e0| 6e 74 20 0a 74 6f 20 74 | 68 65 20 6e 65 77 20 73 |nt .to t|he new s|
|000029f0| 74 61 63 6b 2c 20 73 6f | 20 61 20 5c 63 6f 64 65 |tack, so| a \code|
|00002a00| 7b 53 74 61 63 6b 50 72 | 6f 63 7d 20 63 6f 6e 74 |{StackPr|oc} cont|
|00002a10| 65 78 74 20 73 77 69 74 | 63 68 20 69 73 20 6d 75 |ext swit|ch is mu|
|00002a20| 63 68 20 73 6c 6f 77 65 | 72 20 74 68 61 6e 20 61 |ch slowe|r than a|
|00002a30| 20 0a 5c 63 6f 64 65 7b | 48 65 61 70 50 72 6f 63 | .\code{|HeapProc|
|00002a40| 7d 20 63 6f 6e 74 65 78 | 74 20 73 77 69 74 63 68 |} contex|t switch|
|00002a50| 2e 20 20 48 6f 77 65 76 | 65 72 2c 20 75 73 69 6e |. Howev|er, usin|
|00002a60| 67 20 5c 63 6f 64 65 7b | 48 65 61 70 50 72 6f 63 |g \code{|HeapProc|
|00002a70| 7d 73 20 74 65 6e 64 73 | 20 74 6f 20 0a 62 72 65 |}s tends| to .bre|
|00002a80| 61 6b 20 64 65 62 75 67 | 67 65 72 73 2c 20 77 68 |ak debug|gers, wh|
|00002a90| 69 63 68 20 75 73 75 61 | 6c 6c 79 20 63 61 6e 27 |ich usua|lly can'|
|00002aa0| 74 20 63 6f 70 65 20 77 | 69 74 68 20 74 68 65 20 |t cope w|ith the |
|00002ab0| 62 69 7a 61 72 72 65 20 | 73 74 61 63 6b 20 6c 6f |bizarre |stack lo|
|00002ac0| 63 61 74 69 6f 6e 2c 20 | 73 6f 20 0a 70 72 6f 67 |cation, |so .prog|
|00002ad0| 72 61 6d 73 20 75 73 69 | 6e 67 20 74 68 65 6d 20 |rams usi|ng them |
|00002ae0| 61 72 65 20 64 69 66 66 | 69 63 75 6c 74 20 74 6f |are diff|icult to|
|00002af0| 20 64 65 62 75 67 2e 20 | 20 41 6c 73 6f 2c 20 74 | debug. | Also, t|
|00002b00| 68 65 20 73 74 61 63 6b | 20 61 72 65 61 20 66 6f |he stack| area fo|
|00002b10| 72 20 61 20 0a 5c 63 6f | 64 65 7b 48 65 61 70 50 |r a .\co|de{HeapP|
|00002b20| 72 6f 63 7d 20 6d 75 73 | 74 20 62 65 20 73 70 65 |roc} mus|t be spe|
|00002b30| 63 69 66 69 65 64 20 77 | 68 65 6e 20 69 74 20 69 |cified w|hen it i|
|00002b40| 73 20 63 6f 6e 73 74 72 | 75 63 74 65 64 2c 20 61 |s constr|ucted, a|
|00002b50| 6e 64 20 6d 75 73 74 20 | 62 65 20 6c 61 72 67 65 |nd must |be large|
|00002b60| 20 0a 65 6e 6f 75 67 68 | 20 74 6f 20 68 6f 6c 64 | .enough| to hold|
|00002b70| 20 74 68 65 20 6c 61 72 | 67 65 73 74 20 73 74 61 | the lar|gest sta|
|00002b80| 63 6b 20 74 68 61 74 20 | 63 61 6e 20 6f 63 63 75 |ck that |can occu|
|00002b90| 72 20 61 6e 79 74 69 6d | 65 20 64 75 72 69 6e 67 |r anytim|e during|
|00002ba0| 20 65 78 65 63 75 74 69 | 6f 6e 2e 20 20 49 6e 20 | executi|on. In |
|00002bb0| 0a 63 6f 6e 74 72 61 73 | 74 2c 20 74 68 65 20 73 |.contras|t, the s|
|00002bc0| 74 61 63 6b 20 73 61 76 | 65 20 61 72 65 61 20 66 |tack sav|e area f|
|00002bd0| 6f 72 20 61 20 5c 63 6f | 64 65 7b 53 74 61 63 6b |or a \co|de{Stack|
|00002be0| 50 72 6f 63 7d 20 67 72 | 6f 77 73 20 69 6e 20 73 |Proc} gr|ows in s|
|00002bf0| 69 7a 65 20 69 66 20 0a | 6e 65 63 65 73 73 61 72 |ize if .|necessar|
|00002c00| 79 20 61 6e 64 20 6d 75 | 73 74 20 6f 6e 6c 79 20 |y and mu|st only |
|00002c10| 62 65 20 6c 61 72 67 65 | 20 65 6e 6f 75 67 68 20 |be large| enough |
|00002c20| 74 6f 20 68 6f 6c 64 20 | 74 68 65 20 6c 61 72 67 |to hold |the larg|
|00002c30| 65 73 74 20 73 74 61 63 | 6b 20 69 6e 20 75 73 65 |est stac|k in use|
|00002c40| 20 77 68 65 6e 20 0a 74 | 68 65 20 70 72 6f 63 65 | when .t|he proce|
|00002c50| 73 73 20 69 73 20 73 75 | 73 70 65 6e 64 65 64 2e |ss is su|spended.|
|00002c60| 20 20 54 68 75 73 2c 20 | 74 68 65 20 74 72 61 64 | Thus, |the trad|
|00002c70| 65 6f 66 66 20 69 73 20 | 64 65 62 75 67 67 61 62 |eoff is |debuggab|
|00002c80| 69 6c 69 74 79 20 61 6e | 64 20 72 65 64 75 63 65 |ility an|d reduce|
|00002c90| 64 20 0a 6d 65 6d 6f 72 | 79 20 72 65 71 75 69 72 |d .memor|y requir|
|00002ca0| 65 6d 65 6e 74 20 76 73 | 2e 20 73 70 65 65 64 2e |ement vs|. speed.|
|00002cb0| 0a 0a 0a 46 69 64 64 6c | 69 6e 67 20 77 69 74 68 |...Fiddl|ing with|
|00002cc0| 20 74 68 65 20 73 74 61 | 63 6b 20 61 72 65 61 20 | the sta|ck area |
|00002cd0| 61 6e 64 20 6d 61 63 68 | 69 6e 65 20 72 65 67 69 |and mach|ine regi|
|00002ce0| 73 74 65 72 73 20 69 73 | 20 73 6f 6d 65 74 68 69 |sters is| somethi|
|00002cf0| 6e 67 20 79 6f 75 20 63 | 61 6e 27 74 20 64 6f 20 |ng you c|an't do |
|00002d00| 0a 64 69 72 65 63 74 6c | 79 20 66 72 6f 6d 20 43 |.directl|y from C|
|00002d10| 2b 2b 2c 20 73 6f 20 70 | 72 6f 63 65 73 73 65 73 |++, so p|rocesses|
|00002d20| 20 61 72 65 20 69 6e 68 | 65 72 65 6e 74 6c 79 20 | are inh|erently |
|00002d30| 6e 6f 6e 2d 70 6f 72 74 | 61 62 6c 65 2e 20 20 54 |non-port|able. T|
|00002d40| 68 65 20 52 33 2e 30 20 | 0a 69 6d 70 6c 65 6d 65 |he R3.0 |.impleme|
|00002d50| 6e 74 61 74 69 6f 6e 20 | 6f 66 20 74 68 65 20 5c |ntation |of the \|
|00002d60| 63 6f 64 65 7b 50 72 6f | 63 65 73 73 7d 20 63 6c |code{Pro|cess} cl|
|00002d70| 61 73 73 65 73 20 61 74 | 74 65 6d 70 74 73 20 74 |asses at|tempts t|
|00002d80| 6f 20 75 73 65 20 74 68 | 65 20 43 20 6c 69 62 72 |o use th|e C libr|
|00002d90| 61 72 79 20 0a 72 6f 75 | 74 69 6e 65 73 20 5c 63 |ary .rou|tines \c|
|00002da0| 6f 64 65 7b 73 65 74 6a | 6d 70 28 29 7d 2c 20 5c |ode{setj|mp()}, \|
|00002db0| 63 6f 64 65 7b 6c 6f 6e | 67 6a 6d 70 28 29 7d 2c |code{lon|gjmp()},|
|00002dc0| 20 61 6e 64 20 5c 63 6f | 64 65 7b 61 6c 6c 6f 63 | and \co|de{alloc|
|00002dd0| 61 28 29 7d 20 74 6f 20 | 64 6f 20 63 6f 6e 74 65 |a()} to |do conte|
|00002de0| 78 74 20 0a 73 77 69 74 | 63 68 69 6e 67 2e 20 20 |xt .swit|ching. |
|00002df0| 57 68 69 6c 65 20 74 68 | 69 73 20 77 6f 72 6b 73 |While th|is works|
|00002e00| 20 6f 6e 20 6d 61 6e 79 | 20 6d 61 63 68 69 6e 65 | on many| machine|
|00002e10| 73 2c 20 79 6f 75 20 6d | 61 79 20 6e 65 65 64 20 |s, you m|ay need |
|00002e20| 74 6f 20 77 72 69 74 65 | 20 79 6f 75 72 20 6f 77 |to write| your ow|
|00002e30| 6e 20 0a 76 65 72 73 69 | 6f 6e 73 20 6f 66 20 74 |n .versi|ons of t|
|00002e40| 68 65 73 65 20 72 6f 75 | 74 69 6e 65 73 20 66 6f |hese rou|tines fo|
|00002e50| 72 20 6d 61 63 68 69 6e | 65 73 20 6f 6e 20 77 68 |r machin|es on wh|
|00002e60| 69 63 68 20 69 74 20 64 | 6f 65 73 6e 27 74 2e 20 |ich it d|oesn't. |
|00002e70| 20 53 65 65 20 74 68 65 | 20 73 65 63 74 69 6f 6e | See the| section|
|00002e80| 20 0a 6f 6e 20 5c 69 74 | 61 6c 69 63 7b 50 4f 52 | .on \it|alic{POR|
|00002e90| 54 49 4e 47 20 54 48 45 | 20 50 52 4f 43 45 53 53 |TING THE| PROCESS|
|00002ea0| 20 43 4c 41 53 53 45 53 | 7d 20 66 6f 72 20 69 6e | CLASSES|} for in|
|00002eb0| 73 74 72 75 63 74 69 6f | 6e 73 2e 0a 0a 0a 5c 73 |structio|ns....\s|
|00002ec0| 75 62 73 65 63 74 69 6f | 6e 7b 45 78 74 65 72 6e |ubsectio|n{Extern|
|00002ed0| 61 6c 20 5c 63 6f 64 65 | 7b 63 6c 61 73 73 5f 7d |al \code|{class_}|
|00002ee0| 5c 69 74 61 6c 69 63 7b | 63 6c 61 73 73 6e 61 6d |\italic{|classnam|
|00002ef0| 65 7d 20 69 64 65 6e 74 | 69 66 69 65 72 73 20 65 |e} ident|ifiers e|
|00002f00| 6c 69 6d 69 6e 61 74 65 | 64 0a 0a 7d 0a 54 68 65 |liminate|d..}.The|
|00002f10| 20 63 6c 61 73 73 20 64 | 65 73 63 72 69 70 74 6f | class d|escripto|
|00002f20| 72 20 66 6f 72 20 65 61 | 63 68 20 63 6c 61 73 73 |r for ea|ch class|
|00002f30| 20 6e 6f 20 6c 6f 6e 67 | 65 72 20 68 61 73 20 61 | no long|er has a|
|00002f40| 6e 20 65 78 74 65 72 6e | 61 6c 20 69 64 65 6e 74 |n extern|al ident|
|00002f50| 69 66 69 65 72 20 6f 66 | 20 0a 74 68 65 20 66 6f |ifier of| .the fo|
|00002f60| 72 6d 20 5c 63 6f 64 65 | 7b 63 6c 61 73 73 5f 7d |rm \code|{class_}|
|00002f70| 5c 69 74 61 6c 69 63 7b | 63 6c 61 73 73 6e 61 6d |\italic{|classnam|
|00002f80| 65 7d 2e 20 20 49 6e 73 | 74 65 61 64 2c 20 74 68 |e}. Ins|tead, th|
|00002f90| 65 20 63 6c 61 73 73 20 | 64 65 73 63 72 69 70 74 |e class |descript|
|00002fa0| 6f 72 20 69 73 20 61 20 | 0a 73 74 61 74 69 63 20 |or is a |.static |
|00002fb0| 6d 65 6d 62 65 72 20 76 | 61 72 69 61 62 6c 65 20 |member v|ariable |
|00002fc0| 6f 66 20 65 61 63 68 20 | 63 6c 61 73 73 2c 20 61 |of each |class, a|
|00002fd0| 6e 64 20 74 68 65 20 69 | 6e 6c 69 6e 65 20 73 74 |nd the i|nline st|
|00002fe0| 61 74 69 63 20 6d 65 6d | 62 65 72 20 66 75 6e 63 |atic mem|ber func|
|00002ff0| 74 69 6f 6e 20 0a 5c 63 | 6f 64 65 7b 64 65 73 63 |tion .\c|ode{desc|
|00003000| 28 29 7d 20 72 65 74 75 | 72 6e 73 20 69 74 73 20 |()} retu|rns its |
|00003010| 61 64 64 72 65 73 73 2e | 0a 0a 0a 5c 73 75 62 73 |address.|...\subs|
|00003020| 65 63 74 69 6f 6e 7b 43 | 68 61 6e 67 65 73 20 74 |ection{C|hanges t|
|00003030| 6f 20 4f 62 6a 65 63 74 | 20 49 2f 4f 0a 0a 7d 0a |o Object| I/O..}.|
|00003040| 50 72 65 76 69 6f 75 73 | 20 72 65 6c 65 61 73 65 |Previous| release|
|00003050| 73 20 6f 66 20 4f 4f 50 | 53 20 68 61 76 65 20 61 |s of OOP|S have a|
|00003060| 20 66 75 6e 64 61 6d 65 | 6e 74 61 6c 20 70 72 6f | fundame|ntal pro|
|00003070| 62 6c 65 6d 20 69 6e 20 | 74 68 65 20 77 61 79 20 |blem in |the way |
|00003080| 74 68 65 79 20 68 61 6e | 64 6c 65 20 0a 6f 62 6a |they han|dle .obj|
|00003090| 65 63 74 20 49 2f 4f 20 | 66 6f 72 20 63 6c 61 73 |ect I/O |for clas|
|000030a0| 73 65 73 20 77 69 74 68 | 20 6d 65 6d 62 65 72 20 |ses with| member |
|000030b0| 76 61 72 69 61 62 6c 65 | 73 20 74 68 61 74 20 61 |variable|s that a|
|000030c0| 72 65 20 63 6c 61 73 73 | 20 69 6e 73 74 61 6e 63 |re class| instanc|
|000030d0| 65 73 2e 20 20 46 6f 72 | 20 0a 65 78 61 6d 70 6c |es. For| .exampl|
|000030e0| 65 2c 20 63 6f 6e 73 69 | 64 65 72 20 61 6e 20 4f |e, consi|der an O|
|000030f0| 4f 50 53 20 63 6c 61 73 | 73 20 5c 63 6f 64 65 7b |OPS clas|s \code{|
|00003100| 58 7d 20 77 69 74 68 20 | 61 20 6d 65 6d 62 65 72 |X} with |a member|
|00003110| 20 76 61 72 69 61 62 6c | 65 20 6f 66 20 63 6c 61 | variabl|e of cla|
|00003120| 73 73 20 0a 5c 63 6f 64 | 65 7b 4d 7d 2c 20 77 68 |ss .\cod|e{M}, wh|
|00003130| 65 72 65 20 5c 63 6f 64 | 65 7b 4d 7d 20 69 73 20 |ere \cod|e{M} is |
|00003140| 61 6c 73 6f 20 61 6e 20 | 4f 4f 50 53 20 63 6c 61 |also an |OOPS cla|
|00003150| 73 73 3a 0a 0a 0a 5c 65 | 78 61 6d 70 6c 65 7b 63 |ss:...\e|xample{c|
|00003160| 6c 61 73 73 20 58 20 3a | 20 70 75 62 6c 69 63 20 |lass X :| public |
|00003170| 42 41 53 45 20 5c 7b 0a | 0a 20 20 20 20 4d 20 6d |BASE \{.|. M m|
|00003180| 3b 20 20 20 20 2f 2f 20 | 61 20 6d 65 6d 62 65 72 |; // |a member|
|00003190| 20 63 6c 61 73 73 20 69 | 6e 73 74 61 6e 63 65 0a | class i|nstance.|
|000031a0| 0a 20 20 20 20 4d 2a 20 | 70 3b 20 20 20 2f 2f 20 |. M* |p; // |
|000031b0| 61 20 6d 65 6d 62 65 72 | 20 70 6f 69 6e 74 65 72 |a member| pointer|
|000031c0| 20 74 6f 20 61 20 63 6c | 61 73 73 20 69 6e 73 74 | to a cl|ass inst|
|000031d0| 61 6e 63 65 0a 0a 20 20 | 20 20 69 6e 74 20 69 3b |ance.. | int i;|
|000031e0| 20 20 2f 2f 20 61 20 66 | 75 6e 64 61 6d 65 6e 74 | // a f|undament|
|000031f0| 61 6c 20 74 79 70 65 0a | 0a 2f 2f 20 2e 2e 2e 0a |al type.|.// ....|
|00003200| 0a 5c 7d 3b 0a 0a 7d 0a | 50 72 65 76 69 6f 75 73 |.\};..}.|Previous|
|00003210| 20 72 65 6c 65 61 73 65 | 73 20 69 6d 70 6c 65 6d | release|s implem|
|00003220| 65 6e 74 20 5c 63 6f 64 | 65 7b 58 3a 3a 73 74 6f |ent \cod|e{X::sto|
|00003230| 72 65 72 28 29 7d 20 61 | 6e 64 5c 63 6f 64 65 7b |rer()} a|nd\code{|
|00003240| 20 58 3a 3a 58 28 69 73 | 74 72 65 61 6d 26 2c 58 | X::X(is|tream&,X|
|00003250| 26 29 7d 20 61 73 20 0a | 66 6f 6c 6c 6f 77 73 3a |&)} as .|follows:|
|00003260| 0a 0a 0a 5c 65 78 61 6d | 70 6c 65 7b 76 6f 69 64 |...\exam|ple{void|
|00003270| 20 58 3a 3a 73 74 6f 72 | 65 72 28 6f 73 74 72 65 | X::stor|er(ostre|
|00003280| 61 6d 26 20 73 74 72 6d | 29 0a 0a 5c 7b 0a 0a 20 |am& strm|)..\{.. |
|00003290| 20 20 20 42 41 53 45 3a | 3a 73 74 6f 72 65 72 28 | BASE:|:storer(|
|000032a0| 73 74 72 6d 29 3b 0a 0a | 20 20 20 20 6d 2e 73 74 |strm);..| m.st|
|000032b0| 6f 72 65 4f 6e 28 73 74 | 72 6d 29 3b 0a 0a 20 20 |oreOn(st|rm);.. |
|000032c0| 20 20 70 2d 3e 73 74 6f | 72 65 4f 6e 28 73 74 72 | p->sto|reOn(str|
|000032d0| 6d 29 3b 0a 0a 20 20 20 | 20 73 74 72 6d 20 3c 3c |m);.. | strm <<|
|000032e0| 20 69 20 3c 3c 20 22 20 | 22 3b 0a 0a 5c 7d 0a 0a | i << " |";..\}..|
|000032f0| 0a 76 6f 69 64 20 58 3a | 3a 58 28 69 73 74 72 65 |.void X:|:X(istre|
|00003300| 61 6d 26 73 74 72 6d 2c | 20 58 26 20 77 68 65 72 |am&strm,| X& wher|
|00003310| 65 29 0a 0a 20 20 20 20 | 3a 20 28 73 74 72 6d 2c |e).. |: (strm,|
|00003320| 77 68 65 72 65 29 0a 0a | 5c 7b 0a 0a 20 20 20 20 |where)..|\{.. |
|00003330| 74 68 69 73 20 3d 20 26 | 77 68 65 72 65 3b 0a 0a |this = &|where;..|
|00003340| 20 20 20 20 72 65 61 64 | 46 72 6f 6d 28 73 74 72 | read|From(str|
|00003350| 6d 2c 22 4d 22 2c 6d 29 | 3b 0a 0a 20 20 20 20 70 |m,"M",m)|;.. p|
|00003360| 20 3d 20 28 4d 2a 29 72 | 65 61 64 46 72 6f 6d 28 | = (M*)r|eadFrom(|
|00003370| 73 74 72 6d 2c 22 4d 22 | 29 3b 0a 0a 20 20 20 20 |strm,"M"|);.. |
|00003380| 73 74 72 6d 20 3e 3e 20 | 69 3b 0a 0a 5c 7d 0a 0a |strm >> |i;..\}..|
|00003390| 0a 76 6f 69 64 20 58 3a | 3a 73 74 6f 72 65 72 28 |.void X:|:storer(|
|000033a0| 46 69 6c 65 44 65 73 63 | 54 79 26 20 66 64 29 0a |FileDesc|Ty& fd).|
|000033b0| 0a 5c 7b 0a 0a 20 20 20 | 20 42 41 53 45 3a 3a 73 |.\{.. | BASE::s|
|000033c0| 74 6f 72 65 72 28 66 64 | 29 3b 0a 0a 20 20 20 20 |torer(fd|);.. |
|000033d0| 6d 2e 73 74 6f 72 65 4f | 6e 28 66 64 29 3b 0a 0a |m.storeO|n(fd);..|
|000033e0| 20 20 20 20 70 2d 3e 73 | 74 6f 72 65 4f 6e 28 66 | p->s|toreOn(f|
|000033f0| 64 29 3b 0a 0a 20 20 20 | 20 73 74 6f 72 65 42 69 |d);.. | storeBi|
|00003400| 6e 28 66 64 2c 69 29 3b | 0a 0a 5c 7d 0a 0a 0a 76 |n(fd,i);|..\}...v|
|00003410| 6f 69 64 20 58 3a 3a 58 | 28 46 69 6c 65 44 65 73 |oid X::X|(FileDes|
|00003420| 63 54 79 26 20 66 64 2c | 20 58 26 20 77 68 65 72 |cTy& fd,| X& wher|
|00003430| 65 29 0a 0a 20 20 20 20 | 3a 20 28 66 64 2c 77 68 |e).. |: (fd,wh|
|00003440| 65 72 65 29 0a 0a 5c 7b | 0a 0a 20 20 20 20 74 68 |ere)..\{|.. th|
|00003450| 69 73 20 3d 20 26 77 68 | 65 72 65 3b 0a 0a 20 20 |is = &wh|ere;.. |
|00003460| 20 20 72 65 61 64 46 72 | 6f 6d 28 66 64 2c 22 4d | readFr|om(fd,"M|
|00003470| 22 2c 6d 29 3b 0a 0a 20 | 20 20 20 70 20 3d 20 28 |",m);.. | p = (|
|00003480| 4d 2a 29 72 65 61 64 46 | 72 6f 6d 28 66 64 2c 22 |M*)readF|rom(fd,"|
|00003490| 4d 22 29 3b 0a 0a 20 20 | 20 20 72 65 61 64 42 69 |M");.. | readBi|
|000034a0| 6e 28 66 64 2c 69 29 3b | 0a 0a 5c 7d 0a 0a 7d 0a |n(fd,i);|..\}..}.|
|000034b0| 54 68 65 20 70 72 6f 62 | 6c 65 6d 20 69 73 20 74 |The prob|lem is t|
|000034c0| 68 61 74 20 74 68 69 73 | 20 63 6f 6e 73 74 72 75 |hat this| constru|
|000034d0| 63 74 6f 72 20 66 69 72 | 73 74 20 69 6e 69 74 69 |ctor fir|st initi|
|000034e0| 61 6c 69 7a 65 73 20 5c | 63 6f 64 65 7b 6d 7d 20 |alizes \|code{m} |
|000034f0| 75 73 69 6e 67 20 74 68 | 65 20 0a 5c 63 6f 64 65 |using th|e .\code|
|00003500| 7b 4d 3a 3a 4d 28 29 7d | 20 63 6f 6e 73 74 72 75 |{M::M()}| constru|
|00003510| 63 74 6f 72 2c 20 74 68 | 65 6e 20 63 61 6c 6c 73 |ctor, th|en calls|
|00003520| 20 5c 63 6f 64 65 7b 72 | 65 61 64 46 72 6f 6d 28 | \code{r|eadFrom(|
|00003530| 29 7d 2c 20 77 68 69 63 | 68 20 6f 76 65 72 77 72 |)}, whic|h overwr|
|00003540| 69 74 65 73 20 74 68 69 | 73 20 0a 69 6e 69 74 69 |ites thi|s .initi|
|00003550| 61 6c 69 7a 65 64 20 69 | 6e 73 74 61 6e 63 65 20 |alized i|nstance |
|00003560| 77 69 74 68 20 61 6e 20 | 69 6e 73 74 61 6e 63 65 |with an |instance|
|00003570| 20 63 6f 6e 73 74 72 75 | 63 74 65 64 20 62 79 20 | constru|cted by |
|00003580| 72 65 61 64 69 6e 67 20 | 5c 63 6f 64 65 7b 73 74 |reading |\code{st|
|00003590| 72 6d 7d 2e 20 20 57 65 | 20 0a 64 69 64 6e 27 74 |rm}. We| .didn't|
|000035a0| 20 6e 6f 74 69 63 65 20 | 74 68 69 73 20 62 75 67 | notice |this bug|
|000035b0| 20 65 61 72 6c 69 65 72 | 20 62 65 63 61 75 73 65 | earlier| because|
|000035c0| 2c 20 69 6e 20 70 72 61 | 63 74 69 63 65 2c 20 74 |, in pra|ctice, t|
|000035d0| 68 65 20 70 72 6f 62 6c | 65 6d 20 6f 63 63 75 72 |he probl|em occur|
|000035e0| 73 20 6f 6e 6c 79 20 0a | 69 6e 20 63 6c 61 73 73 |s only .|in class|
|000035f0| 65 73 20 5c 63 6f 64 65 | 7b 52 65 63 74 61 6e 67 |es \code|{Rectang|
|00003600| 6c 65 7d 20 61 6e 64 20 | 5c 63 6f 64 65 7b 53 68 |le} and |\code{Sh|
|00003610| 61 72 65 64 51 75 65 75 | 65 7d 2c 20 61 6e 64 20 |aredQueu|e}, and |
|00003620| 68 61 73 20 6e 6f 20 6f | 62 76 69 6f 75 73 20 0a |has no o|bvious .|
|00003630| 63 6f 6e 73 65 71 75 65 | 6e 63 65 73 2e 20 20 54 |conseque|nces. T|
|00003640| 68 65 20 77 6f 72 73 74 | 20 74 68 61 74 20 69 73 |he worst| that is|
|00003650| 20 6c 69 6b 65 6c 79 20 | 74 6f 20 68 61 70 70 65 | likely |to happe|
|00003660| 6e 20 69 73 20 74 68 61 | 74 20 5c 63 6f 64 65 7b |n is tha|t \code{|
|00003670| 4d 3a 3a 4d 28 29 7d 20 | 0a 61 6c 6c 6f 63 61 74 |M::M()} |.allocat|
|00003680| 65 73 20 73 6f 6d 65 20 | 6d 65 6d 6f 72 79 20 74 |es some |memory t|
|00003690| 68 61 74 20 6e 65 76 65 | 72 20 67 65 74 73 20 72 |hat neve|r gets r|
|000036a0| 65 63 6c 61 69 6d 65 64 | 2e 0a 0a 0a 55 6e 66 6f |eclaimed|....Unfo|
|000036b0| 72 74 75 6e 61 74 65 6c | 79 2c 20 74 68 65 20 66 |rtunatel|y, the f|
|000036c0| 69 78 20 72 65 71 75 69 | 72 65 73 20 73 6f 6d 65 |ix requi|res some|
|000036d0| 20 77 69 64 65 73 70 72 | 65 61 64 20 63 68 61 6e | widespr|ead chan|
|000036e0| 67 65 73 2e 20 20 42 75 | 74 2c 20 69 74 20 74 75 |ges. Bu|t, it tu|
|000036f0| 72 6e 73 20 6f 75 74 20 | 0a 74 68 61 74 20 6e 75 |rns out |.that nu|
|00003700| 6d 65 72 6f 75 73 20 6f | 74 68 65 72 20 69 6d 70 |merous o|ther imp|
|00003710| 72 6f 76 65 6d 65 6e 74 | 73 20 62 65 63 6f 6d 65 |rovement|s become|
|00003720| 20 70 6f 73 73 69 62 6c | 65 2e 20 20 54 68 65 20 | possibl|e. The |
|00003730| 6e 65 77 20 66 6f 72 6d | 61 74 20 66 6f 72 20 0a |new form|at for .|
|00003740| 5c 63 6f 64 65 7b 73 74 | 6f 72 65 72 28 29 7d 20 |\code{st|orer()} |
|00003750| 66 75 6e 63 74 69 6f 6e | 73 20 61 6e 64 20 5c 63 |function|s and \c|
|00003760| 6f 64 65 7b 72 65 61 64 | 46 72 6f 6d 28 29 7d 20 |ode{read|From()} |
|00003770| 63 6f 6e 73 74 72 75 63 | 74 6f 72 73 20 77 68 65 |construc|tors whe|
|00003780| 6e 20 6e 6f 74 20 75 73 | 69 6e 67 20 4d 49 20 0a |n not us|ing MI .|
|00003790| 69 73 3a 0a 0a 0a 5c 65 | 78 61 6d 70 6c 65 7b 76 |is:...\e|xample{v|
|000037a0| 6f 69 64 20 58 3a 3a 73 | 74 6f 72 65 72 28 4f 49 |oid X::s|torer(OI|
|000037b0| 4f 6f 75 74 26 20 73 74 | 72 6d 29 0a 0a 5c 7b 0a |Oout& st|rm)..\{.|
|000037c0| 0a 20 20 20 20 42 41 53 | 45 3a 3a 73 74 6f 72 65 |. BAS|E::store|
|000037d0| 72 28 73 74 72 6d 29 3b | 0a 0a 20 20 20 20 6d 2e |r(strm);|.. m.|
|000037e0| 73 74 6f 72 65 4d 65 6d | 62 65 72 4f 6e 28 73 74 |storeMem|berOn(st|
|000037f0| 72 6d 29 3b 0a 0a 20 20 | 20 20 70 2d 3e 73 74 6f |rm);.. | p->sto|
|00003800| 72 65 4f 6e 28 73 74 72 | 6d 29 3b 0a 0a 20 20 20 |reOn(str|m);.. |
|00003810| 20 73 74 72 6d 20 3c 3c | 20 69 3b 0a 0a 5c 7d 0a | strm <<| i;..\}.|
|00003820| 0a 0a 76 6f 69 64 20 58 | 3a 3a 58 28 4f 49 4f 69 |..void X|::X(OIOi|
|00003830| 6e 26 20 73 74 72 6d 29 | 0a 0a 20 20 20 20 3a 20 |n& strm)|.. : |
|00003840| 28 73 74 72 6d 29 2c 20 | 6d 28 73 74 72 6d 29 0a |(strm), |m(strm).|
|00003850| 0a 5c 7b 0a 0a 20 20 20 | 20 70 20 3d 20 4d 3a 3a |.\{.. | p = M::|
|00003860| 72 65 61 64 46 72 6f 6d | 28 73 74 72 6d 29 3b 0a |readFrom|(strm);.|
|00003870| 0a 20 20 20 20 73 74 72 | 6d 20 3e 3e 20 69 3b 0a |. str|m >> i;.|
|00003880| 0a 5c 7d 0a 0a 0a 76 6f | 69 64 20 58 3a 3a 73 74 |.\}...vo|id X::st|
|00003890| 6f 72 65 72 28 4f 49 4f | 6f 66 64 26 20 66 64 29 |orer(OIO|ofd& fd)|
|000038a0| 0a 0a 5c 7b 0a 0a 20 20 | 20 20 42 41 53 45 3a 3a |..\{.. | BASE::|
|000038b0| 73 74 6f 72 65 72 28 66 | 64 29 3b 0a 0a 20 20 20 |storer(f|d);.. |
|000038c0| 20 6d 2e 73 74 6f 72 65 | 4d 65 6d 62 65 72 4f 6e | m.store|MemberOn|
|000038d0| 28 66 64 29 3b 0a 0a 20 | 20 20 20 70 2d 3e 73 74 |(fd);.. | p->st|
|000038e0| 6f 72 65 4f 6e 28 66 64 | 29 3b 0a 0a 20 20 20 20 |oreOn(fd|);.. |
|000038f0| 66 64 20 3c 3c 20 69 3b | 0a 0a 5c 7d 0a 0a 0a 76 |fd << i;|..\}...v|
|00003900| 6f 69 64 20 58 3a 3a 58 | 28 4f 49 4f 69 66 64 26 |oid X::X|(OIOifd&|
|00003910| 20 66 64 29 0a 0a 20 20 | 20 20 3a 20 28 66 64 29 | fd).. | : (fd)|
|00003920| 2c 20 6d 28 66 64 29 0a | 0a 5c 7b 0a 0a 20 20 20 |, m(fd).|.\{.. |
|00003930| 20 70 20 3d 20 4d 3a 3a | 72 65 61 64 46 72 6f 6d | p = M::|readFrom|
|00003940| 28 66 64 29 3b 0a 0a 20 | 20 20 20 66 64 20 3e 3e |(fd);.. | fd >>|
|00003950| 20 69 3b 0a 0a 5c 7d 0a | 0a 7d 0a 54 68 65 20 6e | i;..\}.|.}.The n|
|00003960| 65 77 20 66 6f 72 6d 61 | 74 20 69 73 20 73 69 6d |ew forma|t is sim|
|00003970| 70 6c 65 72 20 61 6e 64 | 20 63 6f 6e 73 69 73 74 |pler and| consist|
|00003980| 65 6e 74 2d 2d 2d 5c 63 | 6f 64 65 7b 73 74 6f 72 |ent---\c|ode{stor|
|00003990| 65 72 28 29 7d 20 66 75 | 6e 63 74 69 6f 6e 73 20 |er()} fu|nctions |
|000039a0| 61 6c 77 61 79 73 20 0a | 63 61 6c 6c 20 5c 63 6f |always .|call \co|
|000039b0| 64 65 7b 42 41 53 45 3a | 3a 73 74 6f 72 65 72 28 |de{BASE:|:storer(|
|000039c0| 29 7d 20 61 6e 64 20 5c | 63 6f 64 65 7b 58 3a 3a |)} and \|code{X::|
|000039d0| 58 28 4f 49 4f 69 6e 26 | 29 7d 20 63 6f 6e 73 74 |X(OIOin&|)} const|
|000039e0| 72 75 63 74 6f 72 73 20 | 61 6c 77 61 79 73 20 63 |ructors |always c|
|000039f0| 61 6c 6c 20 0a 5c 63 6f | 64 65 7b 42 41 53 45 3a |all .\co|de{BASE:|
|00003a00| 3a 42 41 53 45 28 4f 49 | 4f 69 6e 26 29 7d 2e 0a |:BASE(OI|Oin&)}..|
|00003a10| 0a 0a 5c 70 61 72 61 67 | 72 61 70 68 7b 50 75 62 |..\parag|raph{Pub|
|00003a20| 6c 69 63 20 5c 63 6f 64 | 65 7b 72 65 61 64 46 72 |lic \cod|e{readFr|
|00003a30| 6f 6d 28 29 7d 20 63 6f | 6e 73 74 72 75 63 74 6f |om()} co|nstructo|
|00003a40| 72 0a 0a 7d 0a 53 69 6e | 63 65 20 6f 74 68 65 72 |r..}.Sin|ce other|
|00003a50| 20 63 6c 61 73 73 65 73 | 20 69 6e 20 67 65 6e 65 | classes| in gene|
|00003a60| 72 61 6c 20 6d 75 73 74 | 20 68 61 76 65 20 61 63 |ral must| have ac|
|00003a70| 63 65 73 73 20 74 6f 20 | 5c 63 6f 64 65 7b 58 3a |cess to |\code{X:|
|00003a80| 3a 58 28 4f 49 4f 69 6e | 26 29 7d 2c 20 69 74 20 |:X(OIOin|&)}, it |
|00003a90| 0a 6d 75 73 74 20 62 65 | 20 70 75 62 6c 69 63 20 |.must be| public |
|00003aa0| 69 6e 73 74 65 61 64 20 | 6f 66 20 70 72 6f 74 65 |instead |of prote|
|00003ab0| 63 74 65 64 2c 20 72 65 | 71 75 69 72 69 6e 67 20 |cted, re|quiring |
|00003ac0| 61 20 63 68 61 6e 67 65 | 20 74 6f 20 61 6c 6c 20 |a change| to all |
|00003ad0| 68 65 61 64 65 72 20 66 | 69 6c 65 73 2e 0a 0a 0a |header f|iles....|
|00003ae0| 5c 70 61 72 61 67 72 61 | 70 68 7b 43 68 61 6e 67 |\paragra|ph{Chang|
|00003af0| 65 73 20 74 6f 20 5c 63 | 6f 64 65 7b 72 65 61 64 |es to \c|ode{read|
|00003b00| 46 72 6f 6d 28 29 7d 7d | 0a 0a 0a 41 73 20 65 78 |From()}}|...As ex|
|00003b10| 70 6c 61 69 6e 65 64 20 | 70 72 65 76 69 6f 75 73 |plained |previous|
|00003b20| 6c 79 2c 20 63 61 6c 6c | 73 20 74 6f 20 5c 63 6f |ly, call|s to \co|
|00003b30| 64 65 7b 72 65 61 64 46 | 72 6f 6d 28 29 7d 20 74 |de{readF|rom()} t|
|00003b40| 68 61 74 20 73 70 65 63 | 69 66 79 20 74 68 65 20 |hat spec|ify the |
|00003b50| 74 68 69 72 64 20 0a 61 | 72 67 75 6d 65 6e 74 20 |third .a|rgument |
|00003b60| 6f 76 65 72 77 72 69 74 | 65 20 61 6e 20 69 6e 69 |overwrit|e an ini|
|00003b70| 74 69 61 6c 69 7a 65 64 | 20 69 6e 73 74 61 6e 63 |tialized| instanc|
|00003b80| 65 20 6f 66 20 61 20 63 | 6c 61 73 73 2e 20 20 53 |e of a c|lass. S|
|00003b90| 69 6e 63 65 20 74 68 69 | 73 20 69 73 20 0a 67 65 |ince thi|s is .ge|
|00003ba0| 6e 65 72 61 6c 6c 79 20 | 61 20 62 61 64 20 74 68 |nerally |a bad th|
|00003bb0| 69 6e 67 20 74 6f 20 64 | 6f 2c 20 74 68 65 20 74 |ing to d|o, the t|
|00003bc0| 68 69 72 64 20 61 72 67 | 75 6d 65 6e 74 20 74 6f |hird arg|ument to|
|00003bd0| 20 5c 63 6f 64 65 7b 72 | 65 61 64 46 72 6f 6d 28 | \code{r|eadFrom(|
|00003be0| 29 7d 20 68 61 73 20 62 | 65 65 6e 20 0a 65 6c 69 |)} has b|een .eli|
|00003bf0| 6d 69 6e 61 74 65 64 3b | 20 74 68 75 73 2c 20 5c |minated;| thus, \|
|00003c00| 63 6f 64 65 7b 72 65 61 | 64 46 72 6f 6d 28 29 7d |code{rea|dFrom()}|
|00003c10| 20 77 69 6c 6c 20 6f 6e | 6c 79 20 72 65 74 75 72 | will on|ly retur|
|00003c20| 6e 20 61 20 70 6f 69 6e | 74 65 72 20 74 6f 20 61 |n a poin|ter to a|
|00003c30| 6e 20 6f 62 6a 65 63 74 | 2e 20 0a 54 68 69 73 20 |n object|. .This |
|00003c40| 66 6f 72 6d 20 6f 66 20 | 5c 63 6f 64 65 7b 72 65 |form of |\code{re|
|00003c50| 61 64 46 72 6f 6d 28 29 | 7d 20 77 61 73 20 75 73 |adFrom()|} was us|
|00003c60| 65 64 20 74 6f 20 69 6e | 69 74 69 61 6c 69 7a 65 |ed to in|itialize|
|00003c70| 20 6d 65 6d 62 65 72 20 | 63 6c 61 73 73 20 69 6e | member |class in|
|00003c80| 73 74 61 6e 63 65 73 2e | 20 0a 20 54 68 65 73 65 |stances.| . These|
|00003c90| 20 6d 75 73 74 20 6e 6f | 77 20 62 65 20 69 6e 69 | must no|w be ini|
|00003ca0| 74 69 61 6c 69 7a 65 64 | 20 76 69 61 20 74 68 65 |tialized| via the|
|00003cb0| 20 5c 63 6f 64 65 7b 72 | 65 61 64 46 72 6f 6d 28 | \code{r|eadFrom(|
|00003cc0| 29 7d 20 63 6f 6e 73 74 | 72 75 63 74 6f 72 20 69 |)} const|ructor i|
|00003cd0| 6e 20 74 68 65 20 0a 69 | 6e 69 74 69 61 6c 69 7a |n the .i|nitializ|
|00003ce0| 65 72 20 6c 69 73 74 2c | 20 61 73 20 73 68 6f 77 |er list,| as show|
|00003cf0| 6e 20 69 6e 20 74 68 65 | 20 65 78 61 6d 70 6c 65 |n in the| example|
|00003d00| 2e 20 20 57 68 65 6e 20 | 63 6f 6e 76 65 72 74 69 |. When |converti|
|00003d10| 6e 67 20 6f 6c 64 20 70 | 72 6f 67 72 61 6d 73 2c |ng old p|rograms,|
|00003d20| 20 0a 74 68 65 73 65 20 | 63 61 6c 6c 73 20 74 6f | .these |calls to|
|00003d30| 20 5c 63 6f 64 65 7b 72 | 65 61 64 46 72 6f 6d 28 | \code{r|eadFrom(|
|00003d40| 29 7d 20 77 69 6c 6c 20 | 62 65 20 66 6c 61 67 67 |)} will |be flagg|
|00003d50| 65 64 20 61 73 20 65 72 | 72 6f 72 73 20 62 65 63 |ed as er|rors bec|
|00003d60| 61 75 73 65 20 74 68 65 | 20 74 68 72 65 65 20 0a |ause the| three .|
|00003d70| 61 72 67 75 6d 65 6e 74 | 20 66 6f 72 6d 20 6f 66 |argument| form of|
|00003d80| 20 5c 63 6f 64 65 7b 72 | 65 61 64 46 72 6f 6d 28 | \code{r|eadFrom(|
|00003d90| 29 7d 20 69 73 20 6e 6f | 20 6c 6f 6e 67 65 72 20 |)} is no| longer |
|00003da0| 64 65 66 69 6e 65 64 2e | 20 20 5c 69 74 61 6c 69 |defined.| \itali|
|00003db0| 63 7b 4e 6f 74 65 20 74 | 68 61 74 20 0a 77 68 65 |c{Note t|hat .whe|
|00003dc0| 6e 20 79 6f 75 20 63 68 | 61 6e 67 65 20 74 68 65 |n you ch|ange the|
|00003dd0| 20 5c 63 6f 64 65 7b 72 | 65 61 64 46 72 6f 6d 28 | \code{r|eadFrom(|
|00003de0| 29 7d 20 63 6f 6e 73 74 | 72 75 63 74 6f 72 2c 20 |)} const|ructor, |
|00003df0| 79 6f 75 20 6d 75 73 74 | 20 61 6c 73 6f 20 63 68 |you must| also ch|
|00003e00| 61 6e 67 65 20 74 68 65 | 20 0a 63 6f 72 72 65 73 |ange the| .corres|
|00003e10| 70 6f 6e 64 69 6e 67 20 | 5c 63 6f 64 65 7b 73 74 |ponding |\code{st|
|00003e20| 6f 72 65 72 28 29 7d 20 | 66 75 6e 63 74 69 6f 6e |orer()} |function|
|00003e30| 20 74 6f 20 73 74 6f 72 | 65 20 74 68 65 20 6d 65 | to stor|e the me|
|00003e40| 6d 62 65 72 20 75 73 69 | 6e 67 20 0a 5c 63 6f 64 |mber usi|ng .\cod|
|00003e50| 65 7b 73 74 6f 72 65 4d | 65 6d 62 65 72 4f 6e 28 |e{storeM|emberOn(|
|00003e60| 29 7d 20 72 61 74 68 65 | 72 20 74 68 61 6e 20 5c |)} rathe|r than \|
|00003e70| 63 6f 64 65 7b 73 74 6f | 72 65 4f 6e 28 29 7d 2e |code{sto|reOn()}.|
|00003e80| 7d 20 0a 0a 0a 49 6e 20 | 70 72 65 76 69 6f 75 73 |} ...In |previous|
|00003e90| 20 72 65 6c 65 61 73 65 | 73 2c 20 74 68 65 20 73 | release|s, the s|
|00003ea0| 65 63 6f 6e 64 20 61 72 | 67 75 6d 65 6e 74 20 74 |econd ar|gument t|
|00003eb0| 6f 20 5c 63 6f 64 65 7b | 72 65 61 64 46 72 6f 6d |o \code{|readFrom|
|00003ec0| 28 29 7d 20 77 61 73 20 | 61 6e 20 6f 70 74 69 6f |()} was |an optio|
|00003ed0| 6e 61 6c 20 0a 6e 61 6d | 65 20 6f 66 20 74 68 65 |nal .nam|e of the|
|00003ee0| 20 63 6c 61 73 73 20 6f | 66 20 6f 62 6a 65 63 74 | class o|f object|
|00003ef0| 20 74 68 61 74 20 77 61 | 73 20 65 78 70 65 63 74 | that wa|s expect|
|00003f00| 65 64 20 74 6f 20 62 65 | 20 72 65 61 64 2e 20 20 |ed to be| read. |
|00003f10| 49 66 20 74 68 65 20 6f | 62 6a 65 63 74 20 72 65 |If the o|bject re|
|00003f20| 61 64 20 0a 77 61 73 20 | 6f 66 20 61 20 64 69 66 |ad .was |of a dif|
|00003f30| 66 65 72 65 6e 74 20 63 | 6c 61 73 73 2c 20 5c 63 |ferent c|lass, \c|
|00003f40| 6f 64 65 7b 72 65 61 64 | 46 72 6f 6d 28 29 7d 20 |ode{read|From()} |
|00003f50| 72 61 69 73 65 64 20 61 | 6e 20 65 72 72 6f 72 2e |raised a|n error.|
|00003f60| 20 20 42 65 67 69 6e 6e | 69 6e 67 20 77 69 74 68 | Beginn|ing with|
|00003f70| 20 0a 74 68 69 73 20 72 | 65 6c 65 61 73 65 2c 20 | .this r|elease, |
|00003f80| 5c 63 6f 64 65 7b 72 65 | 61 64 46 72 6f 6d 28 4f |\code{re|adFrom(O|
|00003f90| 49 4f 69 6e 26 29 7d 2c | 20 61 6e 64 20 5c 63 6f |IOin&)},| and \co|
|00003fa0| 64 65 7b 72 65 61 64 46 | 72 6f 6d 28 4f 49 4f 69 |de{readF|rom(OIOi|
|00003fb0| 66 64 26 29 7d 20 61 72 | 65 20 73 74 61 74 69 63 |fd&)} ar|e static|
|00003fc0| 20 0a 6d 65 6d 62 65 72 | 20 66 75 6e 63 74 69 6f | .member| functio|
|00003fd0| 6e 73 20 6f 66 20 65 61 | 63 68 20 63 6c 61 73 73 |ns of ea|ch class|
|00003fe0| 20 77 68 69 63 68 20 77 | 69 6c 6c 20 61 6c 73 6f | which w|ill also|
|00003ff0| 20 61 63 63 65 70 74 20 | 64 65 72 69 76 65 64 20 | accept |derived |
|00004000| 63 6c 61 73 73 65 73 20 | 6f 66 20 74 68 65 20 0a |classes |of the .|
|00004010| 73 70 65 63 69 66 69 65 | 64 20 63 6c 61 73 73 2c |specifie|d class,|
|00004020| 20 6a 75 73 74 20 61 73 | 20 43 2b 2b 20 61 6c 6c | just as| C++ all|
|00004030| 6f 77 73 20 61 20 70 6f | 69 6e 74 65 72 20 74 6f |ows a po|inter to|
|00004040| 20 61 20 64 65 72 69 76 | 65 64 20 63 6c 61 73 73 | a deriv|ed class|
|00004050| 20 74 6f 20 62 65 20 75 | 73 65 64 20 0a 69 6e 73 | to be u|sed .ins|
|00004060| 74 65 61 64 20 6f 66 20 | 61 20 70 6f 69 6e 74 65 |tead of |a pointe|
|00004070| 72 20 74 6f 20 61 20 62 | 61 73 65 20 63 6c 61 73 |r to a b|ase clas|
|00004080| 73 2e 20 20 54 68 65 20 | 67 6c 6f 62 61 6c 20 66 |s. The |global f|
|00004090| 75 6e 63 74 69 6f 6e 73 | 20 0a 5c 63 6f 64 65 7b |unctions| .\code{|
|000040a0| 72 65 61 64 46 72 6f 6d | 28 69 73 74 72 65 61 6d |readFrom|(istream|
|000040b0| 2c 20 63 6f 6e 73 74 20 | 63 68 61 72 2a 20 63 6c |, const |char* cl|
|000040c0| 61 73 73 6e 61 6d 65 29 | 7d 20 61 6e 64 20 5c 63 |assname)|} and \c|
|000040d0| 6f 64 65 7b 72 65 61 64 | 46 72 6f 6d 28 69 6e 74 |ode{read|From(int|
|000040e0| 20 66 64 2c 20 0a 63 6f | 6e 73 74 20 63 68 61 72 | fd, .co|nst char|
|000040f0| 2a 20 63 6c 61 73 73 6e | 61 6d 65 29 7d 20 68 61 |* classn|ame)} ha|
|00004100| 76 65 20 62 65 65 6e 20 | 65 6c 69 6d 69 6e 61 74 |ve been |eliminat|
|00004110| 65 64 2e 0a 0a 0a 5c 70 | 61 72 61 67 72 61 70 68 |ed....\p|aragraph|
|00004120| 7b 5c 63 6f 64 65 7b 69 | 73 74 72 65 61 6d 26 7d |{\code{i|stream&}|
|00004130| 20 72 65 70 6c 61 63 65 | 64 20 62 79 20 5c 63 6f | replace|d by \co|
|00004140| 64 65 7b 4f 49 4f 69 6e | 26 7d 0a 0a 7d 0a 54 68 |de{OIOin|&}..}.Th|
|00004150| 65 20 74 79 70 65 20 6f | 66 20 74 68 65 20 66 69 |e type o|f the fi|
|00004160| 72 73 74 20 28 61 6e 64 | 20 6e 6f 77 20 6f 6e 6c |rst (and| now onl|
|00004170| 79 29 20 61 72 67 75 6d | 65 6e 74 20 74 6f 20 74 |y) argum|ent to t|
|00004180| 68 65 20 63 6f 6e 73 74 | 72 75 63 74 6f 72 73 20 |he const|ructors |
|00004190| 63 61 6c 6c 65 64 20 62 | 79 20 0a 5c 63 6f 64 65 |called b|y .\code|
|000041a0| 7b 72 65 61 64 46 72 6f | 6d 28 69 73 74 72 65 61 |{readFro|m(istrea|
|000041b0| 6d 26 29 7d 20 68 61 73 | 20 62 65 65 6e 20 63 68 |m&)} has| been ch|
|000041c0| 61 6e 67 65 64 20 66 72 | 6f 6d 20 61 6e 20 5c 63 |anged fr|om an \c|
|000041d0| 6f 64 65 7b 69 73 74 72 | 65 61 6d 26 7d 20 74 6f |ode{istr|eam&} to|
|000041e0| 20 61 6e 20 0a 5c 63 6f | 64 65 7b 4f 49 4f 69 6e | an .\co|de{OIOin|
|000041f0| 26 7d 2e 20 20 54 68 69 | 73 20 61 76 6f 69 64 73 |&}. Thi|s avoids|
|00004200| 20 6e 61 6d 69 6e 67 20 | 63 6f 6e 66 6c 69 63 74 | naming |conflict|
|00004210| 73 20 77 69 74 68 20 6f | 74 68 65 72 20 63 6f 6e |s with o|ther con|
|00004220| 73 74 72 75 63 74 6f 72 | 73 2e 20 20 41 6c 73 6f |structor|s. Also|
|00004230| 2c 20 0a 5c 63 6f 64 65 | 7b 4f 49 4f 69 6e 7d 20 |, .\code|{OIOin} |
|00004240| 69 73 20 61 6e 20 61 62 | 73 74 72 61 63 74 20 62 |is an ab|stract b|
|00004250| 61 73 65 20 63 6c 61 73 | 73 2c 20 61 6e 64 20 61 |ase clas|s, and a|
|00004260| 6c 6c 20 69 6e 70 75 74 | 20 6f 70 65 72 61 74 6f |ll input| operato|
|00004270| 72 73 20 61 72 65 20 76 | 69 72 74 75 61 6c 20 0a |rs are v|irtual .|
|00004280| 66 75 6e 63 74 69 6f 6e | 73 2c 20 73 6f 20 79 6f |function|s, so yo|
|00004290| 75 20 63 61 6e 20 63 75 | 73 74 6f 6d 69 7a 65 20 |u can cu|stomize |
|000042a0| 74 68 65 20 4f 62 6a 65 | 63 74 20 49 2f 4f 20 66 |the Obje|ct I/O f|
|000042b0| 6f 72 6d 61 74 20 62 79 | 20 64 65 66 69 6e 69 6e |ormat by| definin|
|000042c0| 67 20 79 6f 75 72 20 6f | 77 6e 20 0a 64 65 72 69 |g your o|wn .deri|
|000042d0| 76 65 64 20 63 6c 61 73 | 73 65 73 2e 20 20 20 5c |ved clas|ses. \|
|000042e0| 63 6f 64 65 7b 4f 49 4f | 69 73 74 72 65 61 6d 7d |code{OIO|istream}|
|000042f0| 20 61 6e 64 20 5c 63 6f | 64 65 7b 4f 49 4f 6e 69 | and \co|de{OIOni|
|00004300| 68 69 6e 7d 20 69 6d 70 | 6c 65 6d 65 6e 74 20 61 |hin} imp|lement a|
|00004310| 20 66 6f 72 6d 61 74 20 | 0a 73 69 6d 69 6c 61 72 | format |.similar|
|00004320| 20 74 6f 20 74 68 65 20 | 6f 6c 64 20 4f 4f 50 53 | to the |old OOPS|
|00004330| 20 66 6f 72 6d 61 74 2e | 0a 0a 0a 5c 70 61 72 61 | format.|...\para|
|00004340| 67 72 61 70 68 7b 5c 63 | 6f 64 65 7b 6f 73 74 72 |graph{\c|ode{ostr|
|00004350| 65 61 6d 26 7d 20 72 65 | 70 6c 61 63 65 64 20 62 |eam&} re|placed b|
|00004360| 79 20 5c 63 6f 64 65 7b | 4f 49 4f 6f 75 74 26 7d |y \code{|OIOout&}|
|00004370| 0a 0a 7d 0a 54 68 65 20 | 74 79 70 65 20 6f 66 20 |..}.The |type of |
|00004380| 74 68 65 20 61 72 67 75 | 6d 65 6e 74 20 74 6f 20 |the argu|ment to |
|00004390| 74 68 65 20 5c 63 6f 64 | 65 7b 73 74 6f 72 65 72 |the \cod|e{storer|
|000043a0| 28 6f 73 74 72 65 61 6d | 26 29 7d 20 66 75 6e 63 |(ostream|&)} func|
|000043b0| 74 69 6f 6e 20 68 61 73 | 20 62 65 65 6e 20 0a 63 |tion has| been .c|
|000043c0| 68 61 6e 67 65 64 20 20 | 74 6f 20 61 6e 20 5c 63 |hanged |to an \c|
|000043d0| 6f 64 65 7b 4f 49 4f 6f | 75 74 26 7d 2e 20 20 5c |ode{OIOo|ut&}. \|
|000043e0| 63 6f 64 65 7b 4f 49 4f | 6f 75 74 7d 20 69 73 20 |code{OIO|out} is |
|000043f0| 61 6e 20 61 62 73 74 72 | 61 63 74 20 62 61 73 65 |an abstr|act base|
|00004400| 20 63 6c 61 73 73 2c 20 | 61 6e 64 20 0a 61 6c 6c | class, |and .all|
|00004410| 20 6f 75 74 70 75 74 20 | 6f 70 65 72 61 74 6f 72 | output |operator|
|00004420| 73 20 61 72 65 20 76 69 | 72 74 75 61 6c 20 66 75 |s are vi|rtual fu|
|00004430| 6e 63 74 69 6f 6e 73 2c | 20 73 6f 20 79 6f 75 20 |nctions,| so you |
|00004440| 63 61 6e 20 63 75 73 74 | 6f 6d 69 7a 65 20 74 68 |can cust|omize th|
|00004450| 65 20 4f 62 6a 65 63 74 | 20 0a 49 2f 4f 20 66 6f |e Object| .I/O fo|
|00004460| 72 6d 61 74 20 62 79 20 | 64 65 66 69 6e 69 6e 67 |rmat by |defining|
|00004470| 20 79 6f 75 72 20 6f 77 | 6e 20 64 65 72 69 76 65 | your ow|n derive|
|00004480| 64 20 63 6c 61 73 73 65 | 73 2e 20 20 20 5c 63 6f |d classe|s. \co|
|00004490| 64 65 7b 4f 49 4f 6f 73 | 74 72 65 61 6d 7d 20 61 |de{OIOos|tream} a|
|000044a0| 6e 64 20 0a 5c 63 6f 64 | 65 7b 4f 49 4f 6e 69 68 |nd .\cod|e{OIOnih|
|000044b0| 6f 75 74 7d 20 69 6d 70 | 6c 65 6d 65 6e 74 20 61 |out} imp|lement a|
|000044c0| 20 66 6f 72 6d 61 74 20 | 73 69 6d 69 6c 61 72 20 | format |similar |
|000044d0| 74 6f 20 74 68 65 20 6f | 6c 64 20 4f 4f 50 53 20 |to the o|ld OOPS |
|000044e0| 66 6f 72 6d 61 74 2e 0a | 0a 0a 5c 70 61 72 61 67 |format..|..\parag|
|000044f0| 72 61 70 68 7b 41 75 74 | 6f 6d 61 74 69 63 20 73 |raph{Aut|omatic s|
|00004500| 65 70 61 72 61 74 6f 72 | 73 20 6f 75 74 70 75 74 |eparator|s output|
|00004510| 20 62 79 20 5c 63 6f 64 | 65 7b 4f 49 4f 6f 73 74 | by \cod|e{OIOost|
|00004520| 72 65 61 6d 3a 3a 6f 70 | 65 72 61 74 6f 72 3c 3c |ream::op|erator<<|
|00004530| 28 29 7d 0a 0a 7d 0a 49 | 74 20 69 73 20 6e 6f 20 |()}..}.I|t is no |
|00004540| 6c 6f 6e 67 65 72 20 6e | 65 63 65 73 73 61 72 79 |longer n|ecessary|
|00004550| 20 74 6f 20 65 78 70 6c | 69 63 69 74 6c 79 20 6f | to expl|icitly o|
|00004560| 75 74 70 75 74 20 61 20 | 73 70 61 63 65 20 61 66 |utput a |space af|
|00004570| 74 65 72 20 65 61 63 68 | 20 6e 75 6d 62 65 72 20 |ter each| number |
|00004580| 0a 77 72 69 74 74 65 6e | 20 69 6e 20 61 20 5c 63 |.written| in a \c|
|00004590| 6f 64 65 7b 73 74 6f 72 | 65 72 28 4f 49 4f 6e 69 |ode{stor|er(OIOni|
|000045a0| 68 6f 75 74 26 29 7d 20 | 66 75 6e 63 74 69 6f 6e |hout&)} |function|
|000045b0| 2e 20 20 43 6c 61 73 73 | 20 5c 63 6f 64 65 7b 4f |. Class| \code{O|
|000045c0| 49 4f 6f 73 74 72 65 61 | 6d 7d 20 0a 72 65 69 6d |IOostrea|m} .reim|
|000045d0| 70 6c 65 6d 65 6e 74 73 | 20 5c 63 6f 64 65 7b 6f |plements| \code{o|
|000045e0| 70 65 72 61 74 6f 72 3c | 3c 28 29 7d 20 74 6f 20 |perator<|<()} to |
|000045f0| 73 75 70 70 6c 79 20 74 | 68 65 20 73 70 61 63 65 |supply t|he space|
|00004600| 20 61 75 74 6f 6d 61 74 | 69 63 61 6c 6c 79 2e 0a | automat|ically..|
|00004610| 0a 0a 5c 70 61 72 61 67 | 72 61 70 68 7b 5c 63 6f |..\parag|raph{\co|
|00004620| 64 65 7b 46 69 6c 65 44 | 65 73 63 54 79 26 7d 20 |de{FileD|escTy&} |
|00004630| 72 65 70 6c 61 63 65 64 | 20 62 79 20 5c 63 6f 64 |replaced| by \cod|
|00004640| 65 7b 4f 49 4f 69 66 64 | 26 2f 4f 49 4f 6f 66 64 |e{OIOifd|&/OIOofd|
|00004650| 26 7d 0a 0a 7d 0a 54 68 | 65 20 74 79 70 65 20 6f |&}..}.Th|e type o|
|00004660| 66 20 74 68 65 20 61 72 | 67 75 6d 65 6e 74 20 74 |f the ar|gument t|
|00004670| 6f 20 74 68 65 20 5c 63 | 6f 64 65 7b 73 74 6f 72 |o the \c|ode{stor|
|00004680| 65 72 28 46 69 6c 65 44 | 65 73 63 54 79 26 29 7d |er(FileD|escTy&)}|
|00004690| 20 66 75 6e 63 74 69 6f | 6e 20 68 61 73 20 62 65 | functio|n has be|
|000046a0| 65 6e 20 0a 63 68 61 6e | 67 65 64 20 20 74 6f 20 |en .chan|ged to |
|000046b0| 61 6e 20 5c 63 6f 64 65 | 7b 4f 49 4f 6f 66 64 26 |an \code|{OIOofd&|
|000046c0| 7d 2e 20 61 6e 64 20 74 | 68 65 20 61 72 67 75 6d |}. and t|he argum|
|000046d0| 65 6e 74 20 74 6f 20 74 | 68 65 20 0a 5c 63 6f 64 |ent to t|he .\cod|
|000046e0| 65 7b 72 65 61 64 46 72 | 6f 6d 28 46 69 6c 65 44 |e{readFr|om(FileD|
|000046f0| 65 73 63 54 79 26 29 7d | 20 66 75 6e 63 74 69 6f |escTy&)}| functio|
|00004700| 6e 20 68 61 73 20 62 65 | 65 6e 20 63 68 61 6e 67 |n has be|en chang|
|00004710| 65 64 20 74 6f 20 61 6e | 20 5c 63 6f 64 65 7b 4f |ed to an| \code{O|
|00004720| 49 4f 69 66 64 26 7d 2e | 20 0a 20 5c 63 6f 64 65 |IOifd&}.| . \code|
|00004730| 7b 4f 49 4f 69 66 64 7d | 20 61 6e 64 20 5c 63 6f |{OIOifd}| and \co|
|00004740| 64 65 7b 4f 49 4f 6f 66 | 64 7d 20 61 72 65 20 6e |de{OIOof|d} are n|
|00004750| 6f 74 20 61 62 73 74 72 | 61 63 74 20 63 6c 61 73 |ot abstr|act clas|
|00004760| 73 65 73 2c 20 61 6e 64 | 20 74 68 65 69 72 20 49 |ses, and| their I|
|00004770| 2f 4f 20 0a 6f 70 65 72 | 61 74 6f 72 73 20 61 72 |/O .oper|ators ar|
|00004780| 65 20 6e 6f 74 20 76 69 | 72 74 75 61 6c 20 66 75 |e not vi|rtual fu|
|00004790| 6e 63 74 69 6f 6e 73 20 | 61 73 20 69 6e 20 5c 63 |nctions |as in \c|
|000047a0| 6f 64 65 7b 4f 49 4f 69 | 6e 7d 20 61 6e 64 20 5c |ode{OIOi|n} and \|
|000047b0| 63 6f 64 65 7b 4f 49 4f | 6f 75 74 7d 2c 20 73 6f |code{OIO|out}, so|
|000047c0| 20 0a 75 73 69 6e 67 20 | 74 68 65 6d 20 64 6f 65 | .using |them doe|
|000047d0| 73 20 6e 6f 74 20 69 6e | 63 75 72 20 74 68 65 20 |s not in|cur the |
|000047e0| 6f 76 65 72 68 65 61 64 | 20 6f 66 20 61 20 76 69 |overhead| of a vi|
|000047f0| 72 74 75 61 6c 20 66 75 | 6e 63 74 69 6f 6e 20 63 |rtual fu|nction c|
|00004800| 61 6c 6c 20 66 6f 72 20 | 65 61 63 68 20 0a 6d 65 |all for |each .me|
|00004810| 6d 62 65 72 20 76 61 72 | 69 61 62 6c 65 2e 0a 0a |mber var|iable...|
|00004820| 0a 5c 70 61 72 61 67 72 | 61 70 68 7b 43 68 61 6e |.\paragr|aph{Chan|
|00004830| 67 65 20 74 6f 20 5c 63 | 6f 64 65 7b 72 65 61 64 |ge to \c|ode{read|
|00004840| 46 72 6f 6d 28 4f 49 4f | 69 6e 26 29 7d 0a 0a 7d |From(OIO|in&)}..}|
|00004850| 0a 45 6e 63 6f 75 6e 74 | 65 72 69 6e 67 20 45 4f |.Encount|ering EO|
|00004860| 46 20 64 75 72 69 6e 67 | 20 5c 63 6f 64 65 7b 72 |F during| \code{r|
|00004870| 65 61 64 46 72 6f 6d 28 | 4f 49 4f 69 6e 26 29 7d |eadFrom(|OIOin&)}|
|00004880| 20 69 73 20 6e 6f 77 20 | 61 6c 77 61 79 73 20 61 | is now |always a|
|00004890| 6e 20 65 72 72 6f 72 2e | 20 0a 20 50 72 65 76 69 |n error.| . Previ|
|000048a0| 6f 75 73 20 72 65 6c 65 | 61 73 65 73 20 72 65 74 |ous rele|ases ret|
|000048b0| 75 72 6e 65 64 20 5c 63 | 6f 64 65 7b 6e 69 6c 7d |urned \c|ode{nil}|
|000048c0| 20 69 66 20 74 68 65 20 | 69 6e 70 75 74 20 73 74 | if the |input st|
|000048d0| 72 65 61 6d 20 77 61 73 | 20 69 6e 69 74 69 61 6c |ream was| initial|
|000048e0| 6c 79 20 61 74 20 0a 74 | 68 65 20 45 4f 46 2e 20 |ly at .t|he EOF. |
|000048f0| 20 5c 63 6f 64 65 7b 72 | 65 61 64 46 72 6f 6d 28 | \code{r|eadFrom(|
|00004900| 4f 49 4f 69 6e 26 29 7d | 20 6e 6f 77 20 62 65 68 |OIOin&)}| now beh|
|00004910| 61 76 65 73 20 6c 69 6b | 65 20 5c 63 6f 64 65 7b |aves lik|e \code{|
|00004920| 72 65 61 64 46 72 6f 6d | 28 4f 49 4f 69 66 64 26 |readFrom|(OIOifd&|
|00004930| 29 7d 20 0a 61 6c 77 61 | 79 73 20 68 61 73 2e 0a |)} .alwa|ys has..|
|00004940| 0a 0a 5c 70 61 72 61 67 | 72 61 70 68 7b 5c 63 6f |..\parag|raph{\co|
|00004950| 64 65 7b 73 74 6f 72 65 | 42 69 6e 28 29 7d 20 72 |de{store|Bin()} r|
|00004960| 65 70 6c 61 63 65 64 20 | 62 79 20 5c 63 6f 64 65 |eplaced |by \code|
|00004970| 7b 4f 49 4f 6f 66 64 3a | 3a 6f 70 65 72 61 74 6f |{OIOofd:|:operato|
|00004980| 72 3c 3c 28 29 7d 20 61 | 6e 64 20 0a 5c 63 6f 64 |r<<()} a|nd .\cod|
|00004990| 65 7b 4f 49 4f 6f 66 64 | 3a 3a 70 75 74 28 29 7d |e{OIOofd|::put()}|
|000049a0| 0a 0a 7d 0a 54 68 65 20 | 66 75 6e 63 74 69 6f 6e |..}.The |function|
|000049b0| 20 5c 63 6f 64 65 7b 73 | 74 6f 72 65 42 69 6e 28 | \code{s|toreBin(|
|000049c0| 46 69 6c 65 44 65 73 63 | 54 79 26 2c 20 5c 69 74 |FileDesc|Ty&, \it|
|000049d0| 61 6c 69 63 7b 74 79 70 | 65 7d 29 7d 20 68 61 73 |alic{typ|e})} has|
|000049e0| 20 62 65 65 6e 20 72 65 | 70 6c 61 63 65 64 20 62 | been re|placed b|
|000049f0| 79 20 0a 5c 63 6f 64 65 | 7b 4f 49 4f 6f 66 64 3a |y .\code|{OIOofd:|
|00004a00| 3a 6f 70 65 72 61 74 6f | 72 3c 3c 28 5c 69 74 61 |:operato|r<<(\ita|
|00004a10| 6c 69 63 7b 74 79 70 65 | 7d 29 7d 20 61 6e 64 20 |lic{type|})} and |
|00004a20| 74 68 65 20 66 75 6e 63 | 74 69 6f 6e 20 0a 5c 63 |the func|tion .\c|
|00004a30| 6f 64 65 7b 73 74 6f 72 | 65 42 69 6e 28 46 69 6c |ode{stor|eBin(Fil|
|00004a40| 65 44 65 73 63 54 79 26 | 2c 20 5c 69 74 61 6c 69 |eDescTy&|, \itali|
|00004a50| 63 7b 74 79 70 65 7d 2a | 2c 20 75 6e 73 69 67 6e |c{type}*|, unsign|
|00004a60| 65 64 29 7d 20 68 61 73 | 20 62 65 65 6e 20 72 65 |ed)} has| been re|
|00004a70| 70 6c 61 63 65 64 20 62 | 79 20 0a 5c 63 6f 64 65 |placed b|y .\code|
|00004a80| 7b 4f 49 4f 6f 66 64 3a | 3a 70 75 74 28 5c 69 74 |{OIOofd:|:put(\it|
|00004a90| 61 6c 69 63 7b 74 79 70 | 65 7d 2a 2c 20 75 6e 73 |alic{typ|e}*, uns|
|00004aa0| 69 67 6e 65 64 29 7d 2e | 0a 0a 0a 5c 70 61 72 61 |igned)}.|...\para|
|00004ab0| 67 72 61 70 68 7b 5c 63 | 6f 64 65 7b 72 65 61 64 |graph{\c|ode{read|
|00004ac0| 42 69 6e 28 29 7d 20 72 | 65 70 6c 61 63 65 64 20 |Bin()} r|eplaced |
|00004ad0| 62 79 20 5c 63 6f 64 65 | 7b 4f 49 4f 69 66 64 3a |by \code|{OIOifd:|
|00004ae0| 3a 6f 70 65 72 61 74 6f | 72 3e 3e 28 29 7d 20 61 |:operato|r>>()} a|
|00004af0| 6e 64 20 0a 5c 63 6f 64 | 65 7b 4f 49 4f 69 66 64 |nd .\cod|e{OIOifd|
|00004b00| 3a 3a 67 65 74 28 29 7d | 0a 0a 7d 0a 54 68 65 20 |::get()}|..}.The |
|00004b10| 66 75 6e 63 74 69 6f 6e | 20 5c 63 6f 64 65 7b 72 |function| \code{r|
|00004b20| 65 61 64 42 69 6e 28 46 | 69 6c 65 44 65 73 63 54 |eadBin(F|ileDescT|
|00004b30| 79 26 2c 20 5c 69 74 61 | 6c 69 63 7b 74 79 70 65 |y&, \ita|lic{type|
|00004b40| 7d 29 7d 20 68 61 73 20 | 62 65 65 6e 20 72 65 70 |})} has |been rep|
|00004b50| 6c 61 63 65 64 20 62 79 | 20 0a 5c 63 6f 64 65 7b |laced by| .\code{|
|00004b60| 4f 49 4f 69 66 64 3a 3a | 6f 70 65 72 61 74 6f 72 |OIOifd::|operator|
|00004b70| 3e 3e 28 5c 69 74 61 6c | 69 63 7b 74 79 70 65 7d |>>(\ital|ic{type}|
|00004b80| 29 7d 20 61 6e 64 20 74 | 68 65 20 66 75 6e 63 74 |)} and t|he funct|
|00004b90| 69 6f 6e 20 0a 5c 63 6f | 64 65 7b 72 65 61 64 42 |ion .\co|de{readB|
|00004ba0| 69 6e 28 46 69 6c 65 44 | 65 73 63 54 79 26 2c 20 |in(FileD|escTy&, |
|00004bb0| 5c 69 74 61 6c 69 63 7b | 74 79 70 65 7d 2a 2c 20 |\italic{|type}*, |
|00004bc0| 75 6e 73 69 67 6e 65 64 | 29 7d 20 68 61 73 20 62 |unsigned|)} has b|
|00004bd0| 65 65 6e 20 72 65 70 6c | 61 63 65 64 20 62 79 20 |een repl|aced by |
|00004be0| 0a 5c 63 6f 64 65 7b 4f | 49 4f 69 66 64 3a 3a 67 |.\code{O|IOifd::g|
|00004bf0| 65 74 28 5c 69 74 61 6c | 69 63 7b 74 79 70 65 7d |et(\ital|ic{type}|
|00004c00| 2a 2c 20 75 6e 73 69 67 | 6e 65 64 29 7d 2e 0a 0a |*, unsig|ned)}...|
|00004c10| 0a 5c 70 61 72 61 67 72 | 61 70 68 7b 5c 63 6f 64 |.\paragr|aph{\cod|
|00004c20| 65 7b 72 65 61 64 5f 43 | 73 74 72 69 6e 67 28 29 |e{read_C|string()|
|00004c30| 7d 20 72 65 70 6c 61 63 | 65 64 20 62 79 20 5c 63 |} replac|ed by \c|
|00004c40| 6f 64 65 7b 4f 49 4f 69 | 6e 3a 3a 67 65 74 43 73 |ode{OIOi|n::getCs|
|00004c50| 74 72 69 6e 67 28 29 7d | 0a 0a 7d 0a 54 68 65 20 |tring()}|..}.The |
|00004c60| 66 75 6e 63 74 69 6f 6e | 20 5c 63 6f 64 65 7b 72 |function| \code{r|
|00004c70| 65 61 64 5f 43 73 74 72 | 69 6e 67 28 29 7d 20 68 |ead_Cstr|ing()} h|
|00004c80| 61 73 20 62 65 65 6e 20 | 72 65 70 6c 61 63 65 64 |as been |replaced|
|00004c90| 20 62 79 20 0a 5c 63 6f | 64 65 7b 4f 49 4f 69 6e | by .\co|de{OIOin|
|00004ca0| 3a 3a 67 65 74 43 73 74 | 72 69 6e 67 28 29 7d 2e |::getCst|ring()}.|
|00004cb0| 0a 0a 0a 5c 70 61 72 61 | 67 72 61 70 68 7b 5c 63 |...\para|graph{\c|
|00004cc0| 6f 64 65 7b 73 74 6f 72 | 65 5f 43 73 74 72 69 6e |ode{stor|e_Cstrin|
|00004cd0| 67 28 29 7d 20 72 65 70 | 6c 61 63 65 64 20 62 79 |g()} rep|laced by|
|00004ce0| 20 5c 63 6f 64 65 7b 4f | 49 4f 6f 75 74 3a 3a 70 | \code{O|IOout::p|
|00004cf0| 75 74 43 73 74 72 69 6e | 67 28 29 7d 0a 0a 7d 0a |utCstrin|g()}..}.|
|00004d00| 54 68 65 20 66 75 6e 63 | 74 69 6f 6e 20 5c 63 6f |The func|tion \co|
|00004d10| 64 65 7b 73 74 6f 72 65 | 5f 43 73 74 72 69 6e 67 |de{store|_Cstring|
|00004d20| 28 29 7d 20 68 61 73 20 | 62 65 65 6e 20 72 65 70 |()} has |been rep|
|00004d30| 6c 61 63 65 64 20 62 79 | 20 0a 5c 63 6f 64 65 7b |laced by| .\code{|
|00004d40| 4f 49 4f 6f 75 74 3a 3a | 70 75 74 43 73 74 72 69 |OIOout::|putCstri|
|00004d50| 6e 67 28 29 7d 2e 0a 0a | 0a 5c 70 61 72 61 67 72 |ng()}...|.\paragr|
|00004d60| 61 70 68 7b 5c 63 6f 64 | 65 7b 52 45 41 44 5f 4f |aph{\cod|e{READ_O|
|00004d70| 42 4a 45 43 54 5f 41 53 | 5f 42 49 4e 41 52 59 7d |BJECT_AS|_BINARY}|
|00004d80| 20 65 6c 69 6d 69 6e 61 | 74 65 64 0a 0a 7d 0a 54 | elimina|ted..}.T|
|00004d90| 68 65 20 5c 63 6f 64 65 | 7b 52 45 41 44 5f 4f 42 |he \code|{READ_OB|
|00004da0| 4a 45 43 54 5f 41 53 5f | 42 49 4e 41 52 59 7d 20 |JECT_AS_|BINARY} |
|00004db0| 6d 61 63 72 6f 20 68 61 | 73 20 62 65 65 6e 20 65 |macro ha|s been e|
|00004dc0| 6c 69 6d 69 6e 61 74 65 | 64 2e 20 20 52 65 70 6c |liminate|d. Repl|
|00004dd0| 61 63 65 20 69 74 20 77 | 69 74 68 20 0a 63 6f 64 |ace it w|ith .cod|
|00004de0| 65 20 74 6f 20 72 65 61 | 64 20 6d 65 6d 62 65 72 |e to rea|d member|
|00004df0| 20 76 61 72 69 61 62 6c | 65 73 20 69 6e 64 69 76 | variabl|es indiv|
|00004e00| 69 64 75 61 6c 6c 79 20 | 75 73 69 6e 67 20 5c 63 |idually |using \c|
|00004e10| 6f 64 65 7b 3e 3e 7d 20 | 61 6e 64 20 5c 63 6f 64 |ode{>>} |and \cod|
|00004e20| 65 7b 67 65 74 28 29 7d | 2e 0a 0a 0a 5c 70 61 72 |e{get()}|....\par|
|00004e30| 61 67 72 61 70 68 7b 5c | 63 6f 64 65 7b 53 54 4f |agraph{\|code{STO|
|00004e40| 52 45 5f 4f 42 4a 45 43 | 54 5f 41 53 5f 42 49 4e |RE_OBJEC|T_AS_BIN|
|00004e50| 41 52 59 7d 20 65 6c 69 | 6d 69 6e 61 74 65 64 0a |ARY} eli|minated.|
|00004e60| 0a 7d 0a 54 68 65 20 5c | 63 6f 64 65 7b 53 54 4f |.}.The \|code{STO|
|00004e70| 52 45 5f 4f 42 4a 45 43 | 54 5f 41 53 5f 42 49 4e |RE_OBJEC|T_AS_BIN|
|00004e80| 41 52 59 7d 20 6d 61 63 | 72 6f 20 68 61 73 20 62 |ARY} mac|ro has b|
|00004e90| 65 65 6e 20 65 6c 69 6d | 69 6e 61 74 65 64 2e 20 |een elim|inated. |
|00004ea0| 20 52 65 70 6c 61 63 65 | 20 69 74 20 77 69 74 68 | Replace| it with|
|00004eb0| 20 0a 63 6f 64 65 20 74 | 6f 20 73 74 6f 72 65 20 | .code t|o store |
|00004ec0| 6d 65 6d 62 65 72 20 76 | 61 72 69 61 62 6c 65 73 |member v|ariables|
|00004ed0| 20 69 6e 64 69 76 69 64 | 75 61 6c 6c 79 20 75 73 | individ|ually us|
|00004ee0| 69 6e 67 20 5c 63 6f 64 | 65 7b 3c 3c 7d 20 61 6e |ing \cod|e{<<} an|
|00004ef0| 64 20 5c 63 6f 64 65 7b | 70 75 74 28 29 7d 2e 0a |d \code{|put()}..|
|00004f00| 0a 0a 5c 73 75 62 73 65 | 63 74 69 6f 6e 7b 43 68 |..\subse|ction{Ch|
|00004f10| 61 6e 67 65 73 20 74 6f | 20 74 68 65 20 5c 63 6f |anges to| the \co|
|00004f20| 64 65 7b 44 45 46 49 4e | 45 5f 43 4c 41 53 53 7d |de{DEFIN|E_CLASS}|
|00004f30| 20 6d 61 63 72 6f 0a 0a | 7d 0a 54 68 65 20 6e 65 | macro..|}.The ne|
|00004f40| 77 20 76 65 72 73 69 6f | 6e 20 6f 66 20 74 68 65 |w versio|n of the|
|00004f50| 20 5c 63 6f 64 65 7b 44 | 45 46 49 4e 45 5f 43 4c | \code{D|EFINE_CL|
|00004f60| 41 53 53 7d 20 6d 61 63 | 72 6f 20 68 61 73 20 68 |ASS} mac|ro has h|
|00004f70| 6f 6f 6b 73 20 66 6f 72 | 20 73 75 70 70 6f 72 74 |ooks for| support|
|00004f80| 69 6e 67 20 0a 6d 75 6c | 74 69 70 6c 65 20 69 6e |ing .mul|tiple in|
|00004f90| 68 65 72 69 74 61 6e 63 | 65 2e 20 20 42 65 66 6f |heritanc|e. Befo|
|00004fa0| 72 65 20 63 61 6c 6c 69 | 6e 67 20 74 68 65 20 5c |re calli|ng the \|
|00004fb0| 63 6f 64 65 7b 44 45 46 | 49 4e 45 5f 43 4c 41 53 |code{DEF|INE_CLAS|
|00004fc0| 53 7d 20 6d 61 63 72 6f | 2c 20 79 6f 75 20 6d 75 |S} macro|, you mu|
|00004fd0| 73 74 20 0a 64 65 66 69 | 6e 65 20 74 68 72 65 65 |st .defi|ne three|
|00004fe0| 20 70 72 65 70 72 6f 63 | 65 73 73 6f 72 20 73 79 | preproc|essor sy|
|00004ff0| 6d 62 6f 6c 73 3a 20 5c | 63 6f 64 65 7b 42 41 53 |mbols: \|code{BAS|
|00005000| 45 5f 43 4c 41 53 53 45 | 53 7d 2c 20 5c 63 6f 64 |E_CLASSE|S}, \cod|
|00005010| 65 7b 4d 45 4d 42 45 52 | 5f 43 4c 41 53 53 45 53 |e{MEMBER|_CLASSES|
|00005020| 7d 2c 20 0a 61 6e 64 20 | 5c 63 6f 64 65 7b 56 49 |}, .and |\code{VI|
|00005030| 52 54 55 41 4c 5f 42 41 | 53 45 5f 43 4c 41 53 53 |RTUAL_BA|SE_CLASS|
|00005040| 45 53 7d 2e 20 20 41 73 | 20 61 6e 20 65 78 61 6d |ES}. As| an exam|
|00005050| 70 6c 65 2c 20 73 75 70 | 70 6f 73 65 20 79 6f 75 |ple, sup|pose you|
|00005060| 20 61 72 65 20 77 72 69 | 74 69 6e 67 20 74 68 65 | are wri|ting the|
|00005070| 20 0a 69 6d 70 6c 65 6d | 65 6e 74 61 74 69 6f 6e | .implem|entation|
|00005080| 20 6f 66 20 61 20 63 6c | 61 73 73 20 77 69 74 68 | of a cl|ass with|
|00005090| 20 74 68 65 20 66 6f 6c | 6c 6f 77 69 6e 67 20 64 | the fol|lowing d|
|000050a0| 65 63 6c 61 72 61 74 69 | 6f 6e 3a 0a 0a 0a 5c 65 |eclarati|on:...\e|
|000050b0| 78 61 6d 70 6c 65 7b 63 | 6c 61 73 73 20 58 3a 20 |xample{c|lass X: |
|000050c0| 70 75 62 6c 69 63 20 41 | 2c 20 70 75 62 6c 69 63 |public A|, public|
|000050d0| 20 76 69 72 74 75 61 6c | 20 42 20 5c 7b 0a 0a 20 | virtual| B \{.. |
|000050e0| 20 20 20 43 20 63 3b 20 | 20 20 20 20 20 20 20 2f | C c; | /|
|000050f0| 2f 20 43 20 69 73 20 61 | 20 63 6c 61 73 73 0a 0a |/ C is a| class..|
|00005100| 20 20 20 20 44 20 64 3b | 20 20 20 20 20 20 20 20 | D d;| |
|00005110| 2f 2f 20 44 20 69 73 20 | 61 20 63 6c 61 73 73 0a |// D is |a class.|
|00005120| 0a 2f 2f 2e 2e 2e 0a 0a | 5c 7d 3b 0a 0a 7d 0a 53 |.//.....|\};..}.S|
|00005130| 65 74 20 74 68 65 20 73 | 79 6d 62 6f 6c 20 5c 63 |et the s|ymbol \c|
|00005140| 6f 64 65 7b 42 41 53 45 | 5f 43 4c 41 53 53 45 53 |ode{BASE|_CLASSES|
|00005150| 7d 20 74 6f 20 61 20 6c | 69 73 74 20 6f 66 20 74 |} to a l|ist of t|
|00005160| 68 65 20 61 64 64 72 65 | 73 73 65 73 20 6f 66 20 |he addre|sses of |
|00005170| 74 68 65 20 63 6c 61 73 | 73 20 0a 64 65 73 63 72 |the clas|s .descr|
|00005180| 69 70 74 6f 72 73 20 66 | 6f 72 20 74 68 65 20 62 |iptors f|or the b|
|00005190| 61 73 65 20 63 6c 61 73 | 73 65 73 20 6f 66 20 74 |ase clas|ses of t|
|000051a0| 68 65 20 63 6c 61 73 73 | 20 79 6f 75 20 61 72 65 |he class| you are|
|000051b0| 20 64 65 66 69 6e 69 6e | 67 2e 20 20 54 68 65 73 | definin|g. Thes|
|000051c0| 65 20 6d 75 73 74 20 62 | 65 20 0a 69 6e 20 74 68 |e must b|e .in th|
|000051d0| 65 20 73 61 6d 65 20 6f | 72 64 65 72 20 61 73 20 |e same o|rder as |
|000051e0| 74 68 65 79 20 61 70 70 | 65 61 72 20 69 6e 20 74 |they app|ear in t|
|000051f0| 68 65 20 63 6c 61 73 73 | 20 64 65 63 6c 61 72 61 |he class| declara|
|00005200| 74 69 6f 6e 3a 0a 0a 0a | 5c 65 78 61 6d 70 6c 65 |tion:...|\example|
|00005210| 7b 23 64 65 66 69 6e 65 | 20 42 41 53 45 5f 43 4c |{#define| BASE_CL|
|00005220| 41 53 53 45 53 20 41 3a | 3a 64 65 73 63 28 29 2c |ASSES A:|:desc(),|
|00005230| 20 42 3a 3a 64 65 73 63 | 28 29 0a 0a 7d 0a 53 65 | B::desc|()..}.Se|
|00005240| 74 20 74 68 65 20 73 79 | 6d 62 6f 6c 20 5c 63 6f |t the sy|mbol \co|
|00005250| 64 65 7b 4d 45 4d 42 45 | 52 5f 43 4c 41 53 53 45 |de{MEMBE|R_CLASSE|
|00005260| 53 7d 20 74 6f 20 61 20 | 6c 69 73 74 20 6f 66 20 |S} to a |list of |
|00005270| 74 68 65 20 61 64 64 72 | 65 73 73 65 73 20 6f 66 |the addr|esses of|
|00005280| 20 74 68 65 20 63 6c 61 | 73 73 20 0a 64 65 73 63 | the cla|ss .desc|
|00005290| 72 69 70 74 6f 72 73 20 | 66 6f 72 20 61 6e 79 20 |riptors |for any |
|000052a0| 6d 65 6d 62 65 72 20 76 | 61 72 69 61 62 6c 65 73 |member v|ariables|
|000052b0| 20 6f 66 20 74 68 65 20 | 63 6c 61 73 73 20 74 68 | of the |class th|
|000052c0| 61 74 20 61 72 65 20 4e | 49 48 20 4c 69 62 72 61 |at are N|IH Libra|
|000052d0| 72 79 20 0a 63 6c 61 73 | 73 65 73 2e 20 20 54 68 |ry .clas|ses. Th|
|000052e0| 65 73 65 20 6d 75 73 74 | 20 62 65 20 69 6e 20 74 |ese must| be in t|
|000052f0| 68 65 20 73 61 6d 65 20 | 6f 72 64 65 72 20 61 73 |he same |order as|
|00005300| 20 74 68 65 79 20 61 70 | 70 65 61 72 20 69 6e 20 | they ap|pear in |
|00005310| 74 68 65 20 63 6c 61 73 | 73 20 0a 64 65 63 6c 61 |the clas|s .decla|
|00005320| 72 61 74 69 6f 6e 3a 0a | 0a 0a 5c 65 78 61 6d 70 |ration:.|..\examp|
|00005330| 6c 65 7b 23 64 65 66 69 | 6e 65 20 4d 45 4d 42 45 |le{#defi|ne MEMBE|
|00005340| 52 5f 43 4c 41 53 53 45 | 53 20 43 3a 3a 64 65 73 |R_CLASSE|S C::des|
|00005350| 63 28 29 2c 20 44 3a 3a | 64 65 73 63 28 29 0a 0a |c(), D::|desc()..|
|00005360| 7d 0a 49 66 20 61 20 63 | 6c 61 73 73 20 68 61 73 |}.If a c|lass has|
|00005370| 20 6e 6f 20 63 6c 61 73 | 73 20 6d 65 6d 62 65 72 | no clas|s member|
|00005380| 73 2c 20 64 65 66 69 6e | 65 20 5c 63 6f 64 65 7b |s, defin|e \code{|
|00005390| 4d 45 4d 42 45 52 5f 43 | 4c 41 53 53 45 53 7d 2c |MEMBER_C|LASSES},|
|000053a0| 20 62 75 74 20 67 69 76 | 65 20 69 74 20 6e 6f 20 | but giv|e it no |
|000053b0| 0a 76 61 6c 75 65 2e 0a | 0a 0a 53 65 74 20 74 68 |.value..|..Set th|
|000053c0| 65 20 73 79 6d 62 6f 6c | 20 5c 63 6f 64 65 7b 56 |e symbol| \code{V|
|000053d0| 49 52 54 55 41 4c 5f 42 | 41 53 45 5f 43 4c 41 53 |IRTUAL_B|ASE_CLAS|
|000053e0| 53 45 53 7d 20 74 6f 20 | 61 20 6c 69 73 74 20 6f |SES} to |a list o|
|000053f0| 66 20 74 68 65 20 61 64 | 64 72 65 73 73 65 73 20 |f the ad|dresses |
|00005400| 6f 66 20 74 68 65 20 0a | 63 6c 61 73 73 20 64 65 |of the .|class de|
|00005410| 73 63 72 69 70 74 6f 72 | 73 20 66 6f 72 20 74 68 |scriptor|s for th|
|00005420| 65 20 76 69 72 74 75 61 | 6c 20 62 61 73 65 20 63 |e virtua|l base c|
|00005430| 6c 61 73 73 65 73 20 6f | 66 20 74 68 65 20 63 6c |lasses o|f the cl|
|00005440| 61 73 73 20 79 6f 75 20 | 61 72 65 20 64 65 66 69 |ass you |are defi|
|00005450| 6e 69 6e 67 2e 20 0a 20 | 54 68 65 73 65 20 6d 75 |ning. . |These mu|
|00005460| 73 74 20 62 65 20 69 6e | 20 74 68 65 20 73 61 6d |st be in| the sam|
|00005470| 65 20 6f 72 64 65 72 20 | 61 73 20 74 68 65 79 20 |e order |as they |
|00005480| 61 70 70 65 61 72 20 69 | 6e 20 74 68 65 20 63 6c |appear i|n the cl|
|00005490| 61 73 73 20 64 65 63 6c | 61 72 61 74 69 6f 6e 3a |ass decl|aration:|
|000054a0| 0a 0a 0a 5c 65 78 61 6d | 70 6c 65 7b 23 64 65 66 |...\exam|ple{#def|
|000054b0| 69 6e 65 20 56 49 52 54 | 55 41 4c 5f 42 41 53 45 |ine VIRT|UAL_BASE|
|000054c0| 5f 43 4c 41 53 53 45 53 | 20 42 3a 3a 64 65 73 63 |_CLASSES| B::desc|
|000054d0| 28 29 0a 0a 7d 0a 49 66 | 20 61 20 63 6c 61 73 73 |()..}.If| a class|
|000054e0| 20 68 61 73 20 6e 6f 20 | 76 69 72 74 75 61 6c 20 | has no |virtual |
|000054f0| 62 61 73 65 20 63 6c 61 | 73 73 65 73 2c 20 64 65 |base cla|sses, de|
|00005500| 66 69 6e 65 20 5c 63 6f | 64 65 7b 56 49 52 54 55 |fine \co|de{VIRTU|
|00005510| 41 4c 5f 42 41 53 45 5f | 43 4c 41 53 53 45 53 7d |AL_BASE_|CLASSES}|
|00005520| 2c 20 0a 62 75 74 20 67 | 69 76 65 20 69 74 20 6e |, .but g|ive it n|
|00005530| 6f 20 76 61 6c 75 65 2e | 0a 0a 0a 4e 6f 77 20 79 |o value.|...Now y|
|00005540| 6f 75 20 61 72 65 20 72 | 65 61 64 79 20 74 6f 20 |ou are r|eady to |
|00005550| 63 61 6c 6c 20 74 68 65 | 20 5c 63 6f 64 65 7b 44 |call the| \code{D|
|00005560| 45 46 49 4e 45 5f 43 4c | 41 53 53 7d 20 6d 61 63 |EFINE_CL|ASS} mac|
|00005570| 72 6f 3a 0a 0a 0a 5c 65 | 78 61 6d 70 6c 65 7b 44 |ro:...\e|xample{D|
|00005580| 45 46 49 4e 45 5f 43 4c | 41 53 53 28 5c 69 74 61 |EFINE_CL|ASS(\ita|
|00005590| 6c 69 63 7b 63 6c 61 73 | 73 6e 61 6d 65 7d 2c 5c |lic{clas|sname},\|
|000055a0| 69 74 61 6c 69 63 7b 76 | 65 72 73 69 6f 6e 7d 2c |italic{v|ersion},|
|000055b0| 5c 69 74 61 6c 69 63 7b | 69 64 65 6e 74 69 66 69 |\italic{|identifi|
|000055c0| 63 61 74 69 6f 5c 0a 6e | 7d 2c 5c 69 74 61 6c 69 |catio\.n|},\itali|
|000055d0| 63 7b 69 6e 69 74 6f 72 | 31 7d 2c 5c 69 74 61 6c |c{initor|1},\ital|
|000055e0| 69 63 7b 69 6e 69 74 6f | 72 32 7d 29 0a 0a 7d 0a |ic{inito|r2})..}.|
|000055f0| 5c 69 74 61 6c 69 63 7b | 43 6c 61 73 73 6e 61 6d |\italic{|Classnam|
|00005600| 65 7d 20 69 73 20 74 68 | 65 20 6e 61 6d 65 20 6f |e} is th|e name o|
|00005610| 66 20 74 68 65 20 63 6c | 61 73 73 20 79 6f 75 20 |f the cl|ass you |
|00005620| 61 72 65 20 64 65 66 69 | 6e 69 6e 67 2e 0a 0a 0a |are defi|ning....|
|00005630| 5c 69 74 61 6c 69 63 7b | 56 65 72 73 69 6f 6e 7d |\italic{|Version}|
|00005640| 20 69 73 20 74 68 65 20 | 76 65 72 73 69 6f 6e 20 | is the |version |
|00005650| 6e 75 6d 62 65 72 20 6f | 66 20 74 68 65 20 63 6c |number o|f the cl|
|00005660| 61 73 73 20 79 6f 75 20 | 61 72 65 20 64 65 66 69 |ass you |are defi|
|00005670| 6e 69 6e 67 2e 20 20 49 | 74 20 0a 73 68 6f 75 6c |ning. I|t .shoul|
|00005680| 64 20 62 65 20 63 68 61 | 6e 67 65 64 20 77 68 65 |d be cha|nged whe|
|00005690| 6e 65 76 65 72 20 74 68 | 65 20 66 6f 72 6d 61 74 |never th|e format|
|000056a0| 20 6f 66 20 74 68 65 20 | 69 6e 66 6f 72 6d 61 74 | of the |informat|
|000056b0| 69 6f 6e 20 77 72 69 74 | 74 65 6e 20 62 79 20 74 |ion writ|ten by t|
|000056c0| 68 65 20 0a 5c 63 6f 64 | 65 7b 73 74 6f 72 65 72 |he .\cod|e{storer|
|000056d0| 28 29 7d 20 66 75 6e 63 | 74 69 6f 6e 20 63 68 61 |()} func|tion cha|
|000056e0| 6e 67 65 73 20 73 75 63 | 68 20 74 68 61 74 20 6f |nges suc|h that o|
|000056f0| 6c 64 65 72 20 76 65 72 | 73 69 6f 6e 73 20 6f 66 |lder ver|sions of|
|00005700| 20 5c 63 6f 64 65 7b 72 | 65 61 64 46 72 6f 6d 28 | \code{r|eadFrom(|
|00005710| 29 7d 20 0a 63 61 6e 20 | 6e 6f 20 6c 6f 6e 67 65 |)} .can |no longe|
|00005720| 72 20 69 6e 74 65 72 70 | 72 65 74 20 69 74 20 63 |r interp|ret it c|
|00005730| 6f 72 72 65 63 74 6c 79 | 2e 0a 0a 0a 5c 69 74 61 |orrectly|....\ita|
|00005740| 6c 69 63 7b 49 64 65 6e | 74 69 66 69 63 61 74 69 |lic{Iden|tificati|
|00005750| 6f 6e 7d 20 69 73 20 61 | 20 63 68 61 72 61 63 74 |on} is a| charact|
|00005760| 65 72 20 73 74 72 69 6e | 67 20 74 68 61 74 20 69 |er strin|g that i|
|00005770| 64 65 6e 74 69 66 69 65 | 73 20 74 68 65 20 72 65 |dentifie|s the re|
|00005780| 76 69 73 69 6f 6e 20 0a | 6c 65 76 65 6c 20 6f 66 |vision .|level of|
|00005790| 20 74 68 65 20 69 6d 70 | 6c 65 6d 65 6e 74 61 74 | the imp|lementat|
|000057a0| 69 6f 6e 20 6f 66 20 74 | 68 65 20 63 6c 61 73 73 |ion of t|he class|
|000057b0| 2e 20 20 49 74 20 69 73 | 20 73 69 6d 70 6c 79 20 |. It is| simply |
|000057c0| 73 74 6f 72 65 64 20 69 | 6e 20 74 68 65 20 63 6c |stored i|n the cl|
|000057d0| 61 73 73 20 0a 64 65 73 | 63 72 69 70 74 6f 72 20 |ass .des|criptor |
|000057e0| 77 68 65 72 65 20 79 6f | 75 20 63 61 6e 20 72 65 |where yo|u can re|
|000057f0| 74 72 69 65 76 65 20 69 | 74 20 62 79 20 63 61 6c |trieve i|t by cal|
|00005800| 6c 69 6e 67 20 74 68 65 | 20 66 75 6e 63 74 69 6f |ling the| functio|
|00005810| 6e 20 0a 5c 63 6f 64 65 | 7b 43 6c 61 73 73 3a 3a |n .\code|{Class::|
|00005820| 69 64 65 6e 74 28 29 7d | 2e 20 20 54 68 65 20 69 |ident()}|. The i|
|00005830| 64 65 6e 74 69 66 69 63 | 61 74 69 6f 6e 20 70 61 |dentific|ation pa|
|00005840| 72 61 6d 65 74 65 72 20 | 69 73 20 69 6e 74 65 6e |rameter |is inten|
|00005850| 64 65 64 20 66 6f 72 20 | 75 73 65 20 77 69 74 68 |ded for |use with|
|00005860| 20 0a 61 20 72 65 76 69 | 73 69 6f 6e 20 63 6f 6e | .a revi|sion con|
|00005870| 74 72 6f 6c 20 73 79 73 | 74 65 6d 20 73 75 63 68 |trol sys|tem such|
|00005880| 20 61 73 20 52 43 53 20 | 6f 72 20 53 43 43 53 2e | as RCS |or SCCS.|
|00005890| 20 20 4e 49 48 20 4c 69 | 62 72 61 72 79 20 63 6c | NIH Li|brary cl|
|000058a0| 61 73 73 65 73 20 73 70 | 65 63 69 66 79 20 69 74 |asses sp|ecify it|
|000058b0| 20 0a 61 73 20 74 68 65 | 20 73 74 72 69 6e 67 20 | .as the| string |
|000058c0| 22 5c 63 6f 64 65 7b 24 | 7d 5c 63 6f 64 65 7b 48 |"\code{$|}\code{H|
|000058d0| 65 61 64 65 72 7d 5c 63 | 6f 64 65 7b 24 7d 22 2c |eader}\c|ode{$}",|
|000058e0| 20 77 68 69 63 68 20 52 | 43 53 20 72 65 70 6c 61 | which R|CS repla|
|000058f0| 63 65 73 20 77 69 74 68 | 20 74 68 65 20 0a 72 65 |ces with| the .re|
|00005900| 76 69 73 69 6f 6e 20 69 | 64 65 6e 74 69 66 69 63 |vision i|dentific|
|00005910| 61 74 69 6f 6e 2e 0a 0a | 0a 5c 69 74 61 6c 69 63 |ation...|.\italic|
|00005920| 7b 49 6e 69 74 6f 72 31 | 7d 20 61 6e 64 20 5c 69 |{Initor1|} and \i|
|00005930| 74 61 6c 69 63 7b 69 6e | 69 74 6f 72 32 7d 20 61 |talic{in|itor2} a|
|00005940| 72 65 20 70 6f 69 6e 74 | 65 72 73 20 74 6f 20 66 |re point|ers to f|
|00005950| 75 6e 63 74 69 6f 6e 73 | 20 79 6f 75 20 6d 61 79 |unctions| you may|
|00005960| 20 73 75 70 70 6c 79 20 | 0a 74 6f 20 70 65 72 66 | supply |.to perf|
|00005970| 6f 72 6d 20 69 6e 69 74 | 69 61 6c 69 7a 61 74 69 |orm init|ializati|
|00005980| 6f 6e 20 66 6f 72 20 74 | 68 65 20 63 6c 61 73 73 |on for t|he class|
|00005990| 2c 20 66 6f 72 20 65 78 | 61 6d 70 6c 65 2c 20 69 |, for ex|ample, i|
|000059a0| 6e 69 74 69 61 6c 69 7a | 69 6e 67 20 0a 5c 63 6f |nitializ|ing .\co|
|000059b0| 64 65 7b 73 74 61 74 69 | 63 7d 20 64 61 74 61 20 |de{stati|c} data |
|000059c0| 74 68 61 74 20 74 68 65 | 20 63 6c 61 73 73 20 75 |that the| class u|
|000059d0| 73 65 73 2e 0a 0a 0a 5c | 63 6f 64 65 7b 5c 73 75 |ses....\|code{\su|
|000059e0| 62 73 65 63 74 69 6f 6e | 7b 44 45 46 49 4e 45 5f |bsection|{DEFINE_|
|000059f0| 41 42 53 54 52 41 43 54 | 5f 43 4c 41 53 53 7d 7d |ABSTRACT|_CLASS}}|
|00005a00| 0a 0a 0a 41 62 73 74 72 | 61 63 74 20 63 6c 61 73 |...Abstr|act clas|
|00005a10| 73 65 73 20 73 68 6f 75 | 6c 64 20 75 73 65 20 74 |ses shou|ld use t|
|00005a20| 68 65 20 6e 65 77 20 6d | 61 63 72 6f 20 5c 63 6f |he new m|acro \co|
|00005a30| 64 65 7b 44 45 46 49 4e | 45 5f 41 42 53 54 52 41 |de{DEFIN|E_ABSTRA|
|00005a40| 43 54 5f 43 4c 41 53 53 | 7d 20 69 6e 73 74 65 61 |CT_CLASS|} instea|
|00005a50| 64 20 0a 6f 66 20 5c 63 | 6f 64 65 7b 44 45 46 49 |d .of \c|ode{DEFI|
|00005a60| 4e 45 5f 43 4c 41 53 53 | 7d 2e 20 20 5c 63 6f 64 |NE_CLASS|}. \cod|
|00005a70| 65 7b 5c 63 6f 64 65 7b | 44 45 46 49 4e 45 5f 41 |e{\code{|DEFINE_A|
|00005a80| 42 53 54 52 41 43 54 5f | 43 4c 41 53 53 20 7d 7d |BSTRACT_|CLASS }}|
|00005a90| 68 61 73 20 74 68 65 20 | 73 61 6d 65 20 0a 61 72 |has the |same .ar|
|00005aa0| 67 75 6d 65 6e 74 73 20 | 61 73 20 5c 63 6f 64 65 |guments |as \code|
|00005ab0| 7b 44 45 46 49 4e 45 5f | 43 4c 41 53 53 7d 3b 20 |{DEFINE_|CLASS}; |
|00005ac0| 74 68 65 20 6f 6e 6c 79 | 20 64 69 66 66 65 72 65 |the only| differe|
|00005ad0| 6e 63 65 20 69 73 20 74 | 68 61 74 20 74 68 65 20 |nce is t|hat the |
|00005ae0| 0a 5c 63 6f 64 65 7b 72 | 65 61 64 65 72 28 29 7d |.\code{r|eader()}|
|00005af0| 20 66 75 6e 63 74 69 6f | 6e 73 20 69 74 20 67 65 | functio|ns it ge|
|00005b00| 6e 65 72 61 74 65 73 20 | 64 6f 20 6e 6f 74 20 72 |nerates |do not r|
|00005b10| 65 66 65 72 65 6e 63 65 | 20 74 68 65 20 63 6c 61 |eference| the cla|
|00005b20| 73 73 27 73 20 6f 62 6a | 65 63 74 20 49 2f 4f 20 |ss's obj|ect I/O |
|00005b30| 0a 63 6f 6e 73 74 72 75 | 63 74 6f 72 73 2c 20 61 |.constru|ctors, a|
|00005b40| 6e 64 20 5c 63 6f 64 65 | 7b 73 68 61 6c 6c 6f 77 |nd \code|{shallow|
|00005b50| 43 6f 70 79 28 29 7d 20 | 69 73 20 64 65 66 69 6e |Copy()} |is defin|
|00005b60| 65 64 20 61 73 20 61 20 | 0a 5c 63 6f 64 65 7b 64 |ed as a |.\code{d|
|00005b70| 65 72 69 76 65 64 43 6c | 61 73 73 52 65 73 70 6f |erivedCl|assRespo|
|00005b80| 6e 73 69 62 69 6c 69 74 | 79 28 29 7d 2e 0a 0a 0a |nsibilit|y()}....|
|00005b90| 5c 73 75 62 73 65 63 74 | 69 6f 6e 7b 43 68 61 6e |\subsect|ion{Chan|
|00005ba0| 67 65 20 74 6f 20 5c 63 | 6f 64 65 7b 43 6c 61 73 |ge to \c|ode{Clas|
|00005bb0| 73 3a 3a 63 6c 61 73 73 | 4e 61 6d 65 28 29 7d 0a |s::class|Name()}.|
|00005bc0| 0a 7d 0a 54 68 65 20 66 | 75 6e 63 74 69 6f 6e 20 |.}.The f|unction |
|00005bd0| 5c 63 6f 64 65 7b 63 6c | 61 73 73 4e 61 6d 65 28 |\code{cl|assName(|
|00005be0| 29 7d 20 72 65 74 75 72 | 6e 73 20 74 68 65 20 6e |)} retur|ns the n|
|00005bf0| 61 6d 65 20 6f 66 20 74 | 68 65 20 63 6c 61 73 73 |ame of t|he class|
|00005c00| 20 6f 66 20 74 68 65 20 | 6f 62 6a 65 63 74 20 74 | of the |object t|
|00005c10| 6f 20 0a 77 68 69 63 68 | 20 69 74 20 69 73 20 61 |o .which| it is a|
|00005c20| 70 70 6c 69 65 64 2e 20 | 20 49 6e 20 70 72 65 76 |pplied. | In prev|
|00005c30| 69 6f 75 73 20 72 65 6c | 65 61 73 65 73 20 5c 63 |ious rel|eases \c|
|00005c40| 6f 64 65 7b 43 6c 61 73 | 73 3a 3a 63 6c 61 73 73 |ode{Clas|s::class|
|00005c50| 4e 61 6d 65 28 29 7d 20 | 64 6f 65 73 20 6e 6f 74 |Name()} |does not|
|00005c60| 20 0a 64 6f 20 74 68 69 | 73 2e 20 20 49 6e 73 74 | .do thi|s. Inst|
|00005c70| 65 61 64 2c 20 69 74 20 | 72 65 74 75 72 6e 73 20 |ead, it |returns |
|00005c80| 74 68 65 20 6e 61 6d 65 | 20 6f 66 20 74 68 65 20 |the name| of the |
|00005c90| 63 6c 61 73 73 20 64 65 | 73 63 72 69 62 65 64 20 |class de|scribed |
|00005ca0| 62 79 20 74 68 65 20 63 | 6c 61 73 73 20 0a 6f 62 |by the c|lass .ob|
|00005cb0| 6a 65 63 74 20 74 6f 20 | 77 68 69 63 68 20 69 74 |ject to |which it|
|00005cc0| 20 69 73 20 61 70 70 6c | 69 65 64 2e 20 20 54 68 | is appl|ied. Th|
|00005cd0| 69 73 20 72 65 6c 65 61 | 73 65 20 65 6c 69 6d 69 |is relea|se elimi|
|00005ce0| 6e 61 74 65 73 20 74 68 | 69 73 20 69 6e 63 6f 6e |nates th|is incon|
|00005cf0| 73 69 73 74 65 6e 63 79 | 3a 20 0a 5c 63 6f 64 65 |sistency|: .\code|
|00005d00| 7b 63 6c 61 73 73 4e 61 | 6d 65 28 29 7d 20 72 65 |{classNa|me()} re|
|00005d10| 74 75 72 6e 73 20 5c 63 | 6f 64 65 7b 22 43 6c 61 |turns \c|ode{"Cla|
|00005d20| 73 73 22 7d 20 77 68 65 | 6e 20 61 70 70 6c 69 65 |ss"} whe|n applie|
|00005d30| 64 20 74 6f 20 61 6e 20 | 69 6e 73 74 61 6e 63 65 |d to an |instance|
|00005d40| 20 6f 66 20 63 6c 61 73 | 73 20 0a 5c 63 6f 64 65 | of clas|s .\code|
|00005d50| 7b 43 6c 61 73 73 7d 2e | 20 20 54 68 65 20 6e 65 |{Class}.| The ne|
|00005d60| 77 20 66 75 6e 63 74 69 | 6f 6e 20 5c 63 6f 64 65 |w functi|on \code|
|00005d70| 7b 43 6c 61 73 73 3a 3a | 6e 61 6d 65 28 29 7d 20 |{Class::|name()} |
|00005d80| 72 65 74 75 72 6e 73 20 | 74 68 65 20 6e 61 6d 65 |returns |the name|
|00005d90| 20 6f 66 20 74 68 65 20 | 0a 63 6c 61 73 73 20 64 | of the |.class d|
|00005da0| 65 73 63 72 69 62 65 64 | 20 62 79 20 61 6e 20 69 |escribed| by an i|
|00005db0| 6e 73 74 61 6e 63 65 20 | 6f 66 20 63 6c 61 73 73 |nstance |of class|
|00005dc0| 20 5c 63 6f 64 65 7b 43 | 6c 61 73 73 7d 2e 0a 0a | \code{C|lass}...|
|00005dd0| 0a 5c 73 75 62 73 65 63 | 74 69 6f 6e 7b 4e 65 77 |.\subsec|tion{New|
|00005de0| 20 6d 65 6d 62 65 72 20 | 66 75 6e 63 74 69 6f 6e | member |function|
|00005df0| 73 20 6f 66 20 63 6c 61 | 73 73 20 5c 63 6f 64 65 |s of cla|ss \code|
|00005e00| 7b 43 6c 61 73 73 7d 0a | 0a 7d 0a 5c 63 6f 64 65 |{Class}.|.}.\code|
|00005e10| 7b 43 6c 61 73 73 2a 2a | 20 62 61 73 65 43 6c 61 |{Class**| baseCla|
|00005e20| 73 73 65 73 28 29 7d 20 | 72 65 74 75 72 6e 73 20 |sses()} |returns |
|00005e30| 61 20 7a 65 72 6f 2d 74 | 65 72 6d 69 6e 61 74 65 |a zero-t|erminate|
|00005e40| 64 20 61 72 72 61 79 20 | 6f 66 20 70 6f 69 6e 74 |d array |of point|
|00005e50| 65 72 73 20 74 6f 20 0a | 74 68 65 20 63 6c 61 73 |ers to .|the clas|
|00005e60| 73 20 64 65 73 63 72 69 | 70 74 6f 72 73 20 6f 66 |s descri|ptors of|
|00005e70| 20 74 68 65 20 62 61 73 | 65 20 63 6c 61 73 73 65 | the bas|e classe|
|00005e80| 73 20 6f 66 20 74 68 69 | 73 20 63 6c 61 73 73 2e |s of thi|s class.|
|00005e90| 0a 0a 0a 5c 63 6f 64 65 | 7b 43 6c 61 73 73 2a 2a |...\code|{Class**|
|00005ea0| 20 6d 65 6d 62 65 72 43 | 6c 61 73 73 65 73 28 29 | memberC|lasses()|
|00005eb0| 7d 20 72 65 74 75 72 6e | 73 20 61 20 7a 65 72 6f |} return|s a zero|
|00005ec0| 2d 74 65 72 6d 69 6e 61 | 74 65 64 20 61 72 72 61 |-termina|ted arra|
|00005ed0| 79 20 6f 66 20 70 6f 69 | 6e 74 65 72 73 20 74 6f |y of poi|nters to|
|00005ee0| 20 0a 74 68 65 20 63 6c | 61 73 73 20 64 65 73 63 | .the cl|ass desc|
|00005ef0| 72 69 70 74 6f 72 73 20 | 6f 66 20 74 68 65 20 6d |riptors |of the m|
|00005f00| 65 6d 62 65 72 20 63 6c | 61 73 73 65 73 20 6f 66 |ember cl|asses of|
|00005f10| 20 74 68 69 73 20 63 6c | 61 73 73 2e 0a 0a 0a 5c | this cl|ass....\|
|00005f20| 63 6f 64 65 7b 43 6c 61 | 73 73 2a 2a 20 76 69 72 |code{Cla|ss** vir|
|00005f30| 74 75 61 6c 42 61 73 65 | 43 6c 61 73 73 65 73 28 |tualBase|Classes(|
|00005f40| 29 7d 20 72 65 74 75 72 | 6e 73 20 61 20 7a 65 72 |)} retur|ns a zer|
|00005f50| 6f 2d 74 65 72 6d 69 6e | 61 74 65 64 20 61 72 72 |o-termin|ated arr|
|00005f60| 61 79 20 6f 66 20 0a 70 | 6f 69 6e 74 65 72 73 20 |ay of .p|ointers |
|00005f70| 74 6f 20 74 68 65 20 63 | 6c 61 73 73 20 64 65 73 |to the c|lass des|
|00005f80| 63 72 69 70 74 6f 72 73 | 20 6f 66 20 74 68 65 20 |criptors| of the |
|00005f90| 76 69 72 74 75 61 6c 20 | 62 61 73 65 20 63 6c 61 |virtual |base cla|
|00005fa0| 73 73 65 73 20 6f 66 20 | 74 68 69 73 20 63 6c 61 |sses of |this cla|
|00005fb0| 73 73 2e 0a 0a 0a 5c 63 | 6f 64 65 7b 75 6e 73 69 |ss....\c|ode{unsi|
|00005fc0| 67 6e 65 64 20 6c 6f 6e | 67 20 73 69 67 6e 61 74 |gned lon|g signat|
|00005fd0| 75 72 65 28 29 7d 20 72 | 65 74 75 72 6e 73 20 74 |ure()} r|eturns t|
|00005fe0| 68 65 20 73 69 67 6e 61 | 74 75 72 65 20 6f 66 20 |he signa|ture of |
|00005ff0| 74 68 69 73 20 63 6c 61 | 73 73 2e 20 20 54 68 65 |this cla|ss. The|
|00006000| 20 0a 73 69 67 6e 61 74 | 75 72 65 20 6f 66 20 61 | .signat|ure of a|
|00006010| 20 63 6c 61 73 73 20 69 | 73 20 63 6f 6d 70 75 74 | class i|s comput|
|00006020| 65 64 20 62 79 20 68 61 | 73 68 69 6e 67 20 74 68 |ed by ha|shing th|
|00006030| 65 20 73 69 67 6e 61 74 | 75 72 65 73 20 6f 66 20 |e signat|ures of |
|00006040| 74 68 69 73 20 63 6c 61 | 73 73 27 73 20 0a 62 61 |this cla|ss's .ba|
|00006050| 73 65 20 61 6e 64 20 6d | 65 6d 62 65 72 20 63 6c |se and m|ember cl|
|00006060| 61 73 73 65 73 20 61 6e | 64 20 74 68 65 20 76 65 |asses an|d the ve|
|00006070| 72 73 69 6f 6e 20 6e 75 | 6d 62 65 72 20 6f 66 20 |rsion nu|mber of |
|00006080| 74 68 69 73 20 63 6c 61 | 73 73 2e 20 20 49 74 20 |this cla|ss. It |
|00006090| 69 73 20 63 75 72 72 65 | 6e 74 6c 79 20 0a 75 73 |is curre|ntly .us|
|000060a0| 65 64 20 62 79 20 5c 63 | 6f 64 65 7b 73 74 6f 72 |ed by \c|ode{stor|
|000060b0| 65 4f 6e 28 29 7d 2f 5c | 63 6f 64 65 7b 72 65 61 |eOn()}/\|code{rea|
|000060c0| 64 46 72 6f 6d 28 29 7d | 20 74 6f 20 70 72 65 76 |dFrom()}| to prev|
|000060d0| 65 6e 74 20 6f 62 73 6f | 6c 65 74 65 20 76 65 72 |ent obso|lete ver|
|000060e0| 73 69 6f 6e 73 20 6f 66 | 20 0a 6f 62 6a 65 63 74 |sions of| .object|
|000060f0| 73 20 66 72 6f 6d 20 62 | 65 69 6e 67 20 72 65 61 |s from b|eing rea|
|00006100| 64 2e 0a 0a 0a 5c 63 6f | 64 65 7b 63 6f 6e 73 74 |d....\co|de{const|
|00006110| 20 43 6c 61 73 73 2a 20 | 43 6c 61 73 73 3a 3a 6c | Class* |Class::l|
|00006120| 6f 6f 6b 75 70 28 63 6f | 6e 73 74 20 63 68 61 72 |ookup(co|nst char|
|00006130| 2a 20 6e 61 6d 65 29 7d | 20 72 65 74 75 72 6e 73 |* name)}| returns|
|00006140| 20 61 20 70 6f 69 6e 74 | 65 72 20 74 6f 20 74 68 | a point|er to th|
|00006150| 65 20 0a 63 6c 61 73 73 | 20 64 65 73 63 72 69 70 |e .class| descrip|
|00006160| 74 6f 72 20 6f 62 6a 65 | 63 74 20 66 6f 72 20 74 |tor obje|ct for t|
|00006170| 68 65 20 63 6c 61 73 73 | 20 77 69 74 68 20 74 68 |he class| with th|
|00006180| 65 20 73 70 65 63 69 66 | 69 65 64 20 6e 61 6d 65 |e specif|ied name|
|00006190| 2e 20 0a 20 5c 63 6f 64 | 65 7b 43 6c 61 73 73 3a |. . \cod|e{Class:|
|000061a0| 3a 6c 6f 6f 6b 75 70 28 | 29 7d 20 72 65 74 75 72 |:lookup(|)} retur|
|000061b0| 6e 73 20 30 20 69 66 20 | 74 68 65 20 6e 61 6d 65 |ns 0 if |the name|
|000061c0| 20 69 73 20 6e 6f 74 20 | 66 6f 75 6e 64 2e 0a 0a | is not |found...|
|000061d0| 0a 5c 73 75 62 73 65 63 | 74 69 6f 6e 7b 43 68 61 |.\subsec|tion{Cha|
|000061e0| 6e 67 65 73 20 74 6f 20 | 5c 63 6f 64 65 7b 63 6f |nges to |\code{co|
|000061f0| 70 79 28 29 7d 2c 20 5c | 63 6f 64 65 7b 73 68 61 |py()}, \|code{sha|
|00006200| 6c 6c 6f 77 43 6f 70 79 | 28 29 7d 2c 20 61 6e 64 |llowCopy|()}, and|
|00006210| 20 0a 5c 63 6f 64 65 7b | 64 65 65 70 43 6f 70 79 | .\code{|deepCopy|
|00006220| 28 29 7d 0a 0a 7d 0a 49 | 6e 20 70 72 65 76 69 6f |()}..}.I|n previo|
|00006230| 75 73 20 72 65 6c 65 61 | 73 65 73 2c 20 5c 63 6f |us relea|ses, \co|
|00006240| 64 65 7b 73 68 61 6c 6c | 6f 77 43 6f 70 79 28 29 |de{shall|owCopy()|
|00006250| 7d 20 6d 61 64 65 20 61 | 20 62 69 74 77 69 73 65 |} made a| bitwise|
|00006260| 20 63 6f 70 79 20 6f 66 | 20 61 6e 20 6f 62 6a 65 | copy of| an obje|
|00006270| 63 74 2c 20 0a 61 6e 64 | 20 5c 63 6f 64 65 7b 64 |ct, .and| \code{d|
|00006280| 65 65 70 43 6f 70 79 28 | 29 7d 20 66 69 72 73 74 |eepCopy(|)} first|
|00006290| 20 6d 61 64 65 20 61 20 | 73 68 61 6c 6c 6f 77 20 | made a |shallow |
|000062a0| 63 6f 70 79 20 6f 66 20 | 61 6e 20 6f 62 6a 65 63 |copy of |an objec|
|000062b0| 74 2c 20 61 6e 64 20 74 | 68 65 6e 20 63 61 6c 6c |t, and t|hen call|
|000062c0| 65 64 20 0a 74 68 65 20 | 76 69 72 74 75 61 6c 20 |ed .the |virtual |
|000062d0| 66 75 6e 63 74 69 6f 6e | 20 5c 63 6f 64 65 7b 64 |function| \code{d|
|000062e0| 65 65 70 65 6e 53 68 61 | 6c 6c 6f 77 43 6f 70 79 |eepenSha|llowCopy|
|000062f0| 28 29 7d 20 74 6f 20 63 | 6f 6e 76 65 72 74 20 74 |()} to c|onvert t|
|00006300| 68 65 20 73 68 61 6c 6c | 6f 77 20 63 6f 70 79 20 |he shall|ow copy |
|00006310| 74 6f 20 0a 61 20 64 65 | 65 70 20 63 6f 70 79 2e |to .a de|ep copy.|
|00006320| 20 20 45 61 63 68 20 63 | 6c 61 73 73 20 72 65 69 | Each c|lass rei|
|00006330| 6d 70 6c 65 6d 65 6e 74 | 65 64 20 5c 63 6f 64 65 |mplement|ed \code|
|00006340| 7b 64 65 65 70 65 6e 53 | 68 61 6c 6c 6f 77 43 6f |{deepenS|hallowCo|
|00006350| 70 79 28 29 7d 20 74 6f | 20 68 61 6e 64 6c 65 20 |py()} to| handle |
|00006360| 0a 61 6e 79 20 70 6f 69 | 6e 74 65 72 20 6d 65 6d |.any poi|nter mem|
|00006370| 62 65 72 20 76 61 72 69 | 61 62 6c 65 73 20 63 6f |ber vari|ables co|
|00006380| 6e 74 61 69 6e 65 64 20 | 69 6e 20 69 6e 73 74 61 |ntained |in insta|
|00006390| 6e 63 65 73 20 6f 66 20 | 69 74 73 20 63 6c 61 73 |nces of |its clas|
|000063a0| 73 2e 0a 0a 0a 54 68 65 | 20 70 72 6f 62 6c 65 6d |s....The| problem|
|000063b0| 73 20 77 69 74 68 20 74 | 68 69 73 20 61 70 70 72 |s with t|his appr|
|000063c0| 6f 61 63 68 20 61 72 65 | 20 74 68 61 74 20 28 31 |oach are| that (1|
|000063d0| 29 20 69 74 20 69 73 20 | 75 73 75 61 6c 6c 79 20 |) it is |usually |
|000063e0| 75 6e 73 61 66 65 20 74 | 6f 20 6d 61 6b 65 20 61 |unsafe t|o make a|
|000063f0| 20 0a 73 68 61 6c 6c 6f | 77 20 63 6f 70 79 20 6f | .shallo|w copy o|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.