home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / help / cppclrf.inf (.txt) < prev    next >
Encoding:
OS/2 Help File  |  1996-02-26  |  547.7 KB  |  20,754 lines

  1.  
  2. ΓòÉΓòÉΓòÉ 1. About this Online Reference ΓòÉΓòÉΓòÉ
  3.  
  4. This reference describes the classes and class members that are included in IBM 
  5. Open Class Library. 
  6.  
  7.       Notices 
  8.       Trademarks and Service Marks 
  9.       What is IBM Open Class? 
  10.       About Examples 
  11.       Using this Book 
  12.       Contextual Help 
  13.       Finding Descriptions 
  14.       How to Use the Contents 
  15.       Getting More Information 
  16.       Using Menu Bar Choices 
  17.       Cutting and Pasting 
  18.       Other Helpful Information 
  19.       Sending Comments to IBM 
  20.  
  21.  
  22. ΓòÉΓòÉΓòÉ 1.1. Notices ΓòÉΓòÉΓòÉ
  23.  
  24. (C) Copyright International Business Machines Corporation, 1992, 1996. All 
  25. rights reserved. 
  26.  
  27. Note to U.S. Government Users - Documentation related to restricted rights - 
  28. Use, duplication, or disclosure is subject to restrictions set forth in GSA ADP 
  29. Schedule Contract with IBM Corp. 
  30.  
  31. First Edition, March 1996 
  32.  
  33. This edition applies to Version 3.5 of IBM VisualAge for C++ for Windows ( 
  34. 33H4979, 33H4980) and to all subsequent releases and modifications until 
  35. otherwise indicated in new editions.  Make sure you are using the correct 
  36. edition for the level of the product. 
  37.  
  38. This publication could include technical inaccuracies or typographical errors. 
  39. Changes are periodically made to the information herein; any such changes will 
  40. be reported in subsequent revisions. 
  41.  
  42. Requests for publications and for technical information about IBM products 
  43. should be made to your IBM Authorized Dealer or your IBM Marketing 
  44. Representative. 
  45.  
  46. When you send information to IBM, you grant IBM a nonexclusive right to use or 
  47. distribute the information in any ways it believes appropriate without 
  48. incurring any obligation to you. 
  49.  
  50. Any reference to an IBM licensed program in this publication is not intended to 
  51. state or imply that only IBM's licensed program may be used. Any functionally 
  52. equivalent product, program, or service that does not infringe any of IBM's 
  53. intellectual property rights may be used instead of the IBM product, program, 
  54. or service. Evaluation and verification of operation in conjunction with other 
  55. products, except those expressly designated by IBM, is the user's 
  56. responsibility. 
  57.  
  58. IBM may have patents or pending patent applications covering subject matter in 
  59. this document.  The furnishing of this document does not give you any license 
  60. to these patents.  You can send license inquiries, in writing, to the IBM 
  61. Director of Licensing, IBM Corporation, 500 Columbus Avenue, Thornwood, NY, 
  62. 10594, USA. 
  63.  
  64. Licensees of this program who wish to have information about it for the purpose 
  65. of enabling: (i) the exchange of information between independent created 
  66. programs and other programs (including this one) and (ii) the mutual use of the 
  67. information which has been exchanged, should contact IBM Canada Ltd., 
  68. Department 071, 1150 Eglinton Avenue East, North York, Ontario M3C 1H7, Canada. 
  69. Such information may be available, subject to appropriate terms and conditions, 
  70. including in some cases payment of a fee. 
  71.  
  72.  
  73. ΓòÉΓòÉΓòÉ 1.2. Trademarks and Service Marks ΓòÉΓòÉΓòÉ
  74.  
  75. The following terms used in this publication are trademarks or service marks of 
  76. IBM Corporation in the United States or other countries: 
  77.  
  78.       AIX 
  79.       BookManager 
  80.       C/2 
  81.       C Set/2 
  82.       C Set ++ 
  83.       Common User Access 
  84.       CUA 
  85.       IBM 
  86.       IBMLink 
  87.       Operating System/2 
  88.       OS/2 
  89.       Personal System/2 
  90.       Presentation Manager 
  91.       PS/2 
  92.       System Object Model 
  93.       VisualAge 
  94.       WorkFrame 
  95.  
  96.  Windows is a trademark of Microsoft Corporation. 
  97.  
  98.  UNIX is a registered trademark in the United States and other countries 
  99.  licensed exclusively through X/Open Company Limited. 
  100.  
  101.  Other company, product, and service names, which may be denoted by a double 
  102.  asterisk(**), may be trademarks or service marks of others. 
  103.  
  104.  IBM's VisualAge products and services are not associated with or sponsored by 
  105.  Visual Edge Software, Ltd.. 
  106.  
  107.  
  108. ΓòÉΓòÉΓòÉ 1.3. What is IBM Open Class Library? ΓòÉΓòÉΓòÉ
  109.  
  110. IBM Open Class Library (or IBM Open Class) consists of classes in the following 
  111. categories: 
  112.  
  113.      Complex Mathematics 
  114.      I/O Streams 
  115.      Collections 
  116.      Data Types 
  117.      Exceptions 
  118.      Database Access Builder 
  119.      User Interface, including the following: 
  120.         -  Applicaton Control Classes 
  121.         -  Base Windows, Menu, Handler, and Event Classes 
  122.         -  Standard Control Classes 
  123.         -  Advanced Controls, Dialogs, and their Handlers 
  124.         -  Direct Manipulation Classes 
  125.         -  Dynamic Data Exchange (DDE) Classes 
  126.         -  Two-Dimensional Graphic Classes 
  127.         -  Multimedia Classes 
  128.         -  Compound Document Framework Classes 
  129.  
  130.  This book is intended for skilled C++ programmers who understand the concept 
  131.  of classes and who are familiar with using C++ templates when working with 
  132.  individual class libraries. Use this book if you want to do any of the 
  133.  following in your C++ programs: 
  134.  
  135.      Manipulate complex numbers (numbers with both a real and an imaginary 
  136.       part) 
  137.      Perform input and output to console or files using a typesafe, 
  138.       object-oriented programming approach 
  139.      Implement commonly used abstract data types, including sets, maps, 
  140.       sequences, trees, stacks, queues, and sorted or keyed collections 
  141.      Manipulate strings with greater ease and flexibility than the standard 
  142.       C++ method of using character pointers and the string functions of the C 
  143.       string.h library 
  144.      Use date and time information and apply member functions to date and time 
  145.       objects 
  146.      Use Data Access Builder generated source code in conjunction with the 
  147.       Data Access Builder class library to access a DB2/2 relational database. 
  148.      Simplify the development of portable applications containing graphical 
  149.       user interfaces (GUI). 
  150.      Simulate both the Common User Access (CUA) workplace look-and-feel to 
  151.       take advantage of Presentation Manager features on the OS/2 operating 
  152.       system and the native controls provided by the Windows operating system. 
  153.  
  154.  You can create applications for Windows NT, Windows 95, and for the Win32s 
  155.  platforms. To run applications on Win32s systems, we require Win32s 1.30 or 
  156.  later with OLE support. You must use Windows 95 or Windows NT for your 
  157.  development environment to use the IBM VisualAge for C++ for Windows product. 
  158.  
  159.  Before you begin to use this information, it would be helpful to understand 
  160.  how to navigate through it. You can use the Table of Contents and Index 
  161.  facility to locate topics and the Search facility to search the text of this 
  162.  document. You can use hypertext links to acquire related information on the 
  163.  current topic.  Hypertext links appear in a different color For example, here 
  164.  is a link to another panel: Communicating Your Comments to IBM. By 
  165.  double-clicking on the text of the link or by pressing Enter on a highlighted 
  166.  link, you will open a panel of related information. When you open a panel, the 
  167.  first link has the focus; to shift the focus to other links, use the Tab key. 
  168.  
  169.  You should also understand: 
  170.  
  171.      How to Use the Contents 
  172.      How to Obtain Additional Information 
  173.      How to Use Menu Bar Choices 
  174.      How to Cut and Paste Examples 
  175.  
  176.  
  177. ΓòÉΓòÉΓòÉ 1.4. A Note about Examples ΓòÉΓòÉΓòÉ
  178.  
  179. The examples in this book explain elements of the C++ class libraries. They are 
  180. coded in a simple style. They do not try to conserve storage, check for errors, 
  181. achieve fast run times, or demonstrate all possible uses of a library, class, 
  182. or member function. 
  183.  
  184. Source Files for Samples 
  185.  
  186. This online reference contains links to the runnable sample programs that are 
  187. shipped as separate files with IBM Open Class. There can be up to five links 
  188. for each member function. Functions with multiple overloads may have links to 
  189. the samples for each overload. When you select a sample, the sample is loaded 
  190. into the editor defined in your WorkFrame profile at the function's line and 
  191. column. 
  192.  
  193. Collection Class Library samples are included in this online document as well. 
  194. All of these sample source files are located in the following directory: 
  195. \ibmcppw\samples\ioc. 
  196.  
  197. Examples are code excerpts or runnable programs that are not shipped as 
  198. separate files with IBM Open Class; they exist only in this reference. 
  199.  
  200.  
  201. ΓòÉΓòÉΓòÉ 1.5. How to Use the Features of this Book ΓòÉΓòÉΓòÉ
  202.  
  203. The IBM Open Class Library classes are grouped into major categories. These 
  204. groups comprise the majority of this document. You can use this information as 
  205. a guide when choosing classes. 
  206.  
  207. You can quickly locate and learn more about any class using the alphabetical 
  208. reference in Class Descriptions by Name. 
  209.  
  210. The header files on many class description panels is a link that brings up your 
  211. WorkFrame editor and loads the appropriate .HPP file. You can link to the .HPP 
  212. for all classes from the Class to Header File Cross-Reference found at the end 
  213. of this book. 
  214.  
  215. Also in this book, classes, member functions, and enumerations might have the 
  216. following sections: 
  217.  
  218.       Portability Considerations 
  219.       Motif Information 
  220.       Presentation Manager Information 
  221.       Windows Information 
  222.       Win32s Information 
  223.  
  224.  These sections contain information that is specific to a particular platform 
  225.  or suggestions for developing portable applications. 
  226.  
  227.  Note:  The platform specific notes in the Windows Information section relates 
  228.         to all Windows platforms.  Any additional information for using Win32s 
  229.         is documented in the Win32s Information section. 
  230.  
  231.  Note that some members have a Platform Support Table. If a member function is 
  232.  overloaded, one overload might have one condition, while a second overload has 
  233.  a different condition. For example, in IBaseSpinButton::initialize, one 
  234.  implementation is for all three platforms, Windows, AIX, and OS/2, while 
  235.  another implementation is for Windows and OS/2 only. 
  236.  
  237.  This table lists each platform in the heading and the table entries explain if 
  238.  the function is supported, not supported, or silently ignored. 
  239.  
  240.  
  241. ΓòÉΓòÉΓòÉ 1.6. The Contextual Help Feature ΓòÉΓòÉΓòÉ
  242.  
  243. IBM Open Class provides contextual help for each class and member function. To 
  244. access contextual help: 
  245.  
  246.      Install the CPP*.INF and CPP.NDX and CPPBRS.NDX files 
  247.      Use the VisualAge Editor 
  248.  
  249.  Access contextual help by positioning the cursor over the name of a class or 
  250.  member function in the text you are editing, and then pressing Ctrl+H. This 
  251.  opens the online version of the IBM Open Class Library Reference and displays 
  252.  information about that class or member function. 
  253.  
  254.  Refer to the product installation instructions for complete details on setting 
  255.  the environment variables needed to use the contextual help feature. 
  256.  
  257.  
  258. ΓòÉΓòÉΓòÉ 1.7. How to Find Class or Function Descriptions ΓòÉΓòÉΓòÉ
  259.  
  260. You can use this online reference to find individual class or member function 
  261. documentation.  If you know what library or group a class is in, expand the 
  262. table of contents entry for that library or group, and select the class from 
  263. there.  When you select a class entry from the table of contents, the lefthand 
  264. panel contains a list of hypertext links including one for member functions. 
  265. Select that link and a list of member functions is displayed.  You can then 
  266. select the member function you want information on. 
  267.  
  268. You can also search on a member function name, or on a fully qualified name: 
  269. Class::function. For flat collections, search only on the function name if you 
  270. want information on a particular function; the Class::function syntax will not 
  271. work for these functions. 
  272.  
  273. You can also use the Source Code Browser or an editor to find information on 
  274. any function, if you use the CPPBRS.NDX help index file. 
  275.  
  276.  
  277. ΓòÉΓòÉΓòÉ 1.8. How to Use the Contents ΓòÉΓòÉΓòÉ
  278.  
  279. When the Contents window first appears, some topics have a plus (+) sign beside 
  280. them. The plus sign indicates that additional topics are available. 
  281.  
  282. To expand the Contents if you are using a mouse, click on the plus sign.  If 
  283. you are using the keyboard, use the Up or Down Arrow key to highlight the 
  284. topic, and press the Plus (+) key. For example, How to Use Menu Bar Choices has 
  285. a plus sign beside it.  To see additional topics for that heading, click on the 
  286. plus sign or highlight that topic and press the Plus (+) key. 
  287.  
  288. To view a topic, double-click on the topic (or press the Up or Down Arrow key 
  289. to highlight the topic, and then press the Enter key). 
  290.  
  291.  
  292. ΓòÉΓòÉΓòÉ 1.9. How to Obtain Additional Information ΓòÉΓòÉΓòÉ
  293.  
  294. After you select a topic, the information for that topic appears in a window. 
  295. Highlighted words or phrases indicate that additional information is available. 
  296. Certain words and phrases are highlighted in a different color from the 
  297. surrounding text. These are called hypertext terms. 
  298.  
  299. If you are using a mouse, double-click on the highlighted word.  If you are 
  300. using a keyboard, press the Tab key to move to the highlighted word, and then 
  301. press the Enter key.  Additional information then appears in a window. 
  302.  
  303.  
  304. ΓòÉΓòÉΓòÉ 1.10. How to Use Menu Bar Choices ΓòÉΓòÉΓòÉ
  305.  
  306. Several choices are available for managing the information presented in this 
  307. document. There are three choices on the menu bar: the Services menu, the 
  308. Options menu, and the Help menu. 
  309.  
  310. Use the Services menu to operate on the active window currently displayed on 
  311. the screen. Available actions include the following: 
  312.  
  313.  Placing Bookmarks 
  314.    You can set a placeholder so you can retrieve information of interest to 
  315.    you. 
  316.  
  317.  Searching for Information 
  318.    You can find occurrences of a word or phrase in the current topic, selected 
  319.    topics, or all topics. 
  320.  
  321.  Printing Information 
  322.    You can print one or more topics. You can also print a set of topics by 
  323.    first marking the topics in the Contents list. 
  324.  
  325.  Copying Information to a File 
  326.    You can copy a topic that you are viewing to the System Clipboard or to a 
  327.    file that you can edit. This method is particularly useful for copying 
  328.    syntax definitions and program samples into the application that you are 
  329.    developing. 
  330.  
  331.  Select actions from the Options menu, to change the way your Contents list is 
  332.  displayed. To expand the Contents and show all levels for all topics, choose 
  333.  Expand all from the Options pull-down. You can also press the Ctrl, Shift, and 
  334.  * keys together. 
  335.  
  336.  You can select various types of help information from the Help menu. 
  337.  
  338.  For information about any of the menu choices, highlight the choice in the 
  339.  menu and press F1. 
  340.  
  341.  
  342. ΓòÉΓòÉΓòÉ 1.10.1. Placing Bookmarks ΓòÉΓòÉΓòÉ
  343.  
  344. When you place a bookmark on a topic, it is added to a list of bookmarks you 
  345. have previously set.  You can view the list, and you can remove one or all 
  346. bookmarks from the list.  If you have not set any bookmarks, the list is empty. 
  347.  
  348. To set a bookmark, do the following: 
  349.  
  350.    1. Select a topic from the Contents. 
  351.    2. When that topic appears, select the Bookmark option from the Services 
  352.       menu. 
  353.    3. If you want to change the name used for the bookmark, type the new name 
  354.       in the field. 
  355.    4. Click on the Place radio button (or press the Up or Down Arrow key to 
  356.       select it). 
  357.    5. Click on OK (or select it and press Enter). The bookmark is then added to 
  358.       the bookmark list. 
  359.  
  360.  
  361. ΓòÉΓòÉΓòÉ 1.10.2. Searching for Information ΓòÉΓòÉΓòÉ
  362.  
  363. You can specify a word or phrase to be searched.  You can also limit the search 
  364. to a set of topics by first marking the topics in the Contents list. 
  365.  
  366. To search for a word or phrase in all topics, do the following: 
  367.  
  368.    1. Select the Search option from the Services menu. 
  369.    2. Type the word or words to be searched for. 
  370.    3. Click on All sections (or press the Up or Down Arrow keys to select it). 
  371.    4. Click on Search (or select it and press Enter) to begin the search. 
  372.    5. The list of topics where the word or phrase appears is displayed. 
  373.  
  374.  
  375. ΓòÉΓòÉΓòÉ 1.10.3. Printing Information ΓòÉΓòÉΓòÉ
  376.  
  377. You can print one or more topics, the index, or the table of contents.  Make 
  378. sure that your printer is connected to the serial port, configured correctly, 
  379. and ready for input. To print: 
  380.  
  381.    1. Select Print from the Services pull-down. 
  382.    2. Select what you want to print. Note that the This section and Marked 
  383.       sections choices are only available if you are viewing a topic or if you 
  384.       have marked topics, respectively.  To mark topics in the table of 
  385.       contents, press the Ctrl key and click on the topics, or use the arrow 
  386.       keys. 
  387.    3. Select Print to print what you've chosen on your printer. 
  388.  
  389.  
  390. ΓòÉΓòÉΓòÉ 1.10.4. Copying Information to a File ΓòÉΓòÉΓòÉ
  391.  
  392. You can copy a topic that you are viewing in two ways: 
  393.  
  394.      Copy copies the topic that you are viewing into the System Clipboard. 
  395.  
  396.      Copy to file copies the topic that you are viewing into a temporary file 
  397.       named text.tmp.  You can later edit that file by using any editor. 
  398.       text.tmp is placed in the directory where your viewable document resides. 
  399.       This copy function does not apply if you are viewing the document from 
  400.       the CD-ROM. 
  401.  
  402.  To copy a topic, do the following: 
  403.  
  404.    1. Expand the Contents list and select a topic. 
  405.    2. When the topic appears, select Copy to file from the Services menu. 
  406.    3. The system puts the text pertaining to that topic into the temporary file 
  407.       text.tmp. 
  408.  
  409.  
  410. ΓòÉΓòÉΓòÉ 1.11. How to Cut and Paste Examples ΓòÉΓòÉΓòÉ
  411.  
  412. You can copy examples (or information) from this reference/guide/book to 
  413. compile, link, and run them, or to paste them into your own code. 
  414.  
  415. To copy an example or information: 
  416.  
  417.    1. Make the topic you want to copy the active window. 
  418.  
  419.    2. From the Services menu, select Copy to file. The text in that topic is 
  420.       placed in the temporary file text.tmp, in the same directory as this 
  421.       reference. This copy function does not apply if you are viewing the 
  422.       document from the CD-ROM. 
  423.  
  424.    3. You can then modify or use text.tmp as you want. 
  425.  
  426.  Note:  Because the system copies the entire contents of the topic to the file, 
  427.  you may need to edit it to remove additional text. Examples in this reference 
  428.  that have a main function are ready to compile, link, and run as they appear, 
  429.  and do not require any editing. 
  430.  
  431.  
  432. ΓòÉΓòÉΓòÉ 1.12. Other Information You Might Find Helpful ΓòÉΓòÉΓòÉ
  433.  
  434. This product provides a number of online guides and references that we hope 
  435. you'll find helpful as you develop applications. This information includes 
  436. User's Guides, References, and How Do I help that gives you specific 
  437. instructions for performing common tasks. You can get to this online 
  438. information from the Information folder inside the main product folder.  You 
  439. can also get to it from the Help menu in any of the components of the product. 
  440.  
  441.  
  442. ΓòÉΓòÉΓòÉ 1.13. Communicating Your Comments to IBM ΓòÉΓòÉΓòÉ
  443.  
  444. If there is something you like, or dislike, about this book, please let us 
  445. know.  You can use one of the methods listed below to send your comments to 
  446. IBM.  Please be sure to include the complete title of the publication that you 
  447. are commenting on. 
  448.  
  449. The comments you send should only pertain to the information in this document 
  450. and its presentation.  To request additional publications or to ask questions 
  451. or make comments about the functions of IBM products or systems, you should 
  452. talk to your IBM representative or you authorized IBM remarketer. 
  453.  
  454. When you send comments to IBM, you grant IBM a nonexclusive right to use or 
  455. distribute your comments in any way it believes appropriate without incurring 
  456. any obligation to you. 
  457.  
  458. You can send your comments to IBM in the following ways: 
  459.  
  460.      By mail to the following address: 
  461.  
  462.             IBM Canada Ltd. Laboratory
  463.             Information Development
  464.             2G/345/1150/TOR
  465.             1150 EGLINTON AVENUE EAST
  466.             NORTH YORK, ONTARIO
  467.             CANADA M3C 1H7
  468.  
  469.      By FAX to the following number: 
  470.  
  471.         -  United States and Canada: (416) 448-6161 
  472.         -  Other countries (+1) 416-448-6161 
  473.  
  474.      By electronic mail to one of the following IDs.  Be sure to include your 
  475.       entire network address if you wish to get a reply. 
  476.  
  477.         -  Internet: torrcf@vnet.ibm.com 
  478.         -  IBMLink: toribm(torrcf) 
  479.         -  IBM/PROFS: torolab4(torrcf) 
  480.         -  IBMMAIL: ibmmail(caibmwt9) 
  481.  
  482.  
  483. ΓòÉΓòÉΓòÉ 2. Classes by Name ΓòÉΓòÉΓòÉ
  484.  
  485. Bag
  486. Collection
  487. complex
  488. Constant Applicator
  489. Cursor
  490. c_exception
  491. Deque
  492. Equality Collection
  493. Equality Key Collection
  494. Equality Key Sorted Collection
  495. Equality Sequence
  496. Equality Sorted Collection
  497. filebuf
  498. fstream
  499. fstreambase
  500. Heap
  501. I0String
  502. I3StateCheckBox
  503. I3StateCheckBox::Style
  504. IAccelerator
  505. IAcceleratorKey
  506. IAcceleratorTable
  507. IAcceleratorTable::Cursor
  508. IAccelTblHandle
  509. IAccessError
  510. IAnchorBlockHandle
  511. IAnimatedButton
  512. IAnimatedButton::Style
  513. IApplication
  514. IAssertionFailure
  515. IAutoElemPointer
  516. IAutoPointer
  517. IBase
  518. IBase::Version
  519. IBaseComboBox
  520. IBaseComboBox::Cursor
  521. IBaseComboBox::Style
  522. IBaseErrorInfo
  523. IBaseListBox
  524. IBaseListBox::Cursor
  525. IBaseListBox::Style
  526. IBaseSpinButton
  527. IBaseSpinButton::Style
  528. IBaseStream
  529. IBidiSettings
  530. IBitFlag
  531. IBitmapControl
  532. IBitmapControl::Style
  533. IBitmapHandle
  534. IBuffer
  535. IButton
  536. IButton::Style
  537. IButtonNotifyHandler
  538. ICanvas
  539. ICanvas::Style
  540. ICheckBox
  541. ICheckBox::Style
  542. ICircularSlider
  543. ICircularSlider::Style
  544. ICircularSliderNotifyHandler
  545. ICLibErrorInfo
  546. IClipboard
  547. IClipboard::Cursor
  548. IClipboardHandler
  549. ICnrAllocator
  550. ICnrBeginEditEvent
  551. ICnrControlList
  552. ICnrDate
  553. ICnrDrawBackgroundEvent
  554. ICnrDrawHandler
  555. ICnrDrawItemEvent
  556. ICnrEditEvent
  557. ICnrEditHandler
  558. ICnrEmphasisEvent
  559. ICnrEndEditEvent
  560. ICnrEnterEvent
  561. ICnrEvent
  562. ICnrHandler
  563. ICnrHelpEvent
  564. ICnrMenuHandler
  565. ICnrObjectSet
  566. ICnrQueryDeltaEvent
  567. ICnrReallocStringEvent
  568. ICnrScrollEvent
  569. ICnrTime
  570. ICollectionViewComboBox
  571. ICollectionViewConstants
  572. ICollectionViewListBox
  573. IColor
  574. IComboBox
  575. IComboBox::Style
  576. IComboBoxNotifyHandler
  577. ICommand
  578. ICommandConnectionTo
  579. ICommandEvent
  580. ICommandHandler
  581. IComponent
  582. IComponentStationery
  583. IComponentStationeryFor
  584. IContainerColumn
  585. IContainerControl
  586. IContainerControl::Attribute
  587. IContainerControl::ColumnCursor
  588. IContainerControl::CompareFn
  589. IContainerControl::FilterFn
  590. IContainerControl::Iterator
  591. IContainerControl::ObjectCursor
  592. IContainerControl::Style
  593. IContainerControl::TextCursor
  594. IContainerControlNotifyHandler
  595. IContainerObject
  596. IContext
  597. IContextHandle
  598. IControl
  599. IControl::Style
  600. IControlEvent
  601. ICoordinateSystem
  602. ICritSec
  603. ICurrentApplication
  604. ICurrentThread
  605. ICustomButton
  606. ICustomButton::Style
  607. ICustomButtonDrawEvent
  608. ICustomButtonDrawHandler
  609. IDate
  610. IDBCSBuffer
  611. IDDEAcknowledgeEvent
  612. IDDEAcknowledgeExecuteEvent
  613. IDDEAcknowledgePokeEvent
  614. IDDEActiveServer
  615. IDDEActiveServerSet
  616. IDDEBeginEvent
  617. IDDEClientAcknowledgeEvent
  618. IDDEClientConversation
  619. IDDEClientEndEvent
  620. IDDEClientHotLinkEvent
  621. IDDEClientHotLinkSet
  622. IDDEDataEvent
  623. IDDEEndEvent
  624. IDDEEvent
  625. IDDEExecuteEvent
  626. IDDEPokeEvent
  627. IDDERequestDataEvent
  628. IDDEServerAcknowledgeEvent
  629. IDDEServerHotLinkEvent
  630. IDDESetAcknowledgeInfoEvent
  631. IDDETopicServer
  632. IDeviceColor
  633. IDeviceError
  634. IDisplayHandle
  635. IDM
  636. IDMCnrItem
  637. IDMEFItem
  638. IDMEvent
  639. IDMHandler
  640. IDMImage
  641. IDMImage::Style
  642. IDMItem
  643. IDMItemProvider
  644. IDMItemProviderFor
  645. IDMMenuItem
  646. IDMMLEItem
  647. IDMOperation
  648. IDMRenderer
  649. IDMSourceBeginEvent
  650. IDMSourceDiscardEvent
  651. IDMSourceEndEvent
  652. IDMSourceHandler
  653. IDMSourceOperation
  654. IDMSourcePrepareEvent
  655. IDMSourcePrintEvent
  656. IDMSourceRenderer
  657. IDMSourceRenderEvent
  658. IDMTargetDropEvent
  659. IDMTargetEndEvent
  660. IDMTargetEnterEvent
  661. IDMTargetEvent
  662. IDMTargetHandler
  663. IDMTargetHelpEvent
  664. IDMTargetLeaveEvent
  665. IDMTargetOperation
  666. IDMTargetRenderer
  667. IDMTBarButtonItem
  668. IDMToolBarItem
  669. IDocumentStorage
  670. IDrawingCanvas
  671. IDrawingCanvas::Style
  672. IDrawItemEvent
  673. IDynamicLinkLibrary
  674. IEditHandler
  675. IElemPointer
  676. IEmbeddedComponent
  677. IEmbedderModel
  678. IEntryField
  679. IEntryField::Style
  680. IEntryFieldNotifyHandler
  681. IEnumHandle
  682. IEvent
  683. IEventData
  684. IEventParameter1
  685. IEventParameter2
  686. IEventResult
  687. IException
  688. IException::TraceFn
  689. IExceptionLocation
  690. IFileDialog
  691. IFileDialog::Settings
  692. IFileDialog::Style
  693. IFileDialogEvent
  694. IFileDialogHandler
  695. IFileStream
  696. IFlatFileStorage
  697. IFlyOverHelpHandler
  698. IFlyText
  699. IFocusHandler
  700. IFont
  701. IFont::FaceNameCursor
  702. IFont::PointSizeCursor
  703. IFontDialog
  704. IFontDialog::Settings
  705. IFontDialog::Style
  706. IFontDialogHandler
  707. IFrameEvent
  708. IFrameExtension
  709. IFrameExtensions
  710. IFrameFormatEvent
  711. IFrameHandler
  712. IFrameWindow
  713. IFrameWindow::Style
  714. IFrameWindowNotifyHandler
  715. ifstream
  716. IG3PointArc
  717. IGArc
  718. IGBitmap
  719. IGChord
  720. IGEllipse
  721. IGLine
  722. IGList
  723. IGList::Cursor
  724. IGPie
  725. IGPolygon
  726. IGPolyline
  727. IGrabHandles
  728. IGraphic
  729. IGraphicBundle
  730. IGraphicContext
  731. IGraphicPushButton
  732. IGraphicPushButton::Style
  733. IGRectangle
  734. IGRegion
  735. IGroupBox
  736. IGroupBox::Style
  737. IGString
  738. IGUIBundle
  739. IGUIColor
  740. IGUIErrorInfo
  741. IHandle
  742. IHandler
  743. IHelpErrorEvent
  744. IHelpHandler
  745. IHelpHyperlinkEvent
  746. IHelpMenuBarEvent
  747. IHelpNotifyEvent
  748. IHelpSubitemNotFoundEvent
  749. IHelpTutorialEvent
  750. IHelpWindow
  751. IHelpWindow::Settings
  752. IHelpWindow::Style
  753. IHighEventParameter
  754. IIconControl
  755. IIconControl::Style
  756. IInfoArea
  757. IInvalidParameter
  758. IInvalidRequest
  759. IKey
  760. IKey::KeyModifier
  761. IKeyboardConnectionTo
  762. IKeyboardEvent
  763. IKeyboardHandler
  764. IListBox
  765. IListBox::Style
  766. IListBoxDrawItemEvent
  767. IListBoxDrawItemHandler
  768. IListBoxNotifyHandler
  769. IListBoxSizeItemEvent
  770. ILowEventParameter
  771. IMemoryStream
  772. IMenu
  773. IMenu::Cursor
  774. IMenu::Style
  775. IMenuBar
  776. IMenuBar::Style
  777. IMenuDrawItemEvent
  778. IMenuDrawItemHandler
  779. IMenuDrawItemHandler::DrawFlag
  780. IMenuEvent
  781. IMenuHandle
  782. IMenuHandler
  783. IMenuItem
  784. IMenuItem::Attribute
  785. IMenuItem::Style
  786. IMenuNotifyHandler
  787. IMessageBox
  788. IMessageBox::Style
  789. IMessageQueueHandle
  790. IMessageText
  791. IMetaType
  792. IMetaTypeInfo
  793. IMGrabbable
  794. IMM24FramesPerSecondTime
  795. IMM25FramesPerSecondTime
  796. IMM30FramesPerSecondTime
  797. IMMAmpMixer
  798. IMMAudioBuffer
  799. IMMAudioCD
  800. IMMAudioCDContents
  801. IMMAudioCDContents::Cursor
  802. IMMCDXA
  803. IMMConfigurableAudio
  804. IMMCuePointEvent
  805. IMMDevice
  806. IMMDeviceEvent
  807. IMMDeviceHandler
  808. IMMDeviceNotifyHandler
  809. IMMDigitalVideo
  810. IMMErrorInfo
  811. IMMFileMedia
  812. IMMHourMinSecFrameTime
  813. IMMHourMinSecTime
  814. IMMMasterAudio
  815. IMMMillisecondTime
  816. IMMMinSecFrameTime
  817. IMMNotifyEvent
  818. IMMPassDeviceEvent
  819. IMMPlayableDevice
  820. IMMPlayerPanel
  821. IMMPlayerPanelHandler
  822. IMMPositionChangeEvent
  823. IMMRecordable
  824. IMMRemovableMedia
  825. IMMRemovableMediaHandler
  826. IMMRemovableMediaNotifyHandler
  827. IMMSequencer
  828. IMMSpeed
  829. IMMTime
  830. IMMTrackMinSecFrameTime
  831. IMMWaveAudio
  832. IMngElemPointer
  833. IMngPointer
  834. IModel
  835. IModuleHandle
  836. IMouseClickEvent
  837. IMouseConnectionTo
  838. IMouseEvent
  839. IMouseHandler
  840. IMousePointerEvent
  841. IMousePointerHandler
  842. IMultiCellCanvas
  843. IMultiCellCanvas::Style
  844. IMultiLineEdit
  845. IMultiLineEdit::Style
  846. IMultiLineEditNotifyHandler
  847. INotebook
  848. INotebook::Cursor
  849. INotebook::PageSettings
  850. INotebook::PageSettings::Attribute
  851. INotebook::Style
  852. INotebookDrawItemEvent
  853. INotebookNotifyHandler
  854. INotificationEvent
  855. INotifier
  856. INumericSpinButton
  857. INumericSpinButton::Style
  858. INumericSpinButtonNotifyHandler
  859. IObjectWindow
  860. IObserver
  861. IObserverList
  862. IObserverList::Cursor
  863. ios
  864. iostream
  865. iostream_withassign
  866. IOutlineBox
  867. IOutlineBox::Style
  868. IOutOfMemory
  869. IOutOfSystemResource
  870. IOutOfWindowResource
  871. IPageEvent
  872. IPageHandle
  873. IPageHandler
  874. IPageHelpEvent
  875. IPageRemoveEvent
  876. IPageSelectEvent
  877. IPaintConnectionTo
  878. IPaintEvent
  879. IPaintHandler
  880. IPair
  881. IPoint
  882. IPointArray
  883. IPointerHandle
  884. IPopUpMenu
  885. IPresSpaceHandle
  886. IPrivateResource
  887. IProcedureAddress
  888. IProcessId
  889. IProfile
  890. IProfile::Cursor
  891. IProfileHandle
  892. IProgressIndicator
  893. IProgressIndicator::Style
  894. IProgressIndicatorNotifyHandler
  895. IPushButton
  896. IPushButton::Style
  897. IRadioButton
  898. IRadioButton::Style
  899. IRange
  900. IRecoordHandler
  901. IRectangle
  902. IRefCounted
  903. IReference
  904. IRegionHandle
  905. IResizeEvent
  906. IResizeHandler
  907. IResource
  908. IResourceExhausted
  909. IResourceId
  910. IResourceLibrary
  911. IResourceLock
  912. IScrollBar
  913. IScrollBar::Style
  914. IScrollBarNotifyHandler
  915. IScrollEvent
  916. IScrollHandler
  917. ISelectHandler
  918. ISemaphoreHandle
  919. ISetCanvas
  920. ISetCanvas::Style
  921. ISettingButton
  922. ISettingButtonNotifyHandler
  923. ISharedResource
  924. IShowListHandler
  925. ISize
  926. ISlider
  927. ISlider::Style
  928. ISliderArmHandler
  929. ISliderDrawHandler
  930. ISpinHandler
  931. ISplitCanvas
  932. ISplitCanvas::Style
  933. IStandardNotifier
  934. IStaticText
  935. IStaticText::Style
  936. istream
  937. istream_withassign
  938. IString
  939. IStringEnum
  940. IStringGenerator
  941. IStringGeneratorFn
  942. IStringGeneratorMemberFn
  943. IStringGeneratorRefMemberFn
  944. IStringHandle
  945. IStringParser
  946. IStringParser::SkipWords
  947. IStringTest
  948. IStringTestMemberFn
  949. istrstream
  950. IStructuredStorage
  951. ISubmenu
  952. ISubmenu::Cursor
  953. ISWP
  954. ISWPArray
  955. ISystemBitmapHandle
  956. ISystemErrorInfo
  957. ISystemMenu
  958. ISystemPointerHandle
  959. Applicator
  960. ITextControl
  961. ITextControlNotifyHandler
  962. ITextSpinButton
  963. ITextSpinButton::Cursor
  964. ITextSpinButton::Style
  965. ITextSpinButtonNotifyHandler
  966. IThread
  967. IThread::Cursor
  968. IThreadFn
  969. IThreadHandle
  970. IThreadId
  971. IThreadMemberFn
  972. ITime
  973. ITimer
  974. ITimer::Cursor
  975. ITimerFn
  976. ITimerMemberFn
  977. ITimerMemberFn0
  978. ITitle
  979. ITitleNotifyHandler
  980. IToolBar
  981. IToolBar::FrameCursor
  982. IToolBar::Style
  983. IToolBar::WindowCursor
  984. IToolBarButton
  985. IToolBarButton::Style
  986. IToolBarContainer
  987. IToolBarContainer::Style
  988. IToolBarFrameWindow
  989. ITrace
  990. ITransformMatrix
  991. IVBase
  992. IView
  993. IViewPort
  994. IViewPort::Style
  995. IWindow
  996. IWindow::ChildCursor
  997. IWindow::ExceptionFn
  998. IWindow::Style
  999. IWindowHandle
  1000. IWindowNotifyHandler
  1001. IXLibErrorInfo
  1002. Key Bag
  1003. Key Collection
  1004. Key Set
  1005. Key Sorted Bag
  1006. Key Sorted Collection
  1007. Key Sorted Set
  1008. Manipulators
  1009. Map
  1010. ofstream
  1011. Ordered Collection
  1012. ostream
  1013. ostream_withassign
  1014. ostrstream
  1015. Pointer Classes
  1016. Priority Queue
  1017. Queue
  1018. Relation
  1019. Sequence
  1020. Sequential Collection
  1021. Set
  1022. Sorted Bag
  1023. Sorted Collection
  1024. Sorted Map
  1025. Sorted Relation
  1026. Sorted Set
  1027. Stack
  1028. stdiobuf
  1029. stdiostream
  1030. streambuf
  1031. strstream
  1032. strstreambase
  1033. strstreambuf
  1034. Tree
  1035. Tree Cursor
  1036.  
  1037.  
  1038. ΓòÉΓòÉΓòÉ 3. Complex Mathematics Library ΓòÉΓòÉΓòÉ
  1039.  
  1040. The Complex Mathematics Library contains two classes: 
  1041.  
  1042.  complex Class                 The class you can use to manipulate complex 
  1043.                                numbers. 
  1044.  
  1045.  c_exception Class             The class that provides runtime error-handling 
  1046.                                facilities for the functions and operations in 
  1047.                                the complex class. 
  1048.  
  1049.  
  1050. ΓòÉΓòÉΓòÉ 3.1. complex Class ΓòÉΓòÉΓòÉ
  1051.  
  1052. Description 
  1053.  
  1054. Derivation 
  1055.  
  1056. Header File 
  1057.  
  1058. Constructors 
  1059.  
  1060. Members 
  1061.  
  1062. To close all the panels in a chapter, double-click on this panel's system menu. 
  1063.  
  1064.  
  1065. ΓòÉΓòÉΓòÉ 3.1.1. Class Description - complex ΓòÉΓòÉΓòÉ
  1066.  
  1067. This chapter describes the member functions of the complex class, the class 
  1068. that provides you with the facilities to manipulate complex numbers. 
  1069.  
  1070.  
  1071. ΓòÉΓòÉΓòÉ 3.1.2. Derivation ΓòÉΓòÉΓòÉ
  1072.  
  1073. complex does not derive from any class. 
  1074.  
  1075.  
  1076. ΓòÉΓòÉΓòÉ 3.1.3. Header File ΓòÉΓòÉΓòÉ
  1077.  
  1078. complex is declared in complex.h 
  1079.  
  1080.  
  1081. ΓòÉΓòÉΓòÉ 3.1.4. Members ΓòÉΓòÉΓòÉ
  1082.  
  1083. The following members are provided for complex: 
  1084.  
  1085.      Constructors for complex 
  1086.      Addition 
  1087.      Mathematical Assignment Operators 
  1088.      Inequality 
  1089.      Multiplication 
  1090.      Negation 
  1091.      Subtraction 
  1092.      Division 
  1093.      Input Operator 
  1094.      Output Operator 
  1095.      Equality 
  1096.      abs 
  1097.      arg 
  1098.      conj 
  1099.      cos 
  1100.      cosh 
  1101.      exp 
  1102.      imag 
  1103.      log 
  1104.      norm 
  1105.      polar 
  1106.      pow 
  1107.      real 
  1108.      sin 
  1109.      sinh 
  1110.      sqrt 
  1111.  
  1112.  complex also defines a set of mathematical constants. 
  1113.  
  1114.  
  1115. ΓòÉΓòÉΓòÉ 3.1.5. Constants Defined in complex.h ΓòÉΓòÉΓòÉ
  1116.  
  1117. The following table lists the mathematical constants that the Complex 
  1118. Mathematics Library defines (if they have not been previously defined): 
  1119.  
  1120. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  1121. Γöé Table 1. Constants Defined in complex.h             Γöé
  1122. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  1123. Γöé CONSTANT NAME       Γöé DESCRIPTION              Γöé
  1124. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  1125. Γöé M_E            Γöé The constant e            Γöé
  1126. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  1127. Γöé M_LOG2E          Γöé The logarithm of e to the base of 2  Γöé
  1128. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  1129. Γöé M_LOG10E         Γöé The logarithm of e to the base of 10 Γöé
  1130. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  1131. Γöé M_LN2           Γöé The natural logarithm of 2      Γöé
  1132. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  1133. Γöé M_LN10          Γöé The natural logarithm of 10      Γöé
  1134. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  1135. Γöé M_PI           Γöé pi                  Γöé
  1136. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  1137. Γöé M_PI_2          Γöé pi  / 2                Γöé
  1138. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  1139. Γöé M_PI_4          Γöé pi  / 4                Γöé
  1140. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  1141. Γöé M_1_PI          Γöé 1 / pi                Γöé
  1142. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  1143. Γöé M_2_PI          Γöé 2 / pi                Γöé
  1144. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  1145. Γöé M_2_SQRTPI        Γöé 2 divided by the square root of pi  Γöé
  1146. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  1147. Γöé M_SQRT2          Γöé The square root of 2         Γöé
  1148. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  1149. Γöé M_SQRT1_2         Γöé The square root of 1 / 2       Γöé
  1150. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  1151.  
  1152.  
  1153. ΓòÉΓòÉΓòÉ 3.1.6. Constructors for complex ΓòÉΓòÉΓòÉ
  1154.  
  1155. See also Initializing complex Arrays (next panel). 
  1156.  
  1157. There are two versions of the complex constructor: 
  1158.  
  1159. complex();
  1160. complex(double r, double i=0.0);
  1161.  
  1162. If you declare a complex object without specifying any values for the real or 
  1163. imaginary part of the complex value, the constructor that takes no arguments is 
  1164. used and the complex value is initialized to (0, 0). For example, the following 
  1165. declaration gives the object comp the value (0, 0): 
  1166.  
  1167.    complex comp;
  1168.  
  1169. If you give either one or two values in your declaration, the constructor that 
  1170. takes two arguments is used. If you only give one value, the real part of the 
  1171. complex object is initialized to that value, and the imaginary part is 
  1172. initialized to 0. 
  1173.  
  1174. For example, the following declaration gives the object comp2 the value 
  1175. (3.14, 0): 
  1176.  
  1177.    complex comp2(3.14);
  1178.  
  1179. If you give two values in the declaration, the real part of the complex object 
  1180. is initialized to the first value and the imaginary part is initialized to the 
  1181. second value. For example, the following declaration gives the object comp3 the 
  1182. value (3.14, 6.44): 
  1183.  
  1184.    complex comp3(3.14, 6.44);
  1185.  
  1186. There is no explicit complex destructor. 
  1187.  
  1188.  
  1189. ΓòÉΓòÉΓòÉ 3.1.6.1. Initializing complex Arrays ΓòÉΓòÉΓòÉ
  1190.  
  1191. You can use the complex constructor to initialize arrays of complex numbers. 
  1192. If the list of initial values is made up of complex values, each array element 
  1193. is initialized to the corresponding value in the list of initial values. If the 
  1194. list of initial values is not made up of complex values, the real parts of the 
  1195. array elements are initialized to these initial values and the imaginary parts 
  1196. of the array elements are initialized to 0.  In the following example, the 
  1197. elements of array b are initialized to the values in the initial value list, 
  1198. but only the real parts of elements of array a are initialized to the values in 
  1199. the initial value list. 
  1200.  
  1201.    #include <complex.h>
  1202.  
  1203.    void main() {
  1204.      complex a[3] = {1.0, 2.0, 3.0};
  1205.      complex b[3] = {complex(1.0, 1.0), complex(2.0, 2.0),
  1206.                     complex(3.0, 3.0)};
  1207.      cout << "Here is the first element of a: " << a[0] << endl;
  1208.      cout << "Here is the first element of b: " << b[0] << endl;
  1209.    }
  1210.  
  1211. This example produces the following output: 
  1212.  
  1213.    Here is the first element of a: ( 1, 0)
  1214.    Here is the first element of b: ( 1, 1)
  1215.  
  1216.  
  1217. ΓòÉΓòÉΓòÉ 3.1.7. Mathematical Operators for complex ΓòÉΓòÉΓòÉ
  1218.  
  1219. The complex operators described in this section have the same precedence as the 
  1220. corresponding real operators. 
  1221.  
  1222. The following operators are described: 
  1223.  
  1224.      Addition operator 
  1225.      Subtraction operator 
  1226.      Negation operator 
  1227.      Multiplication operator 
  1228.      Division operator 
  1229.      Equality operator 
  1230.      Inequality operator 
  1231.      Mathematical assignment operators 
  1232.  
  1233.  
  1234. ΓòÉΓòÉΓòÉ 3.1.7.1. Addition ΓòÉΓòÉΓòÉ
  1235.  
  1236. friend complex operator+(complex x, complex y);
  1237.  
  1238. The addition operator returns the sum of x and y. 
  1239.  
  1240.  
  1241. ΓòÉΓòÉΓòÉ 3.1.7.2. Subtraction ΓòÉΓòÉΓòÉ
  1242.  
  1243. friend complex operator-(complex x, complex y);
  1244.  
  1245. The subtraction operator returns the difference between x and y. 
  1246.  
  1247.  
  1248. ΓòÉΓòÉΓòÉ 3.1.7.3. Negation ΓòÉΓòÉΓòÉ
  1249.  
  1250. friend complex operator-(complex x);
  1251.  
  1252. The negation operator returns (- a, - b) when its argument is (a, b). 
  1253.  
  1254.  
  1255. ΓòÉΓòÉΓòÉ 3.1.7.4. Multiplication ΓòÉΓòÉΓòÉ
  1256.  
  1257. friend complex operator*(complex x, complex y);
  1258.  
  1259. The multiplication operator returns the product of x and y. 
  1260.  
  1261.  
  1262. ΓòÉΓòÉΓòÉ 3.1.7.5. Division ΓòÉΓòÉΓòÉ
  1263.  
  1264. friend complex operator/(complex x, complex y);
  1265.  
  1266. The division operator returns the quotient of x divided by y. 
  1267.  
  1268.  
  1269. ΓòÉΓòÉΓòÉ 3.1.7.6. Equality ΓòÉΓòÉΓòÉ
  1270.  
  1271. friend int operator==(complex x, complex y);
  1272.  
  1273. The  equality operator "==" returns a nonzero value if x equals y.  This 
  1274. operator tests for equality by testing that the two real components are equal 
  1275. and that the two imaginary components are equal. 
  1276.  
  1277. Because both components are double values, the equality operator tests for an 
  1278. exact match between the two sets of values.  If you want an equality operator 
  1279. that can test for an absolute difference within a certain tolerance between the 
  1280. two pairs of corresponding components, you can use a function such as the 
  1281. isequal function. 
  1282.  
  1283.  
  1284. ΓòÉΓòÉΓòÉ 3.1.7.7. Inequality ΓòÉΓòÉΓòÉ
  1285.  
  1286. friend int operator!=(complex x, complex y);
  1287.  
  1288. The inequality operator "! =" returns a nonzero value if x does not equal y. 
  1289. This operator tests for inequality by testing that the two real components are 
  1290. not equal and that the two imaginary components are not equal. 
  1291.  
  1292. Because both components are double values, the inequality operator returns 
  1293. false only when both the real and imaginary components of the two values are 
  1294. identical. If you want an inequality operator that can test for an absolute 
  1295. difference within a certain tolerance between the two pairs of corresponding 
  1296. components, you can use a function such as the is_not_equal function. 
  1297.  
  1298.  
  1299. ΓòÉΓòÉΓòÉ 3.1.7.8. Mathematical Assignment Operators ΓòÉΓòÉΓòÉ
  1300.  
  1301. void operator+=(complex x);
  1302. void operator-=(complex x);
  1303. void operator*=(complex x);
  1304. void operator/=(complex x);
  1305.  
  1306. The following list describes the functions of the mathematical assignment 
  1307. operators: 
  1308.  
  1309.      x += y assigns the value of x + y to x. 
  1310.      x -= y assigns the value of x - y to x. 
  1311.      x *= y assigns the value of x * y to x. 
  1312.      x /= y assigns the value of x / y to x. 
  1313.  
  1314.  Note:  The assignment operators do not produce a value that can be used in an 
  1315.  expression. The following code, for example, produces a compile-time error: 
  1316.  
  1317.      complex x, y, z;     // valid declaration
  1318.      x = (y += z);        // invalid assignment causes a
  1319.                           // compile-time error
  1320.      y += z;              // correct method involves splitting
  1321.      x = y;               // expression into separate statements
  1322.  
  1323.  
  1324. ΓòÉΓòÉΓòÉ 3.1.8. Input and Output Operators for complex ΓòÉΓòÉΓòÉ
  1325.  
  1326. The following topics are described: 
  1327.  
  1328.      The input operator 
  1329.      The output operator. 
  1330.  
  1331.  You can also view the Open Class Library User's Guide section on complex input 
  1332.  and output operators for an example of using them. 
  1333.  
  1334.  
  1335. ΓòÉΓòÉΓòÉ 3.1.8.1. Input Operator ΓòÉΓòÉΓòÉ
  1336.  
  1337. istream& operator>>(istream& is, complex& c);
  1338.  
  1339. The input (or extraction) operator >> takes complex value c from the stream is 
  1340. in the form (a,b).  The parentheses and comma are mandatory delimiters for 
  1341. input when the imaginary part of the complex number being read is nonzero. 
  1342. Otherwise, they are optional. In both cases, white space is optional. 
  1343.  
  1344.  
  1345. ΓòÉΓòÉΓòÉ 3.1.8.2. Output Operator ΓòÉΓòÉΓòÉ
  1346.  
  1347. ostream& operator<<(ostream& os, complex c);
  1348.  
  1349. The output (or insertion) operator <<  writes complex value c to the stream os 
  1350. in the form (a,b). 
  1351.  
  1352.  
  1353. ΓòÉΓòÉΓòÉ 3.1.9. Mathematical Functions for complex ΓòÉΓòÉΓòÉ
  1354.  
  1355. The following mathematical functions are described: 
  1356.  
  1357.      exp - Exponent 
  1358.      log - Logarithm 
  1359.      pow - Power 
  1360.      sqrt - Square Root 
  1361.  
  1362.  You can also the Open Class Library User's Guide information on the complex 
  1363.  mathematical functions for an example of using them. 
  1364.  
  1365.  
  1366. ΓòÉΓòÉΓòÉ 3.1.9.1. exp ΓòÉΓòÉΓòÉ
  1367.  
  1368. friend complex exp(complex x);
  1369.  
  1370. exp() returns the complex value equal to e to the power of x where x is the 
  1371. argument. Results of the Default Error-Handling Procedures shows the values 
  1372. returned by the default error-handling procedure for exp(). 
  1373.  
  1374.  
  1375. ΓòÉΓòÉΓòÉ 3.1.9.2. log ΓòÉΓòÉΓòÉ
  1376.  
  1377. friend complex log(complex x);
  1378.  
  1379. log() returns the natural logarithm of the argument x. Results of the Default 
  1380. Error-Handling Procedures shows the values returned by the default 
  1381. error-handling procedure for log(). 
  1382.  
  1383.  
  1384. ΓòÉΓòÉΓòÉ 3.1.9.3. pow ΓòÉΓòÉΓòÉ
  1385.  
  1386. friend complex pow(double d, complex z);
  1387. friend complex pow(complex c, int i);
  1388. friend complex pow(complex c, double d);
  1389. friend complex pow(complex c, complex z);
  1390.  
  1391. Note:  Exponents in the following text are shown in square brackets. 
  1392.  
  1393. pow() returns the complex value x[y], where x is the first argument and y is 
  1394. the second argument.  pow() is overloaded four times. If d is a double value, i 
  1395. is an integer value, and c and z are complex values, then pow() can produce any 
  1396. of the following results: 
  1397.  
  1398.      d[z] 
  1399.      c[i] 
  1400.      c[d] 
  1401.      c[z] 
  1402.  
  1403.  
  1404. ΓòÉΓòÉΓòÉ 3.1.9.4. sqrt ΓòÉΓòÉΓòÉ
  1405.  
  1406. friend complex sqrt(complex x);
  1407.  
  1408. sqrt() returns the square root of its argument. If c and d are real values, 
  1409. then every complex number (a,b), where: 
  1410.  
  1411.      a = c┬ñ - d┬ñ 
  1412.      b = 2cd 
  1413.  
  1414.  has two square roots: 
  1415.  
  1416.      (c,d) 
  1417.      (-c,-d ) 
  1418.  
  1419.  sqrt() returns the square root that has a positive real part, that is, the 
  1420.  square root that is contained in the first or fourth quadrants of the complex 
  1421.  plane. 
  1422.  
  1423.  
  1424. ΓòÉΓòÉΓòÉ 3.1.10. Trigonometric Functions for complex ΓòÉΓòÉΓòÉ
  1425.  
  1426. The following trigonometric functions are described: 
  1427.  
  1428.      cos - Cosine 
  1429.      cosh - Hyperbolic cosine 
  1430.      sin - Sine 
  1431.      sinh - Hyperbolic sine 
  1432.  
  1433.  You can also view the Open Class Library User's Guide section on complex 
  1434.  trigonometric functions for an example of using them. 
  1435.  
  1436.  
  1437. ΓòÉΓòÉΓòÉ 3.1.10.1. cos ΓòÉΓòÉΓòÉ
  1438.  
  1439. friend complex cos(complex x);
  1440.  
  1441. cos() returns the cosine of x. 
  1442.  
  1443.  
  1444. ΓòÉΓòÉΓòÉ 3.1.10.2. cosh ΓòÉΓòÉΓòÉ
  1445.  
  1446. friend complex cosh(complex x);
  1447.  
  1448. cosh() returns the hyperbolic cosine of x. Results of the Default 
  1449. Error-Handling Procedures shows the values returned by the default 
  1450. error-handling procedure for cosh(). 
  1451.  
  1452.  
  1453. ΓòÉΓòÉΓòÉ 3.1.10.3. sin ΓòÉΓòÉΓòÉ
  1454.  
  1455. friend complex sin(complex x);
  1456.  
  1457. sin() returns the sine of x. 
  1458.  
  1459.  
  1460. ΓòÉΓòÉΓòÉ 3.1.10.4. sinh ΓòÉΓòÉΓòÉ
  1461.  
  1462. friend complex sinh(complex x);
  1463.  
  1464. sinh() returns the hyperbolic sine of x. Results of the Default Error-Handling 
  1465. Procedures shows the values returned by the default error-handling procedure 
  1466. for sinh(). 
  1467.  
  1468.  
  1469. ΓòÉΓòÉΓòÉ 3.1.11. Magnitude Functions for complex ΓòÉΓòÉΓòÉ
  1470.  
  1471. The following magnitude functions are described: 
  1472.  
  1473.      abs - Absolute value 
  1474.      norm - Square magnitude 
  1475.  
  1476.  
  1477. ΓòÉΓòÉΓòÉ 3.1.11.1. abs ΓòÉΓòÉΓòÉ
  1478.  
  1479. friend double abs(complex x);
  1480.  
  1481. abs() returns the absolute value or magnitude of its argument. The absolute 
  1482. value of a complex value (a,b) is the positive square root of a┬ñ+b┬ñ. 
  1483.  
  1484.  
  1485. ΓòÉΓòÉΓòÉ 3.1.11.2. norm ΓòÉΓòÉΓòÉ
  1486.  
  1487. friend double norm(complex x);
  1488.  
  1489. norm() returns the square of the magnitude of its argument. If the argument x 
  1490. is equal to the complex number (a,b), norm() returns the value a┬ñ+b┬ñ. norm() is 
  1491. faster than  abs(), but it is more likely to cause overflow errors. 
  1492.  
  1493.  
  1494. ΓòÉΓòÉΓòÉ 3.1.12. Conversion Functions for complex ΓòÉΓòÉΓòÉ
  1495.  
  1496. You can use the conversion functions in the Complex Mathematics Library to 
  1497. convert between the polar and standard complex representations of a value and 
  1498. to extract the real and imaginary parts of a complex value. 
  1499.  
  1500. The following conversion functions are described: 
  1501.  
  1502.      arg - Angle in radians 
  1503.      conj - Conjugation 
  1504.      polar - Polar to complex 
  1505.      real - Extract real part 
  1506.      imag - Extract imaginary part 
  1507.  
  1508.  You can also view the Open Class Library User's Guide section on complex 
  1509.  conversion functions for an example of using them. 
  1510.  
  1511.  
  1512. ΓòÉΓòÉΓòÉ 3.1.12.1. arg ΓòÉΓòÉΓòÉ
  1513.  
  1514. friend double arg(complex x);
  1515.  
  1516. arg() returns the angle (in radians) of the polar representation of its 
  1517. argument. If the argument x is equal to the complex number (a,b), the angle 
  1518. returned is the angle in radians on the complex plane between the real axis and 
  1519. the vector (a,b). The return value has a range of -pi  to pi . Click here for 
  1520. an illustration of the polar representation of complex numbers. 
  1521.  
  1522.  
  1523. ΓòÉΓòÉΓòÉ 3.1.12.2. conj ΓòÉΓòÉΓòÉ
  1524.  
  1525. friend complex conj(complex x);
  1526.  
  1527. conj() returns the complex value equal to (a,-b) if the input argument x is 
  1528. equal to (a,b). 
  1529.  
  1530.  
  1531. ΓòÉΓòÉΓòÉ 3.1.12.3. polar ΓòÉΓòÉΓòÉ
  1532.  
  1533. friend complex polar(double a, double b= 0);
  1534.  
  1535. polar() returns the standard complex representation of the complex number that 
  1536. has a polar representation (a,b). 
  1537.  
  1538.  
  1539. ΓòÉΓòÉΓòÉ 3.1.12.4. real ΓòÉΓòÉΓòÉ
  1540.  
  1541. friend double real(const complex& x);
  1542.  
  1543. real() extracts the real part of the complex number x. 
  1544.  
  1545.  
  1546. ΓòÉΓòÉΓòÉ 3.1.12.5. imag ΓòÉΓòÉΓòÉ
  1547.  
  1548. friend double imag(const complex& x);
  1549.  
  1550. imag() extracts the imaginary part of the complex number x. 
  1551.  
  1552.  
  1553. ΓòÉΓòÉΓòÉ 3.2. c_exception Class ΓòÉΓòÉΓòÉ
  1554.  
  1555. Description 
  1556.  
  1557. Derivation 
  1558.  
  1559. Header File 
  1560.  
  1561. Constructors 
  1562.  
  1563. Members 
  1564.  
  1565. To close all the panels in a chapter, double-click on this panel's system menu. 
  1566.  
  1567.  
  1568. ΓòÉΓòÉΓòÉ 3.2.1. Class Description - c_exception ΓòÉΓòÉΓòÉ
  1569.  
  1570. Use the c_exception class to handle errors that are created by the functions 
  1571. and operations in the complex class. 
  1572.  
  1573. Note:  The c_exception class is not related to the C++ exception handling 
  1574. mechanism that uses the try, catch, and throw statements. 
  1575.  
  1576.  
  1577. ΓòÉΓòÉΓòÉ 3.2.2. Derivation ΓòÉΓòÉΓòÉ
  1578.  
  1579. c_exception is not derived from any other class. 
  1580.  
  1581.  
  1582. ΓòÉΓòÉΓòÉ 3.2.3. Header File ΓòÉΓòÉΓòÉ
  1583.  
  1584. c_exception is declared in complex.h. 
  1585.  
  1586.  
  1587. ΓòÉΓòÉΓòÉ 3.2.4. Members ΓòÉΓòÉΓòÉ
  1588.  
  1589. The following members are provided for c_exception: 
  1590.  
  1591.      Constructor for c_exception 
  1592.      arg1, arg2 
  1593.      name 
  1594.      retval 
  1595.      type 
  1596.  
  1597.  
  1598. ΓòÉΓòÉΓòÉ 3.2.5. Constructor for c_exception ΓòÉΓòÉΓòÉ
  1599.  
  1600. c_exception(char *n, const complex& a1,
  1601.                      const complex& a2 = complex_zero);
  1602.  
  1603. The c_exception constructor creates a c_exception object with name member equal 
  1604. to n, arg1 member equal to a1, and arg2 member equal to a2. 
  1605.  
  1606.  
  1607. ΓòÉΓòÉΓòÉ 3.2.6. Data Members of c_exception ΓòÉΓòÉΓòÉ
  1608.  
  1609. The following data members are described: 
  1610.  
  1611.      arg1, arg2 - Arguments of the function that caused the error 
  1612.      name - Name of the function that caused the error 
  1613.      retval - Value returned by the default definition of the error handling 
  1614.       function 
  1615.      type - Type of error that has occurred 
  1616.  
  1617.  
  1618. ΓòÉΓòÉΓòÉ 3.2.6.1. arg1, arg2 ΓòÉΓòÉΓòÉ
  1619.  
  1620. complex arg1;
  1621. complex arg2;
  1622.  
  1623. arg1 and arg2 are the arguments with which the function that caused the error 
  1624. was called. 
  1625.  
  1626.  
  1627. ΓòÉΓòÉΓòÉ 3.2.6.2. name ΓòÉΓòÉΓòÉ
  1628.  
  1629. char *name;
  1630.  
  1631. name is a string that contains the name of the function where the error 
  1632. occurred. 
  1633.  
  1634.  
  1635. ΓòÉΓòÉΓòÉ 3.2.6.3. retval ΓòÉΓòÉΓòÉ
  1636.  
  1637. complex retval;
  1638.  
  1639. retval is the value that the default definition if the error handling function 
  1640. complex_error() returns. You can make your own definition of complex_error() 
  1641. return a different value. 
  1642.  
  1643.  
  1644. ΓòÉΓòÉΓòÉ 3.2.6.4. type ΓòÉΓòÉΓòÉ
  1645.  
  1646. int type;
  1647.  
  1648. type describes the type of error that has occurred. It can take the following 
  1649. values that are defined in the complex.h header file: 
  1650.  
  1651.      SING argument singularity 
  1652.      OVERFLOW overflow range error 
  1653.      UNDERFLOW underflow range error 
  1654.  
  1655.  
  1656. ΓòÉΓòÉΓòÉ 3.2.7. Errors Handled by the Complex Mathematics Library ΓòÉΓòÉΓòÉ
  1657.  
  1658. The following topics are discussed: 
  1659.  
  1660.      complex_error 
  1661.      Default Error-Handling Procedures 
  1662.  
  1663.  
  1664. ΓòÉΓòÉΓòÉ 3.2.7.1. complex_error ΓòÉΓòÉΓòÉ
  1665.  
  1666. friend int complex_error(c_exception& ce);
  1667.  
  1668. complex_error() is invoked by member functions of the Complex Mathematics 
  1669. Library when errors are detected. The argument ce refers to the c_exception 
  1670. object that contains information about the error. You can define your own 
  1671. procedures for handling errors by defining a function called complex_error() 
  1672. with return type int and a single parameter of type c_exception&. 
  1673.  
  1674. If you define your own complex_error() function and this function returns a 
  1675. nonzero value, no error message will be generated and the external variable 
  1676. errno will not be set. If this function returns zero, errno is given the value 
  1677. of one of the following constants: 
  1678.  
  1679.      ERANGE if the result is too large or too small 
  1680.      EDOM if there is a domain error within a mathematical function 
  1681.  
  1682.  These constants are defined in errno.h. 
  1683.  
  1684.  If you define your own version of complex_error(), when you link your program 
  1685.  you must use the /NOE option. 
  1686.  
  1687.  For example, if the source file containing your definition of complex_error() 
  1688.  is source1.cpp, then you would invoke the compiler like this: 
  1689.  
  1690.      icc source1.cpp /B"/NOE"
  1691.  
  1692.  
  1693. ΓòÉΓòÉΓòÉ 3.2.7.2. Default Error-Handling Procedures ΓòÉΓòÉΓòÉ
  1694.  
  1695.  
  1696. If you do not define your own complex_error(), the default error-handling 
  1697. procedures will be invoked when an error occurs. The results for a given input 
  1698. complex value (a, b) depend on the kind of error and the sign of the cosine and 
  1699. sine of b. The following table shows the return value of the default 
  1700. error-handling procedure and the value given to errno for each function with 
  1701. input equal to the complex value (a, b). 
  1702.  
  1703. Note:  The following symbols appear in this table: 
  1704.  
  1705.    1. NA - not applicable. The result of the error depends on the sign of the 
  1706.       cosine and sine of b (the imaginary part of the argument) unless "NA" 
  1707.       appears in the Cosine b or Sine b columns. 
  1708.  
  1709.    2. HUGE - the maximum double value. This value is defined in math.h. 
  1710.  
  1711.   Function Error        Cosine b  Sine b   Return Value   errno Value
  1712.  
  1713.   cosh     a too large  nonneg.   nonneg.  (+HUGE,+HUGE)  ERANGE
  1714.   cosh     a too large  nonneg.   nenneg.  (+HUGE,-HUGE)  ERANGE
  1715.   cosh     a too small  nonneg.   nonneg.  (+HUGE,-HUGE)  ERANGE
  1716.   cosh     a too small  nonneg.   nenneg.  (+HUGE,+HUGE)  ERANGE
  1717.   cosh     a too small  negative  nonneg.  (-HUGE,-HUGE)  ERANGE
  1718.   cosh     a too small  negative  nenneg.  (-HUGE,+HUGE)  ERANGE
  1719.   cosh     b too large  negative  nonneg.  (-HUGE,+HUGE)  ERANGE
  1720.   cosh     b too large  negative  nenneg.  (-HUGE,-HUGE)  ERANGE
  1721.   cosh     b too small  NA        NA       (0,0)          ERANGE
  1722.   exp      a too large  positive  positive (+HUGE,+HUGE)  ERANGE
  1723.   exp      a too large  positive  positive (+HUGE,-HUGE)  ERANGE
  1724.   exp      a too large  nonpos.   positive (-HUGE,+HUGE)  ERANGE
  1725.   exp      a too large  nonpos.   positive (-HUGE,-HUGE)  ERANGE
  1726.   exp      a too small  NA        NA       (0,0)          ERANGE
  1727.   exp      b too large  NA        NA       (0,0)          ERANGE
  1728.   exp      b too small  NA        NA       (0,0)          ERANGE
  1729.   log      a too large  positive  positive (+HUGE,0)      EDOM
  1730.                                     (a message is also produced)
  1731.   sinh     a too large  nonneg.   nonneg.  (+HUGE,+HUGE)  ERANGE
  1732.   sinh     a too large  nonneg.   negative (+HUGE,-HUGE)  ERANGE
  1733.   sinh     a too large  negative  nonneg.  (-HUGE,+HUGE)  ERANGE
  1734.   sinh     a too large  negative  negative (-HUGE,-HUGE)  ERANGE
  1735.   sinh     a too small  nonneg.   nonneg.  (-HUGE,+HUGE)  ERANGE
  1736.   sinh     a too small  nonneg.   negative (-HUGE,-HUGE)  ERANGE
  1737.   sinh     a too small  negative  nonneg.  (+HUGE,+HUGE)  ERANGE
  1738.   sinh     a too small  negative  negative (+HUGE,-HUGE)  ERANGE
  1739.   sinh     b too large  NA        NA       (0,0)          ERANGE
  1740.   sinh     b too small  NA        NA       (0,0)          ERANGE
  1741.  
  1742.  Note:  errno is set to EDOM when the error for log() is detected. The message 
  1743.  is stored in CPPWRTM.DLL. The message number in CPPWRTM.DLL is 90. When this 
  1744.  message is displayed by the C/C++ Runtime Library, it is changed to 5090. For 
  1745.  information on binding this message, see "Binding Runtime Messages" in the IBM 
  1746.  VisualAge for C++ for Windows User's Guide. 
  1747.  
  1748.  
  1749. ΓòÉΓòÉΓòÉ 3.2.8. Errors Not Handled by the Complex Mathematics Library ΓòÉΓòÉΓòÉ
  1750.  
  1751. There are some cases where member functions of the Complex Mathematics Library 
  1752. call functions in the math library. These calls can cause underflow and 
  1753. overflow conditions that are handled by the matherr() function that is declared 
  1754. in the math.h header file. For example, the overflow conditions that are caused 
  1755. by the following calls are handled by matherr(): 
  1756.  
  1757.      exp(complex(DBL_MAX, DBL_MAX)) 
  1758.      pow(complex(DBL_MAX, DBL_MAX), INT_MAX) 
  1759.      norm(complex(DBL_MAX, DBL_MAX)) 
  1760.  
  1761.  DBL_MAX is the maximum valid double value.  INT_MAX is the maximum int value. 
  1762.  Both these constants are defined in float.h. 
  1763.  
  1764.  If you do not want the default error-handling defined by matherr(), you should 
  1765.  define your own version of matherr(). 
  1766.  
  1767.  
  1768. ΓòÉΓòÉΓòÉ 4. I/O Stream Library ΓòÉΓòÉΓòÉ
  1769.  
  1770. With the I/O Stream Library you can perform input and output to console or 
  1771. files using a typesafe, object-oriented programming approach.  The following 
  1772. classes or groups of classes are described in this section: 
  1773.  
  1774.  filebuf Class                                     Describes filebuf, the class 
  1775.                                                    that is used to associate 
  1776.                                                    stream buffers with files. 
  1777.  
  1778.  fstream, ifstream, and ofstream Classes           Describes fstream, ifstream, 
  1779.                                                    and ofstream, the classes 
  1780.                                                    that specialize istream, 
  1781.                                                    ostream, and iostream for 
  1782.                                                    use with files. 
  1783.  
  1784.  ios Class                                         Describes ios, the base 
  1785.                                                    class for the classes that 
  1786.                                                    format data that is 
  1787.                                                    extracted from or inserted 
  1788.                                                    into stream buffers. 
  1789.  
  1790.  iostream and iostream_withassign Classes          Describes iostream, the 
  1791.                                                    class derived from istream 
  1792.                                                    and ostream, and 
  1793.                                                    iostream_withassign, the 
  1794.                                                    class derived from 
  1795.                                                    istream_withassign and 
  1796.                                                    ostream_withassign. 
  1797.  
  1798.  istream and istream_withassign Classes            Describes istream, the class 
  1799.                                                    you can use to extract data 
  1800.                                                    from a stream buffer, and 
  1801.                                                    istream_withassign, a class 
  1802.                                                    derived from istream that 
  1803.                                                    includes an assignment 
  1804.                                                    operator. 
  1805.  
  1806.  Manipulators                                      Describes the parameterized 
  1807.                                                    manipulators you can use to 
  1808.                                                    use the input or operator to 
  1809.                                                    change the state of a 
  1810.                                                    stream. 
  1811.  
  1812.  ostream and ostream_withassign Classes            Describes ostream, the class 
  1813.                                                    you can use to insert data 
  1814.                                                    into a stream buffer, and 
  1815.                                                    ostream_withassign, a class 
  1816.                                                    derived from ostream that 
  1817.                                                    includes an assignment 
  1818.                                                    operator. 
  1819.  
  1820.  stdiobuf and stdiostream Classes                  Describes stdiobuf, the 
  1821.                                                    class you can use to mix 
  1822.                                                    standard C input and output 
  1823.                                                    functions with C++ I/O 
  1824.                                                    Stream Library functions, 
  1825.                                                    and stdiostream, the class 
  1826.                                                    that uses stdiobuf objects 
  1827.                                                    as stream buffers. 
  1828.  
  1829.  streambuf Class                                   Describes streambuf, a class 
  1830.                                                    you can use to manipulate 
  1831.                                                    objects of its derived 
  1832.                                                    classes filebuf, stdiobuf, 
  1833.                                                    and strstreambuf, or derive 
  1834.                                                    other classes from it. 
  1835.  
  1836.  strstream, istrstream, and ostrstream Classes     Describes istrstream, 
  1837.                                                    ostrsteam, and strstream, 
  1838.                                                    the classes that specialize 
  1839.                                                    istream, ostream, and 
  1840.                                                    iostream (respectively) to 
  1841.                                                    use strstreambuf objects for 
  1842.                                                    stream buffers. These 
  1843.                                                    classes are called the array 
  1844.                                                    stream buffer classes 
  1845.                                                    because their stream buffers 
  1846.                                                    are arrays of bytes in 
  1847.                                                    memory. You can use these 
  1848.                                                    classes to perform input and 
  1849.                                                    output with strings in 
  1850.                                                    memory. 
  1851.  
  1852.  strstreambuf Class                                Describes strstreambuf, the 
  1853.                                                    class that specializes 
  1854.                                                    streambuf to use an array of 
  1855.                                                    bytes in memory as the 
  1856.                                                    source or target of data. 
  1857.  
  1858.  
  1859. ΓòÉΓòÉΓòÉ 4.1. filebuf Class ΓòÉΓòÉΓòÉ
  1860.  
  1861. Description 
  1862.  
  1863. Derivation 
  1864.  
  1865. Header File 
  1866.  
  1867. Members 
  1868.  
  1869. To close all the panels in a chapter, double-click on this panel's system menu. 
  1870.  
  1871.  
  1872. ΓòÉΓòÉΓòÉ 4.1.1. Class Description - filebuf ΓòÉΓòÉΓòÉ
  1873.  
  1874. This chapter describes the filebuf class, the class that specializes streambuf 
  1875. for using files as the ultimate producer or the ultimate consumer. 
  1876.  
  1877. In a filebuf object, characters are cleared out of the put area by doing write 
  1878. operations to the file, and characters are put into the get area by doing read 
  1879. operations from that file.  The filebuf class supports seek operations on files 
  1880. that allow seek operations.  A filebuf object that is attached to a file 
  1881. descriptor is said to be open. 
  1882.  
  1883. The stream buffer is allocated automatically if one is not specified explicitly 
  1884. with a constructor or a call to setbuf().  You can also create an unbuffered 
  1885. filebuf object by calling the constructor or setbuf() with the appropriate 
  1886. arguments.  If the filebuf objec is unbuffered, a system call is made for each 
  1887. character that is read or written. 
  1888.  
  1889. The get and put pointers for a filebuf object behave as a single pointer.  This 
  1890. single pointer is referred to as the get/put pointer.  The file that is 
  1891. attached to the filebuf object also has a single pointer that indicates the 
  1892. current position where information is being read or written.  In this chapter, 
  1893. this pointer is called the file get/put pointer. 
  1894.  
  1895.  
  1896. ΓòÉΓòÉΓòÉ 4.1.2. Derivation ΓòÉΓòÉΓòÉ
  1897.  
  1898. streambuf 
  1899.  
  1900.   filebuf
  1901.  
  1902.  
  1903. ΓòÉΓòÉΓòÉ 4.1.3. Header File ΓòÉΓòÉΓòÉ
  1904.  
  1905. filebuf is declared in fstream.h. 
  1906.  
  1907.  
  1908. ΓòÉΓòÉΓòÉ 4.1.4. Public Members of filebuf ΓòÉΓòÉΓòÉ
  1909.  
  1910. See Using filebuf Functions to Move Through a File for an example of using the 
  1911. filebuf class. 
  1912.  
  1913. Note:  The following descriptions assume that the functions are called as part 
  1914. of a filebuf object called fb. 
  1915.  
  1916. The following member functions are described: 
  1917.  
  1918.      Constructors for filebuf 
  1919.      Destructor for filebuf 
  1920.      attach - attach filebuf object to file 
  1921.      close - disconnect filebuf 
  1922.      detach - detach filebuf object from file 
  1923.      fd - return file descriptor 
  1924.      is_open - return status of filebuf 
  1925.      open - open file and attach to filebuf 
  1926.      seekoff - move the file get/put pointer 
  1927.      seekpos - move the file get/put pointer 
  1928.      setbuf - set up stream buffer 
  1929.      sync - synchronize file and stream buffer 
  1930.  
  1931.  
  1932. ΓòÉΓòÉΓòÉ 4.1.4.1. Constructors for filebuf ΓòÉΓòÉΓòÉ
  1933.  
  1934. filebuf();
  1935. filebuf(int d);
  1936. filebuf(int d, char* p, int len);
  1937.  
  1938. The filebuf() constructor with no arguments constructs an initially closed 
  1939. filebuf object. 
  1940.  
  1941. The filebuf() constructor with one argument constructs a filebuf object that is 
  1942. attached to file descriptor d. 
  1943.  
  1944. The filebuf() constructor with three arguments constructs a filebuf object that 
  1945. is attached to file descriptor d. The object is initialized to use the stream 
  1946. buffer starting at the position pointed to by p with length equal to len. 
  1947.  
  1948.  
  1949. ΓòÉΓòÉΓòÉ 4.1.4.2. Destructor for filebuf ΓòÉΓòÉΓòÉ
  1950.  
  1951. ~filebuf();
  1952.  
  1953. The filebuf destructor calls fb.close(). 
  1954.  
  1955.  
  1956. ΓòÉΓòÉΓòÉ 4.1.4.3. attach ΓòÉΓòÉΓòÉ
  1957.  
  1958. filebuf* attach(int d);
  1959.  
  1960. attach() attaches fb to the file descriptor d. fb is the filebuf object 
  1961. returned by attach(). If fb is already open or if d is not open, attach() 
  1962. returns NULL. Otherwise, attach() returns a pointer to fb. 
  1963.  
  1964. Note:  This member is not supported under C++/MVS. 
  1965.  
  1966.  
  1967. ΓòÉΓòÉΓòÉ 4.1.4.4. detach ΓòÉΓòÉΓòÉ
  1968.  
  1969. int detach();
  1970.  
  1971. fb.detach() disconnects fb from the file without closing the file.  If fb is 
  1972. not open, detach() returns -1.  Otherwise, detach() flushes any output that is 
  1973. waiting in fb to be sent to the file, disconnects fb from the file, and returns 
  1974. the file descriptor. 
  1975.  
  1976. Note:  This member is not supported under C++/MVS. 
  1977.  
  1978.  
  1979. ΓòÉΓòÉΓòÉ 4.1.4.5. close ΓòÉΓòÉΓòÉ
  1980.  
  1981. filebuf* close();
  1982.  
  1983. close() does the following: 
  1984.  
  1985.    1. Flushes any output that is waiting in fb to be sent to the file 
  1986.    2. Disconnects fb from the file 
  1987.    3. Closes the file that was attached to fb 
  1988.  
  1989.  If an error occurs, close() returns 0. Otherwise, close() returns a pointer to 
  1990.  fb. Even if an error occurs, close() performs the second and third steps 
  1991.  listed above. 
  1992.  
  1993.  
  1994. ΓòÉΓòÉΓòÉ 4.1.4.6. fd ΓòÉΓòÉΓòÉ
  1995.  
  1996. int fd();
  1997.  
  1998. fd() returns the file descriptor that is attached to fb. If fb is closed, fd() 
  1999. returns EOF. 
  2000.  
  2001. Note:  This member is not supported under C++/MVS. 
  2002.  
  2003.  
  2004. ΓòÉΓòÉΓòÉ 4.1.4.7. is_open ΓòÉΓòÉΓòÉ
  2005.  
  2006. int is_open();
  2007.  
  2008. is_open() returns a nonzero value if fb is attached to a file descriptor. 
  2009. Otherwise, is_open() returns zero. 
  2010.  
  2011.  
  2012. ΓòÉΓòÉΓòÉ 4.1.4.8. open ΓòÉΓòÉΓòÉ
  2013.  
  2014. filebuf* open(const char* fname, int omode, int prot=openprot);
  2015.  
  2016. open() opens the file with the name fname and attaches fb to it. If fname does 
  2017. not already exist and omode does not equal ios::nocreate, open() tries to 
  2018. create it with protection mode equal to prot. The default value of prot is 
  2019. filebuf::openprot. An error occurs if fb is already open. If an error occurs, 
  2020. open() returns 0. Otherwise, open() returns a pointer to fb. 
  2021.  
  2022. The default protection mode for the filebuf class is S_IREAD | S_IWRITE. If you 
  2023. create a file with both S_IREAD and S_IWRITE set, the file is created with both 
  2024. read and write permission. If you create a file with only S_IREAD set, the file 
  2025. is created with read-only permission, and cannot be deleted later with the 
  2026. stdio.h library function remove(). S_IREAD and S_IWRITE are defined in 
  2027. sys\stat.h. 
  2028.  
  2029.  
  2030. ΓòÉΓòÉΓòÉ 4.1.4.9. seekoff ΓòÉΓòÉΓòÉ
  2031.  
  2032. streampos seekoff(streamoff so, seek_dir sd, int omode);
  2033.  
  2034. seekoff() moves the file get/put pointer to the position specified by sd with 
  2035. the offset so. sd can have the following values: 
  2036.  
  2037.      ios::beg: the beginning of the file 
  2038.      ios::cur: the current position of the file get/put pointer 
  2039.      ios::end: the end of the file 
  2040.  
  2041.  seekoff() changes the position of the file get/put pointer to the position 
  2042.  specified by the value sd + so. The offset so can be either positive or 
  2043.  negative. seekoff() ignores the value of omode. 
  2044.  
  2045.  If fb is attached to a file that does not support seeking, or if the value sd 
  2046.  + so specifies a position before the beginning of the file, seekoff() returns 
  2047.  EOF and the position of the file get/put pointer is undefined. Otherwise, 
  2048.  seekoff() returns the new position of the file get/put pointer. 
  2049.  
  2050.  
  2051. ΓòÉΓòÉΓòÉ 4.1.4.10. seekpos ΓòÉΓòÉΓòÉ
  2052.  
  2053. The filebuf class inherits the default definition of seekpos() from the 
  2054. streambuf class. The default definition defines seekpos() as a call to 
  2055. seekoff(). Thus, the following call to seekpos(): 
  2056.  
  2057. seekpos(pos, mode);
  2058.  
  2059. is converted to a call to seekoff(): 
  2060.  
  2061. seekoff(streamoff(pos), ios::beg, mode);
  2062.  
  2063.  
  2064. ΓòÉΓòÉΓòÉ 4.1.4.11. setbuf ΓòÉΓòÉΓòÉ
  2065.  
  2066. streambuf* setbuf(char* pbegin, int len);
  2067.  
  2068. setbuf() sets up a stream buffer with length in bytes equal to len, beginning 
  2069. at the position pointed to by pbegin. setbuf() does the following: 
  2070.  
  2071.      If pbegin is 0 or len is nonpositive, setbuf() makes fb unbuffered. 
  2072.      If fb is open and a stream buffer has been allocated, no changes are made 
  2073.       to this stream buffer, and setbuf() returns NULL. 
  2074.      If neither of these cases is true, setbuf() returns a pointer to fb. 
  2075.  
  2076.  
  2077. ΓòÉΓòÉΓòÉ 4.1.4.12. sync ΓòÉΓòÉΓòÉ
  2078.  
  2079. int sync();
  2080.  
  2081. sync() attempts to synchronize the get/put pointer and the file get/put 
  2082. pointer. sync() may cause bytes that are waiting in the stream buffer to be 
  2083. written to the file, or it may reposition the file get/put pointer if 
  2084. characters that have been read from the file are waiting in the stream buffer. 
  2085. If it is not possible to synchronize the get/put pointer and the file get/put 
  2086. pointer, sync() returns EOF. If they can be synchronized, sync() returns zero. 
  2087.  
  2088.  
  2089. ΓòÉΓòÉΓòÉ 4.2. fstream, ifstream, and ofstream Classes ΓòÉΓòÉΓòÉ
  2090.  
  2091. Description 
  2092.  
  2093. Derivation 
  2094.  
  2095. Header File 
  2096.  
  2097. Members 
  2098.  
  2099. To close all the panels in a chapter, double-click on this panel's system menu. 
  2100.  
  2101.  
  2102. ΓòÉΓòÉΓòÉ 4.2.1. Class Description - fstream, ifstream, and ofstream classes ΓòÉΓòÉΓòÉ
  2103.  
  2104. The fstream, ifstream, and ofstream classes specialize istream, ostream, and 
  2105. iostream for use with files. 
  2106.  
  2107.  
  2108. ΓòÉΓòÉΓòÉ 4.2.2. Derivation ΓòÉΓòÉΓòÉ
  2109.  
  2110. ios 
  2111.  
  2112.   istream
  2113.    ifstream
  2114.   ostream
  2115.    ofstream
  2116.   istream and ostream
  2117.    iostream
  2118.      fstream
  2119.  
  2120.  
  2121. ΓòÉΓòÉΓòÉ 4.2.3. Header File ΓòÉΓòÉΓòÉ
  2122.  
  2123. fstream, ifstream, and ofstream are declared in fstream.h. 
  2124.  
  2125.  
  2126. ΓòÉΓòÉΓòÉ 4.2.4. Members ΓòÉΓòÉΓòÉ
  2127.  
  2128. The following members are provided for fstream, ifstream, ofstream, and 
  2129. fstreambase: 
  2130.  
  2131.      fstreambase: 
  2132.            attach 
  2133.            close 
  2134.            detach 
  2135.            setbuf 
  2136.      fstream: 
  2137.            Constructors for fstream 
  2138.            open 
  2139.            rdbuf 
  2140.      ifstream: 
  2141.            Constructors for ifstream 
  2142.            open 
  2143.            rdbuf 
  2144.      ofstream: 
  2145.            Constructors for ofstream 
  2146.            open 
  2147.            rdbuf 
  2148.  
  2149.  
  2150. ΓòÉΓòÉΓòÉ 4.2.5. fstreambase ΓòÉΓòÉΓòÉ
  2151.  
  2152. Description 
  2153.  
  2154. Members 
  2155.  
  2156. To close all the panels in a chapter, double-click on this panel's system menu. 
  2157.  
  2158.  
  2159. ΓòÉΓòÉΓòÉ 4.2.6. Class Description - fstreambase ΓòÉΓòÉΓòÉ
  2160.  
  2161. Note: 
  2162.  
  2163.    1. The fstreambase class is an internal class that provides common functions 
  2164.       for the classes that are derived from it. Do not use the fstreambase 
  2165.       class directly. The following descriptions are provided so that you can 
  2166.       use the functions as part of fstream, ifstream, and ofstream objects. 
  2167.  
  2168.    2. The following descriptions assume that the functions are called as part 
  2169.       of an fstream, ifstream, or ofstream object called fb. 
  2170.  
  2171.  
  2172. ΓòÉΓòÉΓòÉ 4.2.6.1. Members ΓòÉΓòÉΓòÉ
  2173.  
  2174. The following functions are described: 
  2175.  
  2176.      attach - connect fstream object to file descriptor 
  2177.      close - close associated filebuf object 
  2178.      detach - detach associated filebuf object 
  2179.      setbuf - set up stream buffer 
  2180.  
  2181.  
  2182. ΓòÉΓòÉΓòÉ 4.2.6.1.1. attach ΓòÉΓòÉΓòÉ
  2183.  
  2184. void attach(int filedesc);
  2185.  
  2186. attach() attaches fb to the file descriptor filedesc. If fb is already attached 
  2187. to a file descriptor, an error occurs and ios::failbit is set in the format 
  2188. state of fb. 
  2189.  
  2190. Note:  This member function is not supported under C++/MVS. 
  2191.  
  2192.  
  2193. ΓòÉΓòÉΓòÉ 4.2.6.1.2. close ΓòÉΓòÉΓòÉ
  2194.  
  2195. void close();
  2196.  
  2197. close() closes the filebuf object, breaking the connection between fb and the 
  2198. file descriptor. close() calls fb.rdbuf()->close(). If this call fails, the 
  2199. error state of fb is not cleared. 
  2200.  
  2201.  
  2202. ΓòÉΓòÉΓòÉ 4.2.6.1.3. detach ΓòÉΓòÉΓòÉ
  2203.  
  2204. int detach();
  2205.  
  2206. detach detaches the filebuf object by calling fb.rdbuf()->detach(), and returns 
  2207. the value returned by fb.rdbuf()->detach(). 
  2208.  
  2209. Note:  This member function is not supported under C++/MVS. 
  2210.  
  2211.  
  2212. ΓòÉΓòÉΓòÉ 4.2.6.1.4. setbuf ΓòÉΓòÉΓòÉ
  2213.  
  2214. void setbuf(char* pbegin, int len);
  2215.  
  2216. setbuf() sets up a stream buffer with length in bytes equal to len beginning at 
  2217. the position pointed to by pbegin. If pbegin is equal to 0 or len is 
  2218. nonpositive, fb will be unbuffered. If fb is open, or the call to 
  2219. fb.rdbuf()->setbuf() fails, setbuf() sets ios::failbit in the object's state. 
  2220.  
  2221.  
  2222. ΓòÉΓòÉΓòÉ 4.2.7. fstream Class ΓòÉΓòÉΓòÉ
  2223.  
  2224. Description 
  2225.  
  2226. Members 
  2227.  
  2228. To close all the panels in a chapter, double-click on this panel's system menu. 
  2229.  
  2230.  
  2231. ΓòÉΓòÉΓòÉ 4.2.8. Class Description - fstream class ΓòÉΓòÉΓòÉ
  2232.  
  2233. The fstream class specializes iostream for use with files. Once an fstream 
  2234. object is associated with a file, you can either read to it or write to it, 
  2235. depending on the mode with which the file was opened.  Once the file is closed, 
  2236. you can open another file (or the same file again) in a different mode using 
  2237. the same fstream object. 
  2238.  
  2239. The descriptions for fstream member functions assume that the functions are 
  2240. called as part of an fstream object called fs. 
  2241.  
  2242.  
  2243. ΓòÉΓòÉΓòÉ 4.2.8.1. Members ΓòÉΓòÉΓòÉ
  2244.  
  2245. The following functions are described: 
  2246.  
  2247.      Constructors for fstream 
  2248.      open - open file and connect to fstream object 
  2249.      rdbuf - return pointer to filebuf object 
  2250.  
  2251.  
  2252. ΓòÉΓòÉΓòÉ 4.2.8.1.1. Constructors for fstream ΓòÉΓòÉΓòÉ
  2253.  
  2254. fstream();
  2255.  
  2256. This version of the fstream constructor takes no arguments and constructs an 
  2257. unopened fstream object. 
  2258.  
  2259. fstream(int filedesc);
  2260.  
  2261. This version takes one argument and constructs an fstream object that is 
  2262. attached to the file descriptor filedesc. If filedesc is not open, ios::failbit 
  2263. is set in the format state of fs. 
  2264.  
  2265. fstream(const char* fname, int mode, int prot=filebuf::openprot);
  2266.  
  2267. This version constructs an fstream object and opens the file fname with open 
  2268. mode equal to mode and protection mode equal to prot. The default value for the 
  2269. argument prot is filebuf::openprot. If the file cannot be opened, the error 
  2270. state of the constructed fstream object is set. 
  2271.  
  2272. fstream(int filedesc, char* bufpos, int len);
  2273.  
  2274. This version constructs an fstream object that is attached to the file 
  2275. descriptor filedesc. If filedesc is not open, ios::failbit is set in the format 
  2276. state of fs. This constructor also sets up an associated filebuf object with a 
  2277. stream buffer that has length len bytes and begins at the position pointed to 
  2278. by bufpos. If bufpos is equal to 0 or len is equal to 0, the associated filebuf 
  2279. object is unbuffered. 
  2280.  
  2281.  
  2282. ΓòÉΓòÉΓòÉ 4.2.8.1.2. open ΓòÉΓòÉΓòÉ
  2283.  
  2284. void open(const char* fname, int mode, int prot=filebuf::openprot);
  2285.  
  2286. open() opens the file with the name fname and attaches it to fs. If fname does 
  2287. not already exist, open() tries to create it with protection mode equal to 
  2288. prot, unless ios::nocreate is set. 
  2289.  
  2290. The default value for prot is filebuf::openprot. If fs is already attached to a 
  2291. file or if the call to fs.rdbuf()->open() fails, ios::failbit is set in the 
  2292. error state for fs. 
  2293.  
  2294. The members of the ios::open_mode enumeration are bits that can be ORed 
  2295. together. The value of mode is the result of such an OR operation. This result 
  2296. is an int value, and for this reason, mode has type int rather than open_mode. 
  2297.  
  2298. The elements of the open_mode enumeration have the following meanings: 
  2299.  
  2300.  ios::app       open() performs a seek to the end of the file. Data that is 
  2301.                 written is appended to the end of the file. This value implies 
  2302.                 that the file is open for output. 
  2303.  
  2304.  ios::ate       open() performs a seek to the end of the file. Setting ios::ate 
  2305.                 does not open the file for input or output. If you set 
  2306.                 ios::ate, you should explicitly set ios::in, ios::out, or both. 
  2307.  
  2308.  ios::bin       See ios::binary below. 
  2309.  
  2310.  ios::binary    The file is opened in binary mode. In the default (text) mode, 
  2311.                 carriage returns are discarded on input, as is an end-of-file 
  2312.                 (0x1a) character if it is the last character in the file. This 
  2313.                 means that a carriage return without an accompanying line feed 
  2314.                 causes the characters on either side of the carriage return to 
  2315.                 become adjacent. On output, a line feed is expanded to a 
  2316.                 carriage return and line feed. If you specify ios::binary, 
  2317.                 carriage returns and terminating end-of-file characters are not 
  2318.                 removed on input, and a line feed is not expanded to a carriage 
  2319.                 return and line feed on output. ios::binary and ios::bin 
  2320.                 provide identical functionality. 
  2321.  
  2322.  ios::in        The file is opened for input. If the file that is being opened 
  2323.                 for input does not exist, the open operation will fail. 
  2324.                 ios::noreplace is ignored if ios::in is set. 
  2325.  
  2326.  ios::out       The file is opened for output. 
  2327.  
  2328.  ios::trunc     If the file already exists, its contents will be discarded. If 
  2329.                 you specify ios::out and neither ios::ate nor ios::app, you are 
  2330.                 implicitly specifying ios::trunc. If you set ios::trunc, you 
  2331.                 should explicitly set ios::in, ios::out, or both. 
  2332.  
  2333.  ios::nocreate  If the file does not exist, the call to open() fails. 
  2334.  
  2335.  ios::noreplace If the file already exists and ios::out is set, the call to 
  2336.                 open() fails. If ios::out is not set, ios::noreplace is 
  2337.                 ignored. 
  2338.  
  2339.  
  2340. ΓòÉΓòÉΓòÉ 4.2.8.1.3. rdbuf ΓòÉΓòÉΓòÉ
  2341.  
  2342. filebuf* rdbuf();
  2343.  
  2344. rdbuf() returns a pointer to the filebuf object that is attached to fs. 
  2345.  
  2346.  
  2347. ΓòÉΓòÉΓòÉ 4.2.9. ifstream Class ΓòÉΓòÉΓòÉ
  2348.  
  2349. Description 
  2350.  
  2351. Members 
  2352.  
  2353. To close all the panels in a chapter, double-click on this panel's system menu. 
  2354.  
  2355.  
  2356. ΓòÉΓòÉΓòÉ 4.2.10. Class Description - ifstream class ΓòÉΓòÉΓòÉ
  2357.  
  2358. The ifstream class specializes istream for use with files.  When you create an 
  2359. ifstream object and associate it with a file, the file is opened for input. 
  2360. The advantage of using ifstream over fstream is that attempts to write data to 
  2361. an ifstream object are flagged as errors at compilation. 
  2362.  
  2363. For an example of using the ifstream class, click here. 
  2364.  
  2365. Note:  The following descriptions assume that the functions are called as part 
  2366. of an ifstream object called ifs. 
  2367.  
  2368.  
  2369. ΓòÉΓòÉΓòÉ 4.2.10.1. Members ΓòÉΓòÉΓòÉ
  2370.  
  2371.      Constructors for ifstream 
  2372.      open - open file and connect to ifstream object 
  2373.      rdbuf - return pointer to filebuf object 
  2374.  
  2375.  
  2376. ΓòÉΓòÉΓòÉ 4.2.10.1.1. Constructors for ifstream ΓòÉΓòÉΓòÉ
  2377.  
  2378. ifstream();
  2379.  
  2380. This version of the ifstream constructor takes no arguments and constructs an 
  2381. unopened ifstream object. 
  2382.  
  2383. ifstream(int filedesc);
  2384.  
  2385. This version takes one argument and constructs an ifstream object that is 
  2386. attached to the file descriptor filedesc. If filedesc is not open, ios::failbit 
  2387. is set in the format state of ifs. 
  2388.  
  2389. ifstream(const char* fname,
  2390.          int mode=ios::in,
  2391.          int prot=filebuf::openprot);
  2392.  
  2393. The third version constructs an ifstream object and opens the file fname with 
  2394. open mode equal to mode and protection mode equal to prot. The default value 
  2395. for mode is ios::in, and the default value for prot is filebuf::openprot. If 
  2396. the file cannot be opened, the error state of the constructed ifstream object 
  2397. is set. 
  2398.  
  2399. ifstream(int filedesc, char* bufpos, int len);
  2400.  
  2401. This version constructs an ifstream object that is attached to the file 
  2402. descriptor filedesc. If filedesc is not open, ios::failbit is set in the format 
  2403. state of ifs. This constructor also sets up an associated filebuf object with a 
  2404. stream buffer that has length len bytes and begins at the position pointed to 
  2405. by bufpos. If bufpos is equal to 0 or len is equal to 0, the associated filebuf 
  2406. object is unbuffered. 
  2407.  
  2408.  
  2409. ΓòÉΓòÉΓòÉ 4.2.10.1.2. open ΓòÉΓòÉΓòÉ
  2410.  
  2411. void open(const char* fname,
  2412.           int mode=ios::in,
  2413.           int prot=filebuf::openprot);
  2414.  
  2415. open() opens the file with the name fname and attaches it to ifs. If fname does 
  2416. not already exist, open() tries to create it with protection mode equal to 
  2417. prot, unless ios::nocreate is set in mode. 
  2418.  
  2419. The default value for mode is ios::in. The default value for prot is 
  2420. filebuf::openprot. If ifs is already attached to a file, or if the call to 
  2421. ifs.rdbuf()->open() fails, ios::failbit is set in the error status for ifs. 
  2422.  
  2423. The members of the ios::open_mode enumeration are bits that can be ORed 
  2424. together. The value of mode is the result of such an OR operation. This result 
  2425. is an int value, and for this reason mode has type int rather than type 
  2426. open_mode. See open for a list of the possible values for mode. 
  2427.  
  2428.  
  2429. ΓòÉΓòÉΓòÉ 4.2.10.1.3. rdbuf ΓòÉΓòÉΓòÉ
  2430.  
  2431. filebuf* rdbuf();
  2432.  
  2433. rdbuf() returns a pointer to the filebuf object that is attached to ifs. 
  2434.  
  2435.  
  2436. ΓòÉΓòÉΓòÉ 4.2.11. ofstream Class ΓòÉΓòÉΓòÉ
  2437.  
  2438. Description 
  2439.  
  2440. Members 
  2441.  
  2442. To close all the panels in a chapter, double-click on this panel's system menu. 
  2443.  
  2444.  
  2445. ΓòÉΓòÉΓòÉ 4.2.12. Class Description - ofstream class ΓòÉΓòÉΓòÉ
  2446.  
  2447. The ofstream class specializes ostream for use with files.  When you create an 
  2448. ofstream object and associate it with a file, the file is opened for output. 
  2449. The advantage of using ofstream over fstream is that attempts to read data from 
  2450. an ofstream object are flagged as errors at compilation. 
  2451.  
  2452. For an example of using the ofstream class, select this hypertext link. 
  2453.  
  2454. Note:  The following descriptions assume that the functions are called as part 
  2455. of an ofstream object called ofs. 
  2456.  
  2457.  
  2458. ΓòÉΓòÉΓòÉ 4.2.12.1. Members ΓòÉΓòÉΓòÉ
  2459.  
  2460.      Constructors for ofstream 
  2461.      open - open file and connect to ofstream object 
  2462.      rdbuf - return pointer to filebuf object 
  2463.  
  2464.  
  2465. ΓòÉΓòÉΓòÉ 4.2.12.2. Constructors for ofstream ΓòÉΓòÉΓòÉ
  2466.  
  2467. ofstream();
  2468.  
  2469. This version of the ofstream constructor takes no arguments and constructs an 
  2470. unopened ofstream object. 
  2471.  
  2472. ofstream(int filedesc);
  2473.  
  2474. This version takes one argument and constructs an ofstream object that is 
  2475. attached to the file descriptor filedesc. If filedesc is not open, ios::failbit 
  2476. is set in the format state of ofs. 
  2477.  
  2478. ofstream(const char* fname,
  2479.          int mode=ios::out,
  2480.          int prot=filebuf::openprot);
  2481.  
  2482. This version constructs an ofstream object and opens the file fname with open 
  2483. mode equal to mode and protection mode equal to prot. The default value for 
  2484. mode is ios::out, and the default value for prot is filebuf::openprot. If the 
  2485. file cannot be opened, the error state of the constructed ofstream object is 
  2486. set. 
  2487.  
  2488. ofstream(int filedesc, char* bufpos, int len);
  2489.  
  2490. This version constructs an ofstream object that is attached to the file 
  2491. descriptor filedesc. If filedesc is not open, ios::failbit is set in the format 
  2492. state of ofs. This constructor also sets up an associated filebuf object with a 
  2493. stream buffer that has length len bytes and begins at the position pointed to 
  2494. by bufpos. If p is equal to 0 or len is equal to 0, the associated filebuf 
  2495. object is unbuffered. 
  2496.  
  2497.  
  2498. ΓòÉΓòÉΓòÉ 4.2.12.3. open ΓòÉΓòÉΓòÉ
  2499.  
  2500. void open(const char* fname, int mode, int prot=filebuf::openprot);
  2501.  
  2502. open() opens the file with the name fname and attaches it to ofs. If fname does 
  2503. not already exist, open() tries to create it with protection mode equal to 
  2504. prot, unless ios::nocreate is set. 
  2505.  
  2506. The default value for mode is ios::out. The default value for the argument prot 
  2507. is filebuf::openprot. If ofs is already attached to a file, or if the call to 
  2508. the function ofs.rdbuf()->open() fails, ios::failbit is set in the error state 
  2509. for ofs. 
  2510.  
  2511. The members of the ios::open_mode enumeration are bits that can be ORed 
  2512. together. The value of mode is the result of such an OR operation. This result 
  2513. is an int value, and for this reason, mode has type int rather than open_mode. 
  2514. See open for a list of the possible values for mode. 
  2515.  
  2516.  
  2517. ΓòÉΓòÉΓòÉ 4.2.12.4. rdbuf ΓòÉΓòÉΓòÉ
  2518.  
  2519. filebuf* rdbuf();
  2520.  
  2521. rdbuf() returns a pointer to the filebuf object that is attached to ofs. 
  2522.  
  2523.  
  2524. ΓòÉΓòÉΓòÉ 4.3. ios Class ΓòÉΓòÉΓòÉ
  2525.  
  2526. Description 
  2527.  
  2528. Derivation 
  2529.  
  2530. Header File 
  2531.  
  2532. Constructors 
  2533.  
  2534. Members 
  2535.  
  2536. To close all the panels in a chapter, double-click on this panel's system menu. 
  2537.  
  2538.  
  2539. ΓòÉΓòÉΓòÉ 4.3.1. Class Description - ios class ΓòÉΓòÉΓòÉ
  2540.  
  2541. The ios class maintains the error and format state information for the classes 
  2542. that are derived from it. The derived classes support the movement of formatted 
  2543. and unformatted data to and from the stream buffer. This chapter describes the 
  2544. members of the ios class, and thus describes the operations that are common to 
  2545. all the classes that are derived from ios. 
  2546.  
  2547. You can view the topics in this chapter either through the panel on the left, 
  2548. or by selecting from among the following: 
  2549.  
  2550.      Format State Variables 
  2551.      Format State Flags: 
  2552.         -  White Space and Padding 
  2553.         -  Base Conversion 
  2554.         -  Integral Formatting 
  2555.         -  Floating-Point Formatting 
  2556.         -  Uppercase and Lowercase 
  2557.         -  Buffer Flushing 
  2558.         -  Mutually Exclusive Format Flags 
  2559.      Format State Members 
  2560.      User-Defined Format Flags 
  2561.      ios Error State 
  2562.      Other ios Members 
  2563.      Built-In Manipulators 
  2564.  
  2565.  
  2566. ΓòÉΓòÉΓòÉ 4.3.2. Derivation ΓòÉΓòÉΓòÉ
  2567.  
  2568. ios 
  2569.  
  2570.  
  2571. ΓòÉΓòÉΓòÉ 4.3.3. Header File ΓòÉΓòÉΓòÉ
  2572.  
  2573. ios is declared in iostream.h. 
  2574.  
  2575.  
  2576. ΓòÉΓòÉΓòÉ 4.3.4. Members ΓòÉΓòÉΓòÉ
  2577.  
  2578. The following members are provided for ios. Italicized members are flags or 
  2579. variables used to maintain the format state information for streams. 
  2580.  
  2581.      ios constructor 
  2582.      bad 
  2583.      bitalloc 
  2584.      clear 
  2585.      dec 
  2586.      dec manipulator 
  2587.      endl manipulator 
  2588.      ends manipulator 
  2589.      eof 
  2590.      fail 
  2591.      fill 
  2592.      fixed 
  2593.      flags 
  2594.      flush manipulator 
  2595.      good 
  2596.      hex 
  2597.      hex manipulator 
  2598.      internal 
  2599.      iword 
  2600.      left 
  2601.      oct 
  2602.      oct manipulator 
  2603.      operator void* 
  2604.      operator= 
  2605.      precision 
  2606.      pword 
  2607.      rdbuf 
  2608.      rdstate 
  2609.      right 
  2610.      scientific 
  2611.      setf 
  2612.      showbase 
  2613.      showpoint 
  2614.      showpos 
  2615.      skip 
  2616.      skipws 
  2617.      stdio 
  2618.      sync_with_stdio 
  2619.      tie 
  2620.      unitbuf 
  2621.      unsetf 
  2622.      uppercase 
  2623.      width 
  2624.      ws manipulator 
  2625.      x_fill 
  2626.      x_precision 
  2627.      x_width 
  2628.      xalloc 
  2629.  
  2630.  
  2631. ΓòÉΓòÉΓòÉ 4.3.5. Constructors and Assignment Operator for ios ΓòÉΓòÉΓòÉ
  2632.  
  2633. public:
  2634.      ios(streambuf* sb);
  2635. protected:
  2636.      ios();
  2637.      init(streambuf* isb);
  2638. private:
  2639.      ios(ios& ioa);
  2640.      void operator=(ios& iob);
  2641.  
  2642. There are three versions of the ios constructor. The version that is declared 
  2643. public takes a single argument that is a pointer to the streambuf object that 
  2644. becomes associated with the constructed ios object. If this pointer is equal to 
  2645. 0, the result is undefined. 
  2646.  
  2647. The version of the ios constructor that is declared protected takes no 
  2648. arguments. This version is needed because ios is used as a virtual base class 
  2649. for iostream, and therefore the ios class must have a constructor that takes no 
  2650. arguments. If you use this constructor in a derived class, you must use the 
  2651. init() function to associate the constructed ios object with the streambuf 
  2652. object pointed to by the argument isb. 
  2653.  
  2654. Copying of ios objects is not well defined, and for this reason, both the 
  2655. assignment operator and the copy constructor are declared private. Assignment 
  2656. between streams is supported by the istream_withassign, ostream_withassign, and 
  2657. iostream_withassign classes. See Assignment Operator for istream_withassign and 
  2658. Assignment Operator for ostream_withassign for more details. Except for the 
  2659. ..._withassign classes, none of the predefined classes derived from ios has a 
  2660. copy constructor or an assignment operator. Unless you define your own copy 
  2661. constructor or assignment operator for a class that you derive from ios, your 
  2662. class will have neither a copy constructor nor an assignment operator. 
  2663.  
  2664.  
  2665. ΓòÉΓòÉΓòÉ 4.3.6. Format State Variables ΓòÉΓòÉΓòÉ
  2666.  
  2667. The format state is a collection of format flags and format variables that 
  2668. control the details of formatting for input and output operations. This section 
  2669. describes the format variables. 
  2670.  
  2671.  
  2672. ΓòÉΓòÉΓòÉ 4.3.6.1. x_fill ΓòÉΓòÉΓòÉ
  2673.  
  2674. char x_fill;
  2675.  
  2676. x_fill is the character that is used to pad values that do not require the 
  2677. width of an entire field for their representation. Its default value is a space 
  2678. character. 
  2679.  
  2680.  
  2681. ΓòÉΓòÉΓòÉ 4.3.6.2. x_precision ΓòÉΓòÉΓòÉ
  2682.  
  2683. short x_precision;
  2684.  
  2685. x_precision is the number of significant digits in the representation of 
  2686. floating-point values. Its default value is 6. 
  2687.  
  2688.  
  2689. ΓòÉΓòÉΓòÉ 4.3.6.3. x_width ΓòÉΓòÉΓòÉ
  2690.  
  2691. short x_width;
  2692.  
  2693. x_width is the minimum width of a field. Its default value is 0. 
  2694.  
  2695.  
  2696. ΓòÉΓòÉΓòÉ 4.3.7. Format State Flags ΓòÉΓòÉΓòÉ
  2697.  
  2698. The following list shows the formatting features and the format flags that 
  2699. control them: 
  2700.  
  2701.      White space and padding: ios::skipws, ios::left, ios::right, 
  2702.       ios::internal 
  2703.      Base conversion: ios::dec, ios::hex, ios::oct, ios::showbase 
  2704.      Integral formatting: ios::showpos 
  2705.      Floating-point formatting: ios::fixed, ios::scientific, ios::showpoint 
  2706.      Uppercase and lowercase: ios::uppercase 
  2707.      Buffer flushing: ios::stdio, ios::unitbuf 
  2708.  
  2709.  Mutually Exclusive Format Flags describes the flags that produce unpredictable 
  2710.  results if they are set at the same time. 
  2711.  
  2712.  
  2713. ΓòÉΓòÉΓòÉ 4.3.7.1. White Space and Padding ΓòÉΓòÉΓòÉ
  2714.  
  2715. The following format state flags control white space and padding characters. 
  2716. skipws and right are set by default. 
  2717.  
  2718.  
  2719. ΓòÉΓòÉΓòÉ 4.3.7.1.1. skipws ΓòÉΓòÉΓòÉ
  2720.  
  2721. If ios::skipws is set, white space will be skipped on input. If it is not set, 
  2722. white space is not skipped. If ios::skipws is not set, the arithmetic 
  2723. extractors will signal an error if you attempt to read an integer or 
  2724. floating-point value that is preceded by white space. ios::failbit is set, and 
  2725. extraction ceases until it is cleared. This is done to avoid looping problems. 
  2726. If the following program is run with an input file that contains integer values 
  2727. separated by spaces, ios::failbit is set after the first integer value is read, 
  2728. and the program halts. If the program did not call fail() at the beginning of 
  2729. the while loop to test if ios::failbit is set, it would loop indefinitely. 
  2730.  
  2731.    #include <fstream.h>
  2732.  
  2733.    void main()
  2734.    {
  2735.       fstream f("spadina.dat", ios::in);
  2736.       f.unsetf(ios::skipws);
  2737.       int i;
  2738.       while (!f.eof() && !f.fail()) {
  2739.          f >> i;
  2740.          cout << i;
  2741.       }
  2742.    }
  2743.  
  2744.  
  2745. ΓòÉΓòÉΓòÉ 4.3.7.1.2. left ΓòÉΓòÉΓòÉ
  2746.  
  2747. If ios::left is set, the value is left-justified. Fill characters are added 
  2748. after the value. 
  2749.  
  2750.  
  2751. ΓòÉΓòÉΓòÉ 4.3.7.1.3. right ΓòÉΓòÉΓòÉ
  2752.  
  2753. If ios::right is set, the value is right-justified. Fill characters are added 
  2754. before the value. 
  2755.  
  2756.  
  2757. ΓòÉΓòÉΓòÉ 4.3.7.1.4. internal ΓòÉΓòÉΓòÉ
  2758.  
  2759. If ios::internal is set, the fill characters are added after any leading sign 
  2760. or base notation, but before the value itself. 
  2761.  
  2762.  
  2763. ΓòÉΓòÉΓòÉ 4.3.7.2. Base Conversion ΓòÉΓòÉΓòÉ
  2764.  
  2765. The manipulators ios::dec, ios::oct, and ios::hex (see Built-In Manipulators 
  2766. for ios for more details) have the same effect as the flags ios::dec, ios::oct, 
  2767. and ios::hex, respectively.  dec is set by default. 
  2768.  
  2769.  
  2770. ΓòÉΓòÉΓòÉ 4.3.7.2.1. dec ΓòÉΓòÉΓòÉ
  2771.  
  2772. If ios::dec is set, the conversion base is 10. 
  2773.  
  2774.  
  2775. ΓòÉΓòÉΓòÉ 4.3.7.2.2. oct ΓòÉΓòÉΓòÉ
  2776.  
  2777. If ios::oct is set, the conversion base is 8. 
  2778.  
  2779.  
  2780. ΓòÉΓòÉΓòÉ 4.3.7.2.3. hex ΓòÉΓòÉΓòÉ
  2781.  
  2782. If ios::hex is set, the conversion base is 16. 
  2783.  
  2784.  
  2785. ΓòÉΓòÉΓòÉ 4.3.7.2.4. showbase ΓòÉΓòÉΓòÉ
  2786.  
  2787. If ios::showbase is set, the operation that inserts values converts them to an 
  2788. external form that can be read according to the C++ lexical conventions for 
  2789. integral constants. By default, ios::showbase is unset. 
  2790.  
  2791.  
  2792. ΓòÉΓòÉΓòÉ 4.3.7.3. Integral Formatting ΓòÉΓòÉΓòÉ
  2793.  
  2794. The following manipulator affects integral formatting: 
  2795.  
  2796.  
  2797. ΓòÉΓòÉΓòÉ 4.3.7.3.1. showpos ΓòÉΓòÉΓòÉ
  2798.  
  2799. If ios::showpos is set, the operation that inserts values places a positive 
  2800. sign "+" into decimal conversions of positive integral values. By default, 
  2801. showpos is not set. 
  2802.  
  2803.  
  2804. ΓòÉΓòÉΓòÉ 4.3.7.4. Floating-Point Formatting ΓòÉΓòÉΓòÉ
  2805.  
  2806. The following format flags control the formatting of floating-point values: 
  2807.  
  2808.  
  2809. ΓòÉΓòÉΓòÉ 4.3.7.4.1. showpoint ΓòÉΓòÉΓòÉ
  2810.  
  2811. If ios::showpoint is set, trailing zeros and a decimal point appear in the 
  2812. result of a floating-point conversion. This flag has no effect if either 
  2813. ios::scientific or ios::fixed is set. showpoint is not set by default. 
  2814.  
  2815.  
  2816. ΓòÉΓòÉΓòÉ 4.3.7.4.2. scientific ΓòÉΓòÉΓòÉ
  2817.  
  2818. If ios::scientific is set, the value is converted using scientific notation. In 
  2819. scientific notation, there is one digit before the decimal point and the number 
  2820. of digits following the decimal point depends on the value of ios::x_precision. 
  2821. The default value for ios::x_precision is 6. If ios::uppercase is set, an 
  2822. uppercase "E" precedes the exponent. Otherwise, a lowercase "e" precedes the 
  2823. exponent. By default, uppercase is not set. See uppercase for more information. 
  2824.  
  2825.  
  2826. ΓòÉΓòÉΓòÉ 4.3.7.4.3. fixed ΓòÉΓòÉΓòÉ
  2827.  
  2828. If ios::fixed is set, floating-point values are converted to fixed notation 
  2829. with the number of digits after the decimal point equal to the value of 
  2830. ios::x_precision (or 6 by default). ios::fixed is not set by default. 
  2831.  
  2832.  
  2833. ΓòÉΓòÉΓòÉ 4.3.7.4.4. Default Representation of Floating-Point Values ΓòÉΓòÉΓòÉ
  2834.  
  2835. If neither ios::fixed nor ios::scientific is set, the representation of 
  2836. floating-point values depends on their values and the number of significant 
  2837. digits in the representation equals ios::x_precision. Floating-point values are 
  2838. converted to scientific notation if the exponent resulting from a conversion to 
  2839. scientific notation is less than -4 or greater than or equal to the value of 
  2840. ios::x_precision. Otherwise, floating-point values are converted to fixed 
  2841. notation. If ios::showpoint is not set, trailing zeros are removed from the 
  2842. result and a decimal point appears only if it is followed by a digit. 
  2843. ios::scientific and ios::fixed are collectively identified by the static member 
  2844. ios::floatfield. 
  2845.  
  2846.  
  2847. ΓòÉΓòÉΓòÉ 4.3.7.5. Uppercase and Lowercase ΓòÉΓòÉΓòÉ
  2848.  
  2849. The following enumeration member determines whether alphabetic characters used 
  2850. in floating-point numbers appear in upper- or lowercase: 
  2851.  
  2852.  
  2853. ΓòÉΓòÉΓòÉ 4.3.7.5.1. uppercase ΓòÉΓòÉΓòÉ
  2854.  
  2855. If ios::uppercase is set, the operation that inserts values uses an uppercase 
  2856. "E" for floating-point values in scientific notation. In addition, the 
  2857. operation that inserts values stores hexadecimal digits "A" to "F" in uppercase 
  2858. and places an uppercase "X" before hexadecimal values when ios::showbase is 
  2859. set. If ios::uppercase is not set, a lowercase "e" introduces the exponent in 
  2860. floating-point values, hexadecimal digits "a" to "f" are stored in lowercase, 
  2861. and a lowercase "x" is inserted before hexadecimal values when ios::showbase is 
  2862. set. 
  2863.  
  2864. The setting of uppercase also determines whether special numbers such as inf or 
  2865. infinity are inserted in uppercase. 
  2866.  
  2867.  
  2868. ΓòÉΓòÉΓòÉ 4.3.7.6. Buffer Flushing ΓòÉΓòÉΓòÉ
  2869.  
  2870. The following enumeration members affect buffer flushing behavior: 
  2871.  
  2872.  
  2873. ΓòÉΓòÉΓòÉ 4.3.7.6.1. unitbuf ΓòÉΓòÉΓòÉ
  2874.  
  2875. If ios::unitbuf is set, ostream::osfx() performs a flush after each insertion. 
  2876. The attached stream buffer is unit buffered. ios::unitbuf is not set by 
  2877. default. 
  2878.  
  2879.  
  2880. ΓòÉΓòÉΓòÉ 4.3.7.6.2. stdio ΓòÉΓòÉΓòÉ
  2881.  
  2882. This flag is used internally by sync_with_stdio(). Do not use ios::stdio 
  2883. directly. If you want to combine I/O Stream Library input and output with 
  2884. stdio.h input and output, use sync_with_stdio(). See sync_with_stdio for more 
  2885. details on sync_with_stdio(). ios::stdio is not set by default. 
  2886.  
  2887.  
  2888. ΓòÉΓòÉΓòÉ 4.3.7.7. Mutually Exclusive Format Flags ΓòÉΓòÉΓòÉ
  2889.  
  2890. If you specify conflicting flags, the results are unpredictable. For example, 
  2891. the results will be unpredictable if you set both ios::left and ios::right in 
  2892. the format state of iosobj. Set only one flag in each set of the following 
  2893. three sets: 
  2894.  
  2895.      ios::left, ios::right, ios::internal 
  2896.      ios::dec, ios::oct, ios::hex 
  2897.      ios::scientific, ios::fixed 
  2898.  
  2899.  
  2900. ΓòÉΓòÉΓòÉ 4.3.8. Public Members of ios for the Format State ΓòÉΓòÉΓòÉ
  2901.  
  2902. You can use the member functions listed below to control the format state of an 
  2903. ios object. 
  2904.  
  2905. Note:  The following descriptions assume that the functions are called as part 
  2906. of an ios object called iosobj. 
  2907.  
  2908. The following functions are described: 
  2909.  
  2910.      fill - Set the fill character 
  2911.      flags - Set format flags 
  2912.      precision - Set the precision 
  2913.      setf - Set specific format flags 
  2914.      skip - Set ios::skipws format flag 
  2915.      unsetf - Turn off format flags 
  2916.      width - Set field width 
  2917.  
  2918.  
  2919. ΓòÉΓòÉΓòÉ 4.3.8.1. fill ΓòÉΓòÉΓòÉ
  2920.  
  2921. char fill() const;
  2922. char fill(char fillchar);
  2923.  
  2924. fill() with no arguments returns the value of ios::x_fill in the format state 
  2925. of iosobj. fill() with an argument fillchar sets ios::x_fill to be equal to 
  2926. fillchar.  It returns the value of ios::x_fill. 
  2927.  
  2928. ios::x_fill is the character used as padding if the field is wider than the 
  2929. representation of a value. The default value for ios::x_fill is a space. The 
  2930. ios::left, ios::right, and ios::internal flags determine the position of the 
  2931. fill character. 
  2932.  
  2933. You can also use the parameterized manipulator setfill to set the value of 
  2934. ios::x_fill. 
  2935.  
  2936.  
  2937. ΓòÉΓòÉΓòÉ 4.3.8.2. flags ΓòÉΓòÉΓòÉ
  2938.  
  2939. long flags() const;
  2940. long flags(long flagset);
  2941.  
  2942. flags() with no arguments returns the value of the flags that make up the 
  2943. current format state. flags() with one argument sets the flags in the format 
  2944. state to the settings specified in flagset and returns the value of the 
  2945. previous settings of the format flags. 
  2946.  
  2947.  
  2948. ΓòÉΓòÉΓòÉ 4.3.8.3. precision ΓòÉΓòÉΓòÉ
  2949.  
  2950. int precision() const;
  2951. int precision(int prec);
  2952.  
  2953. precision() with no arguments returns the value of ios::x_precision. 
  2954. precision() with one argument sets the value of ios::x_precision to prec and 
  2955. returns the previous value. The value of prec must be greater than 0. If the 
  2956. value is nonpositive, the value of ios::x_precision is set to the default 
  2957. value, 6. ios::x_precision controls the number of significant digits when 
  2958. floating-point values are inserted. 
  2959.  
  2960. The format state in effect when precision() is called affects the behavior of 
  2961. precision(). If neither ios::scientific nor ios::fixed is set, ios::x_precision 
  2962. specifies the number of significant digits in the floating-point value that is 
  2963. being inserted. If, in addition, ios::showpoint is not set, all trailing zeros 
  2964. are removed and a decimal point only appears if it is followed by digits. 
  2965.  
  2966. If either ios::scientific or ios::fixed is set, ios::x_precision specifies the 
  2967. number of digits following the decimal point. 
  2968.  
  2969. You can also use the parameterized manipulator setprecision to set 
  2970. ios::x_precision. 
  2971.  
  2972.  
  2973. ΓòÉΓòÉΓòÉ 4.3.8.4. setf ΓòÉΓòÉΓòÉ
  2974.  
  2975. long setf(long newset);
  2976. long setf(long newset, long field);
  2977.  
  2978. setf() with one argument is accumulative. It sets the format flags that are 
  2979. marked in newset, without affecting flags that are not marked in newset, and 
  2980. returns the previous value of the format state. You can also use the 
  2981. parameterized manipulator setiosflags to set the format flags to a specific 
  2982. setting. 
  2983.  
  2984. setf() with two arguments clears the format flags specified in field, sets the 
  2985. format flags specified in newset, and returns the previous value of the format 
  2986. state. For example, to change the conversion base in the format state to 
  2987. ios::hex, you could use a statement like this: 
  2988.  
  2989. s.setf(ios::hex, ios::basefield);
  2990.  
  2991. In this statement, ios::basefield specifies the conversion base as the format 
  2992. flag that is going to be changed, and ios::hex specifies the new value for the 
  2993. conversion base. If newset equals 0, all of the format flags specified in field 
  2994. are cleared. You can also use the parameterized manipulator resetiosflags to 
  2995. clear format flags. 
  2996.  
  2997. Note:  If you set conflicting flags the results are unpredictable. 
  2998.  
  2999.  
  3000. ΓòÉΓòÉΓòÉ 4.3.8.5. skip ΓòÉΓòÉΓòÉ
  3001.  
  3002. int skip(int i);
  3003.  
  3004. skip() sets the format flag ios::skipws if the value of the argument i does not 
  3005. equal 0. If i does equal 0, ios::skipws is cleared. skip() returns a value of 1 
  3006. if ios::skipws was set prior to the call to skip(), and returns 0 otherwise. 
  3007.  
  3008.  
  3009. ΓòÉΓòÉΓòÉ 4.3.8.6. unsetf ΓòÉΓòÉΓòÉ
  3010.  
  3011. long unsetf(long oflags);
  3012.  
  3013. unsetf() turns off the format flags specified in oflags and returns the 
  3014. previous format state. 
  3015.  
  3016.  
  3017. ΓòÉΓòÉΓòÉ 4.3.8.7. width ΓòÉΓòÉΓòÉ
  3018.  
  3019. int width() const;
  3020. int width(int fwidth);
  3021.  
  3022. width() with no arguments returns the value of the current setting of the 
  3023. format state field width variable, ios::x_width. If the value of ios::x_width 
  3024. is smaller than the space needed for the representation of the value, the full 
  3025. value is still inserted. 
  3026.  
  3027. width() with one argument, fwidth, sets ios::x_width to the value of fwidth and 
  3028. returns the previous value. The default field width is 0. When the value of 
  3029. ios::x_width is 0, the operations that insert values only insert the characters 
  3030. needed to represent a value. 
  3031.  
  3032. If the value of ios::x_width is greater than 0, the characters needed to 
  3033. represent the value are inserted. Then fill characters are inserted, if 
  3034. necessary, so that the representation of the value takes up the entire field. 
  3035. ios::x_width only specifies a minimum width, not a maximum width. If the number 
  3036. of characters needed to represent a value is greater than the field width, none 
  3037. of the characters is truncated. After every insertion of a value of a numeric 
  3038. or string type (including char*, unsigned char*, signed char*, and wchar_t*, 
  3039. but excluding char, unsigned char, signed char, and wchar_t), the value of 
  3040. ios::x_width is reset to 0. After every extraction of a value of type char*, 
  3041. unsigned char*, signed char*, or wchar_t*, the value of ios::x_width is reset 
  3042. to 0. 
  3043.  
  3044. You can also use the parameterized manipulator setw to set the field width. 
  3045.  
  3046.  
  3047. ΓòÉΓòÉΓòÉ 4.3.9. Public Members of ios for User-Defined Format Flags ΓòÉΓòÉΓòÉ
  3048.  
  3049. In addition to the flags described in Format State Flags, you can also use the 
  3050. ios member functions listed in this section to define additional format flags 
  3051. or variables in classes that you derive from ios. 
  3052.  
  3053. The following member functions are described: 
  3054.  
  3055.      bitalloc - Create bit set 
  3056.      iword - Return reference to user-defined flag 
  3057.      pword - Return reference to user-defined flag 
  3058.      xalloc - Return index to format state variables. 
  3059.  
  3060.  
  3061. ΓòÉΓòÉΓòÉ 4.3.9.1. bitalloc ΓòÉΓòÉΓòÉ
  3062.  
  3063. static long bitalloc();
  3064.  
  3065. bitalloc() is a static function that returns a long value with a previously 
  3066. unallocated bit set. You can use this long value as an additional flag, and 
  3067. pass it as an argument to the format state member functions. When all the bits 
  3068. are exhausted, bitalloc() returns 0. 
  3069.  
  3070.  
  3071. ΓòÉΓòÉΓòÉ 4.3.9.2. iword ΓòÉΓòÉΓòÉ
  3072.  
  3073. long& iword(int i);
  3074.  
  3075. iword() returns a reference to the ith user-defined flag, where i is an index 
  3076. returned by xalloc(). iword() allocates space for the user-defined flag. If the 
  3077. allocation fails, iword() sets ios::failbit. 
  3078.  
  3079.  
  3080. ΓòÉΓòÉΓòÉ 4.3.9.3. pword ΓòÉΓòÉΓòÉ
  3081.  
  3082. void* & pword(int i);
  3083.  
  3084. pword() returns a reference to a pointer to the ith user-defined flag, where i 
  3085. is an index returned by xalloc(). pword() allocates space for the user-defined 
  3086. flag. If the allocation fails, pword() sets ios::failbit. pword() is the same 
  3087. as iword(), except that the two functions return different types. 
  3088.  
  3089.  
  3090. ΓòÉΓòÉΓòÉ 4.3.9.4. xalloc ΓòÉΓòÉΓòÉ
  3091.  
  3092. static int xalloc();
  3093.  
  3094. xalloc() is a static function that returns an unused index into an array of 
  3095. words available for use as format state variables by classes derived from ios. 
  3096.  
  3097. xalloc() simply returns a new index; it does not do any allocation.  iword() 
  3098. and pword() do the allocation, and if the allocation fails, they set 
  3099. ios::failbit. You should check ios::failbit after calling iword() or pword(). 
  3100.  
  3101.  
  3102. ΓòÉΓòÉΓòÉ 4.3.10. Public Members of ios for the Error State ΓòÉΓòÉΓòÉ
  3103.  
  3104. The error state is an enumeration that records the errors that take place in 
  3105. the processing of ios objects. It has the following declaration: 
  3106.  
  3107. enum io_state { goodbit, eofbit, failbit, badbit, hardfail };
  3108.  
  3109. The error state is manipulated using the ios member functions described in this 
  3110. section. 
  3111.  
  3112. Note: 
  3113.  
  3114.    1. hardfail is a flag used internally by the I/O Stream Library. Do not use 
  3115.       it. 
  3116.  
  3117.    2. The following descriptions assume that the functions are called as part 
  3118.       of an ios object called iosobj. 
  3119.  
  3120.  The following member functions are described: 
  3121.  
  3122.      bad - Check ios::badbit 
  3123.      clear - Clear or Set Error State 
  3124.      eof - Check ios::eofbit 
  3125.      fail - Check ios::failbit and ios::badbit 
  3126.      good - Are Any Bits Set 
  3127.      rdstate - Return Error State 
  3128.      Convert ios Object to Pointer Operator void*() 
  3129.      Check ios::failbit and ios::badbit Operator ! 
  3130.  
  3131.  
  3132. ΓòÉΓòÉΓòÉ 4.3.10.1. bad ΓòÉΓòÉΓòÉ
  3133.  
  3134. int bad() const;
  3135.  
  3136. bad() returns a nonzero value if ios::badbit is set in the error state of 
  3137. iosobj. Otherwise, it returns 0. ios::badbit is usually set when some operation 
  3138. on the streambuf object that is associated with the ios object has failed. It 
  3139. will probably not be possible to continue input and output operations on the 
  3140. ios object. 
  3141.  
  3142.  
  3143. ΓòÉΓòÉΓòÉ 4.3.10.2. clear ΓòÉΓòÉΓòÉ
  3144.  
  3145. void clear(int state=0);
  3146.  
  3147. clear() changes the error state of iosobj to state. If state equals 0 (its 
  3148. default), all of the bits in the error state are cleared. If you want to set 
  3149. one of the bits without clearing or setting the other bits in the error state, 
  3150. you can perform a bitwise OR between the bit you want to set and the current 
  3151. error state. For example, the following statement sets ios::badbit in iosobj 
  3152. and leaves all the other error state bits unchanged: 
  3153.  
  3154.    iosobj.clear(ios::badbit|iosobj.rdstate());
  3155.  
  3156.  
  3157. ΓòÉΓòÉΓòÉ 4.3.10.3. eof ΓòÉΓòÉΓòÉ
  3158.  
  3159. int eof() const;
  3160.  
  3161. eof() returns a nonzero value if ios::eofbit is set in the error state of 
  3162. iosobj. Otherwise, it returns 0. ios::eofbit is usually set when an EOF has 
  3163. been encountered during an extraction operation. 
  3164.  
  3165.  
  3166. ΓòÉΓòÉΓòÉ 4.3.10.4. fail ΓòÉΓòÉΓòÉ
  3167.  
  3168. int fail() const;
  3169.  
  3170. fail() returns a nonzero value if either ios::badbit or ios::failbit is set in 
  3171. the error state. Otherwise, it returns 0. 
  3172.  
  3173.  
  3174. ΓòÉΓòÉΓòÉ 4.3.10.5. good ΓòÉΓòÉΓòÉ
  3175.  
  3176. int good() const;
  3177.  
  3178. good() returns a nonzero value if no bits are set in the error state of iosobj. 
  3179. Otherwise, it returns 0. 
  3180.  
  3181.  
  3182. ΓòÉΓòÉΓòÉ 4.3.10.6. rdstate ΓòÉΓòÉΓòÉ
  3183.  
  3184. int rdstate() const;
  3185.  
  3186. rdstate() returns the current value of the error state of iosobj. 
  3187.  
  3188.  
  3189. ΓòÉΓòÉΓòÉ 4.3.10.7. operator void* ΓòÉΓòÉΓòÉ
  3190.  
  3191. operator void*();
  3192. operator const void*() const;
  3193.  
  3194. The void* operator converts iosobj to a pointer so that it can be compared to 
  3195. 0. The conversion returns 0 if ios::failbit or ios::badbit is set in the error 
  3196. state of iosobj. Otherwise, a pointer value is returned. This value is not 
  3197. meant to be manipulated as a pointer; the purpose of the operator is to allow 
  3198. you to write statements such as the following: 
  3199.  
  3200. if (cin)
  3201.      cout << "ios::badbit and ios::failbit are not set" << endl;
  3202. if (cin >> x)
  3203.      cout << "ios::badbit and ios::failbit are not set "
  3204.           << x << " was input" << endl;
  3205.  
  3206.  
  3207. ΓòÉΓòÉΓòÉ 4.3.10.8. operator! ΓòÉΓòÉΓòÉ
  3208.  
  3209. int operator!() const;
  3210.  
  3211. The ! operator returns a nonzero value if ios::failbit or ios::badbit is set in 
  3212. the error state of iosobj. You can use this operator to write statements like 
  3213. the following: 
  3214.  
  3215.    if (!cin)
  3216.       cout << "either ios::failbit or ios::badbit is set" << endl;
  3217.    else
  3218.       cout << "neither ios::failbit nor ios::badbit is set"
  3219.            << endl;
  3220.  
  3221.  
  3222. ΓòÉΓòÉΓòÉ 4.3.11. Other Members of ios ΓòÉΓòÉΓòÉ
  3223.  
  3224. This section describes the ios member functions that do not deal with the error 
  3225. state or the format state. These descriptions assume that the functions are 
  3226. called as part of an ios object called iosobj. 
  3227.  
  3228. The following functions are described: 
  3229.  
  3230.      rdbuf - Return pointer to associated streambuf object 
  3231.      sync_with_stdio - Attach stdiobuf object to predefined streams 
  3232.      tie - Set the tie variable 
  3233.  
  3234.  
  3235. ΓòÉΓòÉΓòÉ 4.3.11.1. rdbuf ΓòÉΓòÉΓòÉ
  3236.  
  3237. streambuf* rdbuf();
  3238.  
  3239. rdbuf() returns a pointer to the streambuf object that is associated with 
  3240. iosobj. This is the streambuf object that was passed as an argument to the ios 
  3241. constructor. 
  3242.  
  3243.  
  3244. ΓòÉΓòÉΓòÉ 4.3.11.2. sync_with_stdio ΓòÉΓòÉΓòÉ
  3245.  
  3246. static void sync_with_stdio();
  3247.  
  3248. sync_with_stdio() is a static function that solves the problems that occur when 
  3249. you call functions declared in stdio.h and I/O Stream Library functions in the 
  3250. same program. The first time that you call sync_with_stdio(), it attaches 
  3251. stdiobuf objects to the predefined streams cin, cout, and cerr. After that, 
  3252. input and output using these predefined streams can be mixed with input and 
  3253. output using the corresponding FILE objects (stdin, stdout, and stderr). This 
  3254. input and output are correctly synchronized. 
  3255.  
  3256. If you switch between the I/O Stream Library formatted extraction functions and 
  3257. stdio.h functions, you may find that a byte is "lost". The reason is that the 
  3258. formatted extraction functions for integers and floating-point values keep 
  3259. extracting characters until a nondigit character is encountered. This nondigit 
  3260. character acts as a delimiter for the value that preceded it.  Because it is 
  3261. not part of the value, putback() is called to return it to the stream buffer. 
  3262. If a C stdio library function, such as getchar(), performs the next input 
  3263. operation, it will begin input at the character after this nondigit character. 
  3264. Thus, this nondigit character is not part of the value extracted by the 
  3265. formatted extraction function, and it is not the character extracted by the C 
  3266. stdio library function. It is "lost". Therefore, you should avoid switching 
  3267. between the I/O Stream Library formatted extraction functions and C stdio 
  3268. library functions whenever possible. 
  3269.  
  3270. sync_with_stdio() makes cout and clog unit buffered. After you call 
  3271. sync_with_stdio(), the performance of your program could diminish. The 
  3272. performance of your program depends on the length of strings, with performance 
  3273. diminishing most when the strings are shortest. 
  3274.  
  3275. Note:  You should use I/O Stream Library functions exclusively for all new 
  3276. code. 
  3277.  
  3278.  
  3279. ΓòÉΓòÉΓòÉ 4.3.11.3. tie ΓòÉΓòÉΓòÉ
  3280.  
  3281. ostream* tie();
  3282. ostream* tie(ostream* os);
  3283.  
  3284. There are two versions of tie(). The version that takes no arguments returns 
  3285. the value of ios::x_tie, the tie variable. (The tie variable points to the 
  3286. ostream object that is tied to the ios object.) The version that takes one 
  3287. argument os makes the tie variable, ios::x_tie, equal to os and returns the 
  3288. previous value. 
  3289.  
  3290. You can use ios::x_tie to automatically flush the stream buffer attached to an 
  3291. ios object. If ios::x_tie for an ios object is not equal to 0 and the ios 
  3292. object needs more characters or has characters to be consumed, the ostream 
  3293. object pointed to by ios::x_tie is flushed. 
  3294.  
  3295. By default, the tie variables of the predefined streams cin, cerr, and clog all 
  3296. point to the predefined stream cout. The following example illustrates how 
  3297. these streams are tied: 
  3298.  
  3299. // Tying two streams together
  3300.    #include <iostream.h>
  3301.    #include <fstream.h>
  3302.  
  3303.    void main() {
  3304.       float f;
  3305.  
  3306.       cout << "Enter a number: ";         // cin is tied to cout, so
  3307.       cin >> f;                           // cout is flushed before input
  3308.       cout << "The number was " << f << ".\n" << endl;
  3309.  
  3310.       ofstream myFile;
  3311.       myFile.open("testfile",ios::out);
  3312.       cin.tie(&myFile);                   // now tie cin to a different ostream
  3313.  
  3314.       cout << "Enter a number: ";         // cout is not flushed by cin,
  3315.       cin >> f;                           // so prompt appears after input.
  3316.       cout << "The number was " << f << ".\n" << endl;
  3317.    }
  3318.  
  3319. Initially, the program displays a prompt, requests input, and then displays 
  3320. output. After cin is tied to the ofstream myFile, however, the output is not 
  3321. flushed by the request for input, so no prompt is displayed until after the 
  3322. input is received.  The output is flushed only by the endl manipulator at the 
  3323. end of the program. The following shows sample output for this program: 
  3324.  
  3325. Enter a number: 5
  3326. The number was 5.
  3327.  
  3328. 6
  3329. Enter a number: The number was 6.
  3330.  
  3331.  
  3332. ΓòÉΓòÉΓòÉ 4.3.12. Built-In Manipulators for ios ΓòÉΓòÉΓòÉ
  3333.  
  3334. The I/O Stream Library provides you with a set of built-in manipulators for ios 
  3335. and the classes derived from it. These manipulators have a specific effect on a 
  3336. stream other than inserting or extracting a value. Manipulators implicitly 
  3337. invoke functions that modify the state of the stream, and they allow you to 
  3338. modify the state of a stream at the same time as you are doing input and 
  3339. output. The syntax for manipulators is consistent with the syntax for input and 
  3340. output. 
  3341.  
  3342. The following is a list of the manipulators and the classes that they apply to: 
  3343.  
  3344.  dec       istream and ostream 
  3345.  hex       istream and ostream 
  3346.  oct       istream and ostream 
  3347.  ws        istream 
  3348.  endl      ostream 
  3349.  ends      ostream 
  3350.  flush     ostream 
  3351.  
  3352.  See Built-In Manipulators for istream for more details on the built-in 
  3353.  manipulators for istream. See Built-In Manipulators for ostream for more 
  3354.  details on the manipulators for ostream. 
  3355.  
  3356.  
  3357. ΓòÉΓòÉΓòÉ 4.4. iostream and iostream_withassign Classes ΓòÉΓòÉΓòÉ
  3358.  
  3359. Description 
  3360.  
  3361. Derivation 
  3362.  
  3363. Header File 
  3364.  
  3365. Members 
  3366.  
  3367. To close all the panels in a chapter, double-click on this panel's system menu. 
  3368.  
  3369.  
  3370. ΓòÉΓòÉΓòÉ 4.4.1. Class Description - iostream and iostream_withassign ΓòÉΓòÉΓòÉ
  3371.  
  3372. The iostream class combines the input capabilities of the istream class with 
  3373. the output capabilities of the ostream class.  It is the base class for three 
  3374. other classes that also provide both input and output capabilities: 
  3375.  
  3376.      iostream_withassign, also described in this chapter, which you can use to 
  3377.       assign another stream (such as an fstream for a file) to an iostream 
  3378.       object. 
  3379.      strstream, which is a stream of characters stored in memory. 
  3380.      fstream, which is a stream that supports input and output. 
  3381.  
  3382.  
  3383. ΓòÉΓòÉΓòÉ 4.4.2. Derivation ΓòÉΓòÉΓòÉ
  3384.  
  3385. ios 
  3386.  
  3387.    istream
  3388.    ostream
  3389.      iostream
  3390.         iostream_withassign
  3391.  
  3392.  
  3393. ΓòÉΓòÉΓòÉ 4.4.3. Header File ΓòÉΓòÉΓòÉ
  3394.  
  3395. iostream and iostream_withassign are declared in iostream.h. 
  3396.  
  3397.  
  3398. ΓòÉΓòÉΓòÉ 4.4.4. Public Members of iostream and iostream_withassign ΓòÉΓòÉΓòÉ
  3399.  
  3400. The following public member functions are described: 
  3401.  
  3402.      iostream constructor 
  3403.      iostream_withassign constructor 
  3404.      iostream_withassign assignment operator 
  3405.  
  3406.  
  3407. ΓòÉΓòÉΓòÉ 4.4.4.1. Constructor for iostream ΓòÉΓòÉΓòÉ
  3408.  
  3409. iostream(streambuf* sb);
  3410.  
  3411. The iostream constructor takes a single argument sb. The constructor creates an 
  3412. iostream object that is attached to the streambuf object that is pointed to by 
  3413. sb. The constructor also initializes the format variables to their defaults. 
  3414.  
  3415.  
  3416. ΓòÉΓòÉΓòÉ 4.4.4.2. Constructor for iostream_withassign ΓòÉΓòÉΓòÉ
  3417.  
  3418. iostream_withassign();
  3419.  
  3420. The iostream_withassign constructor creates an iostream_withassign object. It 
  3421. does not do any initialization of this object. 
  3422.  
  3423.  
  3424. ΓòÉΓòÉΓòÉ 4.4.4.3. Assignment Operator for iostream_withassign ΓòÉΓòÉΓòÉ
  3425.  
  3426. iostream_withassign& operator=(ios& is);
  3427. iostream_withassign& operator=(streambuf* sb);
  3428.  
  3429. There are two versions of the iostream_withassign assignment operator. The 
  3430. first version takes a reference to an ios object, is, as its argument. It 
  3431. associates the stream buffer attached to is with the iostream_withassign object 
  3432. that is on the left side of the assignment operator. 
  3433.  
  3434. The second version of the iostream_withassign assignment operator takes a 
  3435. pointer to a streambuf object, sb, as its argument. It associates this 
  3436. streambuf object with the iostream_withassign object that is on the left side 
  3437. of the assignment operator. 
  3438.  
  3439.  
  3440. ΓòÉΓòÉΓòÉ 4.5. istream and istream_withassign Classes ΓòÉΓòÉΓòÉ
  3441.  
  3442. Description 
  3443.  
  3444. Derivation 
  3445.  
  3446. Header File 
  3447.  
  3448. Constructors 
  3449.  
  3450. Members 
  3451.  
  3452. To close all the panels in a chapter, double-click on this panel's system menu. 
  3453.  
  3454.  
  3455. ΓòÉΓòÉΓòÉ 4.5.1. Class Description - istream ΓòÉΓòÉΓòÉ
  3456.  
  3457. This chapter describes the istream class and its derived class 
  3458. istream_withassign. You can use the istream member functions to take characters 
  3459. out of the stream buffer that is associated with an istream object. 
  3460. istream_withassign is derived from istream and includes an assignment operator. 
  3461.  
  3462. You can view the topics in this chapter either through the panel on the left, 
  3463. or by selecting from among the following: 
  3464.  
  3465.      Input prefix function 
  3466.      istream members for formatted input 
  3467.      istream members for unformatted input 
  3468.      istream members for positioning 
  3469.      Other public members 
  3470.      Built-in manipulators 
  3471.      istream_withassign class 
  3472.  
  3473.  
  3474. ΓòÉΓòÉΓòÉ 4.5.2. Derivation ΓòÉΓòÉΓòÉ
  3475.  
  3476. ios 
  3477.  
  3478.    istream
  3479.      istream_withassign
  3480.  
  3481.  
  3482. ΓòÉΓòÉΓòÉ 4.5.3. Header File ΓòÉΓòÉΓòÉ
  3483.  
  3484. istream and istream_withassign are declared in iostream.h. 
  3485.  
  3486.  
  3487. ΓòÉΓòÉΓòÉ 4.5.4. Members ΓòÉΓòÉΓòÉ
  3488.  
  3489. The following members are provided for istream and istream_withassign: 
  3490.  
  3491.      Input Prefix Function 
  3492.      Constructors for istream 
  3493.      Public Members of istream for Formatted Input 
  3494.      get 
  3495.      getline 
  3496.      ignore 
  3497.      read 
  3498.      seekg 
  3499.      tellg 
  3500.      gcount 
  3501.      peek 
  3502.      putback 
  3503.      sync 
  3504.      Constructor for istream_withassign 
  3505.      Assignment Operator for istream_withassign 
  3506.  
  3507.  
  3508. ΓòÉΓòÉΓòÉ 4.5.5. Constructors for istream ΓòÉΓòÉΓòÉ
  3509.  
  3510. istream(streambuf* sb);
  3511.  
  3512. The istream constructor takes a single argument sb. The constructor creates an 
  3513. istream object that is attached to the streambuf object that is pointed to by 
  3514. sb. The constructor also initializes the format variables to their defaults. 
  3515.  
  3516. The other istream constructor declarations in iostream.h are obsolete; do not 
  3517. use them. 
  3518.  
  3519.  
  3520. ΓòÉΓòÉΓòÉ 4.5.6. Input Prefix Function ΓòÉΓòÉΓòÉ
  3521.  
  3522. int ipfx(int need=0);
  3523.  
  3524. ipfx() checks the stream buffer attached to an istream object to determine if 
  3525. it is capable of satisfying requests for characters. It returns a nonzero value 
  3526. if the stream buffer is ready, and 0 if it is not. 
  3527.  
  3528. The formatted input operator calls ipfx(0), while the unformatted input 
  3529. functions call ipfx(1). 
  3530.  
  3531. If the error state of the istream object is nonzero, ipfx() returns 0. 
  3532. Otherwise, the stream buffer attached to the istream object is flushed if 
  3533. either of the following conditions is true: 
  3534.  
  3535.      need has a value of 0. 
  3536.      The number of characters available in the stream buffer is fewer than the 
  3537.       value of need. 
  3538.  
  3539.  If ios::skipws is set in the format state of the istream object and need has a 
  3540.  value of 0, leading white-space characters are extracted from the stream 
  3541.  buffer and discarded. If ios::hardfail is set or EOF is encountered, ipfx() 
  3542.  returns 0. Otherwise, it returns a nonzero value. 
  3543.  
  3544.  
  3545. ΓòÉΓòÉΓòÉ 4.5.7. Public Members of istream for Formatted Input ΓòÉΓòÉΓòÉ
  3546.  
  3547. You can use the istream class to perform formatted input from a stream buffer 
  3548. using the input operator >>. Consider the following statement, where ins is a 
  3549. reference to an istream object and x is a variable of a built-in type: 
  3550.  
  3551.    ins >> x;
  3552.  
  3553. The input operator >> calls ipfx(0). If ipfx() returns a nonzero value, the 
  3554. input operator extracts characters from the streambuf object that is associated 
  3555. with ins. It converts these characters to the type of x and stores the result 
  3556. in x. The input operator sets ios::failbit if the characters extracted from the 
  3557. stream buffer cannot be converted to the type of x. If the attempt to extract 
  3558. characters fails because EOF is encountered, the input operator sets 
  3559. ios::eofbit and ios::failbit. If the attempt to extract characters fails for 
  3560. another reason, the input operator sets ios::badbit. Even if an error occurs, 
  3561. the input operator always returns ins. 
  3562.  
  3563. The details of conversion depend on the format state of the istream object and 
  3564. the type of the variable x. The input operator may set the width variable 
  3565. ios::x_width to 0, but it does not change anything else in the format state. 
  3566.  
  3567. The input operator is defined for the following types: 
  3568.  
  3569.      Arrays of character values (including signed char and unsigned char) 
  3570.      Other integral values: short, int, long 
  3571.      float, double, and long double values. 
  3572.  
  3573.  In addition, the input operator is defined for streambuf objects. 
  3574.  
  3575.  You can also define input operators for your own types. 
  3576.  
  3577.  The following sections describe the input operator for these types. 
  3578.  
  3579.  Note:  The following descriptions assume that the input operator is called 
  3580.  with the istream object ins on the left side of the operator. 
  3581.  
  3582.  
  3583. ΓòÉΓòÉΓòÉ 4.5.7.1. Input Operator for Arrays of Characters ΓòÉΓòÉΓòÉ
  3584.  
  3585. istream& operator>>(char* pc);
  3586. istream& operator>>(signed char* pc);
  3587. istream& operator>>(unsigned char* pc);
  3588. istream& operator>>(wchar_t* pwc);
  3589.  
  3590. For pointers to char, signed char, and unsigned char, the input operator stores 
  3591. characters from the stream buffer attached to ins in the array pointed to by 
  3592. pc. The input operator stores characters until a white-space character is 
  3593. found. This white-space character is left in the stream buffer, and the 
  3594. extraction stops. If ios::x_width does not equal zero, a maximum of 
  3595. ios::x_width - 1 characters are extracted. The input operator calls 
  3596. ins.width(0) to reset ios::x_width to 0. 
  3597.  
  3598. For pointers to wchar_t, the input operator stores characters from the stream 
  3599. buffer attached to ins in the array pointed to by pwc. The input operator 
  3600. stores characters until a white-space character or a wchar_t blank is found. If 
  3601. the terminating character is a white-space character, it is left in the stream 
  3602. buffer. If it is a wchar_t blank, it is discarded to avoid returning two bytes 
  3603. to the input stream. 
  3604.  
  3605. For wchar_t* arrays, if ios::width does not equal zero, a maximum of 
  3606. ios::width-1 characters (at 2 bytes each) are extracted. A 2-character space is 
  3607. reserved for the wchar_t terminating null character. 
  3608.  
  3609. Note:  The input operators for these types also reset ios::x_width to 0. None 
  3610. of the other input operators affects ios::x_width. All of the output operators 
  3611. except those for the char types and wchar_t, on the other hand, reset 
  3612. ios::x_width to 0. 
  3613.  
  3614. The input operator always stores a terminating null character in the array 
  3615. pointed to by pc or pwc, even if an error occurs. For arrays of wchar_t*, this 
  3616. terminating null character is a wchar_t terminating null character. 
  3617.  
  3618.  
  3619. ΓòÉΓòÉΓòÉ 4.5.7.2. Input Operator for char ΓòÉΓòÉΓòÉ
  3620.  
  3621. istream& operator>>(char& rc);
  3622. istream& operator>>(signed char& rc);
  3623. istream& operator>>(unsigned char& rc);
  3624. istream& operator>>(wchar_t& rc);
  3625.  
  3626. For char, signed char, and unsigned char, the input operator extracts a 
  3627. character from the stream buffer attached to ins and stores it in rc. 
  3628.  
  3629. For references to wchar_t, the input operator extracts a wchar_t character from 
  3630. the stream buffer and stores it in wc. If ios::skipws is set, the input 
  3631. operator skips leading wchar_t spaces as well as leading char white spaces. 
  3632.  
  3633.  
  3634. ΓòÉΓòÉΓòÉ 4.5.7.3. Input Operator for Other Integral Values ΓòÉΓòÉΓòÉ
  3635.  
  3636. istream& operator>>(short& ir);
  3637. istream& operator>>(unsigned short& ir);
  3638. istream& operator>>(int& ir);
  3639. istream& operator>>(unsigned int& ir);
  3640. istream& operator>>(long& ir);
  3641. istream& operator>>(unsigned long& ir);
  3642. istream& operator>>(long long& ir);
  3643. istream& operator>>(unsigned long long& ir);
  3644.  
  3645. Note:  The support for long long is controlled by the -q(no)longlong option. By 
  3646. default, long long is supported. 
  3647.  
  3648. This section describes how the input operator works for references to the 
  3649. integral types: short, unsigned short, int, unsigned int, long, unsigned long, 
  3650. long long, and unsigned long long. For these integral types, the input operator 
  3651. extracts characters from the stream buffer associated with ins and converts 
  3652. them according to the format state of ins. The converted characters are then 
  3653. stored in ir. There is no overflow detection on conversion of integral types. 
  3654.  
  3655. The first character extracted from the stream buffer may be a sign (+ or -). 
  3656. The subsequent characters are converted until a nondigit character is 
  3657. encountered. This nondigit character is left in the stream buffer. Which 
  3658. characters are treated as digits depends on the setting of the following format 
  3659. flags: 
  3660.  
  3661.      ios::oct: the characters are converted to an octal value. Characters are 
  3662.       extracted from the stream buffer until a character that is not an octal 
  3663.       digit (a digit from 0 to 7) is encountered. If ios::oct is set and a 
  3664.       signed value is encountered, the value is converted into a decimal value. 
  3665.       For example, if the characters "- 45" are encountered in the input stream 
  3666.       and ios::oct is set, the decimal value - 37 is actually extracted. 
  3667.  
  3668.      ios::dec: the characters are converted to a decimal value. Characters are 
  3669.       extracted from the stream buffer until a character that is not a decimal 
  3670.       digit (a digit from 0 to 9) is encountered. 
  3671.  
  3672.      ios::hex: the characters are converted to a hexadecimal value. Characters 
  3673.       are extracted from the stream buffer until a character that is not a 
  3674.       hexadecimal digit (a digit from 0 to 9 or a letter from "A" to "F", upper 
  3675.       or lower case) is encountered. If ios::hex is set and a signed value is 
  3676.       encountered, the value is converted into a decimal value. For example, if 
  3677.       the characters "-12" are encountered in the input stream and ios::hex is 
  3678.       set, the decimal value -18 is actually extracted. 
  3679.  
  3680.  If none of these format flags is set, the characters are converted according 
  3681.  to the C++ lexical conventions. This conversion depends on the characters that 
  3682.  follow the optional sign: 
  3683.  
  3684.      If these characters are "0x" or "0X", the subsequent characters are 
  3685.       converted to a hexadecimal value. 
  3686.      If the first character is "0" and the second character is not "x" or "X", 
  3687.       the subsequent characters are converted to an octal value. 
  3688.      If neither of these cases is true, the characters are converted to a 
  3689.       decimal value. 
  3690.  
  3691.  If no digits are available in the stream buffer (other than the "0" in "0X" or 
  3692.  "0x" preceding a hexadecimal value), the input operator sets ios::failbit in 
  3693.  the error state of ins. 
  3694.  
  3695.  
  3696. ΓòÉΓòÉΓòÉ 4.5.7.4. Input Operator for float and double Values ΓòÉΓòÉΓòÉ
  3697.  
  3698. istream& operator>>(float& ref);
  3699. istream& operator>>(double& ref);
  3700. istream& operator>>(long double& ref);
  3701.  
  3702. For float, double, and long double values, the input operator converts 
  3703. characters from the stream buffer attached to ins according to the C++ lexical 
  3704. conventions. 
  3705.  
  3706. The following conversions occur for certain string values: 
  3707.  
  3708.      If the value consists of the character strings "inf" or "infinity" in any 
  3709.       combination of uppercase and lowercase letters, the string is converted 
  3710.       to the appropriate type's representation of infinity. 
  3711.      If the value consists of the character string "nan" in any combination of 
  3712.       uppercase and lowercase letters, the string is converted to the 
  3713.       appropriate type's representation of a NaN. 
  3714.  
  3715.  The resulting value is stored in ref. The input operator sets ios::failbit if 
  3716.  no digits are available in the stream buffer or if the digits that are 
  3717.  available do not begin a floating-point number. 
  3718.  
  3719.  
  3720. ΓòÉΓòÉΓòÉ 4.5.7.5. Input Operator for streambuf Objects ΓòÉΓòÉΓòÉ
  3721.  
  3722. istream& operator>>(streambuf* sb);
  3723.  
  3724. For pointers to streambuf objects, the input operator calls ipfx(0). If ipfx(0) 
  3725. returns a nonzero value, the input operator extracts characters from the stream 
  3726. buffer attached to ins and inserts them in sb. Extraction stops when an EOF 
  3727. character is encountered. The input operator always returns ins. 
  3728.  
  3729.  
  3730. ΓòÉΓòÉΓòÉ 4.5.8. Public Members of istream for Unformatted Input ΓòÉΓòÉΓòÉ
  3731.  
  3732. You can use the functions listed in this section to extract characters from a 
  3733. stream buffer as a sequence of bytes. All of these functions call ipfx(1). They 
  3734. only proceed with their processing if ipfx(1) returns a nonzero value. 
  3735.  
  3736. Note:  The following descriptions assume that the functions are called as part 
  3737. of an  istream object called ins. The following functions are described: 
  3738.  
  3739.      get - Extract characters and store in array 
  3740.      get - Extract characters and store in stream buffer 
  3741.      get - Extract character and store in char 
  3742.      get - Extract character and return it 
  3743.      getline - Extract characters and store in array 
  3744.      ignore - Extract characters and discard them 
  3745.      read - Extract characters and store in array 
  3746.  
  3747.  
  3748. ΓòÉΓòÉΓòÉ 4.5.8.1. get ΓòÉΓòÉΓòÉ
  3749.  
  3750. istream& get(char* ptr, int len, char delim='\n');
  3751. istream& get(signed char* ptr, int len, char delim='\n');
  3752. istream& get(unsigned char* ptr, int len, char delim='\n');
  3753.  
  3754. get() with three arguments extracts characters from the stream buffer attached 
  3755. to ins and stores them in the byte array beginning at the location pointed to 
  3756. by ptr and extending for len bytes. The default value of the delim argument is 
  3757. '\n'. Extraction stops when either of the following conditions is true: 
  3758.  
  3759.      delim or EOF is encountered before len-1 characters have been stored in 
  3760.       the array. delim is left in the stream buffer and not stored in the 
  3761.       array. 
  3762.      len-1 characters are extracted without delim or EOF being encountered. 
  3763.  
  3764.  get() always stores a terminating null character in the array, even if it does 
  3765.  not extract any characters from the stream buffer. get() sets the ios::failbit 
  3766.  if it encounters an EOF character before it stores any characters. 
  3767.  
  3768.  
  3769. ΓòÉΓòÉΓòÉ 4.5.8.2. get ΓòÉΓòÉΓòÉ
  3770.  
  3771. istream& get(streambuf& sb, char delim='\n');
  3772.  
  3773. get() with two arguments extracts characters from the stream buffer attached to 
  3774. ins and stores them in sb. The default value of the delim argument is "\n". 
  3775. Extraction stops when any of the following conditions is true: 
  3776.  
  3777.      An EOF character is encountered. 
  3778.      An attempt to store a character in sb fails. ios::failbit is set in the 
  3779.       error state of ins. 
  3780.      delim is encountered.  delim is left in the stream buffer attached to 
  3781.       ins. 
  3782.  
  3783.  
  3784. ΓòÉΓòÉΓòÉ 4.5.8.3. get ΓòÉΓòÉΓòÉ
  3785.  
  3786. istream& get(char& cref);
  3787. istream& get(signed char& cref);
  3788. istream& get(unsigned char& cref);
  3789. istream& get(wchar_t& cref);
  3790.  
  3791. get() with a single argument extracts a single character or wchar_t from the 
  3792. stream buffer attached to ins and stores this character in cref. 
  3793.  
  3794.  
  3795. ΓòÉΓòÉΓòÉ 4.5.8.4. get ΓòÉΓòÉΓòÉ
  3796.  
  3797. int get();
  3798.  
  3799. get() with no arguments extracts a character from the stream buffer attached to 
  3800. ins and returns it. This version of get() returns EOF if EOF is extracted. 
  3801. ios::failbit is never set. 
  3802.  
  3803.  
  3804. ΓòÉΓòÉΓòÉ 4.5.8.5. getline ΓòÉΓòÉΓòÉ
  3805.  
  3806. istream& getline(char* ptr, int len, char delim='\n');
  3807. istream& getline(signed char* ptr, int len, char delim='\n');
  3808. istream& getline(unsigned char* ptr, int len, char delim='\n');
  3809.  
  3810. getline() extracts characters from the stream buffer attached to ins and stores 
  3811. them in the byte array beginning at the location pointed to by ptr and 
  3812. extending for len bytes. The default value of the delim argument is "\n". 
  3813. Extraction stops when any one of the following conditions is true: 
  3814.  
  3815.      delim or EOF is encountered before len-1 characters have been stored in 
  3816.       the array. getline() extracts delim from the stream buffer, but it does 
  3817.       not store delim in the array. 
  3818.      len-1 characters are extracted before delim or EOF is encountered. 
  3819.  
  3820.  getline() always stores a terminating null character in the array, even if it 
  3821.  does not extract any characters from the stream buffer. getline() sets the 
  3822.  ios::failbit for ins if it encounters an EOF character before it stores any 
  3823.  characters. 
  3824.  
  3825.  getline() is like get() with three arguments, except that get() does not 
  3826.  extract the delim character from the stream buffer, while getline() does. 
  3827.  
  3828.  See White Space in String Input in the Open Class Library User's Guide for an 
  3829.  example of using the getline() function. 
  3830.  
  3831.  
  3832. ΓòÉΓòÉΓòÉ 4.5.8.6. ignore ΓòÉΓòÉΓòÉ
  3833.  
  3834. istream& ignore(int num=1, int delim=EOF);
  3835.  
  3836. ignore() extracts up to num character from the stream buffer attached to ins 
  3837. and discards them.  ignore() will extract fewer than num characters if it 
  3838. encounters delim or EOF. 
  3839.  
  3840.  
  3841. ΓòÉΓòÉΓòÉ 4.5.8.7. read ΓòÉΓòÉΓòÉ
  3842.  
  3843. istream& read(char* s, int n);
  3844. istream& read(signed char* s, int n);
  3845. istream& read(unsigned char* s, int n);
  3846.  
  3847. read() extracts n characters from the stream buffer attached to ins and stores 
  3848. them in an array beginning at the position pointed to by s. If EOF is 
  3849. encountered before read() extracts n characters, read() sets the ios::failbit 
  3850. in the error state of ins. You can determine the number of characters that 
  3851. read() extracted by calling gcount() immediately after the call to read(). 
  3852.  
  3853.  
  3854. ΓòÉΓòÉΓòÉ 4.5.9. Public Members of istream for Positioning ΓòÉΓòÉΓòÉ
  3855.  
  3856. The following functions are described: 
  3857.  
  3858.      seekg - reposition get pointer of ultimate producer 
  3859.      tellg - return position of get pointer of ultimate producer 
  3860.  
  3861.  
  3862. ΓòÉΓòÉΓòÉ 4.5.9.1. seekg ΓòÉΓòÉΓòÉ
  3863.  
  3864. istream& seekg(streampos sp);
  3865. istream& seekg(streamoff so, ios::seek_dir dir);
  3866.  
  3867. seekg() repositions the get pointer of the ultimate producer. seekg() with one 
  3868. argument sets the get pointer to the position sp. seekg() with two arguments 
  3869. sets the get pointer to the position specified by dir with the offset so. dir 
  3870. can have the following values: 
  3871.  
  3872.      ios::beg: the beginning of the stream 
  3873.      ios::cur: the current position of the get pointer 
  3874.      ios::end: the end of the stream 
  3875.  
  3876.  If you attempt to set the get pointer to a position that is not valid, seekg() 
  3877.  sets ios::badbit. 
  3878.  
  3879.  
  3880. ΓòÉΓòÉΓòÉ 4.5.9.2. tellg ΓòÉΓòÉΓòÉ
  3881.  
  3882. streampos tellg();
  3883.  
  3884. tellg() returns the current position of the get pointer of the ultimate 
  3885. producer. 
  3886.  
  3887.  
  3888. ΓòÉΓòÉΓòÉ 4.5.10. Other Public Members of istream ΓòÉΓòÉΓòÉ
  3889.  
  3890. Note:  The following descriptions assume that the functions are called as part 
  3891. of an  istream object called ins. 
  3892.  
  3893. The following member functions are described: 
  3894.  
  3895.      gcount - Return number of characters extracted 
  3896.      peek - Return next character without extracting it 
  3897.      putback - Put extracted characters back into stream buffer 
  3898.      sync - Synchronize stream buffer and ultimate producer 
  3899.  
  3900.  
  3901. ΓòÉΓòÉΓòÉ 4.5.10.1. gcount ΓòÉΓòÉΓòÉ
  3902.  
  3903. int gcount();
  3904.  
  3905. gcount() returns the number of characters extracted from the stream buffer 
  3906. attached to ins by the last call to an unformatted input function. The input 
  3907. operator >> may call unformatted input functions, and thus formatted input may 
  3908. affect the value returned by gcount(). 
  3909.  
  3910.  
  3911. ΓòÉΓòÉΓòÉ 4.5.10.2. peek ΓòÉΓòÉΓòÉ
  3912.  
  3913. int peek();
  3914.  
  3915. peek() calls ipfx(1). If ipfx() returns zero, or if no more input is available 
  3916. from the ultimate producer, peek() returns EOF. Otherwise, it returns the next 
  3917. character in the stream buffer attached to ins without extracting the 
  3918. character. 
  3919.  
  3920.  
  3921. ΓòÉΓòÉΓòÉ 4.5.10.3. putback ΓòÉΓòÉΓòÉ
  3922.  
  3923. istream& putback(char c);
  3924.  
  3925. putback() attempts to put a character that was extracted from the stream buffer 
  3926. attached to ins back into the stream buffer.  c must equal the character before 
  3927. the get pointer of the stream buffer. Unless some other activity is modifying 
  3928. the stream buffer, this is the last character extracted from the stream buffer. 
  3929. If c is not equal to the character before the get pointer, the result of 
  3930. putback() is undefined, and the error state of ins may be set. putback() does 
  3931. not call ipfx(), but if the error state of ins is nonzero, putback() returns 
  3932. without putting back the character or setting the error state. 
  3933.  
  3934.  
  3935. ΓòÉΓòÉΓòÉ 4.5.10.4. sync ΓòÉΓòÉΓòÉ
  3936.  
  3937. int sync();
  3938.  
  3939. sync() establishes consistency between the ultimate producer and the stream 
  3940. buffer attached to ins. sync() calls ins.rdbuf()->sync(), which is a virtual 
  3941. function, so the details of its operation depend on the way the function is 
  3942. defined in a given derived class. If an error occurs, sync() returns EOF. 
  3943.  
  3944.  
  3945. ΓòÉΓòÉΓòÉ 4.5.11. Built-In Manipulators for istream ΓòÉΓòÉΓòÉ
  3946.  
  3947. istream&      ws(istream&);
  3948. ios&          dec(ios&);
  3949. ios&          hex(ios&);
  3950. ios&          oct(ios&);
  3951.  
  3952. The I/O Stream Library provides you with a set of built-in manipulators that 
  3953. can be used with the istream class. These manipulators have a specific effect 
  3954. on an istream object beyond extracting their own values. The built-in 
  3955. manipulators are accepted by the following versions of the input operator: 
  3956.  
  3957. istream& operator>> (istream& (*f) (istream&));
  3958. istream& operator>> (ios& (*f) (ios&));
  3959.  
  3960. If ins is a reference to an istream object, this statement extracts white-space 
  3961. characters from the stream buffer attached to ins: 
  3962.  
  3963.    ins >> ws;
  3964.  
  3965. This statement sets ios::dec: 
  3966.  
  3967.    ins >> dec;
  3968.  
  3969. This statement sets ios::hex: 
  3970.  
  3971.    ins >> hex;
  3972.  
  3973. This statement sets ios::oct: 
  3974.  
  3975.    ins >> oct;
  3976.  
  3977.  
  3978. ΓòÉΓòÉΓòÉ 4.5.12. Public Members of istream_withassign ΓòÉΓòÉΓòÉ
  3979.  
  3980. Description 
  3981.  
  3982. To close all the panels in a chapter, double-click on this panel's system menu. 
  3983.  
  3984.  
  3985. ΓòÉΓòÉΓòÉ 4.5.13. Class Description - istream_withassign ΓòÉΓòÉΓòÉ
  3986.  
  3987. There are two public member functions of istream_withassign: 
  3988.  
  3989.      istream_withassign constructor 
  3990.      istream_withassign assignment operator 
  3991.  
  3992.  
  3993. ΓòÉΓòÉΓòÉ 4.5.13.1. Constructor for istream_withassign ΓòÉΓòÉΓòÉ
  3994.  
  3995. istream_withassign();
  3996.  
  3997. The istream_withassign constructor creates an istream_withassign object. It 
  3998. does not do any initialization of this object. 
  3999.  
  4000.  
  4001. ΓòÉΓòÉΓòÉ 4.5.13.2. Assignment Operator for istream_withassign ΓòÉΓòÉΓòÉ
  4002.  
  4003. istream_withassign& operator=(istream& is);
  4004. istream_withassign& operator=(streambuf* sb);
  4005.  
  4006. There are two versions of the istream_withassign assignment operator. The first 
  4007. version takes a reference to an istream object, is, as its argument. It 
  4008. associates the stream buffer attached to is with the istream_withassign object 
  4009. that is on the left side of the assignment operator. 
  4010.  
  4011. The second version of the assignment operator takes a pointer to a streambuf 
  4012. object, sb, as its argument. It associates this streambuf object with the 
  4013. istream_withassign object that is on the left side of the assignment operator. 
  4014.  
  4015.  
  4016. ΓòÉΓòÉΓòÉ 4.6. Manipulators ΓòÉΓòÉΓòÉ
  4017.  
  4018. Description 
  4019.  
  4020. Derivation 
  4021.  
  4022. Header File 
  4023.  
  4024. Members 
  4025.  
  4026. To close all the panels in a chapter, double-click on this panel's system menu. 
  4027.  
  4028.  
  4029. ΓòÉΓòÉΓòÉ 4.6.1. Class Description - Manipulators ΓòÉΓòÉΓòÉ
  4030.  
  4031. This chapter describes the parameterized manipulators provided by the I/O 
  4032. Stream Library and the facilities you can use to declare your own manipulators. 
  4033.  
  4034.  
  4035. ΓòÉΓòÉΓòÉ 4.6.2. Derivation ΓòÉΓòÉΓòÉ
  4036.  
  4037. The manipulator classes are defined by a set of macros, and take names as 
  4038. defined when you use the macros.  See the section on manipulators in the Open 
  4039. Class Library User's Guide for further information. 
  4040.  
  4041.  
  4042. ΓòÉΓòÉΓòÉ 4.6.3. Header File ΓòÉΓòÉΓòÉ
  4043.  
  4044. The parameterized manipulator classes are declared in iomanip.h. 
  4045.  
  4046.  
  4047. ΓòÉΓòÉΓòÉ 4.6.4. Parameterized Manipulators for the Format State ΓòÉΓòÉΓòÉ
  4048.  
  4049. The iomanip.h header file also contains calls to the IOMANIPdeclare() macro for 
  4050. types int and long. These calls create classes that are used to create the 
  4051. parameterized manipulators that control the format state of ios objects. 
  4052.  
  4053. The call to IOMANIPdeclare(int) creates classes with names that are expanded 
  4054. from the following macros: 
  4055.  
  4056.      SMANIP(int) 
  4057.      SAPP(int) 
  4058.      IMANIP(int) 
  4059.      IAPP(int) 
  4060.      OMANIP(int) 
  4061.      OAPP(int) 
  4062.      IOMANIP(int) 
  4063.      IOAPP(int) 
  4064.  
  4065.  All of these macros expand to names that include the string "int". Similarly, 
  4066.  IOMANIPdeclare(long) creates eight classes whose names include the string 
  4067.  "long". 
  4068.  
  4069.  The following manipulators are declared using the classes created by the calls 
  4070.  to IOMANIPdeclare(int) and IOMANIPdeclare(long). 
  4071.  
  4072.  Note:  All of the parameterized manipulators described below are defined for 
  4073.  both istream and ostream objects. In the following descriptions, is is a 
  4074.  reference to an istream object and os is a reference to an ostream object. 
  4075.  
  4076.  The following manipulators are described: 
  4077.  
  4078.      resetiosflags - clear format flags 
  4079.      setbase - set conversion base 
  4080.      setfill - set fill character 
  4081.      setiosflags - set format flags 
  4082.      setprecision - set precision 
  4083.      setw - set field width 
  4084.  
  4085.  
  4086. ΓòÉΓòÉΓòÉ 4.6.4.1. resetiosflags ΓòÉΓòÉΓòÉ
  4087.  
  4088. SMANIP(long) resetiosflags(long flags);
  4089.  
  4090. resetiosflags() clears the format flags specified in flags. It can appear in an 
  4091. input stream: 
  4092.  
  4093.    is >> resetiosflags(flags);
  4094.  
  4095. In this case, resetiosflags() calls is.setf(0,flags). 
  4096.  
  4097. resetiosflags() can also appear in an output stream: 
  4098.  
  4099.    os << resetiosflags(flags);
  4100.  
  4101. In this case, resetiosflags calls os.setf(0,flags). 
  4102.  
  4103.  
  4104. ΓòÉΓòÉΓòÉ 4.6.4.2. setbase ΓòÉΓòÉΓòÉ
  4105.  
  4106. SMANIP(int) setbase(int base);
  4107.  
  4108. setbase() sets the conversion base to be equal to the value of the argument 
  4109. base. If base equals 10, the conversion base is set to 10. If base equals 8, 
  4110. the conversion base is set to 8. If base equals 16, the conversion base is set 
  4111. to 16. Otherwise, the conversion base is set to 0. If the conversion base is 0, 
  4112. output is treated the same as if the base were 10, but input is interpreted 
  4113. according to the C++ lexical conventions. This means that input values that 
  4114. begin with "0" are interpreted as octal values, and values that begin with "0x" 
  4115. or "0X" are interpreted as hexadecimal values. 
  4116.  
  4117.  
  4118. ΓòÉΓòÉΓòÉ 4.6.4.3. setfill ΓòÉΓòÉΓòÉ
  4119.  
  4120. SMANIP(int) setfill(int fill);
  4121.  
  4122. setfill() sets the fill character, ios::x_fill, to fill. The fill character is 
  4123. the character that appears in values that need to be padded to fill the field 
  4124. width. setfill() can appear in either an input stream or an output stream: 
  4125.  
  4126.    is >> setfill(fill);
  4127.    os << setfill(fill);
  4128.  
  4129. setfill() performs the same task as the function fill(). 
  4130.  
  4131.  
  4132. ΓòÉΓòÉΓòÉ 4.6.4.4. setiosflags ΓòÉΓòÉΓòÉ
  4133.  
  4134. SMANIP(long) setiosflags(long flags);
  4135.  
  4136. setiosflags() sets the format flags specified in flags. setiosflags() can 
  4137. appear in an input stream: 
  4138.  
  4139.    is >> setiosflags(flags);
  4140.  
  4141. If it appears in an input stream, setiosflags() calls is.setf.(flags) 
  4142.  
  4143. If it appears in an output stream, setiosflags() calls os.setf(flags): 
  4144.  
  4145.    os << setiosflags(flags);
  4146.  
  4147.  
  4148. ΓòÉΓòÉΓòÉ 4.6.4.5. setprecision ΓòÉΓòÉΓòÉ
  4149.  
  4150. SMANIP(int) setprecision(int prec);
  4151.  
  4152. setprecision() sets the precision format state variable, ios::x_prec, to the 
  4153. value of prec. The value of prec must be greater than zero. If the value of 
  4154. prec is negative, the precision format state variable is set to 6. 
  4155.  
  4156. setprecision() can appear in either an input stream or an output stream: 
  4157.  
  4158.    is >> setprecision(prec);
  4159.    os << setprecision(prec);
  4160.  
  4161.  
  4162. ΓòÉΓòÉΓòÉ 4.6.4.6. setw ΓòÉΓòÉΓòÉ
  4163.  
  4164. SMANIP(int) setw(int width);
  4165.  
  4166. setw() sets the width format state variable, ios::x_width, to the value of 
  4167. width. 
  4168.  
  4169. setw() can appear in either an input stream or an output stream: 
  4170.  
  4171.    is >> setw(width);
  4172.    os << setw(width);
  4173.  
  4174.  
  4175. ΓòÉΓòÉΓòÉ 4.7. ostream and ostream_withassign Classes ΓòÉΓòÉΓòÉ
  4176.  
  4177. Description 
  4178.  
  4179. Derivation 
  4180.  
  4181. Header File 
  4182.  
  4183. Constructors 
  4184.  
  4185. Members 
  4186.  
  4187. To close all the panels in a chapter, double-click on this panel's system menu. 
  4188.  
  4189.  
  4190. ΓòÉΓòÉΓòÉ 4.7.1. Class Description - ostream ΓòÉΓòÉΓòÉ
  4191.  
  4192. This chapter describes the ostream class and its derived class 
  4193. ostream_withassign. You can use the ostream member functions to put characters 
  4194. into the streambuf object that is associated with an ostream object. 
  4195. ostream_withassign is derived from ostream and includes an assignment operator. 
  4196.  
  4197. You can view the topics in this chapter either through the panel on the left, 
  4198. or by selecting from among the following: 
  4199.  
  4200.      Output prefix and suffix functions 
  4201.      Members for formatted output 
  4202.      Members for unformatted output 
  4203.      Members for positioning 
  4204.      Other public members 
  4205.      Built-in manipulators 
  4206.      ostream_withassign class 
  4207.  
  4208.  
  4209. ΓòÉΓòÉΓòÉ 4.7.2. Derivation ΓòÉΓòÉΓòÉ
  4210.  
  4211. ios 
  4212.  
  4213.    ostream
  4214.      ostream_withassign
  4215.  
  4216.  
  4217. ΓòÉΓòÉΓòÉ 4.7.3. Header File ΓòÉΓòÉΓòÉ
  4218.  
  4219. ostream and ostream_withassign are declared in iostream.h. 
  4220.  
  4221.  
  4222. ΓòÉΓòÉΓòÉ 4.7.4. Members ΓòÉΓòÉΓòÉ
  4223.  
  4224. The following members are provided for ostream and ostream_withassign: 
  4225.  
  4226.      Constructors for ostream 
  4227.      Output Operator for Arrays of Characters and char Values 
  4228.      Constructor for ostream_withassign 
  4229.      Assignment Operator for ostream_withassign 
  4230.      flush 
  4231.      opfx 
  4232.      osfx 
  4233.      put 
  4234.      seekp 
  4235.      tellp 
  4236.      write 
  4237.  
  4238.  
  4239. ΓòÉΓòÉΓòÉ 4.7.5. Constructors for ostream ΓòÉΓòÉΓòÉ
  4240.  
  4241. Class: ostream 
  4242.  
  4243. ostream(streambuf* sb);
  4244.  
  4245. The ostream constructor takes a single argument, sb, which is a pointer to a 
  4246. streambuf object. The constructor creates an ostream object that is attached to 
  4247. the streambuf object pointed to by sb. The constructor also initializes the 
  4248. format variables to their defaults. 
  4249.  
  4250. The other declarations for the ostream constructor in iostream.h are obsolete; 
  4251. do not use them. 
  4252.  
  4253.  
  4254. ΓòÉΓòÉΓòÉ 4.7.6. Output Prefix and Suffix Functions ΓòÉΓòÉΓòÉ
  4255.  
  4256. The output operator calls the output prefix function opfx() before inserting 
  4257. characters into a stream buffer, and calls the output suffix function osfx() 
  4258. after inserting characters. The following descriptions assume the functions are 
  4259. called as part of an ostream object called os. 
  4260.  
  4261.  
  4262. ΓòÉΓòÉΓòÉ 4.7.6.1. opfx ΓòÉΓòÉΓòÉ
  4263.  
  4264. int opfx();
  4265.  
  4266. opfx() is called by the output operator before inserting characters into a 
  4267. stream buffer. opfx() checks the error state of os. If the internal flag 
  4268. ios::hardfail is set, opfx() returns 0. Otherwise, opfx() flushes the stream 
  4269. buffer attached to the ios object pointed to by os.tie(), if one exists, and 
  4270. returns the value returned by ios::good(). ios::good() returns 0 if 
  4271. ios::failbit, ios::badbit, or ios::eofbit is set. Otherwise, ios::good() 
  4272. returns a nonzero value. 
  4273.  
  4274.  
  4275. ΓòÉΓòÉΓòÉ 4.7.6.2. osfx ΓòÉΓòÉΓòÉ
  4276.  
  4277. void osfx();
  4278.  
  4279. osfx() is called before a formatted output function returns. osfx() flushes the 
  4280. streambuf object attached to os if ios::unitbuf is set. 
  4281.  
  4282. osfx() is called by the output operator. If you overload the output operator to 
  4283. handle your own classes, you should ensure that osfx() is called after any 
  4284. direct manipulation of a streambuf object. Binary output functions do not call 
  4285. osfx(). 
  4286.  
  4287.  
  4288. ΓòÉΓòÉΓòÉ 4.7.7. Public Members of ostream for Formatted Output ΓòÉΓòÉΓòÉ
  4289.  
  4290. The ostream class lets you use the output operator << to perform formatted 
  4291. output (or insertion) to a stream buffer. Consider the following statement, 
  4292. where outs is a reference to an ostream object and x is a variable of a 
  4293. built-in type: 
  4294.  
  4295.    outs << x;
  4296.  
  4297. The output operator << calls opfx() before beginning insertion. If opfx() 
  4298. returns a nonzero value, the output operator converts x into a series of 
  4299. characters and inserts these characters into the stream buffer attached to 
  4300. outs. If an error occurs, the output operator sets ios::failbit. 
  4301.  
  4302. The details of the conversion of x depend on the format state of the ostream 
  4303. object and the type of x. For numeric and string values, including the char* 
  4304. types and wchar_t*, but excluding the char types and wchar_t, the output 
  4305. operator resets the width variable ios::x_width of the format state of an 
  4306. ostream object to 0, but it does not affect anything else in the format state. 
  4307.  
  4308. The output operator is defined for the following types: 
  4309.  
  4310.      Arrays of characters and char values, including arrays of wchar_t and 
  4311.       wchar_t values. 
  4312.      Other integral values: short, int, long 
  4313.      float, double and long double values 
  4314.      Pointers to void 
  4315.  
  4316.  The following sections describe the output operators for these types. The 
  4317.  output operator is also defined for streambuf objects. 
  4318.  
  4319.  You can also define output operators for your own types. 
  4320.  
  4321.  Note:  The following descriptions assume that the output operator is called 
  4322.  with the ostream object outs on the left side of the operator. 
  4323.  
  4324.  
  4325. ΓòÉΓòÉΓòÉ 4.7.7.1. Output Operator for Arrays of Characters and char Values ΓòÉΓòÉΓòÉ
  4326.  
  4327. ostream& operator<<(const char* cp);
  4328. ostream& operator<<(const signed char* cp);
  4329. ostream& operator<<(const unsigned char* cp);
  4330. ostream& operator<<(wchar_t);
  4331. ostream& operator<<(char ch);
  4332. ostream& operator<<(signed char ch);
  4333. ostream& operator<<(unsigned char ch);
  4334. ostream& operator<<(const wchar_t *);
  4335.  
  4336. For a pointer to a char, signed char, or unsigned char value, the output 
  4337. operator inserts all the characters in the string into the stream buffer with 
  4338. the exception of the null character that terminates the string. For a pointer 
  4339. to a wchar_t, the output operator converts the wchar_t string to its equivalent 
  4340. multibyte character string, and then inserts it into the stream buffer except 
  4341. for the null character that terminates the string. 
  4342.  
  4343. If ios::x_width is greater than zero and the representation of the value to be 
  4344. inserted is less than ios::x_width, the output operator inserts enough fill 
  4345. characters to ensure that the representation occupies an entire field in the 
  4346. stream buffer. 
  4347.  
  4348. The output operator does not perform any conversion on char, signed char, 
  4349. unsigned char, or wchar_t values. 
  4350.  
  4351.  
  4352. ΓòÉΓòÉΓòÉ 4.7.7.2. Output Operator for Other Integral Values ΓòÉΓòÉΓòÉ
  4353.  
  4354. ostream& operator<<(short iv);
  4355. ostream& operator<<(unsigned short iv);
  4356. ostream& operator<<(int iv);
  4357. ostream& operator<<(unsigned int iv);
  4358. ostream& operator<<(long iv);
  4359. ostream& operator<<(unsigned long iv);
  4360. ostream& operator<<(long long iv);
  4361. ostream& operator<<(unsigned long long iv);
  4362.  
  4363. Note:  The support for long long is controlled by the -q(no)longlong option. By 
  4364. default, long long is supported. 
  4365.  
  4366. For the integral types (short, unsigned short, int, unsigned int, long, 
  4367. unsigned long, long long, and unsigned long long), the output operator converts 
  4368. the integral value iv according to the format state of outs and inserts 
  4369. characters into the stream buffer associated with outs. There is no overflow 
  4370. detection on conversion of integral types. 
  4371.  
  4372. The conversion that takes place on iv depends, in part, on the settings of the 
  4373. following format flags: 
  4374.  
  4375.      If ios::oct is set, iv is converted to a series of octal digits. If 
  4376.       ios::showbase is set, "0" is inserted into the stream buffer before the 
  4377.       octal digits. If the value being inserted is equal to 0, a single "0" is 
  4378.       inserted, not "00". 
  4379.      If ios::dec is set, iv is converted to a series of decimal digits. 
  4380.      If ios::hex is set, iv is converted to a series of hexadecimal digits. If 
  4381.       ios::showbase is set, "0x" (or "0X" if ios::uppercase is set) is inserted 
  4382.       into the stream buffer before the hexadecimal digits. 
  4383.  
  4384.  If none of these format flags is set, iv is converted to a series of decimal 
  4385.  digits. If iv is converted to a series of decimal digits, its sign also 
  4386.  affects the conversion: 
  4387.  
  4388.      If iv is negative, a negative sign "-" is inserted before the decimal 
  4389.       digits. 
  4390.      If iv is equal to 0, the single digit 0 is inserted. 
  4391.      If iv is positive and ios::showpos is set, a positive sign "+" is 
  4392.       inserted before the decimal digits. 
  4393.  
  4394.  
  4395. ΓòÉΓòÉΓòÉ 4.7.7.3. Output Operator for float and double Values ΓòÉΓòÉΓòÉ
  4396.  
  4397. ostream& operator<<(float val);
  4398. ostream& operator<<(double val);
  4399. ostream& operator<<(long double val);
  4400.  
  4401. The output operator performs a conversion operation on the value val and 
  4402. inserts it into the stream buffer attached to outs. The conversion depends on 
  4403. the values returned by the following functions: 
  4404.  
  4405.      outs.precision(): returns the number of significant digits that appear 
  4406.       after the decimal. The default value is 6. 
  4407.      outs.width(): if this returns 0, val is inserted without any fill 
  4408.       characters. If the return value is greater than the number of characters 
  4409.       needed to represent val, extra fill characters are inserted so that the 
  4410.       total number of characters inserted is equal to the return value. 
  4411.  
  4412.  The conversion also depends on the values of the following format flags: 
  4413.  
  4414.      If ios::scientific is set, val is converted to scientific notation, with 
  4415.       one digit before the decimal, and the number of digits after the decimal 
  4416.       equal to the value returned by outs.precision(). The exponent begins with 
  4417.       a lowercase "e" unless ios::uppercase is set, in which case the exponent 
  4418.       begins with an uppercase "E". 
  4419.      If ios::fixed is set, val is converted to fixed notation, with the number 
  4420.       of digits after the decimal point equal to the value returned by 
  4421.       outs.precision(). If neither ios::fixed nor ios::scientific is set, the 
  4422.       conversion depends upon the value of val. See Floating-Point Formatting 
  4423.       for more details. 
  4424.      If ios::uppercase is set, the exponents of values in scientific notation 
  4425.       begin with an uppercase "E". 
  4426.  
  4427.  See Format State Flags for more details on the format state. 
  4428.  
  4429.  
  4430. ΓòÉΓòÉΓòÉ 4.7.7.4. Output Operator for Pointers to void ΓòÉΓòÉΓòÉ
  4431.  
  4432. ostream& operator<<(void* vp);
  4433.  
  4434. The output operator converts pointers to void to integral values and then 
  4435. converts them to hexadecimal values as if ios::showbase were set. This version 
  4436. of the output operator is used to print out the values of pointers. 
  4437.  
  4438.  
  4439. ΓòÉΓòÉΓòÉ 4.7.7.5. Output Operator for streambuf Objects ΓòÉΓòÉΓòÉ
  4440.  
  4441. ostream& operator<<(streambuf* sb);
  4442.  
  4443. If opfx() returns a nonzero value, the output operator inserts all of the 
  4444. characters that can be taken from sb into the stream buffer attached to outs. 
  4445. Insertion stops when no more characters can be fetched from sb. No padding is 
  4446. performed. The return value is outs. 
  4447.  
  4448.  
  4449. ΓòÉΓòÉΓòÉ 4.7.8. Public Members of ostream for Unformatted Output ΓòÉΓòÉΓòÉ
  4450.  
  4451. You can use the functions listed in this section to insert characters into a 
  4452. stream buffer without regard to the type of the values that the characters 
  4453. represent. 
  4454.  
  4455. Note:  The following descriptions assume that the functions are called as part 
  4456. of an ostream object called outs. 
  4457.  
  4458. The following functions are described: 
  4459.  
  4460.      put - insert a single character 
  4461.      write - insert an array of characters 
  4462.  
  4463.  
  4464. ΓòÉΓòÉΓòÉ 4.7.8.1. put ΓòÉΓòÉΓòÉ
  4465.  
  4466. ostream& put(char c);
  4467.  
  4468. put() inserts c in the stream buffer attached to outs. put() sets the error 
  4469. state of outs if the insertion fails. 
  4470.  
  4471.  
  4472. ΓòÉΓòÉΓòÉ 4.7.8.2. write ΓòÉΓòÉΓòÉ
  4473.  
  4474. ostream& write(const char* cp, int n);
  4475. ostream& write(const signed char* cp, int n);
  4476. ostream& write(const unsigned char* cp, int n);
  4477.  
  4478. write() inserts the n characters that begin at the position pointed to by cp. 
  4479. This array of characters does not need to end with a null character. 
  4480.  
  4481.  
  4482. ΓòÉΓòÉΓòÉ 4.7.9. Public Members of ostream for Positioning ΓòÉΓòÉΓòÉ
  4483.  
  4484. Note:  The following descriptions assume that the functions are called as part 
  4485. of an ostream object called outs. 
  4486.  
  4487. The following functions are described: 
  4488.  
  4489.      seekp - reposition put pointer of ultimate consumer 
  4490.      tellp - return position of put pointer of associated stream buffer 
  4491.  
  4492.  
  4493. ΓòÉΓòÉΓòÉ 4.7.9.1. seekp ΓòÉΓòÉΓòÉ
  4494.  
  4495. ostream& seekp(streampos sp);
  4496. ostream& seekp(streamoff so, ios::seek_dir dir);
  4497.  
  4498. seekp() repositions the put pointer of the ultimate consumer. seekp() with one 
  4499. argument sets the put pointer to the position sp. seekp() with two arguments 
  4500. sets the put pointer to the position specified by dir with the offset so. dir 
  4501. can have the following values: 
  4502.  
  4503.      ios::beg: the beginning of the stream 
  4504.      ios::cur: the current position of the put pointer 
  4505.      ios::end: the end of the stream 
  4506.  
  4507.  The new position of the put pointer is equal to the position specified by dir 
  4508.  offset by the value of so. If you attempt to move the put pointer to a 
  4509.  position that is not valid, seekp() sets ios::badbit. 
  4510.  
  4511.  
  4512. ΓòÉΓòÉΓòÉ 4.7.9.2. tellp ΓòÉΓòÉΓòÉ
  4513.  
  4514. streampos tellp();
  4515.  
  4516. tellp() returns the current position of the put pointer of the stream buffer 
  4517. that is attached to outs. 
  4518.  
  4519.  
  4520. ΓòÉΓòÉΓòÉ 4.7.10. Other Public Members of ostream ΓòÉΓòÉΓòÉ
  4521.  
  4522. In this section, the following function is described: 
  4523.  
  4524. flush - clear associated stream buffer 
  4525.  
  4526.  
  4527. ΓòÉΓòÉΓòÉ 4.7.10.1. flush ΓòÉΓòÉΓòÉ
  4528.  
  4529. ostream& flush();
  4530.  
  4531. The ultimate consumer of characters that are stored in a stream buffer may not 
  4532. necessarily consume them immediately. flush() causes any characters that are 
  4533. stored in the stream buffer attached to outs to be consumed. It calls 
  4534. outs.rdbuf()->sync() to accomplish this action. 
  4535.  
  4536.  
  4537. ΓòÉΓòÉΓòÉ 4.7.11. Built-In Manipulators for ostream ΓòÉΓòÉΓòÉ
  4538.  
  4539. ostream&     endl(ostream& i);
  4540. ostream&     ends(ostream& i);
  4541. ostream&     flush(ostream&);
  4542. ios&         dec(ios&);
  4543. ios&         hex(ios&);
  4544. ios&         oct(ios&);
  4545.  
  4546. The I/O Stream Library provides you with a set of built-in manipulators that 
  4547. can be used with the ostream class. These manipulators have a specific effect 
  4548. on an ostream object beyond extracting their own values. The built-in 
  4549. manipulators are accepted by the following versions of the output operators: 
  4550.  
  4551. ostream&     operator<<(ostream& (*f)(ostream&));
  4552. ostream&     operator<<(ios& (*f)(ios&) );
  4553.  
  4554. If outs is a reference to an ostream object, then this statement inserts a 
  4555. newline character and calls flush(). 
  4556.  
  4557.    outs << endl;
  4558.  
  4559. This statement inserts a null character: 
  4560.  
  4561.    outs << ends;
  4562.  
  4563. This statement flushes the stream buffer attached to outs. It is equivalent to 
  4564. flush() 
  4565.  
  4566.    outs << flush;
  4567.  
  4568. This statement sets ios::dec: 
  4569.  
  4570.    outs << dec;
  4571.  
  4572. This statement sets ios::hex: 
  4573.  
  4574.    outs << hex;
  4575.  
  4576. This statement sets ios::oct: 
  4577.  
  4578.    outs << oct;
  4579.  
  4580.  
  4581. ΓòÉΓòÉΓòÉ 4.7.12. Public Members of ostream_withassign ΓòÉΓòÉΓòÉ
  4582.  
  4583. Description 
  4584.  
  4585. To close all the panels in a chapter, double-click on this panel's system menu. 
  4586.  
  4587.  
  4588. ΓòÉΓòÉΓòÉ 4.7.13. Class Description - ostream_withassign ΓòÉΓòÉΓòÉ
  4589.  
  4590. There are two public members of ostream_withassign: 
  4591.  
  4592.      ostream_withassign constructor 
  4593.      ostream_withassign assignment operator 
  4594.  
  4595.  
  4596. ΓòÉΓòÉΓòÉ 4.7.13.1. Constructor for ostream_withassign ΓòÉΓòÉΓòÉ
  4597.  
  4598. ostream_withassign();
  4599.  
  4600. The ostream_withassign constructor creates an ostream_withassign object. It 
  4601. does not do any initialization on the object. 
  4602.  
  4603.  
  4604. ΓòÉΓòÉΓòÉ 4.7.13.2. Assignment Operator for ostream_withassign ΓòÉΓòÉΓòÉ
  4605.  
  4606. ostream_withassign& operator=(ostream& os);
  4607. ostream_withassign& operator=(streambuf* sb);
  4608.  
  4609. There are two versions of the ostream_withassign assignment operator. The first 
  4610. version takes a reference to an ostream object, os, as its argument. It 
  4611. associates the streambuf attached to os with the ostream_withassign object that 
  4612. is on the left side of the assignment operator. 
  4613.  
  4614. The second version of the assignment operator takes a pointer to a streambuf 
  4615. object, sb, as its argument. It associates sb with the ostream_withassign 
  4616. object that is on the left side of the assignment operator. 
  4617.  
  4618.  
  4619. ΓòÉΓòÉΓòÉ 4.8. stdiobuf and stdiostream Classes ΓòÉΓòÉΓòÉ
  4620.  
  4621. Description 
  4622.  
  4623. Derivation 
  4624.  
  4625. Header File 
  4626.  
  4627. Members 
  4628.  
  4629. Examples 
  4630.  
  4631. To close all the panels in a chapter, double-click on this panel's system menu. 
  4632.  
  4633.  
  4634. ΓòÉΓòÉΓòÉ 4.8.1. Class Description - stdiobuf ΓòÉΓòÉΓòÉ
  4635.  
  4636. This chapter describes the stdiobuf class and stdiostream, the class that uses 
  4637. stdiobuf objects as stream buffers. Operations on an stdiobuf are mirrored on 
  4638. the associated FILE structure (defined in the C header file stdio.h). 
  4639.  
  4640. Note:  The classes described in this chapter are meant to be used when you have 
  4641. to mix C code with C++ code. If you are writing new C++ code, use filebuf, 
  4642. fstream, ifstream, and ofstream instead of stdiobuf and stdiostream. See 
  4643. sync_with_stdio for information on synchronizing stdio.h input and output with 
  4644. I/O Stream Library input and output. 
  4645.  
  4646.  
  4647. ΓòÉΓòÉΓòÉ 4.8.2. Derivation ΓòÉΓòÉΓòÉ
  4648.  
  4649. ios 
  4650.  
  4651.   stdiostream
  4652.  
  4653.  
  4654. streambuf 
  4655.  
  4656.   stdiobuf
  4657.  
  4658.  
  4659. ΓòÉΓòÉΓòÉ 4.8.3. Header File ΓòÉΓòÉΓòÉ
  4660.  
  4661. stdiobuf and stdiostream are declared in stdiostr.h. 
  4662.  
  4663.  
  4664. ΓòÉΓòÉΓòÉ 4.8.4. Members ΓòÉΓòÉΓòÉ
  4665.  
  4666. The following members are provided for stdiobuf and stdiostream: 
  4667.  
  4668.      Constructor for stdiobuf 
  4669.      Destructor for stdiobuf 
  4670.      stdiofile 
  4671.      Constructor for stdiostream 
  4672.      rdbuf 
  4673.  
  4674.  
  4675. ΓòÉΓòÉΓòÉ 4.8.5. Public Members of stdiobuf ΓòÉΓòÉΓòÉ
  4676.  
  4677. The following members are described: 
  4678.  
  4679.      Constructor for stdiobuf 
  4680.      Destructor for stdiobuf 
  4681.      stdiofile 
  4682.  
  4683.  
  4684. ΓòÉΓòÉΓòÉ 4.8.5.1. Constructor for stdiobuf ΓòÉΓòÉΓòÉ
  4685.  
  4686. stdiobuf(FILE* f);
  4687.  
  4688. The stdiobuf constructor creates an stdiobuf object that is associated with the 
  4689. FILE pointed to by f. Changes that are made to the stream buffer in an stdiobuf 
  4690. object are also made to the associated FILE pointed to by f. 
  4691.  
  4692. Note:  If ios::stdio is set in the format state of an ostream object, a call to 
  4693. osfx() flushes stdout and stderr. 
  4694.  
  4695.  
  4696. ΓòÉΓòÉΓòÉ 4.8.5.2. Destructor for stdiobuf ΓòÉΓòÉΓòÉ
  4697.  
  4698. ~stdiobuf();
  4699.  
  4700. The stdiobuf destructor frees space allocated by the stdiobuf constructor and 
  4701. flushes the file that this stdiobuf object is associated with. 
  4702.  
  4703.  
  4704. ΓòÉΓòÉΓòÉ 4.8.5.3. stdiofile ΓòÉΓòÉΓòÉ
  4705.  
  4706. FILE* stdiofile();
  4707.  
  4708. stdiofile() returns a pointer to the FILE object that the stdiobuf object is 
  4709. associated with. 
  4710.  
  4711.  
  4712. ΓòÉΓòÉΓòÉ 4.8.6. Public Members of stdiostream ΓòÉΓòÉΓòÉ
  4713.  
  4714.      Constructor for stdiostream 
  4715.      rdbuf 
  4716.  
  4717.  
  4718. ΓòÉΓòÉΓòÉ 4.8.6.1. Constructor for stdiostream ΓòÉΓòÉΓòÉ
  4719.  
  4720. stdiostream(FILE* file);
  4721.  
  4722. The stdiostream constructor creates a stdiostream object that is attached to 
  4723. the FILE pointed to by file. 
  4724.  
  4725.  
  4726. ΓòÉΓòÉΓòÉ 4.8.6.2. rdbuf ΓòÉΓòÉΓòÉ
  4727.  
  4728. stdiobuf* rdbuf();
  4729.  
  4730. rdbuf() returns a pointer to the stdiobuf object that is attached to the 
  4731. stdiostream object. 
  4732.  
  4733.  
  4734. ΓòÉΓòÉΓòÉ 4.8.6.3. Example of Using stdiostream ΓòÉΓòÉΓòÉ
  4735.  
  4736. The following example shows how you can use the stdiostream class. Two files 
  4737. are opened using fopen(). The pointers to the FILE structures are then used to 
  4738. create stdiostream objects. Finally, the contents of one of these stdiostream 
  4739. objects are copied into the other stdiostream object. 
  4740.  
  4741.    #include <stdiostr.h>
  4742.    #include <stdio.h>
  4743.    #include <stdlib.h>
  4744.  
  4745.    void main()
  4746.    {
  4747.       FILE *in = fopen("in.dat", "r");
  4748.       FILE *out = fopen("out.dat", "w");
  4749.       int c;
  4750.       if (in == NULL)
  4751.       {
  4752.            cerr << "Cannot open file 'in.dat' for reading."
  4753.                 << endl;
  4754.            exit(1);
  4755.       }
  4756.       if (out == NULL)
  4757.       {
  4758.            cerr << "Cannot open file 'out.dat' for writing."
  4759.                 << endl;
  4760.            exit(1);
  4761.       }
  4762.       //
  4763.       // Create a stdiostream object attached to "f"
  4764.       //
  4765.       stdiostream sin(in);
  4766.       stdiostream sout(out);
  4767.       cout << "The data contained in the file is: " << endl;
  4768.       //
  4769.       // Now read data from "sin" and copy it to
  4770.       // "cout" and "sout"
  4771.       //
  4772.       while ((c = sin.rdbuf()->sbumpc()) != EOF)
  4773.       {
  4774.          cout << char(c);
  4775.          sout.rdbuf()->sputc(c);
  4776.       }
  4777.       cout << endl;
  4778.    }
  4779.  
  4780. If you run this example with an input file containing the following: 
  4781.  
  4782.    input input input input
  4783.  
  4784. The following output is produced: 
  4785.  
  4786. The data contained in the file is:
  4787.    input input input input
  4788.  
  4789.  
  4790. ΓòÉΓòÉΓòÉ 4.9. streambuf Class ΓòÉΓòÉΓòÉ
  4791.  
  4792. Description 
  4793.  
  4794. Derivation 
  4795.  
  4796. Header File 
  4797.  
  4798. Members 
  4799.  
  4800. To close all the panels in a chapter, double-click on this panel's system menu. 
  4801.  
  4802.  
  4803. ΓòÉΓòÉΓòÉ 4.9.1. Class Description - streambuf ΓòÉΓòÉΓòÉ
  4804.  
  4805. You can use the streambuf class to manipulate objects of its derived classes 
  4806. filebuf, stdiobuf, and strstreambuf, or to derive other classes from it. 
  4807.  
  4808. You can view the topics in this chapter either through the panel on the left, 
  4809. or by selecting from among the following: 
  4810.  
  4811.      streambuf Public and protected interfaces 
  4812.      Public members 
  4813.      Functions that return pointers 
  4814.      Functions that set pointers 
  4815.      Other nonvirtual functions 
  4816.      Virtual functions 
  4817.  
  4818.  
  4819. ΓòÉΓòÉΓòÉ 4.9.2. Derivation ΓòÉΓòÉΓòÉ
  4820.  
  4821. streambuf is the base class for strstream, stdiobuf, and filebuf.  It is not 
  4822. derived from any class. 
  4823.  
  4824.  
  4825. ΓòÉΓòÉΓòÉ 4.9.3. Header File ΓòÉΓòÉΓòÉ
  4826.  
  4827. streambuf is declared in iostream.h. 
  4828.  
  4829.  
  4830. ΓòÉΓòÉΓòÉ 4.9.4. Members ΓòÉΓòÉΓòÉ
  4831.  
  4832. The following members are provided for streambuf: 
  4833.  
  4834.      Constructors for streambuf 
  4835.      Destructor for streambuf 
  4836.      allocate 
  4837.      base 
  4838.      blen 
  4839.      dbp 
  4840.      doallocate 
  4841.      eback 
  4842.      ebuf 
  4843.      egptr 
  4844.      epptr 
  4845.      gbump 
  4846.      gptr 
  4847.      in_avail 
  4848.      out_waiting 
  4849.      overflow 
  4850.      pbackfail 
  4851.      pbase 
  4852.      pbump 
  4853.      pptr 
  4854.      sbumpc 
  4855.      seekoff 
  4856.      seekpos 
  4857.      setb 
  4858.      setbuf 
  4859.      setg 
  4860.      setp 
  4861.      sgetc 
  4862.      sgetn 
  4863.      snextc 
  4864.      sputbackc 
  4865.      sputc 
  4866.      sputn 
  4867.      stossc 
  4868.      sync 
  4869.      unbuffered 
  4870.      underflow 
  4871.  
  4872.  
  4873. ΓòÉΓòÉΓòÉ 4.9.5. streambuf Public and Protected Interfaces ΓòÉΓòÉΓòÉ
  4874.  
  4875. streambuf has both a public interface and a protected interface. You should 
  4876. think of these two interfaces as being two separate classes, because the 
  4877. interfaces are used for different purposes.  You should also treat streambuf as 
  4878. if it were defined as a virtual base class.  Do not create objects of the 
  4879. streambuf class itself. This section describes the ways you can use the two 
  4880. interfaces of streambuf. 
  4881.  
  4882. Although most virtual functions are declared public, you should overload them 
  4883. in the classes that you derive from streambuf, and consider them part of the 
  4884. protected interface. 
  4885.  
  4886.       What is the streambuf public interface? 
  4887.       What is the streambuf protected interface? 
  4888.  
  4889.  
  4890. ΓòÉΓòÉΓòÉ 4.9.5.1. What is the streambuf Public Interface? ΓòÉΓòÉΓòÉ
  4891.  
  4892. You should not create objects of the streambuf public interface directly. 
  4893. Instead, you should use streambuf through one of the predefined classes derived 
  4894. from streambuf.  You can use objects of filebuf, strstreambuf and stdiobuf (the 
  4895. predefined classes derived from streambuf) directly as implementations of 
  4896. stream buffers.  The public interface consists of the streambuf public member 
  4897. functions that can be called on objects of these predefined classes.  streambuf 
  4898. itself does not have any facilities for taking characters from the ultimate 
  4899. producer or sending them to the ultimate consumer.  The specialized member 
  4900. functions that handle the interface with the ultimate producer and the ultimate 
  4901. consumer are defined in filebuf, strstreambuf and stdiobuf. 
  4902.  
  4903. Except for the destructor of the streambuf class, the virtual functions are 
  4904. described as part of the protected interface. 
  4905.  
  4906.  
  4907. ΓòÉΓòÉΓòÉ 4.9.5.2. What is the streambuf Protected Inteface? ΓòÉΓòÉΓòÉ
  4908.  
  4909. Use the streambuf protected interface in the following ways: 
  4910.  
  4911.      As a base class to implement your own specialized stream buffers.  In 
  4912.       this sense you can think of streambuf as a virtual base class.  The 
  4913.       streambuf class only provides the basic functions needed to manipulate 
  4914.       characters in a stream buffer.  The filebuf, strstreambuf and stdiobuf 
  4915.       classes contain functions that handle the interface with the standard 
  4916.       ultimate consumers and producers.  If you want to perform more 
  4917.       sophisticated operations, or if you want to use other ultimate consumers 
  4918.       and ultimate producers, you will have to create your own class derived 
  4919.       from streambuf.  You need to know about the protected interface if you 
  4920.       want to create a class derived from streambuf. 
  4921.  
  4922.      Through a predefined class derived from streambuf. 
  4923.  
  4924.  There are two kinds of functions in the protected interface: 
  4925.  
  4926.      Nonvirtual member functions, which manipulate streambuf objects at a 
  4927.       level of detail that would be inappropriate in the public interface. 
  4928.      Virtual member functions, which permit classes that you derive from 
  4929.       streambuf to customize their operations depending on the ultimate 
  4930.       producer or ultimate consumer.  When you define the virtual functions in 
  4931.       your derived classes, you must ensure that these definitions fulfill the 
  4932.       conditions stated in the descriptions of the virtual functions. If your 
  4933.       definitions of the virtual functions do not fulfill these conditions, 
  4934.       objects of the derived class may have unspecified behavior. Although most 
  4935.       virtual functions are declared as public members, they are described with 
  4936.       the protected interface (with the exception of the destructor for the 
  4937.       streambuf class) because they are meant to be overridden in the classes 
  4938.       that you derive from streambuf. 
  4939.  
  4940.  
  4941. ΓòÉΓòÉΓòÉ 4.9.6. Public Members of the streambuf Public Interface ΓòÉΓòÉΓòÉ
  4942.  
  4943. Note:  The following descriptions assume that the functions are called as part 
  4944. of an object fb of a class derived from streambuf.  fb could, for example, be 
  4945. an object of the class filebuf. It could also be an strstreambuf object or an 
  4946. stdiobuf object. 
  4947.  
  4948. The following member functions are described: 
  4949.  
  4950.      Constructors for streambuf 
  4951.      Destructor for streambuf 
  4952.      in_avail - Return Number of Characters in Get Area 
  4953.      out_waiting - Return Number of Characters in Put Area 
  4954.      sbumpc - Move Get Pointer One Character 
  4955.      sgetc - Return Character After Get Pointer 
  4956.      sgetn - Return Characters Following Get Pointer 
  4957.      snextc - Return Character Following Get Pointer 
  4958.      sputbackc - Move Get Pointer Back One Character 
  4959.      sputc - Store Character After Put Pointer 
  4960.      sputn - Store Characters After Put Pointer 
  4961.      stossc - Move Get Pointer Forward One Character 
  4962.  
  4963.  
  4964. ΓòÉΓòÉΓòÉ 4.9.6.1. Constructors for streambuf ΓòÉΓòÉΓòÉ
  4965.  
  4966. streambuf();
  4967. streambuf(char* buffer, int len);
  4968. streambuf(char* buffer, int len, int c); // obsolete
  4969.  
  4970. There are three versions of the constructor for streambuf. The version with no 
  4971. arguments constructs an empty stream buffer corresponding to an empty sequence. 
  4972. The values returned by base(), eback(), ebuf(), egptr(), epptr(), pptr(), 
  4973. gptr(), and pbase() are initially all zero for this stream buffer. 
  4974.  
  4975. The version with two arguments constructs an empty stream buffer of length len 
  4976. starting at the position pointed to by buffer. 
  4977.  
  4978. The version of the constructor with three arguments is obsolete. It is included 
  4979. in the I/O Stream Library for compatibility with the AT&T C++ Language System 
  4980. Release 1.2. 
  4981.  
  4982.  
  4983. ΓòÉΓòÉΓòÉ 4.9.6.2. Destructor for streambuf ΓòÉΓòÉΓòÉ
  4984.  
  4985. virtual ~streambuf();
  4986.  
  4987. The destructor for streambuf calls sync(). If a stream buffer has been set up 
  4988. and ios::alloc is set, sync() deletes the stream buffer. 
  4989.  
  4990.  
  4991. ΓòÉΓòÉΓòÉ 4.9.6.3. in_avail ΓòÉΓòÉΓòÉ
  4992.  
  4993. int in_avail();
  4994.  
  4995. in_avail() returns the number of characters that are available to be extracted 
  4996. from the get area of fb. You can extract the number of characters equal to the 
  4997. value that in_avail() returns without causing an error. 
  4998.  
  4999.  
  5000. ΓòÉΓòÉΓòÉ 4.9.6.4. out_waiting ΓòÉΓòÉΓòÉ
  5001.  
  5002. int out_waiting();
  5003.  
  5004. out_waiting() returns the number of characters that are in the put area waiting 
  5005. to be sent to the ultimate consumer. 
  5006.  
  5007.  
  5008. ΓòÉΓòÉΓòÉ 4.9.6.5. sbumpc ΓòÉΓòÉΓòÉ
  5009.  
  5010. int sbumpc();
  5011.  
  5012. sbumpc() moves the get pointer past one character and returns the character 
  5013. that it moved past.  sbumpc() returns EOF if the get pointer is already at the 
  5014. end of the get area. 
  5015.  
  5016.  
  5017. ΓòÉΓòÉΓòÉ 4.9.6.6. sgetc ΓòÉΓòÉΓòÉ
  5018.  
  5019. int sgetc();
  5020.  
  5021. sgetc() returns the character after the get pointer without moving the get 
  5022. pointer itself. If no character is available, sgetc() returns EOF. 
  5023.  
  5024. Note:  sgetc() does not change the position of the get pointer. 
  5025.  
  5026.  
  5027. ΓòÉΓòÉΓòÉ 4.9.6.7. sgetn ΓòÉΓòÉΓòÉ
  5028.  
  5029. int sgetn(char* ptr, int n);
  5030.  
  5031. sgetn() extracts the n characters following the get pointer, and copies them to 
  5032. the area starting at the position pointed to by ptr. If there are fewer than n 
  5033. characters following the get pointer, sgetn() takes the characters that are 
  5034. available and stores them in the position pointed to by ptr.  sgetn() 
  5035. repositions the get pointer following the extracted characters and returns the 
  5036. number of extracted characters. 
  5037.  
  5038.  
  5039. ΓòÉΓòÉΓòÉ 4.9.6.8. snextc ΓòÉΓòÉΓòÉ
  5040.  
  5041. int snextc();
  5042.  
  5043. snextc() moves the get pointer forward one character and returns the character 
  5044. following the new position of the get pointer.  snextc() returns EOF if the get 
  5045. pointer is at the end of the get area either before or after it is moved 
  5046. forward. 
  5047.  
  5048.  
  5049. ΓòÉΓòÉΓòÉ 4.9.6.9. sputbackc ΓòÉΓòÉΓòÉ
  5050.  
  5051. int sputbackc(char c);
  5052.  
  5053. sputbackc() moves the get pointer back one character. The get pointer may 
  5054. simply move, or the ultimate producer may rearrange the internal data 
  5055. structures so that the character c is saved. The argument c must equal the 
  5056. character that precedes the get pointer in the stream buffer. The effect of 
  5057. sputbackc() is undefined if c is not equal to the character before the get 
  5058. pointer.  sputbackc() returns EOF if an error occurs. The conditions that cause 
  5059. errors depend on the derived class. 
  5060.  
  5061.  
  5062. ΓòÉΓòÉΓòÉ 4.9.6.10. sputc ΓòÉΓòÉΓòÉ
  5063.  
  5064. int sputc(int c);
  5065.  
  5066. sputc() stores the argument c after the put pointer and moves the put pointer 
  5067. past the stored character. If there is enough space in the stream buffer, this 
  5068. will extend the size of the put area.  sputc() returns EOF if an error occurs. 
  5069. The conditions that cause errors depend on the derived class. 
  5070.  
  5071.  
  5072. ΓòÉΓòÉΓòÉ 4.9.6.11. sputn ΓòÉΓòÉΓòÉ
  5073.  
  5074. int sputn(const char* s, int n);
  5075.  
  5076. sputn() stores the n characters starting at s after the put pointer and moves 
  5077. the put pointer to the end of the series.  sputn() returns the number of 
  5078. characters successfully stored. If an error occurs, sputn() returns a value 
  5079. less than n. 
  5080.  
  5081.  
  5082. ΓòÉΓòÉΓòÉ 4.9.6.12. stossc ΓòÉΓòÉΓòÉ
  5083.  
  5084. void stossc();
  5085.  
  5086. stossc() moves the get pointer forward one character. If the get pointer is 
  5087. already at the end of the get area, stossc() does not move it. 
  5088.  
  5089.  
  5090. ΓòÉΓòÉΓòÉ 4.9.7. Protected Functions That Return Pointers ΓòÉΓòÉΓòÉ
  5091.  
  5092. This section describes the functions in the protected interface of streambuf 
  5093. that return pointers to boundaries of areas in a stream buffer. 
  5094.  
  5095. Note:  The following descriptions assume that the functions are called as part 
  5096. of an object called dsb, which is an object of a class that is derived from 
  5097. streambuf. 
  5098.  
  5099. The following functions are described: 
  5100.  
  5101.      base - Return pointer to beginning of stream buffer 
  5102.      eback - Return pointer to beginning of putback area 
  5103.      ebuf - Return pointer to end of stream buffer 
  5104.      egptr - Return pointer to end of get area 
  5105.      epptr - Return pointer to end of put area 
  5106.      gptr - Return pointer to beginning of get area 
  5107.      pbase - Return pointer to beginning of space available for put area 
  5108.      pptr - Return pointer to beginning of put area 
  5109.  
  5110.  
  5111. ΓòÉΓòÉΓòÉ 4.9.7.1. base ΓòÉΓòÉΓòÉ
  5112.  
  5113. char* base();
  5114.  
  5115. base() returns a pointer to the first byte of the stream buffer. The stream 
  5116. buffer consists of the space between the pointer returned by base() and the 
  5117. pointer returned by ebuf(). 
  5118.  
  5119.  
  5120. ΓòÉΓòÉΓòÉ 4.9.7.2. eback ΓòÉΓòÉΓòÉ
  5121.  
  5122. char* eback();
  5123.  
  5124. eback() returns a pointer to the lower bound of the space available for the get 
  5125. area of dsb. The space between the pointer returned by eback() and the pointer 
  5126. returned by gptr() is available for putback. 
  5127.  
  5128.  
  5129. ΓòÉΓòÉΓòÉ 4.9.7.3. ebuf ΓòÉΓòÉΓòÉ
  5130.  
  5131. char* ebuf();
  5132.  
  5133. ebuf() returns a pointer to the byte after the last byte of the stream buffer. 
  5134.  
  5135.  
  5136. ΓòÉΓòÉΓòÉ 4.9.7.4. egptr ΓòÉΓòÉΓòÉ
  5137.  
  5138. char* egptr();
  5139.  
  5140. egptr() returns a pointer to the byte after the last byte of the get area of 
  5141. dsb. 
  5142.  
  5143.  
  5144. ΓòÉΓòÉΓòÉ 4.9.7.5. epptr ΓòÉΓòÉΓòÉ
  5145.  
  5146. char* epptr();
  5147.  
  5148. epptr() returns a pointer to the byte after the last byte of the put area of 
  5149. dsb. 
  5150.  
  5151.  
  5152. ΓòÉΓòÉΓòÉ 4.9.7.6. gptr ΓòÉΓòÉΓòÉ
  5153.  
  5154. char* gptr();
  5155.  
  5156. gptr() returns a pointer to the first byte of the get area of dsb. The get area 
  5157. consists of the space between the pointer returned by gptr() and the pointer 
  5158. returned by egptr(). Characters are extracted from the stream buffer beginning 
  5159. at the character pointed to by gptr(). 
  5160.  
  5161.  
  5162. ΓòÉΓòÉΓòÉ 4.9.7.7. pbase ΓòÉΓòÉΓòÉ
  5163.  
  5164. char* pbase();
  5165.  
  5166. pbase() returns a pointer to the beginning of the space available for the put 
  5167. area of dsb. Characters between the pointer returned by pbase() and the pointer 
  5168. returned by pptr() have been stored in the stream buffer, but they have not 
  5169. been consumed by the ultimate consumer. 
  5170.  
  5171.  
  5172. ΓòÉΓòÉΓòÉ 4.9.7.8. pptr ΓòÉΓòÉΓòÉ
  5173.  
  5174. char* pptr();
  5175.  
  5176. pptr() returns a pointer to the beginning of the put area of dsb. The put area 
  5177. consists of the space between the pointer returned by pptr() and the pointer 
  5178. returned by epptr(). 
  5179.  
  5180.  
  5181. ΓòÉΓòÉΓòÉ 4.9.8. Protected Functions That Set Pointers ΓòÉΓòÉΓòÉ
  5182.  
  5183. This section describes the functions in the protected interface of streambuf 
  5184. that set the boundaries of areas in a stream buffer. The values of these 
  5185. boundaries are returned by the functions described in Protected Functions That 
  5186. Return Pointers. 
  5187.  
  5188. Note:  The following descriptions assume that the functions are called as part 
  5189. of an object called dsb which is an object of a class that is derived from 
  5190. streambuf. 
  5191.  
  5192. The following functions are described: 
  5193.  
  5194.      setb - Set boundaries of stream buffer 
  5195.      setp - Set boundaries of put area 
  5196.      setg - Set boundaries of get area 
  5197.  
  5198.  
  5199. ΓòÉΓòÉΓòÉ 4.9.8.1. setb ΓòÉΓòÉΓòÉ
  5200.  
  5201. void setb(char* startbuf, char* endbuf, int delbuf = 0);
  5202.  
  5203. setb() sets the beginning of the existing stream buffer (the pointer returned 
  5204. by dsb.base()) to the position pointed to by startbuf, and sets the end of the 
  5205. stream buffer (the pointer returned by dsb.ebuf()) to the position pointed to 
  5206. by endbuf. 
  5207.  
  5208. If delbuf is a nonzero value, the stream buffer will be deleted when setb() is 
  5209. called again. If startbuf and endbuf are both equal to 0, no stream buffer is 
  5210. established. If startbuf is not equal to 0, a stream buffer is established, 
  5211. even if endbuf is less than startbuf. If this is the case, the stream buffer 
  5212. has length zero. 
  5213.  
  5214.  
  5215. ΓòÉΓòÉΓòÉ 4.9.8.2. setg ΓòÉΓòÉΓòÉ
  5216.  
  5217. void setg(char* startpbk, char* startget, char* endget);
  5218.  
  5219. setg() sets the beginning of the get area of dsb (the pointer returned by 
  5220. dsb.gptr()) to startget, and sets the end of the get area (the pointer returned 
  5221. by dsb.egptr()) to endget. setg() also sets the beginning of the area available 
  5222. for putback (the pointer returned by dsb.eback()) to startpbk. 
  5223.  
  5224.  
  5225. ΓòÉΓòÉΓòÉ 4.9.8.3. setp ΓòÉΓòÉΓòÉ
  5226.  
  5227. void setp(char* startput, char* endput);
  5228.  
  5229. setp()sets the spaces available for the put area. Both the start (pbase()) and 
  5230. the beginning (pptr()) of the put area are set to the value startput. See 
  5231. figure The Structure of Stream Buffers for details on where each of these 
  5232. functions points to within the stream buffer. 
  5233.  
  5234. setp() sets the beginning of the put area of dsb (the pointer returned by 
  5235. dsb.pptr()) to the position pointed to by startput, and sets the end of the put 
  5236. area (the pointer returned by dsb.epptr()) to the position pointed to by 
  5237. endput. 
  5238.  
  5239.  
  5240. ΓòÉΓòÉΓòÉ 4.9.9. Other Nonvirtual Protected Member Functions ΓòÉΓòÉΓòÉ
  5241.  
  5242. This section describes the remaining nonvirtual member functions that make up 
  5243. the protected interface of streambuf. 
  5244.  
  5245. Note:  The following descriptions assume that the functions are called as part 
  5246. of an object called dsb which is an object of a class that is derived from 
  5247. streambuf. 
  5248.  
  5249. The following functions are described: 
  5250.  
  5251.      allocate - Set up a stream buffer 
  5252.      blen - Return length of stream buffer 
  5253.      dbp - Record stream buffer status 
  5254.      gbump - Move beginning of get area 
  5255.      pbump - Move beginning of put area 
  5256.      unbuffered - Buffering state 
  5257.  
  5258.  
  5259. ΓòÉΓòÉΓòÉ 4.9.9.1. allocate ΓòÉΓòÉΓòÉ
  5260.  
  5261. int allocate();
  5262.  
  5263. allocate() attempts to set up a stream buffer. allocate() returns the following 
  5264. values: 
  5265.  
  5266.      0, if dsb already has a stream buffer set up (that is, dsb->base() 
  5267.       returns a nonzero value), or if unbuffered() returns a nonzero value. 
  5268.       allocate() does not do any further processing if it returns 0. 
  5269.      1, if allocate() does set up a stream buffer. 
  5270.      EOF, if the attempt to allocate space for the stream buffer fails. 
  5271.  
  5272.  allocate() is not called by any other nonvirtual member function of streambuf. 
  5273.  
  5274.  
  5275. ΓòÉΓòÉΓòÉ 4.9.9.2. blen ΓòÉΓòÉΓòÉ
  5276.  
  5277. int blen() const;
  5278.  
  5279. blen() returns the length (in bytes) of the stream buffer. 
  5280.  
  5281.  
  5282. ΓòÉΓòÉΓòÉ 4.9.9.3. dbp ΓòÉΓòÉΓòÉ
  5283.  
  5284. void dbp();
  5285.  
  5286. dbp() writes to standard output the values returned by the following functions: 
  5287.  
  5288.      base() 
  5289.      eback() 
  5290.      ebuf() 
  5291.      egptr() 
  5292.      epptr() 
  5293.      gptr() 
  5294.      pptr() 
  5295.  
  5296.  dbp() is intended for debugging. streambuf does not specify anything about the 
  5297.  form of the output. dbp() is considered part of the protected interface 
  5298.  because the information that it prints can only be understood in relation to 
  5299.  that interface. It is declared as a public function so that it can be called 
  5300.  anywhere during debugging. 
  5301.  
  5302.  The following example shows the output produced by dbp() when it is called as 
  5303.  part of a filebuf object: 
  5304.  
  5305.      #include <iostream.h>
  5306.      void main()
  5307.      {
  5308.         cout << "Here is some sample output." << endl;
  5309.         cout.rdbuf()->dbp();
  5310.      }
  5311.  
  5312.  If you compile and run this example, your output will look like this: 
  5313.  
  5314.      Here is some sample output.
  5315.      buf at 0x90210, base=0x91010, ebuf=0x91410,
  5316.      pptr=0x91010, epptr=0x91410, eback=0, gptr=0, egptr=0
  5317.  
  5318.  
  5319. ΓòÉΓòÉΓòÉ 4.9.9.4. gbump ΓòÉΓòÉΓòÉ
  5320.  
  5321. void gbump(int offset);
  5322.  
  5323. gbump() offsets the beginning of the get area by the value of offset. The value 
  5324. of offset can be positive or negative. gbump() does not check to see if the new 
  5325. value returned by gptr() is valid. 
  5326.  
  5327. The beginning of the get area is equal to the value returned by gptr(). 
  5328.  
  5329.  
  5330. ΓòÉΓòÉΓòÉ 4.9.9.5. pbump ΓòÉΓòÉΓòÉ
  5331.  
  5332. void pbump(int offset);
  5333.  
  5334. pbump() offsets the beginning of the put area by the value of offset. The value 
  5335. of offset can be positive or negative. pbump() does not check to see if the new 
  5336. value returned by pptr() is valid. 
  5337.  
  5338. The beginning of the put area is equal to the value returned by pptr(). 
  5339.  
  5340.  
  5341. ΓòÉΓòÉΓòÉ 4.9.9.6. unbuffered ΓòÉΓòÉΓòÉ
  5342.  
  5343. int unbuffered() const;
  5344. void unbuffered(int buffstate);
  5345.  
  5346. unbuffered() manipulates the private streambuf variable called the buffering 
  5347. state. If the buffering state is nonzero, a call to allocate() does not set up 
  5348. a stream buffer. 
  5349.  
  5350. There are two versions of unbuffered(). The version that takes no arguments 
  5351. returns the current value of the buffering state. The version that takes an 
  5352. argument, buffstate, changes the value of the buffering state to buffstate. 
  5353.  
  5354.  
  5355. ΓòÉΓòÉΓòÉ 4.9.10. Protected Virtual Member Functions ΓòÉΓòÉΓòÉ
  5356.  
  5357. This section describes the virtual functions in the protected interface of 
  5358. streambuf. Although these virtual functions have default definitions in 
  5359. streambuf, they can be overridden in classes that are derived from streambuf. 
  5360. The following descriptions state the default definition of each function and 
  5361. the expected behavior for these functions in classes where they are overridden. 
  5362.  
  5363. Note:  The following descriptions assume that the functions are called as part 
  5364. of an object called dsb, which is an object of a class that is derived from 
  5365. streambuf. 
  5366.  
  5367. The following functions are described: 
  5368.  
  5369.      doallocate - Allocate space for a stream buffer 
  5370.      overflow -  Clear put area 
  5371.      pbackfail - Deal with full putback area 
  5372.      seekoff - Reposition external get or put pointer 
  5373.      seekpos - Reposition external get or put pointer 
  5374.      setbuf - Set up stream buffer 
  5375.      sync - Synchronize stream buffer and ultimate producer or ultimate 
  5376.       consumer 
  5377.      underflow - Fill get area. 
  5378.  
  5379.  
  5380. ΓòÉΓòÉΓòÉ 4.9.10.1. doallocate ΓòÉΓòÉΓòÉ
  5381.  
  5382. virtual int doallocate();
  5383.  
  5384. doallocate() is called when allocate() determines that space is needed for a 
  5385. stream buffer. 
  5386.  
  5387. The default definition of doallocate() attempts to allocate space for a stream 
  5388. buffer using the operator new. 
  5389.  
  5390. If you define your own version of doallocate(), it must call setb() to provide 
  5391. space for a stream buffer or return EOF if it cannot allocate space. 
  5392. doallocate() should only be called if unbuffered() and base() return zero. 
  5393.  
  5394. In your own version of doallocate(), you provide the size of the buffer for 
  5395. your constructor.  Assign the buffer size you want to to a variable using a 
  5396. #define statement.  This variable can then be used in the constructor for your 
  5397. doallocate() function to define the size of the buffer. 
  5398.  
  5399.  
  5400. ΓòÉΓòÉΓòÉ 4.9.10.2. overflow ΓòÉΓòÉΓòÉ
  5401.  
  5402. virtual int overflow(int c = EOF);
  5403.  
  5404. overflow() is called when the put area is full, and an attempt is made to store 
  5405. another character in it. overflow() may be called at other times. 
  5406.  
  5407. The default definition of overflow() is compatible with the AT&T C++ Language 
  5408. System Release 1.2 version of the stream package, but it is not considered part 
  5409. of the current I/O Stream Library. Thus, the default definition of overflow() 
  5410. should not be used, and every class derived from streambuf should define 
  5411. overflow() itself. 
  5412.  
  5413. The definition of overflow() in your classes derived from streambuf should 
  5414. cause the ultimate consumer to consume the characters in the put area, call 
  5415. setp() to establish a new put area, and store the argument c in the put area if 
  5416. c does not equal EOF. overflow() should return EOF if an error occurs, and it 
  5417. should return a value not equal to EOF otherwise. 
  5418.  
  5419.  
  5420. ΓòÉΓòÉΓòÉ 4.9.10.3. pbackfail ΓòÉΓòÉΓòÉ
  5421.  
  5422. virtual int pbackfail(int c);
  5423.  
  5424. pbackfail() is called when both of the following conditions are true: 
  5425.  
  5426.      An attempt has been made to put back a character. 
  5427.      There is no room in the putback area. The pointer returned by eback() 
  5428.       equals the pointer returned by gptr(). 
  5429.  
  5430.  The default definition of pbackfail() returns EOF. 
  5431.  
  5432.  If you define pbackfail() in your own classes, your definition of pbackfail() 
  5433.  should attempt to deal with the full putback area by, for instance, 
  5434.  repositioning the get pointer of the ultimate producer. If this is possible, 
  5435.  pbackfail() should return the argument c. If not, pbackfail() should return 
  5436.  EOF. 
  5437.  
  5438.  
  5439. ΓòÉΓòÉΓòÉ 4.9.10.4. seekoff ΓòÉΓòÉΓòÉ
  5440.  
  5441. virtual streampos seekoff(streamoff so, seek_dir dir,
  5442.           int mode = ios::in|ios::out);
  5443.  
  5444. seekoff() repositions the get or put pointer of the ultimate producer or 
  5445. ultimate consumer. seekoff() does not change the values returned by dsb.gptr() 
  5446. or dsb.pptr(). 
  5447.  
  5448. The default  definition of seekoff() returns EOF. 
  5449.  
  5450. If you define your own seekoff() function, it should return EOF if the derived 
  5451. class does not support repositioning. If the class does support repositioning, 
  5452. seekoff() should return the new position of the affected pointer, or EOF if an 
  5453. error occurs. so is an offset from a position in the ultimate producer or 
  5454. ultimate consumer. dir is a position in the ultimate producer or ultimate 
  5455. consumer. dir can have the following values: 
  5456.  
  5457.      ios::beg: the beginning of the ultimate producer or ultimate consumer 
  5458.      ios::cur: the current position in the ultimate producer or ultimate 
  5459.       consumer 
  5460.      ios::end: the end of the ultimate producer or ultimate consumer 
  5461.  
  5462.  The new position of the affected pointer is the position specified by dir 
  5463.  offset by the value of so. If you derive your own classes from streambuf, 
  5464.  certain values of dir may not be valid depending on the nature of the ultimate 
  5465.  consumer or producer. 
  5466.  
  5467.  If ios::in is set in mode, the seekoff() should modify the get pointer. If 
  5468.  ios::out is set in mode, the put pointer should be modified. If both ios::in 
  5469.  and ios::out are set, both the get pointer and the put pointer should be 
  5470.  modified. 
  5471.  
  5472.  
  5473. ΓòÉΓòÉΓòÉ 4.9.10.5. seekpos ΓòÉΓòÉΓòÉ
  5474.  
  5475. virtual streampos seekpos(streampos pos,
  5476.           int mode = ios::in|ios::out);
  5477.  
  5478. seekpos() repositions the get or put pointer of the ultimate producer or 
  5479. ultimate consumer to the position pos. If ios::in is set in mode, the get 
  5480. pointer is repositioned. If ios::out is set in mode, the put pointer is 
  5481. repositioned. If both ios::in and ios::out are set, both the get pointer and 
  5482. the put pointer are affected. seekpos() does not change the values returned by 
  5483. dsb.gptr() or dsb.pptr(). 
  5484.  
  5485. The default definition of seekpos() returns the return value of the function 
  5486. seekoff(streamoff(pos), ios::beg, mode). Thus, if you want to define seeking 
  5487. operations in a class derived from streambuf, you can define seekoff() and use 
  5488. the default definition of seekpos(). 
  5489.  
  5490. If you define seekpos() in a class derived from streambuf, seekpos() should 
  5491. return EOF if the class does not support repositioning or if pos points to a 
  5492. position equal to or greater than the end of the stream. If not, seekpos() 
  5493. should return pos. 
  5494.  
  5495.  
  5496. ΓòÉΓòÉΓòÉ 4.9.10.6. setbuf ΓòÉΓòÉΓòÉ
  5497.  
  5498. virtual streambuf* setbuf(char* ptr, int len);
  5499. streambuf* setbuf(unsigned char* ptr, int len);
  5500. streambuf* setbuf(char* ptr, int len, int count); // obsolete
  5501.  
  5502. There are three versions of setbuf(). The two versions that take two arguments 
  5503. set up a stream buffer consisting of the array of bytes starting at ptr with 
  5504. length len. 
  5505.  
  5506. This function is different from setb().  setb() sets pointers to an existing 
  5507. stream buffer.  setbuf(), however, creates the stream buffer. The version of 
  5508. setbuf() that takes three arguments is obsolete. The I/O Stream Library 
  5509. includes it to be compatible with AT&T C++ Language System Release 1.2. 
  5510.  
  5511. The default definition of setbuf() sets up the stream buffer if the streambuf 
  5512. object does not already have a stream buffer. 
  5513.  
  5514. If you define setbuf() in a class derived from streambuf, setbuf() can either 
  5515. accept or ignore a request for an unbuffered streambuf object. The call to 
  5516. setbuf() is a request for an unbuffered streambuf object if ptr equals 0 or len 
  5517. equals 0. setbuf() should return a pointer to sb if it accepts the request, and 
  5518. 0 otherwise. 
  5519.  
  5520.  
  5521. ΓòÉΓòÉΓòÉ 4.9.10.7. sync ΓòÉΓòÉΓòÉ
  5522.  
  5523. virtual int sync();
  5524.  
  5525. sync() synchronizes the stream buffer with the ultimate producer or the 
  5526. ultimate consumer. 
  5527.  
  5528. The default definition of sync() returns 0 if either of the following 
  5529. conditions is true: 
  5530.  
  5531.      The get area is empty and there are no characters waiting to go to the 
  5532.       ultimate consumer 
  5533.      No stream buffer has been allocated for sb. 
  5534.  
  5535.  Otherwise, sync() returns EOF. 
  5536.  
  5537.  If you define sync() in a class derived from streambuf, it should send any 
  5538.  characters that are stored in the put area to the ultimate consumer, and (if 
  5539.  possible) send any characters that are waiting in the get area back to the 
  5540.  ultimate producer. When sync() returns, both the put area and the get area 
  5541.  should be empty. sync() should return EOF if an error occurs. 
  5542.  
  5543.  
  5544. ΓòÉΓòÉΓòÉ 4.9.10.8. underflow ΓòÉΓòÉΓòÉ
  5545.  
  5546. virtual int underflow();
  5547.  
  5548. underflow() takes characters from the ultimate producer and puts them in the 
  5549. get area. 
  5550.  
  5551. The default definition of underflow() is compatible with the AT&T C++ Language 
  5552. System Release 1.2 version version of the stream package, but it is not 
  5553. considered part of the current I/O Stream Library. Thus, the default definition 
  5554. of underflow() should not be used, and every class derived from streambuf 
  5555. should define underflow() itself. 
  5556.  
  5557. If you define underflow() in a class derived from streambuf, it should return 
  5558. the first character in the get area if the get area is not empty. If the get 
  5559. area is empty, underflow() should create a get area that is not empty and 
  5560. return the next character. If no more characters are available in the ultimate 
  5561. producer, underflow() should return EOF and leave the get area empty. 
  5562.  
  5563.  
  5564. ΓòÉΓòÉΓòÉ 4.10. strstream, istrstream, and ostrstream Classes ΓòÉΓòÉΓòÉ
  5565.  
  5566. Description 
  5567.  
  5568. Derivation 
  5569.  
  5570. Header File 
  5571.  
  5572. Members 
  5573.  
  5574. To close all the panels in a chapter, double-click on this panel's system menu. 
  5575.  
  5576.  
  5577. ΓòÉΓòÉΓòÉ 4.10.1. Class Description - strstream, istrstream, and ostrstream ΓòÉΓòÉΓòÉ
  5578.  
  5579. This chapter describes istrstream, ostrsteam, and strstream, the classes that 
  5580. specialize istream, ostream, and iostream (respectively) to use strstreambuf 
  5581. objects for stream buffers. These classes are called the array stream buffer 
  5582. classes because their stream buffers are arrays of bytes in memory. You can use 
  5583. these classes to perform input and output with strings in memory. 
  5584.  
  5585. This chapter also describes strstreambase, the class from which the array 
  5586. stream buffer classes are derived. 
  5587.  
  5588. You can view the topics in this chapter either through the panel on the left, 
  5589. or by selecting the information for a specific class from the list below: 
  5590.  
  5591.      strstreambase class 
  5592.      strstream class 
  5593.      istrstream class 
  5594.      ostrstream class 
  5595.  
  5596.  
  5597. ΓòÉΓòÉΓòÉ 4.10.2. Derivation ΓòÉΓòÉΓòÉ
  5598.  
  5599. ios 
  5600.  
  5601.    istream
  5602.    ostream
  5603.      iostream
  5604.         strstream
  5605.  
  5606. ios 
  5607.  
  5608.    istream
  5609.      istrstream
  5610.  
  5611. ios 
  5612.  
  5613.    ostream
  5614.      ostrstream
  5615.  
  5616.  
  5617. ΓòÉΓòÉΓòÉ 4.10.3. Header File ΓòÉΓòÉΓòÉ
  5618.  
  5619. strstream, istrstream, and ostrstream are declared in strstrea.h. 
  5620.  
  5621.  
  5622. ΓòÉΓòÉΓòÉ 4.10.4. Members ΓòÉΓòÉΓòÉ
  5623.  
  5624. The following members are provided for strstream, istrstream, and ostrstream: 
  5625.  
  5626.      Constructors for istrstream 
  5627.      Destructor for istrstream 
  5628.      Constructors for ostrstream 
  5629.      Destructor for ostrstream 
  5630.      Constructor for strstream 
  5631.      Destructor for strstream 
  5632.      pcount 
  5633.      rdbuf 
  5634.      str 
  5635.      str 
  5636.  
  5637.  
  5638. ΓòÉΓòÉΓòÉ 4.10.5. strstreambase ΓòÉΓòÉΓòÉ
  5639.  
  5640. Description 
  5641.  
  5642. Members 
  5643.  
  5644. To close all the panels in a chapter, double-click on this panel's system menu. 
  5645.  
  5646.  
  5647. ΓòÉΓòÉΓòÉ 4.10.6. Class Description - strstreambase ΓòÉΓòÉΓòÉ
  5648.  
  5649. Note:  The strstreambase class is an internal class that provides common 
  5650. functions for the classes that are derived from it. Do not use the 
  5651. strstreambase class directly. The following description is provided so that you 
  5652. can use the function as part of istrstream, ostrsteam, and strstream objects. 
  5653.  
  5654.  
  5655. ΓòÉΓòÉΓòÉ 4.10.6.1. Public Members of strstreambase ΓòÉΓòÉΓòÉ
  5656.  
  5657. strstreambase implements the rdbuf function. 
  5658.  
  5659.  
  5660. ΓòÉΓòÉΓòÉ 4.10.6.1.1. rdbuf ΓòÉΓòÉΓòÉ
  5661.  
  5662. strstreambuf* rdbuf();
  5663.  
  5664. rdbuf() returns a pointer to the stream buffer that the strstreambase object is 
  5665. attached to. 
  5666.  
  5667.  
  5668. ΓòÉΓòÉΓòÉ 4.10.7. strstream ΓòÉΓòÉΓòÉ
  5669.  
  5670. Description 
  5671.  
  5672. Members 
  5673.  
  5674. To close all the panels in a chapter, double-click on this panel's system menu. 
  5675.  
  5676.  
  5677. ΓòÉΓòÉΓòÉ 4.10.8. Class Description - strstream ΓòÉΓòÉΓòÉ
  5678.  
  5679. strstream is the class that specializes iostream for input and output with 
  5680. arrays of characters in memory. You can create an strstream object by 
  5681. associating the object with a previously allocated array of characters.  You 
  5682. can then write output to it, read input from it, and apply other operations to 
  5683. it just as you would to another type of stream. 
  5684.  
  5685.  
  5686. ΓòÉΓòÉΓòÉ 4.10.8.1. Public Members ΓòÉΓòÉΓòÉ
  5687.  
  5688.      Constructor for strstream 
  5689.      Destructor for strstream 
  5690.      str - return pointer to stream buffer array 
  5691.  
  5692.  You can view an example of using the strstream class in the Open Class Library 
  5693.  User's Guide. 
  5694.  
  5695.  
  5696. ΓòÉΓòÉΓòÉ 4.10.8.1.1. Constructor for strstream ΓòÉΓòÉΓòÉ
  5697.  
  5698. strstream();
  5699. strstream(char* cp, int len, int mode);
  5700. strstream(signed char* cp, int len, int mode);
  5701. strstream(unsigned char* cp, int len, int mode);
  5702.  
  5703. There are two versions of the strstream constructor. The version that takes no 
  5704. arguments specifies that space is allocated dynamically for the stream buffer 
  5705. that is attached to the strstream object. 
  5706.  
  5707. The version of the strstream constructor that takes three arguments specifies 
  5708. that characters should be extracted and inserted into the array of bytes that 
  5709. starts at the position pointed to by cp with a length of len bytes. If ios::ate 
  5710. or ios::app is set in mode, cp points to a null-terminated string and 
  5711. insertions begin at the null character. Otherwise, insertions begin at the 
  5712. position pointed to by cp. You can use the istream::seekg() function to 
  5713. reposition the get pointer anywhere in this array. 
  5714.  
  5715.  
  5716. ΓòÉΓòÉΓòÉ 4.10.8.1.2. Destructor for strstream ΓòÉΓòÉΓòÉ
  5717.  
  5718. ~strstream();
  5719.  
  5720. The strstream destructor frees the space allocated by the strstream 
  5721. constructor. 
  5722.  
  5723.  
  5724. ΓòÉΓòÉΓòÉ 4.10.8.1.3. str ΓòÉΓòÉΓòÉ
  5725.  
  5726. char* str();
  5727.  
  5728. str() returns a pointer to the stream buffer attached to the strstream and 
  5729. calls freeze() with a nonzero value to prevent the stream buffer from being 
  5730. deleted. If the stream buffer was constructed with an explicit array, the value 
  5731. returned is a pointer to that array. If the stream buffer was constructed in 
  5732. dynamic mode, cp points to the dynamically allocated area. 
  5733.  
  5734. Until you call str(), deleting the dynamically allocated stream buffer is the 
  5735. responsibility of the strstream object. After str() has been called, the 
  5736. calling application has responsibility for the dynamically allocated stream 
  5737. buffer. 
  5738.  
  5739. Note:  If your application calls str() without calling freeze() with a nonzero 
  5740. argument (to unfreeze the strstream), or without explicitly deleting the array 
  5741. of characters returned by the call to str(), the array of characters will not 
  5742. be deallocated by the strstream when it is destroyed. This situation is a 
  5743. potential source of a memory leak. 
  5744.  
  5745.  
  5746. ΓòÉΓòÉΓòÉ 4.10.9. istrstream ΓòÉΓòÉΓòÉ
  5747.  
  5748. Description 
  5749.  
  5750. To close all the panels in a chapter, double-click on this panel's system menu. 
  5751.  
  5752.  
  5753. ΓòÉΓòÉΓòÉ 4.10.10. Class Description - istrstream ΓòÉΓòÉΓòÉ
  5754.  
  5755. The following functions are described: 
  5756.  
  5757.      Constructors for istrstream 
  5758.      Destructor for istrstream 
  5759.  
  5760.  
  5761. ΓòÉΓòÉΓòÉ 4.10.10.1. Constructors for istrstream ΓòÉΓòÉΓòÉ
  5762.  
  5763. istrstream(char* cp);
  5764. istrstream(signed char* cp);
  5765. istrstream(unsigned char* cp);
  5766. istrstream(const char* cp);
  5767. istrstream(const signed char* cp);
  5768. istrstream(const unsigned char* cp);
  5769. istrstream(char* cp, int len);
  5770. istrstream(signed char* cp, int len);
  5771. istrstream(unsigned char* cp, int len);
  5772. istrstream(const char* cp, int len);
  5773. istrstream(const signed char* cp, int len);
  5774. istrstream(const unsigned char* cp, int len);
  5775.  
  5776. The versions of the istrstream constructor that take one argument specify that 
  5777. characters should be extracted from the null-terminated string that is pointed 
  5778. to by cp. You can use the istream::seekg() function to reposition the get 
  5779. pointer in this string. 
  5780.  
  5781. The versions of the istrstream constructor that take two arguments specify that 
  5782. characters should be extracted from the array of bytes that starts at the 
  5783. position pointed to by cp and has a length of len bytes. You can use 
  5784. istream::seekg() to reposition the get pointer anywhere in this array. 
  5785.  
  5786.  
  5787. ΓòÉΓòÉΓòÉ 4.10.10.2. Destructor for istrstream ΓòÉΓòÉΓòÉ
  5788.  
  5789. ~istrstream();
  5790.  
  5791. The istrstream destructor frees space that was allocated by the istrstream 
  5792. constructor. 
  5793.  
  5794.  
  5795. ΓòÉΓòÉΓòÉ 4.10.11. ostrstream ΓòÉΓòÉΓòÉ
  5796.  
  5797. Description 
  5798.  
  5799. To close all the panels in a chapter, double-click on this panel's system menu. 
  5800.  
  5801.  
  5802. ΓòÉΓòÉΓòÉ 4.10.12. Class Description - ostrstream ΓòÉΓòÉΓòÉ
  5803.  
  5804. The following functions are described: 
  5805.  
  5806.      Constructors for ostrstream 
  5807.      Destructor for ostrstream 
  5808.      str - return pointer to stream buffer array 
  5809.      pcount - return number of characters in stream buffer 
  5810.  
  5811.  
  5812. ΓòÉΓòÉΓòÉ 4.10.12.1. Constructors for ostrstream ΓòÉΓòÉΓòÉ
  5813.  
  5814. ostrstream();
  5815. ostrstream(char* cp, int len, int mode = ios::out);
  5816. ostrstream(signed char* cp, int len, int mode = ios::out);
  5817. ostrstream(unsigned char* cp, int len, int mode = ios::out);
  5818.  
  5819. The version of the ostrsteam constructor that takes no arguments specifies that 
  5820. space is allocated dynamically for the stream buffer that is attached to the 
  5821. ostrsteam object. 
  5822.  
  5823. The versions of the ostrsteam constructor that take three arguments specify 
  5824. that the stream buffer that is attached to the ostrsteam object consists of an 
  5825. array that starts at the position pointed to by cp with a length of len bytes. 
  5826. If ios::ate or ios::app is set in mode, cp points to a null-terminated string 
  5827. and insertions begin at the null character. Otherwise, insertions begin at the 
  5828. position pointed to by cp. You can use the ostream::seekp() function to 
  5829. reposition the put pointer. 
  5830.  
  5831.  
  5832. ΓòÉΓòÉΓòÉ 4.10.12.2. Destructor for ostrstream ΓòÉΓòÉΓòÉ
  5833.  
  5834. ~ostrstream();
  5835.  
  5836. The ostrsteam destructor frees space allocated by the ostrsteam constructor. 
  5837. The destructor also writes a null byte to the stream buffer to terminate the 
  5838. stream. 
  5839.  
  5840.  
  5841. ΓòÉΓòÉΓòÉ 4.10.12.3. str ΓòÉΓòÉΓòÉ
  5842.  
  5843. char* str();
  5844.  
  5845. str() returns a pointer to the stream buffer attached to the ostrsteam and 
  5846. calls freeze() with a nonzero value to prevent the stream buffer from being 
  5847. deleted. If the stream buffer was constructed with an explicit array, the value 
  5848. returned is a pointer to that array. If the stream buffer was constructed in 
  5849. dynamic mode, cp points to the dynamically allocated area. 
  5850.  
  5851. Until you call str(), deleting the dynamically allocated stream buffer is the 
  5852. responsibility of the ostrsteam object. After str() has been called, the 
  5853. calling application has responsibility for the dynamically allocated stream 
  5854. buffer. 
  5855.  
  5856.  
  5857. ΓòÉΓòÉΓòÉ 4.10.12.4. pcount ΓòÉΓòÉΓòÉ
  5858.  
  5859. int pcount();
  5860.  
  5861. pcount() returns the number of bytes that have been stored in the stream 
  5862. buffer. pcount() is mainly useful when binary data has been stored and the 
  5863. stream buffer attached to the ostrsteam object is not a null-terminated string. 
  5864. pcount() returns the total number of bytes, not just the number of bytes up to 
  5865. the first null character. 
  5866.  
  5867.  
  5868. ΓòÉΓòÉΓòÉ 4.11. strstreambuf Class ΓòÉΓòÉΓòÉ
  5869.  
  5870. Description 
  5871.  
  5872. Derivation 
  5873.  
  5874. Header File 
  5875.  
  5876. Members 
  5877.  
  5878. To close all the panels in a chapter, double-click on this panel's system menu. 
  5879.  
  5880.  
  5881. ΓòÉΓòÉΓòÉ 4.11.1. Class Description - strstreambuf ΓòÉΓòÉΓòÉ
  5882.  
  5883. This chapter describes the strstreambuf class, the class that specializes 
  5884. streambuf to use an array of bytes in memory as the ultimate producer or 
  5885. ultimate consumer. 
  5886.  
  5887.  
  5888. ΓòÉΓòÉΓòÉ 4.11.2. Derivation ΓòÉΓòÉΓòÉ
  5889.  
  5890. streambuf 
  5891.  
  5892.    strstreambuf
  5893.  
  5894.  
  5895. ΓòÉΓòÉΓòÉ 4.11.3. Header File ΓòÉΓòÉΓòÉ
  5896.  
  5897. strstreambuf is declared in strstream.h. 
  5898.  
  5899.  
  5900. ΓòÉΓòÉΓòÉ 4.11.4. Members ΓòÉΓòÉΓòÉ
  5901.  
  5902. The following members are provided for strstreambuf: 
  5903.  
  5904.      Constructors for strstreambuf 
  5905.      Destructor for strstreambuf 
  5906.      doallocate 
  5907.      freeze 
  5908.      overflow 
  5909.      seekoff 
  5910.      setbuf 
  5911.      str 
  5912.      underflow 
  5913.  
  5914.  
  5915. ΓòÉΓòÉΓòÉ 4.11.5. Constructors for strstreambuf ΓòÉΓòÉΓòÉ
  5916.  
  5917. strstreambuf();
  5918. strstreambuf(int bufsize);
  5919. strstreambuf(void* (*alloc) (long), void(*free)(void*));
  5920. strstreambuf(char* sp, int len, char* tp);
  5921. strstreambuf(signed char* sp, int len, signed char* tp);
  5922. strstreambuf(unsigned char* sp, int len, unsigned char* tp);
  5923.  
  5924. The first version of the strstreambuf constructor takes no arguments and 
  5925. constructs an empty strstreambuf object in dynamic mode. Space will be 
  5926. allocated automatically to accommodate the characters that are put into the 
  5927. strstreambuf object. This space will be allocated using the operator new and 
  5928. deallocated using the operator delete. The characters that are already stored 
  5929. by the strstreambuf object may have to be copied when new space is allocated. 
  5930. If you know you are going to insert many characters into an strstreambuf 
  5931. object, you can give the I/O Stream Library an estimate of the size of the 
  5932. object before you create it by calling strstreambuf::setbuf(). 
  5933.  
  5934. The second version of the strstreambuf constructor takes one argument and 
  5935. constructs an empty strstreambuf object in dynamic mode. The initial size of 
  5936. the stream buffer will be at least bufsize bytes. 
  5937.  
  5938. The third version of the strstreambuf constructor takes two arguments and 
  5939. creates an empty strstreambuf object in dynamic mode. alloc is a pointer to the 
  5940. function that is used to allocate space. alloc is passed a long value that 
  5941. equals the number of bytes that it is supposed to allocate. If the value of 
  5942. alloc is 0, the operator new is used to allocate space. free is a pointer to 
  5943. the function that is used to free space. free is passed an argument that is a 
  5944. pointer to the array of bytes that alloc allocated. If free has a value of 0, 
  5945. the operator delete is used to free space. 
  5946.  
  5947. The fourth, fifth, and sixth versions of the strstreambuf constructor take 
  5948. three arguments and construct a strstreambuf object with a stream buffer that 
  5949. begins at the position pointed to by sp. The nature of the stream buffer 
  5950. depends on the value of len: 
  5951.  
  5952.      If len is positive, the len bytes following the position pointed to by sp 
  5953.       make up the stream buffer. 
  5954.  
  5955.      If len equals 0, sp points to the beginning of a null-terminated string, 
  5956.       and the bytes of that string, excluding the terminating null character, 
  5957.       will make up the stream buffer. 
  5958.  
  5959.      If len is negative, the stream buffer has an indefinite length. The get 
  5960.       pointer of the stream buffer is initialized to sp, and the put pointer is 
  5961.       initialized to tp. 
  5962.  
  5963.  Regardless of the value of len, if the value of tp is 0, the get area will 
  5964.  include the entire stream buffer, and insertions will cause errors. 
  5965.  
  5966.  
  5967. ΓòÉΓòÉΓòÉ 4.11.6. Destructor for strstreambuf ΓòÉΓòÉΓòÉ
  5968.  
  5969. ~strstreambuf();
  5970.  
  5971. If freeze() has not been called for the strstreambuf object and a stream buffer 
  5972. is associated with the strstreambuf object, the strstreambuf destructor frees 
  5973. the space allocated by the strstreambuf constructor. The effect of the 
  5974. destructor depends on the constructor used to create the strstreambuf object: 
  5975.  
  5976.      If you created the strstreambuf object using the constructor that takes 
  5977.       two pointers to functions as arguments (see Constructors for strstreambuf 
  5978.       for more details), the destructor frees the space allocated by the 
  5979.       destructor by calling the function pointed to by the second argument to 
  5980.       the constructor. 
  5981.  
  5982.      If you created the strstreambuf object using any of the other 
  5983.       constructors, the destructor calls the delete operator to free the space 
  5984.       allocated by the constructor. 
  5985.  
  5986.  
  5987. ΓòÉΓòÉΓòÉ 4.11.7. doallocate ΓòÉΓòÉΓòÉ
  5988.  
  5989. virtual int doallocate();
  5990.  
  5991. doallocate() attempts to allocate space for a stream buffer. If you created the 
  5992. strstreambuf object using the constructor that takes two pointers to functions 
  5993. as arguments (see Constructors for strstreambuf for more details), doallocate() 
  5994. allocates space for the stream buffer by calling the function pointed to by the 
  5995. first argument to the constructor. Otherwise, doallocate() calls the operator 
  5996. new to allocate space for the stream buffer. 
  5997.  
  5998.  
  5999. ΓòÉΓòÉΓòÉ 4.11.8. freeze ΓòÉΓòÉΓòÉ
  6000.  
  6001. void freeze(int n=1);
  6002.  
  6003. freeze() controls whether the array that makes up a stream buffer can be 
  6004. deleted automatically. If n has a nonzero value, the array is not deleted 
  6005. automatically. If n equals 0, the array is deleted automatically when more 
  6006. space is needed or when the strstreambuf object is deleted. If you call 
  6007. freeze() with a nonzero argument for a strstreambuf object that was allocated 
  6008. in dynamic mode, any attempts to put characters in the stream buffer may result 
  6009. in errors. Therefore, you should avoid insertions to such stream buffers 
  6010. because the results are unpredictable. However, if you have a "frozen" stream 
  6011. buffer and you call freeze() with an argument equal to 0, you can put 
  6012. characters in the stream buffer again. 
  6013.  
  6014. Only space that is acquired through dynamic allocation is ever freed. 
  6015.  
  6016.  
  6017. ΓòÉΓòÉΓòÉ 4.11.9. overflow ΓòÉΓòÉΓòÉ
  6018.  
  6019. virtual int overflow(int c);
  6020.  
  6021. overflow() causes the ultimate consumer to consume the characters in the put 
  6022. area and calls setp() to establish a new put area. The argument c is stored in 
  6023. the new put area if c is not equal to EOF. 
  6024.  
  6025.  
  6026. ΓòÉΓòÉΓòÉ 4.11.10. str ΓòÉΓòÉΓòÉ
  6027.  
  6028. char* str();
  6029.  
  6030. str() returns a pointer to the first character in the stream buffer and calls 
  6031. freeze() with a nonzero argument. Any attempts to put characters in the stream 
  6032. buffer may result in errors. If the strstreambuf object was created with an 
  6033. explicit array (that is, the strstreambuf constructor with three arguments was 
  6034. used), str() returns a pointer to that array. If the strstreambuf object was 
  6035. created in dynamic mode and nothing is stored in the array, str() may return 0. 
  6036.  
  6037.  
  6038. ΓòÉΓòÉΓòÉ 4.11.11. seekoff ΓòÉΓòÉΓòÉ
  6039.  
  6040. virtual streampos seekoff(
  6041.       streamoff so, ios::seek_dir dir, int mode);
  6042.  
  6043. seekoff() repositions the get or put pointer in the array of bytes in memory 
  6044. that serves as the ultimate producer or the ultimate consumer. For a text mode 
  6045. file, seekoff() returns the actual physical file position, because carriage 
  6046. return characters and end-of-file characters are discarded on input. Thus, 
  6047. there may not be a one-to-one correspondence between the characters in a stream 
  6048. and those in its external representation. For further details, see "Low-Level 
  6049. I/O" in the IBM VisualAge for C++ for Windows C Library Reference, S33H-5038. 
  6050.  
  6051. If you constructed the strstreambuf in dynamic mode (see Constructors for 
  6052. strstreambuf), the results of seekoff() are unpredictable. Therefore, do not 
  6053. use seekoff() with an strstreambuf object that you created in dynamic mode. 
  6054.  
  6055. If you did not construct the strstreambuf object in dynamic mode, seekoff() 
  6056. attempts to reposition the get pointer or the put pointer, depending on the 
  6057. value of mode. If ios::in is set in mode, seekoff() repositions the get 
  6058. pointer. If ios::out is set in mode, seekoff() repositions the put pointer. If 
  6059. both ios::in and ios::out are set, seekoff() repositions both pointers. 
  6060.  
  6061. seekoff() attempts to reposition the affected pointer to the value of dir + so. 
  6062. dir can have the following values: 
  6063.  
  6064.      ios::beg: the beginning of the array in memory 
  6065.      ios::cur: the current position in the array in memory 
  6066.      ios::end: the end of the array in memory 
  6067.  
  6068.  If the value of dir + so is equal to or greater than the end of the array, the 
  6069.  value is not valid and seekoff() returns EOF. Otherwise, seekoff() sets the 
  6070.  affected pointer to this value and returns this value. 
  6071.  
  6072.  
  6073. ΓòÉΓòÉΓòÉ 4.11.12. setbuf ΓòÉΓòÉΓòÉ
  6074.  
  6075. virtual streambuf* setbuf(0, int bufsize);
  6076.  
  6077. setbuf() records bufsize. The next time that the strstreambuf object 
  6078. dynamically allocates a stream buffer, the stream buffer is at least bufsize 
  6079. bytes long. 
  6080.  
  6081. Note:  If you call setbuf() for an strstreambuf object, you must call it with 
  6082. the first argument equal to 0. 
  6083.  
  6084.  
  6085. ΓòÉΓòÉΓòÉ 4.11.13. underflow ΓòÉΓòÉΓòÉ
  6086.  
  6087. virtual int underflow();
  6088.  
  6089. If the get area is not empty, underflow() returns the first character in the 
  6090. get area. If the get area is empty, underflow() creates a new get area that is 
  6091. not empty and returns the first character. If no more characters are available 
  6092. in the ultimate producer, underflow() returns EOF and leaves the get area 
  6093. empty. 
  6094.  
  6095.  
  6096. ΓòÉΓòÉΓòÉ 5. Flat Collection Classes ΓòÉΓòÉΓòÉ
  6097.  
  6098. This part contains detailed descriptions of the flat Collection Classes. 
  6099.  
  6100. Introduction to Flat Collections describes the common member functions for flat 
  6101. collections. Subsequent chapters describe individual collection classes. 
  6102.  
  6103. For information on the organization of chapters that describe individual 
  6104. abstract data types, see Format of Class Descriptions. 
  6105.  
  6106. The following flat collections are described in this part: 
  6107.  
  6108.      Bag 
  6109.      Deque 
  6110.      Equality sequence 
  6111.      Heap 
  6112.      Key bag 
  6113.      Key set 
  6114.      Key sorted bag 
  6115.      Key sorted set 
  6116.      Map 
  6117.      Priority queue 
  6118.      Queue 
  6119.      Relation 
  6120.      Sequence 
  6121.      Set 
  6122.      Sorted bag 
  6123.      Sorted map 
  6124.      Sorted relation 
  6125.      Sorted set 
  6126.      Stack 
  6127.  
  6128.  
  6129. ΓòÉΓòÉΓòÉ 5.1. Introduction to Flat Collections ΓòÉΓòÉΓòÉ
  6130.  
  6131. This chapter defines some of the terms used in describing the Collection Class 
  6132. Library classes and functions, describes the format of chapters that describe 
  6133. individual collections, and describes some types defined by the Collection 
  6134. Class Library. 
  6135.  
  6136.  
  6137. ΓòÉΓòÉΓòÉ 5.1.1. Terms Used ΓòÉΓòÉΓòÉ
  6138.  
  6139.  CLASS_BASE_NAME For constructor and destructor declarations, this term is used 
  6140.                  in place of the default implementation variant of a class. 
  6141.                  For example, the constructor CLASS_BASE_NAME(...) for a Bag, 
  6142.                  is really IBag(...), because the default implementation 
  6143.                  variant of a bag is IBag. 
  6144.  
  6145.  CLASS_NAME      For member function declarations, this term is used in place 
  6146.                  of the class with template arguments. For example, if you want 
  6147.                  to use: 
  6148.  
  6149.                                   IBoolean operator != ( CLASS_NAME const& collection ) const;
  6150.  
  6151.                  for a Bag on BST Key Sorted Set, substitute 
  6152.                  IBagOnBSTKeySortedSet<ElementName> for CLASS_NAME. 
  6153.  
  6154.  equal element   Refers to equality of elements as defined by the equality 
  6155.                  operation or ordering relation provided for the element type 
  6156.                  (Element Functions and Key-Type Functions describes the 
  6157.                  purpose of the equality operation and ordering relation.) 
  6158.                  Where both equality operation and ordering relation are 
  6159.                  provided, the Collection Class Library may use either to 
  6160.                  determine element equality. 
  6161.  
  6162.  given ...       Refers to an argument of the described function, such as given 
  6163.                  element, given key, or given collection. 
  6164.  
  6165.  iteration order The order in which elements are visited in allElementsDo() and 
  6166.                  setToNext() or setToPrevious(). 
  6167.  
  6168.                  In ordered collections, the element at position 1 will be 
  6169.                  visited first, then the element at position 2, and so on. 
  6170.                  Sorted collections, in particular, are visited following the 
  6171.                  ordering relation provided for the element type. 
  6172.  
  6173.                  In collections that are not ordered, the elements are visited 
  6174.                  in an arbitrary order. Each element is visited exactly once. 
  6175.  
  6176.  positioning property The property of an element that is used to position the 
  6177.                  element in a collection. For key collections, the positioning 
  6178.                  property is key equality. For nonsequential collections with 
  6179.                  element equality, the positioning property is element 
  6180.                  equality. Other collections have no positioning property. 
  6181.  
  6182.  same key        Refers to equality of keys as defined by the equality 
  6183.                  operation or ordering relation provided for the key type. (See 
  6184.                  Element Functions and Key-Type Functions.) Where both equality 
  6185.                  operation and ordering relation are provided, the Collection 
  6186.                  Class Library may use either to determine key equality. 
  6187.  
  6188.  this collection The collection to which a function is applied.  Contrast with 
  6189.                  the given collection, which is an argument supplied to a 
  6190.                  function. The collection is synonymous with this collection. 
  6191.  
  6192.  undefined cursor A cursor that may or may not be valid; there is no way to 
  6193.                  know whether the cursor is valid or not.  An undefined cursor, 
  6194.                  even if it remains valid, may refer to a different element 
  6195.                  than before, or even to no element of the collection. Do not 
  6196.                  use cursors, once they become undefined, in functions that 
  6197.                  require the cursor to point to an element of the collection. 
  6198.  
  6199.  
  6200. ΓòÉΓòÉΓòÉ 5.1.2. Format of Class Descriptions ΓòÉΓòÉΓòÉ
  6201.  
  6202. Each chapter describing one or more Collection Classes consists of the 
  6203. following components: 
  6204.  
  6205.      The chapter title, which usually refers to the kind of collection being 
  6206.       discussed. 
  6207.  
  6208.      A description of the collection's characteristics, such as whether the 
  6209.       collection is sorted or unsorted, or whether the type and value of the 
  6210.       elements are relevant. 
  6211.  
  6212.      A textual example of using the collection in an application. 
  6213.  
  6214.      Information on the class's derivation. 
  6215.  
  6216.      A section on class implementation variants that provides some or all of 
  6217.       the following information: 
  6218.  
  6219.         -  The default implementation, and the classes that you can use to 
  6220.            alter the way the collection is implemented. 
  6221.         -  The names of the header files that correspond to particular 
  6222.            implementation variants, so that you can include those files in your 
  6223.            source code to make use of the implementation variants. 
  6224.  
  6225.      A section on template arguments and required parameters that provides the 
  6226.       following information: 
  6227.  
  6228.         -  Template arguments, which identify what parameters you must supply 
  6229.            when you instantiate a particular implementation variant. 
  6230.         -  Required functions, which are functions that must be provided by the 
  6231.            element type or key type you use for any implementation variant. 
  6232.  
  6233.      A section on the reference class. The reference class allows you to make 
  6234.       use of polymorphism. This section contains information on include files, 
  6235.       template arguments and required functions similar to the information 
  6236.       provided for the implementation variants described above. In general, 
  6237.       reference classes do not put any additional requirements on the element 
  6238.       type or key type.  The requirements are those of the implementation 
  6239.       variant used with the reference class. 
  6240.  
  6241.      Optionally, a coding example to show you how to use the collection. 
  6242.  
  6243.  
  6244. ΓòÉΓòÉΓòÉ 5.1.2.1. Required Functions ΓòÉΓòÉΓòÉ
  6245.  
  6246. As described in Element Functions and Key-Type Functions, the Collection 
  6247. Classes require that you provide certain functions for the element type and key 
  6248. type. These functions are required by member functions of the Collection Class 
  6249. Library to manipulate elements and keys. The functions you must provide depend 
  6250. on the abstraction you use and on the implementation variant you choose. For 
  6251. example, you will usually need to provide a key access for all keyed 
  6252. abstractions, and for a hash table implementation you will need to provide a 
  6253. hash function. 
  6254.  
  6255.  
  6256. ΓòÉΓòÉΓòÉ 5.1.3. Types Defined for the Collection Class Library ΓòÉΓòÉΓòÉ
  6257.  
  6258. The following types are defined in iglobals.h or in header files included by 
  6259. iglobals.h: 
  6260.  
  6261.    typedef int IBoolean;
  6262.  
  6263.    enum {
  6264.       false = 0,
  6265.       False = 0,
  6266.       true  = 1,
  6267.       True  = 1
  6268.    };
  6269.  
  6270.    typedef unsigned long INumber;
  6271.    typedef unsigned long IPosition;
  6272.  
  6273.    enum ITreeIterationOrder {IPreorder, IPostorder}; // for n-ary tree only
  6274.  
  6275. Note:  If your environment defines another boolean type, use IBoolean wherever 
  6276. you want to refer to Boolean in the context of the Collection Class Library. 
  6277.  
  6278.  
  6279. ΓòÉΓòÉΓòÉ 5.2. Flat Collection Member Functions ΓòÉΓòÉΓòÉ
  6280.  
  6281. Each flat collection implements some or all of the member functions described 
  6282. in this chapter.  Chapters on individual classes identify which functions are 
  6283. implemented for those classes. 
  6284.  
  6285. The following member functions are described: 
  6286.  
  6287. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  6288. Γöé Constructor              Γöé locate                Γöé
  6289. Γöé Copy Constructor            Γöé locateElementWithKey         Γöé
  6290. Γöé Destructor               Γöé locateFirst              Γöé
  6291. Γöé operator!=               Γöé locateLast              Γöé
  6292. Γöé operator=               Γöé locateNext              Γöé
  6293. Γöé operator==               Γöé locateNextElementWithKey       Γöé
  6294. Γöé add                  Γöé locateOrAdd              Γöé
  6295. Γöé addAllFrom               Γöé locateOrAddElementWithKey       Γöé
  6296. Γöé addAsFirst               Γöé locatePrevious            Γöé
  6297. Γöé addAsLast               Γöé maxNumberOfElements          Γöé
  6298. Γöé addAsNext               Γöé newCursor               Γöé
  6299. Γöé addAsPrevious             Γöé numberOfDifferentElements       Γöé
  6300. Γöé addAtPosition             Γöé numberOfDifferentKeys         Γöé
  6301. Γöé addDifference             Γöé numberOfElements           Γöé
  6302. Γöé addIntersection            Γöé numberOfElementsWithKey        Γöé
  6303. Γöé addOrReplaceElementWithKey       Γöé numberOfOccurrences          Γöé
  6304. Γöé addUnion                Γöé pop                  Γöé
  6305. Γöé allElementsDo             Γöé push                 Γöé
  6306. Γöé allElementsDo             Γöé remove               Γöé
  6307. Γöé anyElement               Γöé removeAllElementsWithKey       Γöé
  6308. Γöé compare                Γöé removeAllOccurrences         Γöé
  6309. Γöé contains                Γöé removeAll               Γöé
  6310. Γöé containsAllFrom            Γöé removeAll               Γöé
  6311. Γöé containsAllKeysFrom          Γöé removeAt               Γöé
  6312. Γöé containsElementWithKey         Γöé removeAtPosition           Γöé
  6313. Γöé copy                  Γöé removeElementWithKey         Γöé
  6314. Γöé dequeue                Γöé removeFirst              Γöé
  6315. Γöé differenceWith             Γöé removeLast              Γöé
  6316. Γöé elementAt               Γöé replaceAt               Γöé
  6317. Γöé elementAtPosition           Γöé replaceElementWithKey         Γöé
  6318. Γöé elementWithKey             Γöé setToFirst              Γöé
  6319. Γöé enqueue                Γöé setToLast               Γöé
  6320. Γöé firstElement              Γöé setToNext               Γöé
  6321. Γöé intersectionWith            Γöé setToNextDifferentElement       Γöé
  6322. Γöé isBounded               Γöé setToNextWithDifferentKey       Γöé
  6323. Γöé isEmpty                Γöé setToPosition             Γöé
  6324. Γöé isFirst                Γöé setToPrevious             Γöé
  6325. Γöé isFull                 Γöé sort                 Γöé
  6326. Γöé isLast                 Γöé top                  Γöé
  6327. Γöé key                  Γöé unionWith               Γöé
  6328. Γöé lastElement              Γöé                    Γöé
  6329. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  6330.  
  6331.  
  6332. ΓòÉΓòÉΓòÉ 5.2.1. Constructor ΓòÉΓòÉΓòÉ
  6333.  
  6334. CLASS_BASE_NAME ( INumber numberOfElements = 100 ) ;
  6335.  
  6336. Constructs a collection. numberOfElements is the estimated maximum number of 
  6337. elements contained in the collection. The collection is unbounded and is 
  6338. initially empty. If the estimated maximum is exceeded, the collection is 
  6339. automatically enlarged. 
  6340.  
  6341. Note:  The collection constructor does not define whether any elements are 
  6342. constructed when the collection is constructed. For some classes, the element's 
  6343. default constructor may be invoked when the collection's constructor is 
  6344. invoked. This happens if a tabular or a diluted sequence implementation variant 
  6345. is used for a collection.  The element's default constructor is used to 
  6346. allocate the required storage and initialize the elements. Therefore, a default 
  6347. constructor must be available for elements in such cases. 
  6348.  
  6349. Exception 
  6350.  
  6351. IOutOfMemory 
  6352.  
  6353.  
  6354. ΓòÉΓòÉΓòÉ 5.2.2. Copy Constructor ΓòÉΓòÉΓòÉ
  6355.  
  6356. CLASS_BASE_NAME ( CLASS_NAME const& collection ) ;
  6357.  
  6358. Constructs a collection and copies all elements from the given collection into 
  6359. the collection as described for addAllFrom. 
  6360.  
  6361. Exception 
  6362.  
  6363. IOutOfMemory 
  6364.  
  6365.  
  6366. ΓòÉΓòÉΓòÉ 5.2.3. Destructor ΓòÉΓòÉΓòÉ
  6367.  
  6368. ~CLASS_BASE_NAME ( ) ;
  6369.  
  6370. Removes all elements from the collection. Destructors are called for all 
  6371. elements contained in the collection and for elements that have been 
  6372. constructed in advance. 
  6373.  
  6374. Side Effects 
  6375.  
  6376. All cursors of the collection become undefined. 
  6377.  
  6378.  
  6379. ΓòÉΓòÉΓòÉ 5.2.4. operator!= ΓòÉΓòÉΓòÉ
  6380.  
  6381. IBoolean operator!= ( CLASS_NAME const& collection ) const;
  6382.  
  6383. Returns true if the given collection is not equal to the collection. For a 
  6384. definition of equality for collections, see operator==. 
  6385.  
  6386.  
  6387. ΓòÉΓòÉΓòÉ 5.2.5. operator= ΓòÉΓòÉΓòÉ
  6388.  
  6389. CLASS_NAME& operator= ( CLASS_NAME const& collection ) ;
  6390.  
  6391. Copies the given collection to the collection. Removes all elements from the 
  6392. collection and adds the elements from the given collection as described for 
  6393. addAllFrom. 
  6394.  
  6395. Preconditions 
  6396.  
  6397.      If the collection is bounded, numberOfElements() of the given collection 
  6398.       must be less than maxNumberOfElements() of this collection. 
  6399.  
  6400.  Side Effects 
  6401.  
  6402.      All cursors of this collection become undefined. 
  6403.      Collection classes supporting Visual Builder send a modifiedId 
  6404.       notification. 
  6405.  
  6406.  Return Value 
  6407.  
  6408.  Returns a reference to the collection. 
  6409.  
  6410.  Exceptions 
  6411.  
  6412.      IOutOfMemory 
  6413.      IFullException, if the collection is bounded 
  6414.  
  6415.  
  6416. ΓòÉΓòÉΓòÉ 5.2.6. operator== ΓòÉΓòÉΓòÉ
  6417.  
  6418. IBoolean operator== ( CLASS_NAME const& collection ) const;
  6419.  
  6420. Returns true if the given collection is equal to the collection. Two 
  6421. collections are equal if the number of elements in each collection is the same, 
  6422. and if the condition for the collection is described in the following list: 
  6423.  
  6424.  Type of Collection    Condition 
  6425.  
  6426.  Unique Elements       If the collections have unique elements, any element 
  6427.                        that occurs in one collection must occur in the other 
  6428.                        collection. 
  6429.  
  6430.  Non-Unique Elements   If an element has n occurrences in one collection, it 
  6431.                        must have exactly n occurrences in the other collection. 
  6432.  
  6433.  Sequential            The ordering of the elements is the same for both 
  6434.                        collections. 
  6435.  
  6436.  
  6437. ΓòÉΓòÉΓòÉ 5.2.7. add ΓòÉΓòÉΓòÉ
  6438.  
  6439. IBoolean add ( Element const& element ) ;
  6440.  
  6441. IBoolean add ( Element const& element,
  6442.    ICursor& cursor ) ;
  6443.  
  6444. If the collection is unique (with respect to elements or keys) and the element 
  6445. or key is already contained in the collection, sets the cursor to the existing 
  6446. element in the collection without adding the element. Otherwise, it adds the 
  6447. element to the collection and sets the cursor to the added element. In 
  6448. sequential collections, the given element is added as the last element. In 
  6449. sorted collections, the element is added at a position determined by the 
  6450. element or key value. Adding an element will either use the element's copy 
  6451. constructor or the assignment operator provided for the element type, depending 
  6452. on the implementation variant you choose. See contains for the definition of 
  6453. element or key containment. 
  6454.  
  6455. Preconditions 
  6456.  
  6457.      The cursor must belong to the collection. 
  6458.      If the collection is bounded and unique, the element or key must exist or 
  6459.       (numberOfElements() < maxNumberOfElements()). 
  6460.      If the collection is bounded and nonunique, 
  6461.       (numberOfElements() < maxNumberOfElements()). 
  6462.      If the collection is a map or a sorted map and contains an element with 
  6463.       the same key as the given element, this element must be equal to the 
  6464.       given element. 
  6465.  
  6466.  Side Effects 
  6467.  
  6468.      If an element was added, all cursors of this collection, except the given 
  6469.       cursor, become undefined. 
  6470.      If an element was added, collection classes supporting Visual Builder 
  6471.       send an addedId notification. 
  6472.  
  6473.  Return Value 
  6474.  
  6475.  Returns true if the element was added. 
  6476.  
  6477.  Exceptions 
  6478.  
  6479.      IOutOfMemory 
  6480.      ICursorInvalidException 
  6481.      IFullException, if the collection is bounded 
  6482.      IKeyAlreadyExistsException, if the collection is a map or a sorted map 
  6483.  
  6484.  
  6485. ΓòÉΓòÉΓòÉ 5.2.8. addAllFrom ΓòÉΓòÉΓòÉ
  6486.  
  6487. void addAllFrom ( CLASS_NAME const& collection ) ;
  6488.  
  6489. void addAllFrom (
  6490.    IACollection <Element> const& collection ) ;
  6491.  
  6492. Adds (copies) all elements of the given collection to the collection. The 
  6493. elements are added in the iteration order of the given collection. The contents 
  6494. of the elements, not the pointers to the elements, are copied. The elements are 
  6495. added according to the definition of add for this collection. The given 
  6496. collection is not changed. 
  6497.  
  6498. Preconditions 
  6499.  
  6500. Because the elements are added one by one, the following preconditions are 
  6501. tested for each individual add operation: 
  6502.  
  6503.      If the collection is bounded and unique, the element or key must exist or 
  6504.       (numberOfElements() < maxNumberOfElements()). 
  6505.      If the collection is bounded and nonunique, 
  6506.       (numberOfElements() < maxNumberOfElements()). 
  6507.      If the collection is a map or a sorted map and contains an element with 
  6508.       the same key as the given element, this element must be equal to the 
  6509.       given element. 
  6510.  
  6511.  Side Effects 
  6512.  
  6513.      If any elements were added, all cursors of this collection become 
  6514.       undefined. 
  6515.      If any elements were added, collection classes supporting Visual Builder 
  6516.       send a modifiedId notification. 
  6517.  
  6518.  Exceptions 
  6519.  
  6520.      IOutOfMemory 
  6521.      IIdenticalCollectionException 
  6522.      IFullException, if the collection is bounded 
  6523.      IKeyAlreadyExistsException, if the collection is a map or a sorted map 
  6524.  
  6525.  
  6526. ΓòÉΓòÉΓòÉ 5.2.9. addAsFirst ΓòÉΓòÉΓòÉ
  6527.  
  6528. void addAsFirst ( Element const& element ) ;
  6529.  
  6530. void addAsFirst ( Element const& element, ICursor& cursor ) ;
  6531.  
  6532. Adds the element to the collection as the first element in sequential order. 
  6533. Sets the cursor to the added element. 
  6534.  
  6535. Preconditions 
  6536.  
  6537.      The cursor must belong to the collection. 
  6538.      If the collection is bounded, 
  6539.       (numberOfElements() < maxNumberOfElements()). 
  6540.  
  6541.  Side Effects 
  6542.  
  6543.      All cursors of this collection, except the given cursor, become 
  6544.       undefined. 
  6545.      If an element was added, collection classes supporting Visual Builder 
  6546.       send an addedId notification. 
  6547.  
  6548.  Exceptions 
  6549.  
  6550.      ICursorInvalidException 
  6551.      IOutOfMemory 
  6552.      IFullException, if the collection is bounded 
  6553.  
  6554.  
  6555. ΓòÉΓòÉΓòÉ 5.2.10. addAsLast ΓòÉΓòÉΓòÉ
  6556.  
  6557. void addAsLast ( Element const& element ) ;
  6558.  
  6559. void addAsLast ( Element const& element, ICursor& cursor ) ;
  6560.  
  6561. Adds the element to the collection as the last element in sequential order. 
  6562. Sets the cursor to the added element. 
  6563.  
  6564. Preconditions 
  6565.  
  6566.      The cursor must belong to the collection. 
  6567.      If the collection is bounded, 
  6568.       (numberOfElements() < maxNumberOfElements()). 
  6569.  
  6570.  Side Effects 
  6571.  
  6572.      All cursors of this collection, except the given cursor, become 
  6573.       undefined. 
  6574.      If an element was added, collection classes supporting Visual Builder 
  6575.       send an addedId notification. 
  6576.  
  6577.  Exceptions 
  6578.  
  6579.      ICursorInvalidException 
  6580.      IOutOfMemory 
  6581.      IFullException, if the collection is bounded 
  6582.  
  6583.  
  6584. ΓòÉΓòÉΓòÉ 5.2.11. addAsNext ΓòÉΓòÉΓòÉ
  6585.  
  6586. void addAsNext ( Element const& element, ICursor& cursor ) ;
  6587.  
  6588. Adds the element to the collection as the element following element pointed to 
  6589. by the cursor. Sets the cursor to the added element. 
  6590.  
  6591. Preconditions 
  6592.  
  6593.      The cursor must belong to the collection and must point to an element of 
  6594.       the collection. 
  6595.      If the collection is bounded, 
  6596.       (numberOfElements() < maxNumberOfElements()). 
  6597.  
  6598.  Side Effects 
  6599.  
  6600.      All cursors of this collection, except the given cursor, become 
  6601.       undefined. 
  6602.      If an element was added, collection classes supporting Visual Builder 
  6603.       send an addedId notification. 
  6604.  
  6605.  Exceptions 
  6606.  
  6607.      IOutOfMemory 
  6608.      ICursorInvalidException 
  6609.      IFullException, if the collection is bounded 
  6610.  
  6611.  
  6612. ΓòÉΓòÉΓòÉ 5.2.12. addAsPrevious ΓòÉΓòÉΓòÉ
  6613.  
  6614. void addAsPrevious ( Element const& element, ICursor& cursor ) ;
  6615.  
  6616. Adds the element to the collection as the element preceding the element pointed 
  6617. to by the cursor. Sets the cursor to the added element. 
  6618.  
  6619. Preconditions 
  6620.  
  6621.      The cursor must belong to the collection and must point to an element of 
  6622.       the collection. 
  6623.      If the collection is bounded, 
  6624.       (numberOfElements() < maxNumberOfElements()). 
  6625.  
  6626.  Side Effects 
  6627.  
  6628.      All cursors of this collection, except the given cursor, become 
  6629.       undefined. 
  6630.      If an element was added, collection classes supporting Visual Builder 
  6631.       send an addedId notification. 
  6632.  
  6633.  Exceptions 
  6634.  
  6635.      IOutOfMemory 
  6636.      ICursorInvalidException 
  6637.      IFullException, if the collection is bounded 
  6638.  
  6639.  
  6640. ΓòÉΓòÉΓòÉ 5.2.13. addAtPosition ΓòÉΓòÉΓòÉ
  6641.  
  6642. void addAtPosition ( IPosition position, Element const& element ) ;
  6643.  
  6644. void addAtPosition ( IPosition position, Element const& element,
  6645.    ICursor& cursor ) ;
  6646.  
  6647. Adds the element at the given position to the collection, and sets the cursor 
  6648. to the added element. If an element exists at the given position, the new 
  6649. element is added as the element preceding the existing element. 
  6650.  
  6651. Preconditions 
  6652.  
  6653.      The cursor must belong to the collection. 
  6654.      (1 <= position <= numberOfElements + 1). 
  6655.      If the collection is bounded, 
  6656.       (numberOfElements() < maxNumberOfElements()). 
  6657.  
  6658.  Side Effects 
  6659.  
  6660.      All cursors of this collection, except the given cursor, become 
  6661.       undefined. 
  6662.      If an element was added, collection classes supporting Visual Builder 
  6663.       send an addedId notification. 
  6664.  
  6665.  Exceptions 
  6666.  
  6667.      IOutOfMemory 
  6668.      ICursorInvalidException 
  6669.      IPositionInvalidException 
  6670.      IFullException, if the collection is bounded 
  6671.  
  6672.  
  6673. ΓòÉΓòÉΓòÉ 5.2.14. addDifference ΓòÉΓòÉΓòÉ
  6674.  
  6675. void addDifference ( CLASS_NAME const& collection1,
  6676.    CLASS_NAME const& collection2 ) ;
  6677.  
  6678. Creates the difference between the two given collections, and adds this 
  6679. difference to the collection. The contents of the added elements, not the 
  6680. pointers to those elements, are copied. 
  6681.  
  6682. For a definition of the difference between two collections, see differenceWith. 
  6683.  
  6684. Preconditions 
  6685.  
  6686. Because the elements are added one by one, the following preconditions are 
  6687. tested for each individual addition. 
  6688.  
  6689.      If the collection is bounded and unique, the element or key must exist or 
  6690.       (numberOfElements() < maxNumberOfElements()). 
  6691.      If the collection is bounded and nonunique, 
  6692.       (numberOfElements() < maxNumberOfElements()). 
  6693.      If the collection is a map or a sorted map and contains an element with 
  6694.       the same key as the given element, this element must be equal to the 
  6695.       given element. 
  6696.  
  6697.  Side Effects 
  6698.  
  6699.      If any elements were added, all cursors of this collection become 
  6700.       undefined. 
  6701.      If any elements were added, collection classes supporting Visual Builder 
  6702.       send a modifiedId notification. 
  6703.  
  6704.  Exceptions 
  6705.  
  6706.      IOutOfMemory 
  6707.      IFullException, if the collection is bounded 
  6708.      IKeyAlreadyExistsException, if the collection is a map or a sorted map 
  6709.  
  6710.  
  6711. ΓòÉΓòÉΓòÉ 5.2.15. addIntersection ΓòÉΓòÉΓòÉ
  6712.  
  6713. void addIntersection ( CLASS_NAME const& collection1,
  6714.    CLASS_NAME const& collection2 ) ;
  6715.  
  6716. Creates the intersection of the two given collections, and adds this 
  6717. intersection to the collection. The contents of the added elements, not the 
  6718. pointers to those elements, are copied. 
  6719.  
  6720. For a definition of the intersection of two collections, see intersectionWith. 
  6721.  
  6722. Preconditions 
  6723.  
  6724. Because the elements are added one by one, the following preconditions are 
  6725. tested for each individual addition. 
  6726.  
  6727.      If the collection is bounded and unique, the element or key must exist or 
  6728.       (numberOfElements() < maxNumberOfElements()). 
  6729.      If the collection is bounded and nonunique, 
  6730.       (numberOfElements() < maxNumberOfElements()). 
  6731.      If the collection is a map or a sorted map and contains an element with 
  6732.       the same key as the given element, this element must be equal to the 
  6733.       given element. 
  6734.  
  6735.  Side Effects 
  6736.  
  6737.      If any elements were added, all cursors of this collection become 
  6738.       undefined. 
  6739.      If any elements were added, collection classes supporting Visual Builder 
  6740.       send a modifiedId notification. 
  6741.  
  6742.  Exceptions 
  6743.  
  6744.      IOutOfMemory 
  6745.      IFullException, if the collection is bounded 
  6746.      IKeyAlreadyExistsException, if the collection is a map or a sorted map 
  6747.  
  6748.  
  6749. ΓòÉΓòÉΓòÉ 5.2.16. addOrReplaceElementWithKey ΓòÉΓòÉΓòÉ
  6750.  
  6751. IBoolean addOrReplaceElementWithKey (
  6752.    Element const& element );
  6753.  
  6754. IBoolean addOrReplaceElementWithKey (
  6755.    Element const& element, ICursor& cursor ) ;
  6756.  
  6757. If an element is contained in the collection where the key is equal to the key 
  6758. of the given element, sets the cursor to this element in the collection and 
  6759. replaces it with the given element. Otherwise, it adds the given element to the 
  6760. collection, and sets the cursor to the added element. If the given element is 
  6761. added, the contents of the element, not a pointer to it, is added. 
  6762.  
  6763. Preconditions 
  6764.  
  6765.      The cursor must belong to the collection. 
  6766.      If the collection is bounded, an element with the given key must be 
  6767.       contained in the collection, or 
  6768.       (numberOfElements() < maxNumberOfElements()). 
  6769.  
  6770.  Side Effects 
  6771.  
  6772.      If the element was added, all cursors of this collection, except the 
  6773.       given cursor, become undefined. 
  6774.      If the element was added, collection classes supporting Visual Builder 
  6775.       send a replacedId notification. 
  6776.  
  6777.  Return Value 
  6778.  
  6779.  Returns true if the element was added.  Returns false if the element was 
  6780.  replaced. 
  6781.  
  6782.  Exceptions 
  6783.  
  6784.      IOutOfMemory 
  6785.      ICursorInvalidException 
  6786.      IFullException, if the collection is bounded 
  6787.  
  6788.  
  6789. ΓòÉΓòÉΓòÉ 5.2.17. addUnion ΓòÉΓòÉΓòÉ
  6790.  
  6791. void addUnion (  CLASS_NAME const& collection1,
  6792.    CLASS_NAME const& collection2 ) ;
  6793.  
  6794. Creates the union of the two given collections, and adds this union to the 
  6795. collection. The contents of the added elements, not the pointers to those 
  6796. elements, are copied. 
  6797.  
  6798. For a definition of the union of two collections, see unionWith. 
  6799.  
  6800. Preconditions 
  6801.  
  6802. Because the elements are added one by one, the following preconditions are 
  6803. tested for each individual addition. 
  6804.  
  6805.      If the collection is bounded and unique, the element or key must exist or 
  6806.       (numberOfElements() < maxNumberOfElements()). 
  6807.      If the collection is bounded and nonunique, 
  6808.       (numberOfElements() < maxNumberOfElements()). 
  6809.      If the collection is a map or a sorted map and contains an element with 
  6810.       the same key as the given element, this element must be equal to the 
  6811.       given element. 
  6812.  
  6813.  Side Effects 
  6814.  
  6815.      If any elements were added, all cursors of this collection become 
  6816.       undefined. 
  6817.      If any elements were added, collection classes supporting Visual Builder 
  6818.       send a modifiedId notification. 
  6819.  
  6820.  Exceptions 
  6821.  
  6822.      IOutOfMemory 
  6823.      IFullException, if the collection is bounded 
  6824.      IKeyAlreadyExistsException, if the collection is a map or a sorted map 
  6825.  
  6826.  
  6827. ΓòÉΓòÉΓòÉ 5.2.18. allElementsDo ΓòÉΓòÉΓòÉ
  6828.  
  6829. IBoolean allElementsDo (
  6830.    IBoolean (*function) (Element&, void*),
  6831.    void* additionalArgument = 0 ) ;
  6832.  
  6833. IBoolean allElementsDo (
  6834.    IBoolean (*function) (Element const&, void*),
  6835.    void* additionalArgument = 0 ) const;
  6836.  
  6837. Calls the given function for all elements in the collection until the given 
  6838. function returns false. The elements are visited in iteration order. Additional 
  6839. arguments can be passed to the given function using additionalArgument. The 
  6840. additional argument defaults to zero if no additional argument is given. 
  6841.  
  6842. Note: 
  6843.  
  6844.    1. The given function must not remove elements from or add them to the 
  6845.       collection. If you want to remove elements, you can use the removeAll() 
  6846.       function with a property argument. For further information see removeAll. 
  6847.  
  6848.    2. For the non-const version of allElementsDo(), the given function must not 
  6849.       manipulate the element in the collection in a way that changes the 
  6850.       positioning property of the element. 
  6851.  
  6852.  Return Value 
  6853.  
  6854.  Returns true if the given function returns true for every element it is 
  6855.  applied to. 
  6856.  
  6857.  
  6858. ΓòÉΓòÉΓòÉ 5.2.19. allElementsDo ΓòÉΓòÉΓòÉ
  6859.  
  6860. IBoolean allElementsDo ( IApplicator <Element>& applicator ) ;
  6861.  
  6862. IBoolean allElementsDo ( IConstantApplicator <Element>& applicator ) const;
  6863.  
  6864. Calls the applyTo() function of the given applicator for all elements of the 
  6865. collection until the applyTo() function returns false. The elements are visited 
  6866. in iteration order. Additional arguments may be passed as arguments to the 
  6867. constructor of the derived applicator class. 
  6868.  
  6869. Note: 
  6870.  
  6871.    1. The applyTo() function must not remove elements from or add elements to 
  6872.       the collection. If you want to remove elements, you can use the 
  6873.       removeAll() function with a property argument. For further information, 
  6874.       see removeAll. 
  6875.  
  6876.    2. For the non-const version of allElementsDo(), the applyTo() function must 
  6877.       not manipulate the element in the collection in a way that changes the 
  6878.       positioning property of the element. 
  6879.  
  6880.  Return Value 
  6881.  
  6882.  Returns true if the applyTo() function returns true for every element it is 
  6883.  applied to. 
  6884.  
  6885.  
  6886. ΓòÉΓòÉΓòÉ 5.2.20. anyElement ΓòÉΓòÉΓòÉ
  6887.  
  6888. Element const& anyElement ( ) const;
  6889.  
  6890. Returns a reference to an arbitrary element of the collection. 
  6891.  
  6892. Precondition 
  6893.  
  6894. The collection must not be empty. 
  6895.  
  6896. Exception 
  6897.  
  6898. IEmptyException 
  6899.  
  6900.  
  6901. ΓòÉΓòÉΓòÉ 5.2.21. compare ΓòÉΓòÉΓòÉ
  6902.  
  6903. long compare ( CLASS_NAME const& collection,
  6904.    long (*comparisonFunction)
  6905.      (Element const& element1,Element const& element2)
  6906.    ) const;
  6907.  
  6908. Compares the collection with the given collection. Comparison yields <0 if the 
  6909. collection is less than the given collection, 0 if the collection is equal to 
  6910. the given collection, and >0 if the collection is greater than the given 
  6911. collection. Comparison is defined by the first pair of corresponding elements, 
  6912. in both collections, that are not equal. If such a pair exists, the collection 
  6913. with the greater element is the greater one. Otherwise, the collection with 
  6914. more elements is the greater one. 
  6915.  
  6916. Note: 
  6917.  
  6918.    1. The given comparison function must return a result according to the 
  6919.       following rules: 
  6920.  
  6921.       >0             if (element1 > element2) 
  6922.       0              if (element1 == element2) 
  6923.       <0             if (element1 < element2) 
  6924.  
  6925.    2. For elements of type char*, compare() is not locale-sensitive by default. 
  6926.       Because it uses strcmp() and not strcoll(), it compares the binary values 
  6927.       representing the characters, and is not based on the LC_COLLATE category 
  6928.       of the current locale.  Its results are reliable only for code pages and 
  6929.       character sets in which the collating sequence matches the sequence of 
  6930.       binary representations. If you need a comparison based on the LC_COLLATE 
  6931.       cateogory, then you must implement your own compare() function as 
  6932.       described in Using Separate Functions in the Class Library User's Guide. 
  6933.  
  6934.  Return Value 
  6935.  
  6936.  Returns the result of the collection comparison. 
  6937.  
  6938.  
  6939. ΓòÉΓòÉΓòÉ 5.2.22. contains ΓòÉΓòÉΓòÉ
  6940.  
  6941. IBoolean contains ( Element const& element ) const;
  6942.  
  6943. Returns true if the collection contains an element equal to the given element. 
  6944.  
  6945.  
  6946. ΓòÉΓòÉΓòÉ 5.2.23. containsAllFrom ΓòÉΓòÉΓòÉ
  6947.  
  6948. IBoolean containsAllFrom (
  6949.    CLASS_NAME const& collection ) const;
  6950.  
  6951. IBoolean containsAllFrom (
  6952.    IACollection <Element> const& collection ) const;
  6953.  
  6954. Returns true if all the elements of the given collection are contained in the 
  6955. collection. The definition of containment is described in contains. 
  6956.  
  6957.  
  6958. ΓòÉΓòÉΓòÉ 5.2.24. containsAllKeysFrom ΓòÉΓòÉΓòÉ
  6959.  
  6960. IBoolean containsAllKeysFrom (
  6961.    CLASS_NAME const& collection ) const;
  6962.  
  6963. IBoolean containsAllKeysFrom (
  6964.    IACollection <Element> const& collection ) const;
  6965.  
  6966. Returns true if all of the keys of the given collection are contained in the 
  6967. collection. 
  6968.  
  6969.  
  6970. ΓòÉΓòÉΓòÉ 5.2.25. containsElementWithKey ΓòÉΓòÉΓòÉ
  6971.  
  6972. IBoolean containsElementWithKey ( Key const& key ) const;
  6973.  
  6974. Returns true if the collection contains an element with the same key as the 
  6975. given key. 
  6976.  
  6977.  
  6978. ΓòÉΓòÉΓòÉ 5.2.26. copy ΓòÉΓòÉΓòÉ
  6979.  
  6980. void copy ( IACollection <Element> const& collection ) ;
  6981.  
  6982. Copies the given collection to this collection.  copy() removes all elements 
  6983. from this collection, and adds the elements from the given collection. For 
  6984. information on how adding is done, see addAllFrom. 
  6985.  
  6986. Note:  The given collection may be of a concrete type other than the collection 
  6987. itself. In this case, copying implicitly performs a conversion. If, for 
  6988. example, the given collection is a bag and the collection itself is a set, 
  6989. elements with multiple occurrences in the copied bag will only occur once in 
  6990. the resulting set. 
  6991.  
  6992. Preconditions 
  6993.  
  6994. Because the elements are copied one by one, the following preconditions are 
  6995. tested for each individual copy operation: 
  6996.  
  6997.      If the collection is bounded and unique, the element or key must exist or 
  6998.       (numberOfElements() < maxNumberOfElements()). 
  6999.      If the collection is bounded and nonunique, 
  7000.       (numberOfElements() < maxNumberOfElements()). 
  7001.      If the collection is a map or a sorted map and contains an element with 
  7002.       the same key as the given element, this element must be equal to the 
  7003.       given element. 
  7004.  
  7005.  Side Effects 
  7006.  
  7007.      All cursors of this collection become undefined. 
  7008.      If any elements were copied, collection classes supporting Visual Builder 
  7009.       send a modifiedId notification. 
  7010.  
  7011.  Exceptions 
  7012.  
  7013.      IOutOfMemory 
  7014.      IFullException, if the collection is bounded 
  7015.      IKeyAlreadyExistsException, if the collection has unique keys. This 
  7016.       exception may be thrown, for example, when copying a bag into a map. 
  7017.  
  7018.  
  7019. ΓòÉΓòÉΓòÉ 5.2.27. dequeue ΓòÉΓòÉΓòÉ
  7020.  
  7021. void dequeue ( ) ;
  7022.  
  7023. void dequeue ( Element& element ) ;
  7024.  
  7025. Copies the first element of the collection to the given element, and removes it 
  7026. from the collection. 
  7027.  
  7028. Precondition 
  7029.  
  7030. The collection must not be empty. 
  7031.  
  7032. Side Effects 
  7033.  
  7034.      All cursors of this collection become undefined. 
  7035.      If the element is removed, collection classes supporting Visual Builder 
  7036.       send a modifiedId notification. 
  7037.  
  7038.  Exception 
  7039.  
  7040.  IEmptyException 
  7041.  
  7042.  
  7043. ΓòÉΓòÉΓòÉ 5.2.28. differenceWith ΓòÉΓòÉΓòÉ
  7044.  
  7045. void differenceWith ( CLASS_NAME const& collection ) ;
  7046.  
  7047. Makes the collection the difference between the collection and the given 
  7048. collection. The difference of A and B (A minus B) is the set of elements that 
  7049. are contained in A but not in B. 
  7050.  
  7051. The following rule applies for bags with duplicate elements: If bag P contains 
  7052. the element X m times and bag Q contains the element X n times, the difference 
  7053. of P and Q contains the element X m-n times if m > n, and zero times if m<=n. 
  7054.  
  7055. Side Effects 
  7056.  
  7057.      If any elements were removed, all cursors of this collection become 
  7058.       undefined. 
  7059.      If the element is removed, collection classes supporting Visual Builder 
  7060.       send a modifiedId notification. 
  7061.  
  7062.  
  7063. ΓòÉΓòÉΓòÉ 5.2.29. elementAt ΓòÉΓòÉΓòÉ
  7064.  
  7065. Element& elementAt ( ICursor const& cursor ) ;
  7066.  
  7067. Element const& elementAt ( ICursor const& cursor ) const;
  7068.  
  7069. Returns a reference to the element pointed to by the given cursor. 
  7070.  
  7071. Note:  For the version of elementAt() without the const suffix, do not 
  7072. manipulate the element or the key of the element in the collection in a way 
  7073. that changes the positioning property of the element. 
  7074.  
  7075. Precondition 
  7076.  
  7077. The cursor must belong to the collection and must point to an element of the 
  7078. collection. 
  7079.  
  7080. Exception 
  7081.  
  7082. ICursorInvalidException 
  7083.  
  7084.  
  7085. ΓòÉΓòÉΓòÉ 5.2.30. elementAtPosition ΓòÉΓòÉΓòÉ
  7086.  
  7087. Element const& elementAtPosition ( IPosition position ) const;
  7088.  
  7089. Returns a reference to the element at the given position in the collection. 
  7090.  
  7091. Position 1 specifies the first element. 
  7092.  
  7093. Position must be a valid position in the collection; that is, 
  7094. (1 <= position <= numberOfElements()). 
  7095.  
  7096. Precondition 
  7097.  
  7098. (1 <= position <= numberOfElements()). 
  7099.  
  7100. Exception 
  7101.  
  7102. IPositionInvalidException 
  7103.  
  7104.  
  7105. ΓòÉΓòÉΓòÉ 5.2.31. elementWithKey ΓòÉΓòÉΓòÉ
  7106.  
  7107. Element& elementWithKey ( Key const& key ) ;
  7108.  
  7109. Element const& elementWithKey ( Key const& key ) const;
  7110.  
  7111. Returns a reference to an element specified by the key. 
  7112.  
  7113. Note: 
  7114.  
  7115.    1. For the version of elementWithKey() without a const suffix, do not 
  7116.       manipulate the element in the collection in a way that changes the 
  7117.       positioning property of the element. 
  7118.  
  7119.    2. If there are several elements with the given key, an arbitrary one is 
  7120.       returned. 
  7121.  
  7122.  Precondition 
  7123.  
  7124.  The given key is contained in the collection. 
  7125.  
  7126.  Exception 
  7127.  
  7128.  INotContainsKeyException 
  7129.  
  7130.  
  7131. ΓòÉΓòÉΓòÉ 5.2.32. enqueue ΓòÉΓòÉΓòÉ
  7132.  
  7133. void enqueue ( Element const& element ) ;
  7134.  
  7135. void enqueue ( Element const& element, ICursor& cursor ) ;
  7136.  
  7137. Adds the element to the collection, and sets the cursor to the added element. 
  7138. For ordinary queues, the given element is added as the last element. For 
  7139. priority queues, the element is added at a position determined by the ordering 
  7140. relation provided for the element or key type. 
  7141.  
  7142. Preconditions 
  7143.  
  7144.      The cursor must belong to the collection. 
  7145.      If the collection is bounded, 
  7146.       (numberOfElements() < maxNumberOfElements()). 
  7147.  
  7148.  Side Effects 
  7149.  
  7150.      All cursors of this collection except the given cursor become undefined. 
  7151.      If the element is added, collection classes supporting Visual Builder 
  7152.       send a modifiedId notification. 
  7153.  
  7154.  Exceptions 
  7155.  
  7156.      IOutOfMemory 
  7157.      ICursorInvalidException 
  7158.      IFullException, if the collection is bounded 
  7159.  
  7160.  
  7161. ΓòÉΓòÉΓòÉ 5.2.33. firstElement ΓòÉΓòÉΓòÉ
  7162.  
  7163. Element const& firstElement ( ) const;
  7164.  
  7165. Returns a reference to the first element of the collection. 
  7166.  
  7167. Precondition 
  7168.  
  7169. The collection must not be empty. 
  7170.  
  7171. Exception 
  7172.  
  7173. IEmptyException 
  7174.  
  7175.  
  7176. ΓòÉΓòÉΓòÉ 5.2.34. intersectionWith ΓòÉΓòÉΓòÉ
  7177.  
  7178. void intersectionWith ( CLASS_NAME const& collection ) ;
  7179.  
  7180. Makes the collection the intersection of the collection and the given 
  7181. collection. The intersection of A and B is the set of elements that is 
  7182. contained in both A and B. 
  7183.  
  7184. The following rule applies for bags with duplicate elements: If bag P contains 
  7185. the element X m times and bag Q contains the element X n times, the 
  7186. intersection of P and Q contains the element X MIN(m,n) times. 
  7187.  
  7188. Side Effects 
  7189.  
  7190.      If any elements were removed, all cursors of this collection become 
  7191.       undefined. 
  7192.      If any elements were removed, collection classes supporting Visual 
  7193.       Builder send a modifiedId notification. 
  7194.  
  7195.  
  7196. ΓòÉΓòÉΓòÉ 5.2.35. isBounded ΓòÉΓòÉΓòÉ
  7197.  
  7198. IBoolean isBounded ( ) const;
  7199.  
  7200. Returns true if the collection is bounded. 
  7201.  
  7202.  
  7203. ΓòÉΓòÉΓòÉ 5.2.36. isEmpty ΓòÉΓòÉΓòÉ
  7204.  
  7205. IBoolean isEmpty ( ) const;
  7206.  
  7207. Returns true if the collection is empty. 
  7208.  
  7209.  
  7210. ΓòÉΓòÉΓòÉ 5.2.37. isFirst ΓòÉΓòÉΓòÉ
  7211.  
  7212. IBoolean isFirst ( ICursor const& cursor ) const;
  7213.  
  7214. Returns true if the given cursor points to the first element of the collection. 
  7215.  
  7216. Preconditions 
  7217.  
  7218. The cursor must belong to the collection and must point to an element of the 
  7219. collection. 
  7220.  
  7221. Exception 
  7222.  
  7223. ICursorInvalidException 
  7224.  
  7225.  
  7226. ΓòÉΓòÉΓòÉ 5.2.38. isFull ΓòÉΓòÉΓòÉ
  7227.  
  7228. IBoolean isFull ( ) const;
  7229.  
  7230. Returns true if the collection is bounded and contains the maximum number of 
  7231. elements; that is, if (numberOfElements() == maxNumberOfElements()). 
  7232.  
  7233.  
  7234. ΓòÉΓòÉΓòÉ 5.2.39. isLast ΓòÉΓòÉΓòÉ
  7235.  
  7236. IBoolean isLast ( ICursor const& cursor ) const;
  7237.  
  7238. Returns true if the given cursor points to the last element of the collection. 
  7239.  
  7240. Preconditions 
  7241.  
  7242. The cursor must belong to the collection and must point to an element of the 
  7243. collection. 
  7244.  
  7245. Exception 
  7246.  
  7247. ICursorInvalidException 
  7248.  
  7249.  
  7250. ΓòÉΓòÉΓòÉ 5.2.40. key ΓòÉΓòÉΓòÉ
  7251.  
  7252. Key const& key ( Element const& element ) const;
  7253.  
  7254. Returns a reference to the key of the given element using the key() function 
  7255. provided for the element type. 
  7256.  
  7257.  
  7258. ΓòÉΓòÉΓòÉ 5.2.41. lastElement ΓòÉΓòÉΓòÉ
  7259.  
  7260. Element const& lastElement ( ) const;
  7261.  
  7262. Returns a reference to the last element of the collection. 
  7263.  
  7264. Precondition 
  7265.  
  7266. The collection must not be empty. 
  7267.  
  7268. Exception 
  7269.  
  7270. IEmptyException 
  7271.  
  7272.  
  7273. ΓòÉΓòÉΓòÉ 5.2.42. locate ΓòÉΓòÉΓòÉ
  7274.  
  7275. IBoolean locate ( Element const& element, ICursor& cursor ) const;
  7276.  
  7277. Locates an element in the collection that is equal to the given element. Sets 
  7278. the cursor to point to the element in the collection, or invalidates the cursor 
  7279. if no such element exists. 
  7280.  
  7281. If the collection contains several such elements, the first element in 
  7282. iteration order is located. 
  7283.  
  7284. Precondition 
  7285.  
  7286. The cursor must belong to the collection. 
  7287.  
  7288. Return Value 
  7289.  
  7290. Returns true if an element was found. 
  7291.  
  7292. Exceptions 
  7293.  
  7294. ICursorInvalidException 
  7295.  
  7296.  
  7297. ΓòÉΓòÉΓòÉ 5.2.43. locateElementWithKey ΓòÉΓòÉΓòÉ
  7298.  
  7299. IBoolean locateElementWithKey ( Key const& key, ICursor& cursor ) const;
  7300.  
  7301. Locates an element in the collection with the same key as the given key. Sets 
  7302. the cursor to point to the element in the collection, or invalidates the cursor 
  7303. if no such element exists. 
  7304.  
  7305. If the collection contains several such elements, the first element in 
  7306. iteration order is located. 
  7307.  
  7308. Precondition 
  7309.  
  7310. The cursor must belong to the collection. 
  7311.  
  7312. Return Value 
  7313.  
  7314. Returns true if an element was found. 
  7315.  
  7316. Exception 
  7317.  
  7318. ICursorInvalidException 
  7319.  
  7320.  
  7321. ΓòÉΓòÉΓòÉ 5.2.44. locateFirst ΓòÉΓòÉΓòÉ
  7322.  
  7323. IBoolean locateFirst ( Element const& element, ICursor& cursor ) const;
  7324.  
  7325. Locates the first element in iteration order in the collection that is equal to 
  7326. the given element. Sets the cursor to the located element, or invalidates the 
  7327. cursor if no such element exists. 
  7328.  
  7329. Precondition 
  7330.  
  7331. The cursor must belong to the collection. 
  7332.  
  7333. Return Value 
  7334.  
  7335. Returns true if an element was found. 
  7336.  
  7337. Exception 
  7338.  
  7339. ICursorInvalidException 
  7340.  
  7341.  
  7342. ΓòÉΓòÉΓòÉ 5.2.45. locateLast ΓòÉΓòÉΓòÉ
  7343.  
  7344. IBoolean locateLast ( Element const& element, ICursor& cursor ) const;
  7345.  
  7346. Locates the last element in iteration order in the collection that is equal to 
  7347. the given element. Sets the cursor to the located element, or invalidates the 
  7348. cursor if no such element exists. 
  7349.  
  7350. Precondition 
  7351.  
  7352. The cursor must belong to the collection. 
  7353.  
  7354. Return Value 
  7355.  
  7356. Returns true if an element was found. 
  7357.  
  7358. Exception 
  7359.  
  7360. ICursorInvalidException 
  7361.  
  7362.  
  7363. ΓòÉΓòÉΓòÉ 5.2.46. locateNext ΓòÉΓòÉΓòÉ
  7364.  
  7365. IBoolean locateNext ( Element const& element, ICursor& cursor ) const;
  7366.  
  7367. Locates the next element in iteration order in the collection that is equal to 
  7368. the given element, starting at the element next to the one pointed to by the 
  7369. given cursor. Sets the cursor to point to the element in the collection. The 
  7370. cursor is invalidated if the end of the collection is reached and no more 
  7371. occurrences of the given element are left to be visited. 
  7372.  
  7373. Note:  If you code a call to locateFirst() and a set of calls to locateNext(), 
  7374. each occurrence of an element will be visited exactly once in iteration order. 
  7375.  
  7376. Precondition 
  7377.  
  7378. The cursor must belong to the collection and must point to an element of the 
  7379. collection. 
  7380.  
  7381. Return Value 
  7382.  
  7383. Returns true if an element was found. 
  7384.  
  7385. Exception 
  7386.  
  7387. ICursorInvalidException 
  7388.  
  7389.  
  7390. ΓòÉΓòÉΓòÉ 5.2.47. locateNextElementWithKey ΓòÉΓòÉΓòÉ
  7391.  
  7392. IBoolean locateNextElementWithKey (
  7393.    Key const& key, ICursor& cursor ) const;
  7394.  
  7395. Locates the next element in iteration order in the collection with the given 
  7396. key, starting at the element next to the one pointed to by the given cursor. 
  7397. Sets the cursor to point to the element in the collection. The cursor is 
  7398. invalidated if the end of the collection is reached and no more occurrences of 
  7399. such an element are left to be visited. 
  7400.  
  7401. Note:  If you code a call to locateFirst() and a set of calls to 
  7402. locateNextElementWithKey(), each occurrence of an element will be visited 
  7403. exactly once in iteration order. 
  7404.  
  7405. Preconditions 
  7406.  
  7407. The cursor must belong to the collection and must point to an element of the 
  7408. collection. 
  7409.  
  7410. Return Value 
  7411.  
  7412. Returns true if an element was found. 
  7413.  
  7414. Exception 
  7415.  
  7416. ICursorInvalidException 
  7417.  
  7418.  
  7419. ΓòÉΓòÉΓòÉ 5.2.48. locateOrAdd ΓòÉΓòÉΓòÉ
  7420.  
  7421. IBoolean locateOrAdd ( Element const& element ) ;
  7422.  
  7423. IBoolean locateOrAdd ( Element const& element, ICursor& cursor ) ;
  7424.  
  7425. Locates an element in the collection that is equal to the given element.  (See 
  7426. locate for details on locate().) If no such element is found, locateOrAdd() 
  7427. adds the element as described in add. The cursor is set to the located or added 
  7428. element. 
  7429.  
  7430. Note:  This method may be more efficient than using locate() followed by a 
  7431. conditionally called add(). 
  7432.  
  7433. Preconditions 
  7434.  
  7435.      The cursor must belong to the collection. 
  7436.      If the collection is a map or a sorted map and contains an element with 
  7437.       the same key as the given element, this element must be equal to the 
  7438.       given element. 
  7439.      The element or key must exist, or 
  7440.       (numberOfElements() < maxNumberOfElements()). 
  7441.  
  7442.  Side Effects 
  7443.  
  7444.      If the element was added, all cursors of this collection, except the 
  7445.       given cursor, become undefined. 
  7446.      If the element was added, collection classes supporting Visual Builder 
  7447.       send an addedId notification. 
  7448.  
  7449.  Return Value 
  7450.  
  7451.  Returns true if the element was located.  Returns false if the element could 
  7452.  not be located but had to be added. 
  7453.  
  7454.  Exceptions 
  7455.  
  7456.      IOutOfMemory 
  7457.      ICursorInvalidException 
  7458.      IFullException, if the collection is bounded 
  7459.      IKeyAlreadyExistsException, if the collection is a map or a sorted map 
  7460.  
  7461.  
  7462. ΓòÉΓòÉΓòÉ 5.2.49. locateOrAddElementWithKey ΓòÉΓòÉΓòÉ
  7463.  
  7464. IBoolean locateOrAddElementWithKey (
  7465.    Element const& element ) ;
  7466.  
  7467. IBoolean locateOrAddElementWithKey (
  7468.    Element const& element; ICursor& cursor ) ;
  7469.  
  7470. Locates an element in the collection with the given key as described for the 
  7471. locateElementWithKey() function. If no such element exists, 
  7472. locateOrAddElementWithKey() adds the element as described in add. The cursor is 
  7473. set to the located or added element. 
  7474.  
  7475. Preconditions 
  7476.  
  7477.      If the collection is bounded and an element with the given key is not 
  7478.       already contained, (numberOfElements() < maxNumberOfElements()). 
  7479.      The cursor must belong to the collection. 
  7480.  
  7481.  Side Effects 
  7482.  
  7483.      If the element was added, all cursors of this collection, except the 
  7484.       given cursor, become undefined. 
  7485.      If the element was added, collection classes supporting Visual Builder 
  7486.       send an addedId notification. 
  7487.  
  7488.  Return Value 
  7489.  
  7490.  Returns true if the element was located.  Returns false if the element could 
  7491.  not be located but had to be added. 
  7492.  
  7493.  Exceptions 
  7494.  
  7495.      IOutOfMemory 
  7496.      ICursorInvalidException 
  7497.      IFullException, if the collection is bounded 
  7498.  
  7499.  
  7500. ΓòÉΓòÉΓòÉ 5.2.50. locatePrevious ΓòÉΓòÉΓòÉ
  7501.  
  7502. IBoolean locatePrevious ( Element const& element,
  7503.    ICursor& cursor ) const;
  7504.  
  7505. Locates the previous element in iteration order that is equal to the given 
  7506. element, beginning at the element previous to the one specified by the given 
  7507. cursor and moving in reverse iteration order through the elements. Sets the 
  7508. cursor to the located element, or invalidates the cursor if no such element 
  7509. exists. 
  7510.  
  7511. Preconditions 
  7512.  
  7513. The cursor must belong to the collection and must point to an element of the 
  7514. collection. 
  7515.  
  7516. Return Value 
  7517.  
  7518. Returns true if an element was found. 
  7519.  
  7520. Exceptions 
  7521.  
  7522. ICursorInvalidException 
  7523.  
  7524.  
  7525. ΓòÉΓòÉΓòÉ 5.2.51. maxNumberOfElements ΓòÉΓòÉΓòÉ
  7526.  
  7527. INumber maxNumberOfElements ( ) const;
  7528.  
  7529. Returns the maximum number of elements the collection can contain. 
  7530.  
  7531. Precondition 
  7532.  
  7533. The collection is bounded. 
  7534.  
  7535. Exceptions 
  7536.  
  7537. INotBoundedException 
  7538.  
  7539.  
  7540. ΓòÉΓòÉΓòÉ 5.2.52. newCursor ΓòÉΓòÉΓòÉ
  7541.  
  7542. ICursor* newCursor ( ) const;
  7543.  
  7544. Creates a cursor for the collection and returns a pointer to the cursor. The 
  7545. cursor is initially not valid. 
  7546.  
  7547. Exception 
  7548.  
  7549. IOutOfMemory 
  7550.  
  7551.  
  7552. ΓòÉΓòÉΓòÉ 5.2.53. numberOfDifferentElements ΓòÉΓòÉΓòÉ
  7553.  
  7554. INumber numberOfDifferentElements ( ) const;
  7555.  
  7556. Returns the number of different elements in the collection. 
  7557.  
  7558.  
  7559. ΓòÉΓòÉΓòÉ 5.2.54. numberOfDifferentKeys ΓòÉΓòÉΓòÉ
  7560.  
  7561. INumber numberOfDifferentKeys ( ) const;
  7562.  
  7563. Returns the number of different keys in the collection. 
  7564.  
  7565.  
  7566. ΓòÉΓòÉΓòÉ 5.2.55. numberOfElements ΓòÉΓòÉΓòÉ
  7567.  
  7568. INumber numberOfElements ( ) const;
  7569.  
  7570. Returns the number of elements the collection contains. 
  7571.  
  7572.  
  7573. ΓòÉΓòÉΓòÉ 5.2.56. numberOfElementsWithKey ΓòÉΓòÉΓòÉ
  7574.  
  7575. INumber numberOfElementsWithKey ( Key const& key ) const;
  7576.  
  7577. Returns the number of elements in the collection with the given key. 
  7578.  
  7579.  
  7580. ΓòÉΓòÉΓòÉ 5.2.57. numberOfOccurrences ΓòÉΓòÉΓòÉ
  7581.  
  7582. INumber numberOfOccurrences ( Element const& element ) const;
  7583.  
  7584. Returns the number of occurrences of the given element in the collection. 
  7585.  
  7586.  
  7587. ΓòÉΓòÉΓòÉ 5.2.58. pop ΓòÉΓòÉΓòÉ
  7588.  
  7589. void pop ( ) ;
  7590.  
  7591. void pop ( Element& element ) ;
  7592.  
  7593. Copies the last element of the collection to the given element, and removes it 
  7594. from the collection. 
  7595.  
  7596. Precondition 
  7597.  
  7598. The collection must not be empty. 
  7599.  
  7600. Side Effects 
  7601.  
  7602.      All cursors of this collection become undefined. 
  7603.      If the element was removed from the collection, collection classes 
  7604.       supporting Visual Builder send a removedId notification. 
  7605.  
  7606.  Exception 
  7607.  
  7608.  IEmptyException 
  7609.  
  7610.  
  7611. ΓòÉΓòÉΓòÉ 5.2.59. positionAt ΓòÉΓòÉΓòÉ
  7612.  
  7613. IPosition positionAt ( ICursor const& cursor) const;
  7614.  
  7615. Determines the position of the current element. Position 1 specifies the first 
  7616. element. 
  7617.  
  7618. Precondition 
  7619.  
  7620. The cursor must belong to the collection, and the cursor must point to an 
  7621. element of the collection. 
  7622.  
  7623. Exception 
  7624.  
  7625. ICursorInvalidException 
  7626.  
  7627.  
  7628. ΓòÉΓòÉΓòÉ 5.2.60. push ΓòÉΓòÉΓòÉ
  7629.  
  7630. void push ( Element const& element ) ;
  7631.  
  7632. void push ( Element const& element, ICursor& cursor ) ;
  7633.  
  7634. Adds the element to the collection as the last element (as defined for add), 
  7635. and sets the cursor to the added element. 
  7636.  
  7637. Preconditions 
  7638.  
  7639.      The cursor must belong to the collection. 
  7640.      If the collection is bounded, 
  7641.       (numberOfElements() < maxNumberOfElements()). 
  7642.  
  7643.  Side Effects 
  7644.  
  7645.      All cursors of this collection, except the given cursor, become 
  7646.       undefined. 
  7647.      If the element was added to the collection, collection classes supporting 
  7648.       Visual Builder send an addedId notification. 
  7649.  
  7650.  Exceptions 
  7651.  
  7652.      IOutOfMemory 
  7653.      ICursorInvalidException 
  7654.      IFullException, if the collection is bounded 
  7655.  
  7656.  
  7657. ΓòÉΓòÉΓòÉ 5.2.61. remove ΓòÉΓòÉΓòÉ
  7658.  
  7659. IBoolean remove ( Element const& element ) ;
  7660.  
  7661. Removes an element in the collection that is equal to the given element. If no 
  7662. such element exists, the collection remains unchanged. In collections with 
  7663. nonunique elements, an arbitrary occurrence of the given element will be 
  7664. removed. Element destructors are called as described in removeAt. 
  7665.  
  7666. Side Effects 
  7667.  
  7668.      If an element was removed, all cursors of this collection become 
  7669.       undefined. 
  7670.      If an element was removed, collection classes supporting Visual Builder 
  7671.       send a removedId notification. 
  7672.  
  7673.  Return Value 
  7674.  
  7675.  Returns true if an element was removed. 
  7676.  
  7677.  
  7678. ΓòÉΓòÉΓòÉ 5.2.62. removeAll ΓòÉΓòÉΓòÉ
  7679.  
  7680. INumber removeAll ( ) ;
  7681.  
  7682. Removes all elements from the collection. Element destructors are called as 
  7683. described in removeAt. 
  7684.  
  7685. Side Effects 
  7686.  
  7687.      All cursors of this collection become undefined. 
  7688.      Collection classes supporting Visual Builder send a modifiedId 
  7689.       notification. 
  7690.  
  7691.  Return Value 
  7692.  
  7693.  The number of elements removed. 
  7694.  
  7695.  
  7696. ΓòÉΓòÉΓòÉ 5.2.63. removeAll ΓòÉΓòÉΓòÉ
  7697.  
  7698. INumber removeAll (
  7699.    IBoolean (*propertyFunction) (Element const&, void*),
  7700.    void* additionalArgument = 0 ) ;
  7701.  
  7702. Removes all elements from this collection for which the given property function 
  7703. returns true. Additional arguments can be passed to the given property function 
  7704. using additionalArgument. The additional argument defaults to zero if no 
  7705. additional argument is given. Element destructors are called as described in 
  7706. removeAt. 
  7707.  
  7708. Side Effects 
  7709.  
  7710.      If any elements were removed, all cursors of this collection become 
  7711.       undefined. 
  7712.      If any elements were removed, collection classes supporting Visual 
  7713.       Builder send a modifiedId notification. 
  7714.  
  7715.  Return Value 
  7716.  
  7717.  The number of elements removed. 
  7718.  
  7719.  
  7720. ΓòÉΓòÉΓòÉ 5.2.64. removeAllElementsWithKey ΓòÉΓòÉΓòÉ
  7721.  
  7722. INumber removeAllElementsWithKey ( Key const& key ) ;
  7723.  
  7724. Removes all elements from the collection with the same key as the given key. 
  7725. Element destructors are called as described in removeAt. 
  7726.  
  7727. Side Effects 
  7728.  
  7729.      If any elements were removed, all cursors of this collection become 
  7730.       undefined. 
  7731.      If any elements were removed, collection classes supporting Visual 
  7732.       Builder send a removedId notification. 
  7733.  
  7734.  Return Value 
  7735.  
  7736.  The number of elements removed. 
  7737.  
  7738.  
  7739. ΓòÉΓòÉΓòÉ 5.2.65. removeAllOccurrences ΓòÉΓòÉΓòÉ
  7740.  
  7741. INumber removeAllOccurrences ( Element const& element ) ;
  7742.  
  7743. Removes all elements from the collection that are equal to the given element, 
  7744. and returns the number of elements removed. Element destructors are called as 
  7745. described in removeAt. 
  7746.  
  7747. Side Effects 
  7748.  
  7749.      If any elements were removed, all cursors of this collection become 
  7750.       undefined. 
  7751.      If any elements were removed, collection classes supporting Visual 
  7752.       Builder send a modifiedId notification. 
  7753.  
  7754.  
  7755. ΓòÉΓòÉΓòÉ 5.2.66. removeAt ΓòÉΓòÉΓòÉ
  7756.  
  7757. void removeAt ( ICursor& cursor ) ;
  7758.  
  7759. Removes the element pointed to by the given cursor. The given cursor is 
  7760. invalidated. 
  7761.  
  7762. Note:  It is undefined whether the destructor for the removed element is called 
  7763. or whether the element will only be destructed with the collection destructor. 
  7764. For example, in a tabular implementation, a destructor will only be called when 
  7765. the whole collection is destructed, not when a single element is removed. 
  7766.  
  7767. Preconditions 
  7768.  
  7769. The cursor must belong to the collection and must point to an element of the 
  7770. collection. 
  7771.  
  7772. Side Effects 
  7773.  
  7774.      All cursors of this collection, except the given cursor, become 
  7775.       undefined. 
  7776.      If an element was removed, collection classes supporting Visual Builder 
  7777.       send a removedId notification. 
  7778.  
  7779.  Exception 
  7780.  
  7781.  ICursorInvalidException 
  7782.  
  7783.  
  7784. ΓòÉΓòÉΓòÉ 5.2.67. removeAtPosition ΓòÉΓòÉΓòÉ
  7785.  
  7786. void removeAtPosition ( IPosition position ) ;
  7787.  
  7788. Removes the element from the collection that is at the given position. Element 
  7789. destructors are called as described in removeAt. 
  7790.  
  7791. The first element of the collection has position 1. 
  7792.  
  7793. Precondition 
  7794.  
  7795. Position must be a valid position in the collection; that is, 
  7796. (1 <= position <= numberOfElements()). 
  7797.  
  7798. Side Effects 
  7799.  
  7800.      All cursors of this collection become undefined. 
  7801.      Collection classes supporting Visual Builder send a removedId 
  7802.       notification. 
  7803.  
  7804.  Exception 
  7805.  
  7806.  IPositionInvalidException 
  7807.  
  7808.  
  7809. ΓòÉΓòÉΓòÉ 5.2.68. removeElementWithKey ΓòÉΓòÉΓòÉ
  7810.  
  7811. IBoolean removeElementWithKey ( Key const& key ) ;
  7812.  
  7813. Removes an element from the collection with the same key as the given key. If 
  7814. no such element exists, the collection remains unchanged. In collections with 
  7815. nonunique elements, an arbitrary occurrence of such an element will be removed. 
  7816. Element destructors are called as described in removeAt. 
  7817.  
  7818. Side Effects 
  7819.  
  7820.      If an element was removed, all cursors of this collection become 
  7821.       undefined. 
  7822.      If an element was removed, collection classes supporting Visual Builder 
  7823.       send a removedId notification. 
  7824.  
  7825.  Return Value 
  7826.  
  7827.  Returns true if an element was removed. 
  7828.  
  7829.  
  7830. ΓòÉΓòÉΓòÉ 5.2.69. removeFirst ΓòÉΓòÉΓòÉ
  7831.  
  7832. void removeFirst ( ) ;
  7833.  
  7834. Removes the first element from the collection. Element destructors are called 
  7835. as described in removeAt. 
  7836.  
  7837. Precondition 
  7838.  
  7839. The collection must not be empty. 
  7840.  
  7841. Side Effects 
  7842.  
  7843.      All cursors of this collection become undefined. 
  7844.      If an element was removed, collection classes supporting Visual Builder 
  7845.       send a removedId notification. 
  7846.  
  7847.  Exception 
  7848.  
  7849.  IEmptyException 
  7850.  
  7851.  
  7852. ΓòÉΓòÉΓòÉ 5.2.70. removeLast ΓòÉΓòÉΓòÉ
  7853.  
  7854. void removeLast ( ) ;
  7855.  
  7856. Removes the last element from the collection. Element destructors are called as 
  7857. described in removeAt. 
  7858.  
  7859. Precondition 
  7860.  
  7861. The collection must not be empty. 
  7862.  
  7863. Side Effects 
  7864.  
  7865.      All cursors of this collection become undefined. 
  7866.      If an element was removed, collection classes supporting Visual Builder 
  7867.       send a removedId notification. 
  7868.  
  7869.  Exception 
  7870.  
  7871.  IEmptyException 
  7872.  
  7873.  
  7874. ΓòÉΓòÉΓòÉ 5.2.71. replaceAt ΓòÉΓòÉΓòÉ
  7875.  
  7876. void replaceAt ( ICursor const& cursor, Element const& element ) ;
  7877.  
  7878. Replaces the element pointed to by the cursor with the given element. 
  7879.  
  7880. Preconditions 
  7881.  
  7882.      The cursor must belong to the collection and must point to an element of 
  7883.       the collection. 
  7884.      The given element must have the same positioning property as the replaced 
  7885.       element. 
  7886.  
  7887.  Side Effect 
  7888.  
  7889.  Collection classes supporting Visual Builder send a replacedId notification. 
  7890.  
  7891.  Exceptions 
  7892.  
  7893.      ICursorInvalidException 
  7894.      IInvalidReplacementException 
  7895.  
  7896.  
  7897. ΓòÉΓòÉΓòÉ 5.2.72. replaceElementWithKey ΓòÉΓòÉΓòÉ
  7898.  
  7899. IBoolean replaceElementWithKey ( Element const& element ) ;
  7900.  
  7901. IBoolean replaceElementWithKey ( Element const& element,
  7902.    ICursor& cursor ) ;
  7903.  
  7904. Replaces an element with the same key as the given element by the given 
  7905. element, and sets the cursor to this element. If no such element exists, it 
  7906. invalidates the cursor. In collections with nonunique elements, an arbitrary 
  7907. occurrence of such an element will be replaced. 
  7908.  
  7909. Precondition 
  7910.  
  7911. The cursor must belong to the collection. 
  7912.  
  7913. Side Effect 
  7914.  
  7915. Collection classes supporting Visual Builder send a replacedId notification. 
  7916.  
  7917. Return Value 
  7918.  
  7919. Returns true if an element was replaced. 
  7920.  
  7921. Exceptions 
  7922.  
  7923. ICursorInvalidException 
  7924.  
  7925.  
  7926. ΓòÉΓòÉΓòÉ 5.2.73. reverse ΓòÉΓòÉΓòÉ
  7927.  
  7928. reverse
  7929. void reverse ( ) ;
  7930.  
  7931. Reverses the sequence of elements in the collection. 
  7932.  
  7933. Side Effects 
  7934.  
  7935. All cursors of this collection become undefined. 
  7936.  
  7937.  
  7938. ΓòÉΓòÉΓòÉ 5.2.74. setToFirst ΓòÉΓòÉΓòÉ
  7939.  
  7940. IBoolean setToFirst ( ICursor& cursor ) const;
  7941.  
  7942. Sets the cursor to the first element of the collection in iteration order. If 
  7943. the collection is empty (if no first element exists), it invalidates the given 
  7944. cursor. 
  7945.  
  7946. Precondition 
  7947.  
  7948. The cursor must belong to the collection. 
  7949.  
  7950. Return Value 
  7951.  
  7952. Returns true if the collection is not empty. 
  7953.  
  7954. Exception 
  7955.  
  7956. ICursorInvalidException 
  7957.  
  7958.  
  7959. ΓòÉΓòÉΓòÉ 5.2.75. setToLast ΓòÉΓòÉΓòÉ
  7960.  
  7961. IBoolean setToLast ( ICursor& cursor ) const;
  7962.  
  7963. Sets the cursor to the last element of the collection in iteration order. If 
  7964. the collection is empty (if no last element exists), the given cursor is no 
  7965. longer valid. 
  7966.  
  7967. Precondition 
  7968.  
  7969. The cursor must belong to the collection. 
  7970.  
  7971. Return Value 
  7972.  
  7973. Returns true if the collection is not empty. 
  7974.  
  7975. Exceptions 
  7976.  
  7977. ICursorInvalidException 
  7978.  
  7979.  
  7980. ΓòÉΓòÉΓòÉ 5.2.76. setToNext ΓòÉΓòÉΓòÉ
  7981.  
  7982. IBoolean setToNext ( ICursor& cursor ) const;
  7983.  
  7984. Sets the cursor to the next element in the collection in iteration order. If no 
  7985. more elements are left to be visited, the given cursor will no longer be valid. 
  7986.  
  7987. Precondition 
  7988.  
  7989. The cursor must belong to the collection and must point to an element. 
  7990.  
  7991. Return Value 
  7992.  
  7993. Returns true if there is a next element. 
  7994.  
  7995. Exceptions 
  7996.  
  7997. ICursorInvalidException 
  7998.  
  7999.  
  8000. ΓòÉΓòÉΓòÉ 5.2.77. setToNextDifferentElement ΓòÉΓòÉΓòÉ
  8001.  
  8002. IBoolean setToNextDifferentElement ( ICursor& cursor ) const;
  8003.  
  8004. Sets the cursor to the next element in iteration order in the collection that 
  8005. is different from the element pointed to by the given cursor. If no more 
  8006. elements are left to be visited, the given cursor will no longer be valid. 
  8007.  
  8008. Precondition 
  8009.  
  8010. The cursor must belong to the collection and must point to an element of the 
  8011. collection. 
  8012.  
  8013. Return Value 
  8014.  
  8015. Returns true if a subsequent element was found that is different. 
  8016.  
  8017. Exception 
  8018.  
  8019. ICursorInvalidException 
  8020.  
  8021.  
  8022. ΓòÉΓòÉΓòÉ 5.2.78. setToNextWithDifferentKey ΓòÉΓòÉΓòÉ
  8023.  
  8024. IBoolean setToNextWithDifferentKey ( ICursor& cursor ) const;
  8025.  
  8026. Sets the cursor to the next element in the collection in iteration order with a 
  8027. key different from the key of the element pointed to by the given cursor. If no 
  8028. such element exists, the given cursor is no longer valid. 
  8029.  
  8030. Preconditions 
  8031.  
  8032. The cursor must belong to the collection and must point to an element of the 
  8033. collection. 
  8034.  
  8035. Return Value 
  8036.  
  8037. Returns true if a subsequent element was found whose key is different from the 
  8038. current key. 
  8039.  
  8040. Exception 
  8041.  
  8042. ICursorInvalidException 
  8043.  
  8044.  
  8045. ΓòÉΓòÉΓòÉ 5.2.79. setToPosition ΓòÉΓòÉΓòÉ
  8046.  
  8047. void setToPosition ( IPosition position, ICursor& cursor ) const;
  8048.  
  8049. Sets the cursor to the element at the given position. Position 1 specifies the 
  8050. first element. 
  8051.  
  8052. Precondition 
  8053.  
  8054.      The cursor must belong to the collection. 
  8055.      Position must be a valid position in the collection; that is, 
  8056.       (1 <= position <= numberOfElements()). 
  8057.  
  8058.  Exceptions 
  8059.  
  8060.      ICursorInvalidException 
  8061.      IPositionInvalidException 
  8062.  
  8063.  
  8064. ΓòÉΓòÉΓòÉ 5.2.80. setToPrevious ΓòÉΓòÉΓòÉ
  8065.  
  8066. IBoolean setToPrevious ( ICursor& cursor ) const;
  8067.  
  8068. Sets the cursor to the previous element in iteration order, or invalidates the 
  8069. cursor if no such element exists. 
  8070.  
  8071. Preconditions 
  8072.  
  8073. The cursor must belong to the collection and must point to an element of the 
  8074. collection. 
  8075.  
  8076. Return Value 
  8077.  
  8078. Returns true if a previous element exists. 
  8079.  
  8080. Exception 
  8081.  
  8082. ICursorInvalidException 
  8083.  
  8084.  
  8085. ΓòÉΓòÉΓòÉ 5.2.81. sort ΓòÉΓòÉΓòÉ
  8086.  
  8087. void sort ( long (*comparisonFunction)
  8088.    (Element const& element1, Element const& element2) );
  8089.  
  8090. Sorts the collection so that the elements occur in ascending order. The 
  8091. relation of two elements is defined by the comparisonFunction, which you 
  8092. provide. 
  8093.  
  8094. Note:  The comparisonFunction must deliver a result according to the following 
  8095. rules: 
  8096.  
  8097.  >0        if (element1 > element2) 
  8098.  0         if (element1 == element2) 
  8099.  <0        if (element1 < element2) 
  8100.  
  8101.  Side Effects 
  8102.  
  8103.      All cursors of this collection become undefined. 
  8104.      Collection classes supporting Visual Builder send a modifiedId 
  8105.       notification. 
  8106.  
  8107.  
  8108. ΓòÉΓòÉΓòÉ 5.2.82. top ΓòÉΓòÉΓòÉ
  8109.  
  8110. Element const& top ( ) const;
  8111.  
  8112. Returns a reference to the last element of the collection. 
  8113.  
  8114. Precondition 
  8115.  
  8116. The collection must not be empty. 
  8117.  
  8118. Exception 
  8119.  
  8120. IEmptyException 
  8121.  
  8122.  
  8123. ΓòÉΓòÉΓòÉ 5.2.83. unionWith ΓòÉΓòÉΓòÉ
  8124.  
  8125. void unionWith ( CLASS_NAME const& collection ) ;
  8126.  
  8127. Makes the collection the union of the collection and the given collection. The 
  8128. union of A and B is the set of elements that are members of A or B or both. 
  8129.  
  8130. The following rule applies for bags with duplicate elements: If bag P contains 
  8131. the element X m times and bag Q contains the element X n times, the union of P 
  8132. and Q contains the element X m+n times. 
  8133.  
  8134. Preconditions 
  8135.  
  8136. Because the elements from the given collection are added to the collection one 
  8137. by one, the following preconditions are tested for each individual add 
  8138. operation : 
  8139.  
  8140.      If the collection is bounded and unique, the element or key must exist or 
  8141.       (numberOfElements() < maxNumberOfElements()). 
  8142.      If the collection is bounded and nonunique, 
  8143.       (numberOfElements() < maxNumberOfElements()). 
  8144.      If the collection is a map or a sorted map and contains an element with 
  8145.       the same key as the given element, this element must be equal to the 
  8146.       given element. 
  8147.  
  8148.  Side Effects 
  8149.  
  8150.      If any elements were added to the collection, all cursors of this 
  8151.       collection become undefined. 
  8152.      Collection classes supporting Visual Builder send a modifiedId 
  8153.       notification. 
  8154.  
  8155.  Exceptions 
  8156.  
  8157.      IOutOfMemory 
  8158.      IFullException, if the collection is bounded 
  8159.      IKeyAlreadyExistsException, if the collection is a map or a sorted map 
  8160.  
  8161.  
  8162. ΓòÉΓòÉΓòÉ 5.3. Bag ΓòÉΓòÉΓòÉ
  8163.  
  8164. Description 
  8165.  
  8166. Derivation 
  8167.  
  8168. Variants/Header Files 
  8169.  
  8170. Members 
  8171.  
  8172. Template Arguments and Required Functions 
  8173.  
  8174. Abstract/Reference Classes 
  8175.  
  8176. To close all the panels in a chapter, double-click on this panel's system menu. 
  8177.  
  8178.  
  8179. ΓòÉΓòÉΓòÉ 5.3.1. Class Description - Bag ΓòÉΓòÉΓòÉ
  8180.  
  8181. A bag is an unordered collection of zero or more elements with no key. 
  8182. Multiple elements are supported.  A request to add an element that already 
  8183. exists is not ignored. 
  8184.  
  8185. Figure Combination of Flat Collection Properties gives an overview of the 
  8186. properties of a bag and its relationship to other flat collections. 
  8187.  
  8188. An example of using a bag is a program for entering observations on species of 
  8189. plants and animals found in a river.  Each time you spot a plant or animal in 
  8190. the river, you enter the name of the species into the collection.  If you spot 
  8191. a species twice during an observation period, the species is added twice, 
  8192. because a bag supports multiple elements.  You can locate the name of a species 
  8193. that you have observed, and you can determine the number of observations of 
  8194. that species, but you cannot sort the collection by species, because a bag is 
  8195. an unordered collection.  If you want to sort the elements of a bag, use a 
  8196. sorted bag instead. 
  8197.  
  8198. The following rule applies for duplicates: If bag P contains the element X m 
  8199. times and bag Q contains the element X n times, then the union of P and Q 
  8200. contains the element X m+n times, the intersection of P and Q contains the 
  8201. element X MIN(m,n) times, and the difference of P and Q contains the element X 
  8202. m-n times if m is > n, and zero times if m is <= n. 
  8203.  
  8204.  
  8205. ΓòÉΓòÉΓòÉ 5.3.2. Derivation ΓòÉΓòÉΓòÉ
  8206.  
  8207. Collection 
  8208.  
  8209.   Equality Collection
  8210.    Bag
  8211.  
  8212.  
  8213. ΓòÉΓòÉΓòÉ 5.3.3. Variants and Header Files ΓòÉΓòÉΓòÉ
  8214.  
  8215. IBag, the first class in the table below, is the default implementation 
  8216. variant. 
  8217.  
  8218. To use Visual Builder features with your collections, change the name of the 
  8219. desired collection class template in the list below from I... to IV..., and use 
  8220. the ivbag.h header file instead of the header file that you would normally use 
  8221. without Visual Builder. 
  8222.  
  8223. Class Name                    Header File  Implementation Variant
  8224.  
  8225. IBag                          ibag.h       AVL tree
  8226. IGBag                         ibag.h       AVL tree
  8227.  
  8228. IBagAsAvlTree                 ibagavl.h    AVL tree
  8229. IGBagAsAvlTree                ibagavl.h    AVL tree
  8230.  
  8231. IBagAsBstTree                 ibagbst.h    B* tree
  8232. IGBagAsBstTree                ibagbst.h    B* tree
  8233.  
  8234. IBagAsHshTable                ibaghsh.h    Hash table
  8235. IGBagAsHshTable               ibaghsh.h    Hash table
  8236.  
  8237. IBagAsList                    ibaglst.h    List
  8238. IGBagAsList                   ibaglst.h    List
  8239.  
  8240. IBagAsTable                   ibagtab.h    Table
  8241. IGBagAsTable                  ibagtab.h    Table
  8242.  
  8243. IBagAsDilTable                ibagdil.h    Diluted table
  8244. IGBagAsDilTable               ibagdil.h    Diluted table
  8245.  
  8246.  
  8247. ΓòÉΓòÉΓòÉ 5.3.4. Members ΓòÉΓòÉΓòÉ
  8248.  
  8249. All member functions of flat collections are described in Introduction to Flat 
  8250. Collections. The following members are provided for bag: 
  8251.  
  8252.      Constructor 
  8253.      Copy Constructor 
  8254.      Destructor 
  8255.      operator!= 
  8256.      operator= 
  8257.      operator== 
  8258.      add 
  8259.      addAllFrom 
  8260.      addDifference 
  8261.      addIntersection 
  8262.      addUnion 
  8263.      allElementsDo 
  8264.      anyElement 
  8265.      contains 
  8266.      containsAllFrom 
  8267.      copy 
  8268.      differenceWith 
  8269.      elementAt 
  8270.      intersectionWith 
  8271.      isBounded 
  8272.      isEmpty 
  8273.      isFull 
  8274.      locate 
  8275.      locateNext 
  8276.      locateOrAdd 
  8277.      maxNumberOfElements 
  8278.      newCursor 
  8279.      numberOfDifferentElements 
  8280.      numberOfElements 
  8281.      numberOfOccurrences 
  8282.      remove 
  8283.      removeAllOccurrences 
  8284.      removeAll 
  8285.      removeAt 
  8286.      replaceAt 
  8287.      setToFirst 
  8288.      setToNext 
  8289.      setToNextDifferentElement 
  8290.      unionWith 
  8291.  
  8292.  Bag also defines a cursor that inherits from IElementCursor.  The members for 
  8293.  IElementCursor are described in Cursor. 
  8294.  
  8295.  
  8296. ΓòÉΓòÉΓòÉ 5.3.5. Template Arguments and Required Functions ΓòÉΓòÉΓòÉ
  8297.  
  8298. The following implementation variants are defined for bags: 
  8299.  
  8300.      Bag 
  8301.      Bag as AVL tree 
  8302.      Bag as b* key sorted set 
  8303.      Bag as hash table 
  8304.      Bag as list 
  8305.      Bag as table 
  8306.      Bag as diluted table 
  8307.  
  8308.  
  8309. ΓòÉΓòÉΓòÉ 5.3.5.1. Bag ΓòÉΓòÉΓòÉ
  8310.  
  8311. IBag  <Element>
  8312. IGBag <Element, COps>
  8313.  
  8314. The default implementation of the class IBag requires the following element 
  8315. functions: 
  8316.  
  8317. Element Type 
  8318.  
  8319.      Copy constructor 
  8320.      Destructor 
  8321.      Assignment 
  8322.      Ordering relation 
  8323.  
  8324.  
  8325. ΓòÉΓòÉΓòÉ 5.3.5.2. Bag as AVL Tree ΓòÉΓòÉΓòÉ
  8326.  
  8327. IBagAsAvlTree <Element>
  8328. IGBagAsAvlTree <Element, COps>
  8329.  
  8330. The implementation of the class IBagAsAvlTree requires the following element 
  8331. functions: 
  8332.  
  8333.      Copy constructor 
  8334.      Destructor 
  8335.      Assignment 
  8336.      Ordering relation 
  8337.  
  8338.  
  8339. ΓòÉΓòÉΓòÉ 5.3.5.3. Bag as B* Tree ΓòÉΓòÉΓòÉ
  8340.  
  8341. IBagAsBstTree  <Element>
  8342. IGBagAsBstTree <Element, COps>
  8343.  
  8344. The implementation of the class IBagAsBstTree requires the following element 
  8345. functions: 
  8346.  
  8347. Element Type 
  8348.  
  8349.      Copy constructor 
  8350.      Destructor 
  8351.      Assignment 
  8352.      Ordering relation 
  8353.  
  8354.  
  8355. ΓòÉΓòÉΓòÉ 5.3.5.4. Bag as Hash Table ΓòÉΓòÉΓòÉ
  8356.  
  8357. IBagAsHshTable  <Element>
  8358. IGBagAsHshTable <Element, EHOps>
  8359.  
  8360. The implementation of the class IBagAsHshTable requires the following element 
  8361. functions: 
  8362.  
  8363. Element Type 
  8364.  
  8365.      Default constructor 
  8366.      Copy constructor 
  8367.      Destructor 
  8368.      Assignment 
  8369.      Equality test 
  8370.      Hash function 
  8371.  
  8372.  
  8373. ΓòÉΓòÉΓòÉ 5.3.5.5. Bag as List ΓòÉΓòÉΓòÉ
  8374.  
  8375. IBagAsList  <Element>
  8376. IGBagAsList <Element, COps>
  8377.  
  8378. The implementation of the class IBagAsList requires the following element 
  8379. functions: 
  8380.  
  8381. Element Type 
  8382.  
  8383.      Copy constructor 
  8384.      Destructor 
  8385.      Assignment 
  8386.      Ordering relation 
  8387.  
  8388.  
  8389. ΓòÉΓòÉΓòÉ 5.3.5.6. Bag as Table ΓòÉΓòÉΓòÉ
  8390.  
  8391. IBagAsTable  <Element>
  8392. IGBagAsTable <Element, COps>
  8393.  
  8394. The implementation of the class IBagAsTable requires the following element 
  8395. functions: 
  8396.  
  8397. Element Type 
  8398.  
  8399.      Copy constructor 
  8400.      Destructor 
  8401.      Assignment 
  8402.      Ordering relation 
  8403.  
  8404.  
  8405. ΓòÉΓòÉΓòÉ 5.3.5.7. Bag as Diluted Table ΓòÉΓòÉΓòÉ
  8406.  
  8407. IBagAsDilTable  <Element>
  8408. IGBagAsDilTable <Element, COps>
  8409.  
  8410. The implementation of the class IBagAsDilTable requires the following element 
  8411. functions: 
  8412.  
  8413. Element Type 
  8414.  
  8415.      Copy constructor 
  8416.      Destructor 
  8417.      Assignment 
  8418.      Ordering relation 
  8419.  
  8420.  
  8421. ΓòÉΓòÉΓòÉ 5.3.6. Abstract Class ΓòÉΓòÉΓòÉ
  8422.  
  8423. IABag <Element>
  8424.  
  8425. For polymorphism, you can use the corresponding abstract class, IABag, which is 
  8426. found in the iabag.h header file. See Polymorphism and the Collections for 
  8427. further information. 
  8428.  
  8429. The required functions are the same as the required functions of the concrete 
  8430. base class. 
  8431.  
  8432.  
  8433. ΓòÉΓòÉΓòÉ 5.4. Deque ΓòÉΓòÉΓòÉ
  8434.  
  8435. Description 
  8436.  
  8437. Derivation 
  8438.  
  8439. Variants/Header Files 
  8440.  
  8441. Members 
  8442.  
  8443. Template Arguments and Required Functions 
  8444.  
  8445. Abstract/Reference Classes 
  8446.  
  8447. Examples 
  8448.  
  8449. To close all the panels in a chapter, double-click on this panel's system menu. 
  8450.  
  8451.  
  8452. ΓòÉΓòÉΓòÉ 5.4.1. Class Description - Deque ΓòÉΓòÉΓòÉ
  8453.  
  8454. A deque or double-ended queue is a sequence with restricted access.  It is an 
  8455. ordered collection of elements with no key and no element equality.  The 
  8456. elements are arranged so that each collection has a first and a last element, 
  8457. each element except the last has a next element, and each element but the first 
  8458. has a previous element.  You can only add or remove the first or last element. 
  8459.  
  8460. The type and value of the elements are irrelevant, and have no effect on the 
  8461. behavior of the collection. 
  8462.  
  8463. An example of using a deque is a program for managing a lettuce warehouse. 
  8464. Cases of lettuce arriving into the warehouse are registered at one end of the 
  8465. queue (the "fresh" end) by the receiving department.  The shipping department 
  8466. reads the other end of the queue (the "old" end) to determine which case of 
  8467. lettuce to ship next. However, if an order comes in for very fresh lettuce, 
  8468. which is sold at a premium, the shipping department reads the "fresh" end of 
  8469. the queue to select the freshest case of lettuce available. 
  8470.  
  8471.  
  8472. ΓòÉΓòÉΓòÉ 5.4.2. Derivation ΓòÉΓòÉΓòÉ
  8473.  
  8474. Collection 
  8475.  
  8476.   Ordered Collection
  8477.    Sequential Collection
  8478.      Sequence
  8479.       Deque
  8480.  
  8481. Note that deque is based on sequence but is not actually derived from it or 
  8482. from the other classes shown above. See Restricted Access for further details. 
  8483.  
  8484.  
  8485. ΓòÉΓòÉΓòÉ 5.4.3. Variants and Header Files ΓòÉΓòÉΓòÉ
  8486.  
  8487. IDeque, the first class in the table below, is the default implementation 
  8488. variant. 
  8489.  
  8490. To use Visual Builder features with your collections, change the name of the 
  8491. desired collection class template in the list below from I... to IV..., and use 
  8492. the ivdeque.h header file instead of the header file that you would normally 
  8493. use without Visual Builder. 
  8494.  
  8495. Class Name                Header File  Implementation Variant
  8496.  
  8497. IDeque                    idqu.h       List
  8498. IGDeque                   idqu.h       List
  8499.  
  8500. IDequeAsList              idqulst.h    List
  8501. IGDequeAsList             idqulst.h    List
  8502.  
  8503. IDequeAsTable             idqutab.h    Table
  8504. IGDequeAsTable            idqutab.h    Table
  8505.  
  8506. IDequeAsDilTable          idqudil.h    Diluted table
  8507. IGDequeAsDilTable         idqudil.h    Diluted table
  8508.  
  8509.  
  8510. ΓòÉΓòÉΓòÉ 5.4.4. Members ΓòÉΓòÉΓòÉ
  8511.  
  8512. All members of flat collections are described in Introduction to Flat 
  8513. Collections. The following members are provided for deque: 
  8514.  
  8515.      Constructor 
  8516.      Copy Constructor 
  8517.      Destructor 
  8518.      operator= 
  8519.      add 
  8520.      addAllFrom 
  8521.      addAsFirst 
  8522.      addAsLast 
  8523.      allElementsDo 
  8524.      anyElement 
  8525.      compare 
  8526.      copy 
  8527.      elementAt 
  8528.      elementAtPosition 
  8529.      firstElement 
  8530.      isBounded 
  8531.      isEmpty 
  8532.      isFirst 
  8533.      isFull 
  8534.      isLast 
  8535.      lastElement 
  8536.      maxNumberOfElements 
  8537.      newCursor 
  8538.      numberOfElements 
  8539.      positionAt 
  8540.      removeAll 
  8541.      removeFirst 
  8542.      removeLast 
  8543.      setToFirst 
  8544.      setToLast 
  8545.      setToNext 
  8546.      setToPosition 
  8547.      setToPrevious 
  8548.  
  8549.  Deque also defines a cursor that inherits from IOrderedCursor. The members for 
  8550.  IOrderedCursor are described in Cursor. 
  8551.  
  8552.  
  8553. ΓòÉΓòÉΓòÉ 5.4.5. Template Arguments and Required Functions ΓòÉΓòÉΓòÉ
  8554.  
  8555. The following implementation variants are defined for deques: 
  8556.  
  8557.      Deque 
  8558.      Deque as list 
  8559.      Deque as table 
  8560.      Deque as diluted table 
  8561.  
  8562.  
  8563. ΓòÉΓòÉΓòÉ 5.4.5.1. Deque ΓòÉΓòÉΓòÉ
  8564.  
  8565. IDeque  <Element>
  8566. IGDeque <Element, StdOps>
  8567.  
  8568. The default implementation of the class IDeque requires the following element 
  8569. functions: 
  8570.  
  8571. Element Type 
  8572.  
  8573.      Copy constructor 
  8574.      Destructor 
  8575.      Assignment 
  8576.  
  8577.  
  8578. ΓòÉΓòÉΓòÉ 5.4.5.2. Deque as List ΓòÉΓòÉΓòÉ
  8579.  
  8580. IDequeAsList <Element>
  8581. IGDequeAsList <Element, StdOps>
  8582.  
  8583. The implementation variant IDequeAsList requires the following element 
  8584. functions: 
  8585.  
  8586. Element Type 
  8587.  
  8588.      Copy constructor 
  8589.      Destructor 
  8590.      Assignment 
  8591.  
  8592.  
  8593. ΓòÉΓòÉΓòÉ 5.4.5.3. Deque as Table ΓòÉΓòÉΓòÉ
  8594.  
  8595. IDequeAsTable  <Element>
  8596. IGDequeAsTable <Element, StdOps>
  8597.  
  8598. The implementation of the class IDequeAsTable requires the following element 
  8599. functions: 
  8600.  
  8601. Element Type 
  8602.  
  8603.      Copy constructor 
  8604.      Destructor 
  8605.      Assignment 
  8606.  
  8607.  
  8608. ΓòÉΓòÉΓòÉ 5.4.5.4. Deque as Diluted Table ΓòÉΓòÉΓòÉ
  8609.  
  8610. IDequeAsDilTable  <Element>
  8611. IGDequeAsDilTable <Element, StdOps>
  8612.  
  8613. The implementation of the class IDequeAsDilTable requires the following element 
  8614. functions: 
  8615.  
  8616. Element Type 
  8617.  
  8618.      Copy constructor 
  8619.      Destructor 
  8620.      Assignment 
  8621.  
  8622.  
  8623. ΓòÉΓòÉΓòÉ 5.4.6. Abstract Class ΓòÉΓòÉΓòÉ
  8624.  
  8625. IADeque <Element>
  8626. For polymorphism, you can use the corresponding abstract class, IADeque, which 
  8627. is found in the iadqu.h header file. See Polymorphism and the Collections for 
  8628. further information. 
  8629.  
  8630. The required functions are the same as the required functions of the concrete 
  8631. base class. 
  8632.  
  8633.  
  8634. ΓòÉΓòÉΓòÉ 5.4.7. Coding Example for Deque ΓòÉΓòÉΓòÉ
  8635.  
  8636. The following program uses the default deque class, IDeque, to create a deque. 
  8637. It fills the deque with characters by adding them to the back end. The program 
  8638. then removes the characters from alternating ends of the deque (beginning with 
  8639. the front end) until the deque is empty. 
  8640.  
  8641. The program uses the constant iterator class, IConstantIterator, when printing 
  8642. the collection. It uses the addAsLast() function to fill the deque and the 
  8643. numberOfElements() function to determine the deque's size. It uses the 
  8644. functions firstElement(), removeFirst(), lastElement(), and removeLast() to 
  8645. empty the deque. 
  8646.  
  8647.    //    letterdq.C  -  An example of using a Deque.
  8648.  
  8649.    #include <iostream.h>
  8650.  
  8651.    #include <ideque.h>
  8652.                         // Let's use the default deque
  8653.    typedef IDeque <char> Deque;
  8654.                         // The deque requires iteration to be const
  8655.    typedef IConstantApplicator <char> CharApplicator;
  8656.  
  8657.    class Print : public CharApplicator
  8658.    {
  8659.    public:
  8660.       IBoolean applyTo(char const&c)
  8661.          {
  8662.          cout << c;
  8663.          return true;
  8664.          }
  8665.    };
  8666.  
  8667.    /*-------------------------------------------------------------*\
  8668.    | Test variables                                                |
  8669.    \*-------------------------------------------------------------*/
  8670.  
  8671.    char *String = "Teqikbonfxjmsoe  aydg.o zlarv pu o wr cu h";
  8672.  
  8673.  
  8674.    /*-------------------------------------------------------------*\
  8675.    | Main program                                                  |
  8676.    \*-------------------------------------------------------------*/
  8677.    int main()
  8678.    {
  8679.       Deque D;
  8680.       char  C;
  8681.       IBoolean ReadFront = true;
  8682.  
  8683.       int i;
  8684.  
  8685.       // Put all characters in the deque.
  8686.       // Then read it, changing the end to read from
  8687.       // with every character read.
  8688.  
  8689.       cout << endl
  8690.            << "Adding characters to the back end of the deque:" << endl;
  8691.  
  8692.       for (i = 0; String[i] != 0; i ++) {
  8693.          D.addAsLast(String[i]);
  8694.          cout << String[i];
  8695.          }
  8696.  
  8697.       cout << endl << endl
  8698.            << "Current number of elements in the deque: "
  8699.            <<  D.numberOfElements() << endl;
  8700.  
  8701.       cout << endl
  8702.            << "Contents of the deque:" << endl;
  8703.       Print Aprinter;
  8704.       D.allElementsDo(Aprinter);
  8705.  
  8706.       cout << endl << endl
  8707.            << "Reading from the deque one element from front, one "
  8708.            << "from back, and so on:" << endl;
  8709.  
  8710.       while (!D.isEmpty())
  8711.          {
  8712.          if (ReadFront)                  // Read from front of Deque
  8713.             {
  8714.             C = D.firstElement();        // Get the character
  8715.             D.removeFirst();             // Delete it from the Deque
  8716.             }
  8717.          else
  8718.             {
  8719.             C = D.lastElement();
  8720.             D.removeLast();
  8721.             }
  8722.          cout << C;
  8723.  
  8724.          ReadFront = !ReadFront;     // Switch to other end of Deque
  8725.          }
  8726.  
  8727.       cout << endl;
  8728.  
  8729.       return(0);
  8730.    }
  8731.  
  8732. The program produces the following output: 
  8733.  
  8734.  
  8735. Adding characters to the back end of the deque:
  8736. Teqikbonfxjme vralz o.gdya  eospu o wr cu h
  8737.  
  8738. Current number of elements in the deque: 43
  8739.  
  8740. Contents of the deque:
  8741. Teqikbonfxjme vralz o.gdya  eospu o wr cu h
  8742.  
  8743. Reading from the deque one element from front, one from back, and so on:
  8744. The quick brown fox jumpes over a lazy dog.
  8745.  
  8746.  
  8747. ΓòÉΓòÉΓòÉ 5.5. Equality Sequence ΓòÉΓòÉΓòÉ
  8748.  
  8749. Description 
  8750.  
  8751. Derivation 
  8752.  
  8753. Variants/Header Files 
  8754.  
  8755. Members 
  8756.  
  8757. Template Arguments and Required Functions 
  8758.  
  8759. Abstract/Reference Classes 
  8760.  
  8761. To close all the panels in a chapter, double-click on this panel's system menu. 
  8762.  
  8763.  
  8764. ΓòÉΓòÉΓòÉ 5.5.1. Class Description - Equality Sequence ΓòÉΓòÉΓòÉ
  8765.  
  8766. An equality sequence is an ordered collection of elements. The elements are 
  8767. arranged so that each collection has a first and a last element, each element 
  8768. except the last has a next element, and each element but the first has a 
  8769. previous element.  An equality sequence supports element equality, which gives 
  8770. you the ability, for example, to search for particular elements. 
  8771.  
  8772. An example of using an equality sequence is a program that calculates members 
  8773. of the Fibonacci sequence and places them in a collection.  Multiple elements 
  8774. of the same value are allowed.  For example, the sequence begins with two 
  8775. instances of the value 1.  You can search for a given element, for example 8, 
  8776. and find out what element follows it in the sequence.  Element equality allows 
  8777. you to do this, using the locate() and setToNext() functions. 
  8778.  
  8779.  
  8780. ΓòÉΓòÉΓòÉ 5.5.2. Derivation ΓòÉΓòÉΓòÉ
  8781.  
  8782. Collection 
  8783.  
  8784.   Equality Collection
  8785.   Sequential Collection
  8786.      Equality Sequence
  8787.  
  8788. Figure Combination of Flat Collection Properties illustrates the properties of 
  8789. an equality sequence and its relationship to other flat collections. 
  8790.  
  8791.  
  8792. ΓòÉΓòÉΓòÉ 5.5.3. Variants and Header Files ΓòÉΓòÉΓòÉ
  8793.  
  8794. IEqualitySequence, the first class in the table below, is the default 
  8795. implementation variant. 
  8796.  
  8797. To use Visual Builder features with your collections, change the name of the 
  8798. desired collection class template in the list below from I... to IV..., and use 
  8799. the iveqseq.h header file instead of the header file that you would normally 
  8800. use without Visual Builder. 
  8801.  
  8802. Class Name          Header File  Implementation Variant
  8803.  
  8804. IEqualitySequence   ies.h        List
  8805. IGEqualitySequence  ies.h        List
  8806.  
  8807. IEqualitySequence-  ieslst.h     List
  8808.  AsList
  8809. IGEqualitySequence- ieslst.h     List
  8810.  AsList
  8811.  
  8812. IEqualitySequence-  iestab.h     Table
  8813.  AsTable
  8814. IGEqualitySequence  iestabh      Table
  8815.  
  8816. IEqualitySequence-  iesdilh      Diluted table
  8817.  AsDilTable
  8818. IGEqualitySequence  iesdilh      Diluted table
  8819.  
  8820.  
  8821. ΓòÉΓòÉΓòÉ 5.5.4. Members ΓòÉΓòÉΓòÉ
  8822.  
  8823. All members of flat collections are described in Introduction to Flat 
  8824. Collections. The following members are provided for equality sequence: 
  8825.  
  8826.      Constructor 
  8827.      Copy Constructor 
  8828.      Destructor 
  8829.      operator!= 
  8830.      operator= 
  8831.      operator== 
  8832.      add 
  8833.      addAllFrom 
  8834.      addAsFirst 
  8835.      addAsLast 
  8836.      addAsNext 
  8837.      addAsPrevious 
  8838.      addAtPosition 
  8839.      allElementsDo 
  8840.      anyElement 
  8841.      compare 
  8842.      contains 
  8843.      containsAllFrom 
  8844.      copy 
  8845.      elementAt 
  8846.      elementAtPosition 
  8847.      firstElement 
  8848.      isBounded 
  8849.      isEmpty 
  8850.      isFirst 
  8851.      isFull 
  8852.      isLast 
  8853.      lastElement 
  8854.      locate 
  8855.      locateFirst 
  8856.      locateLast 
  8857.      locateNext 
  8858.      locateOrAdd 
  8859.      locatePrevious 
  8860.      maxNumberOfElements 
  8861.      newCursor 
  8862.      numberOfElements 
  8863.      numberOfOccurrences 
  8864.      positionAt 
  8865.      remove 
  8866.      removeAll 
  8867.      removeAllOccurrences 
  8868.      removeAt 
  8869.      removeAtPosition 
  8870.      removeFirst 
  8871.      removeLast 
  8872.      replaceAt 
  8873.      setToFirst 
  8874.      setToLast 
  8875.      setToNext 
  8876.      setToPosition 
  8877.      setToPrevious 
  8878.      sort 
  8879.  
  8880.  Equality sequence also defines a cursor that inherits from IOrderedCursor. The 
  8881.  members for IOrderedCursor are described in Cursor. 
  8882.  
  8883.  
  8884. ΓòÉΓòÉΓòÉ 5.5.5. Template Arguments and Required Functions ΓòÉΓòÉΓòÉ
  8885.  
  8886. The following implementation variants are defined for equality sequences: 
  8887.  
  8888.      Equality sequence 
  8889.      Equality sequence as list 
  8890.      Equality sequence as table 
  8891.      Equality sequence as diluted table 
  8892.  
  8893.  
  8894. ΓòÉΓòÉΓòÉ 5.5.5.1. Equality Sequence ΓòÉΓòÉΓòÉ
  8895.  
  8896. IEqualitySequence  <Element>
  8897. IGEqualitySequence <Element, EOps>
  8898.  
  8899. The default implementation of IEqualitySequence requires the following element 
  8900. functions: 
  8901.  
  8902. Element Type 
  8903.  
  8904.      Assignment 
  8905.      Copy constructor 
  8906.      Destructor 
  8907.      Equality test 
  8908.  
  8909.  
  8910. ΓòÉΓòÉΓòÉ 5.5.5.2. Equality Sequence as List ΓòÉΓòÉΓòÉ
  8911.  
  8912. IEqualitySequenceAsList  <Element>
  8913. IGEqualitySequenceAsList <Element, EOps>
  8914.  
  8915. The implementation of the class IEqualitySequenceAsList requires the following 
  8916. element functions: 
  8917.  
  8918. Element Type 
  8919.  
  8920.      Assignment 
  8921.      Copy constructor 
  8922.      Destructor 
  8923.      Equality test 
  8924.  
  8925.  
  8926. ΓòÉΓòÉΓòÉ 5.5.5.3. Equality Sequence as Table ΓòÉΓòÉΓòÉ
  8927.  
  8928. IEqualitySequenceAsTable  <Element>
  8929. IGEqualitySequenceAsTable <Element, EOps>
  8930.  
  8931. The implementation of the class IEqualitySequenceAsTable requires the following 
  8932. element functions: 
  8933.  
  8934. Element Type 
  8935.  
  8936.      Copy constructor 
  8937.      Destructor 
  8938.      Assignment 
  8939.      Equality test 
  8940.  
  8941.  
  8942. ΓòÉΓòÉΓòÉ 5.5.5.4. Equality Sequence as Diluted Table ΓòÉΓòÉΓòÉ
  8943.  
  8944. IEqualitySequenceAsDilTable  <Element>
  8945. IGEqualitySequenceAsDilTable <Element, EOps>
  8946.  
  8947. The implementation of the class IEqualitySequenceAsDilTable requires the 
  8948. following element functions: 
  8949.  
  8950. Element Type 
  8951.  
  8952.      Copy constructor 
  8953.      Destructor 
  8954.      Assignment 
  8955.      Equality test 
  8956.  
  8957.  
  8958. ΓòÉΓòÉΓòÉ 5.5.6. Abstract Class ΓòÉΓòÉΓòÉ
  8959.  
  8960. IAEqualitySequence<Element>
  8961.  
  8962. For polymorphism, you can use the corresponding abstract class, 
  8963. IAEqualitySequence, which is found in the iaes.h header file. See Polymorphism 
  8964. and the Collections for further information. 
  8965.  
  8966. The required functions are the same as the required functions of the concrete 
  8967. base class. 
  8968.  
  8969.  
  8970. ΓòÉΓòÉΓòÉ 5.6. Heap ΓòÉΓòÉΓòÉ
  8971.  
  8972. Description 
  8973.  
  8974. Derivation 
  8975.  
  8976. Variants/Header Files 
  8977.  
  8978. Members 
  8979.  
  8980. Template Arguments and Required Functions 
  8981.  
  8982. Abstract/Reference Classes 
  8983.  
  8984. Examples 
  8985.  
  8986. To close all the panels in a chapter, double-click on this panel's system menu. 
  8987.  
  8988.  
  8989. ΓòÉΓòÉΓòÉ 5.6.1. Class Description - Heap ΓòÉΓòÉΓòÉ
  8990.  
  8991. A heap is an unordered collection of zero or more elements with no key. 
  8992. Element equality is not supported.  Multiple elements are supported.  The type 
  8993. and value of the elements are irrelevant, and have no effect on the behavior of 
  8994. the heap. 
  8995.  
  8996. You can compare using a heap collection to managing the scrap metal entering a 
  8997. scrapyard.  Pieces of scrap are placed in the heap in an arbitrary location, 
  8998. and an element can be added multiple times (for example, the rear left fender 
  8999. from a particular kind of car).  When a customer requests a certain amount of 
  9000. scrap, elements are removed from the heap in an arbitrary order until the 
  9001. required amount is reached. You cannot search for a specific piece of scrap 
  9002. except by examining each piece of scrap in the heap and manually comparing it 
  9003. to the piece you are looking for. 
  9004.  
  9005. Figure Combination of Flat Collection Properties illustrates the properties of 
  9006. a heap and its relationship to other flat collections. 
  9007.  
  9008.  
  9009. ΓòÉΓòÉΓòÉ 5.6.2. Derivation ΓòÉΓòÉΓòÉ
  9010.  
  9011. Collection 
  9012.  
  9013.   Heap
  9014.  
  9015.  
  9016. ΓòÉΓòÉΓòÉ 5.6.3. Variants and Header Files ΓòÉΓòÉΓòÉ
  9017.  
  9018. IHeap, the first class in the table below, is the default implementation 
  9019. variant. 
  9020.  
  9021. To use Visual Builder features with your collections, change the name of the 
  9022. desired collection class template in the list below from I... to IV..., and use 
  9023. the ivheap.h header file instead of the header file that you would normally use 
  9024. without Visual Builder. 
  9025.  
  9026. Class Name              Header File  Implementation Variant
  9027.  
  9028. IHeap                   ihp.h        List
  9029. IGHeap                  ihp.h        List
  9030.  
  9031. IHeapAsList             ihplst.h     List
  9032. IGHeapAsList            ihplst.h     List
  9033.  
  9034. IHeapAsTable            ihptab.h     Table
  9035. IGHeapAsTable           ihptab.h     Table
  9036.  
  9037. IHeapAsDilTable         ihpdil.h     Diluted table
  9038. IGHeapAsDilTable        ihpdil.h     Diluted table
  9039.  
  9040.  
  9041. ΓòÉΓòÉΓòÉ 5.6.4. Members ΓòÉΓòÉΓòÉ
  9042.  
  9043. All members of flat collections are described in Introduction to Flat 
  9044. Collections. The following members are provided for heap: 
  9045.  
  9046.      Constructor 
  9047.      Copy Constructor 
  9048.      Destructor 
  9049.      operator= 
  9050.      add 
  9051.      addAllFrom 
  9052.      allElementsDo 
  9053.      anyElement 
  9054.      copy 
  9055.      elementAt 
  9056.      isBounded 
  9057.      isEmpty 
  9058.      isFull 
  9059.      maxNumberOfElements 
  9060.      newCursor 
  9061.      numberOfElements 
  9062.      removeAll 
  9063.      removeAt 
  9064.      replaceAt 
  9065.      setToFirst 
  9066.      setToNext 
  9067.  
  9068.  Heap also defines a cursor that inherits from IElementCursor. The members for 
  9069.  IElementCursor are described in Cursor. 
  9070.  
  9071.  
  9072. ΓòÉΓòÉΓòÉ 5.6.5. Template Arguments and Required Functions ΓòÉΓòÉΓòÉ
  9073.  
  9074. The following implementation variants are defined for heaps: 
  9075.  
  9076.      Heap 
  9077.      Heap as List 
  9078.      Heap as Table 
  9079.      Heap as Diluted Table 
  9080.  
  9081.  
  9082. ΓòÉΓòÉΓòÉ 5.6.5.1. Heap ΓòÉΓòÉΓòÉ
  9083.  
  9084. IHeap  <Element>
  9085. IGHeap <Element, StdOps>
  9086.  
  9087. The default implementation of IHeap requires the following element functions: 
  9088.  
  9089. Element Type 
  9090.  
  9091.      Copy constructor 
  9092.      Assignment 
  9093.  
  9094.  
  9095. ΓòÉΓòÉΓòÉ 5.6.5.2. Heap as List ΓòÉΓòÉΓòÉ
  9096.  
  9097. IHeapAsList  <Element>
  9098. IGHeapAsList <Element, StdOps>
  9099.  
  9100. The implementation variant IHeapAsList requires the following element 
  9101. functions: 
  9102.  
  9103. Element Type 
  9104.  
  9105.      Copy constructor 
  9106.      Assignment 
  9107.  
  9108.  
  9109. ΓòÉΓòÉΓòÉ 5.6.5.3. Heap as Table ΓòÉΓòÉΓòÉ
  9110.  
  9111. IHeapAsTable  <Element>
  9112. IGHeapAsTable <Element, StdOps>
  9113.  
  9114. The implementation of the class IHeapAsTable requires the following element 
  9115. functions: 
  9116.  
  9117. Element Type 
  9118.  
  9119.      Copy constructor 
  9120.      Assignment 
  9121.  
  9122.  
  9123. ΓòÉΓòÉΓòÉ 5.6.5.4. Heap as Diluted Table ΓòÉΓòÉΓòÉ
  9124.  
  9125. IHeapAsDilTable  <Element>
  9126. IGHeapAsDilTable <Element, StdOps>
  9127.  
  9128. The implementation of the class IHeapAsDilTable requires the following element 
  9129. functions: 
  9130.  
  9131. Element Type 
  9132.  
  9133.      Assignment 
  9134.      Copy constructor 
  9135.  
  9136.  
  9137. ΓòÉΓòÉΓòÉ 5.6.6. Abstract Class ΓòÉΓòÉΓòÉ
  9138.  
  9139. IAHeap<Element>
  9140.  
  9141. For polymorphism, you can use the corresponding abstract class, IAHeap, which 
  9142. is found in the iahp.h header file. See Polymorphism and the Collections for 
  9143. further information. 
  9144.  
  9145. The required functions are the same as the required functions of the concrete 
  9146. base class. 
  9147.  
  9148.  
  9149. ΓòÉΓòÉΓòÉ 5.6.7. Coding Example for Heap ΓòÉΓòÉΓòÉ
  9150.  
  9151. See Coding Example for Key Sorted Set for an example of using a heap. 
  9152.  
  9153.  
  9154. ΓòÉΓòÉΓòÉ 5.7. Key Bag ΓòÉΓòÉΓòÉ
  9155.  
  9156. Description 
  9157.  
  9158. Derivation 
  9159.  
  9160. Variants/Header Files 
  9161.  
  9162. Members 
  9163.  
  9164. Template Arguments and Required Functions 
  9165.  
  9166. Abstract/Reference Classes 
  9167.  
  9168. Examples 
  9169.  
  9170. To close all the panels in a chapter, double-click on this panel's system menu. 
  9171.  
  9172.  
  9173. ΓòÉΓòÉΓòÉ 5.7.1. Class Description - Key Bag ΓòÉΓòÉΓòÉ
  9174.  
  9175. A key bag is an unordered collection of zero or more elements that have a key. 
  9176. Multiple elements are supported. 
  9177.  
  9178. An example of using a key bag is a program that manages the distribution of 
  9179. combination locks to members of a fitness club. The element key is the number 
  9180. that is printed on the back of each combination lock.  Each element also has 
  9181. data members for the club member's name, member number, and so on.  When you 
  9182. join the club, you are given one of the available combination locks, and your 
  9183. name, member number, and the number on the combination lock are entered into 
  9184. the collection.  Because a given number on a combination lock may appear on 
  9185. several locks, the program allows the same lock number to be added to the 
  9186. collection multiple times.  When you return a lock because you are leaving the 
  9187. club, the program finds each element whose key matches your lock's serial 
  9188. number, and deletes one such element that has your name associated with it. 
  9189.  
  9190. Figure Behavior of add for Unique and Multiple Collections illustrates the 
  9191. differences in behavior between map, relation, key set, and key bag when 
  9192. identical elements and elements with the same key are added. 
  9193.  
  9194.  
  9195. ΓòÉΓòÉΓòÉ 5.7.2. Derivation ΓòÉΓòÉΓòÉ
  9196.  
  9197. Collection 
  9198.  
  9199.   Key Collection
  9200.    Key Bag
  9201.  
  9202. Figure Combination of Flat Collection Properties gives an overview of the 
  9203. properties of a key bag and its relationship to other flat collections. 
  9204.  
  9205.  
  9206. ΓòÉΓòÉΓòÉ 5.7.3. Variants and Header Files ΓòÉΓòÉΓòÉ
  9207.  
  9208. IKeyBag, the first class in the table below, is the default implementation 
  9209. variant. 
  9210.  
  9211. To use Visual Builder features with your collections, change the name of the 
  9212. desired collection class template in the list below from I... to IV..., and use 
  9213. the ivkeybag.h header file instead of the header file that you would normally 
  9214. use without Visual Builder. 
  9215.  
  9216. Class Name             Header File    Implementation Variant
  9217.  
  9218. IKeyBag                ikb.h          Hash table
  9219. IGKeyBag               ikb.h          Hash table
  9220. IKeyBagAsHshTable      ikbhsh.h       Hash table
  9221. IGKeyBagAsHshTable     ikbhsh.h       Hash table
  9222.  
  9223.  
  9224. ΓòÉΓòÉΓòÉ 5.7.4. Members ΓòÉΓòÉΓòÉ
  9225.  
  9226. All members of flat collections are described in Introduction to Flat 
  9227. Collections. The following members are provided for key bag: 
  9228.  
  9229.      Constructor 
  9230.      Copy Constructor 
  9231.      Destructor 
  9232.      operator= 
  9233.      add 
  9234.      addAllFrom 
  9235.      addOrReplaceElementWithKey 
  9236.      allElementsDo 
  9237.      anyElement 
  9238.      containsAllKeysFrom 
  9239.      containsElementWithKey 
  9240.      copy 
  9241.      elementAt 
  9242.      elementWithKey 
  9243.      isBounded 
  9244.      isEmpty 
  9245.      isFull 
  9246.      key 
  9247.      locateElementWithKey 
  9248.      locateNextElementWithKey 
  9249.      locateOrAddElementWithKey 
  9250.      maxNumberOfElements 
  9251.      newCursor 
  9252.      numberOfDifferentKeys 
  9253.      numberOfElements 
  9254.      numberOfElementsWithKey 
  9255.      removeAll 
  9256.      removeAllElementsWithKey 
  9257.      removeAt 
  9258.      removeElementWithKey 
  9259.      replaceAt 
  9260.      replaceElementWithKey 
  9261.      setToFirst 
  9262.      setToNext 
  9263.      setToNextWithDifferentKey 
  9264.  
  9265.  Key Bag also defines a cursor that inherits from IElementCursor. The members 
  9266.  for IElementCursor are described in Cursor. 
  9267.  
  9268.  
  9269. ΓòÉΓòÉΓòÉ 5.7.5. Template Arguments and Required Functions ΓòÉΓòÉΓòÉ
  9270.  
  9271. The following implementation variants are defined for key bags: 
  9272.  
  9273.      Key bag 
  9274.      Key bag as hash table 
  9275.  
  9276.  
  9277. ΓòÉΓòÉΓòÉ 5.7.5.1. Key Bag ΓòÉΓòÉΓòÉ
  9278.  
  9279. IKeyBag  <Element, Key>
  9280. IGKeyBag <Element, Key, KEHOps>
  9281.  
  9282. The default implementation of the class IKeyBag requires the following element 
  9283. and key-type functions: 
  9284.  
  9285. Element Type 
  9286.  
  9287.      Copy constructor 
  9288.      Destructor 
  9289.      Assignment 
  9290.      Key access 
  9291.  
  9292.  Key Type 
  9293.  
  9294.      Equality test 
  9295.      Hash function 
  9296.  
  9297.  
  9298. ΓòÉΓòÉΓòÉ 5.7.5.2. Key Bag as Hash Table ΓòÉΓòÉΓòÉ
  9299.  
  9300. IKeyBagAsHshTable  <Element, Key>
  9301. IGKeyBagAsHshTable <Element, Key, KEHOps>
  9302.  
  9303. The implementation of the class IKeyBagAsHshTable requires the following 
  9304. element and key-type functions: 
  9305.  
  9306. Element Type 
  9307.  
  9308.      Copy constructor 
  9309.      Destructor 
  9310.      Assignment 
  9311.      Key access 
  9312.  
  9313.  Key Type 
  9314.  
  9315.      Equality test 
  9316.      Hash function 
  9317.  
  9318.  
  9319. ΓòÉΓòÉΓòÉ 5.7.6. Abstract Class ΓòÉΓòÉΓòÉ
  9320.  
  9321. IAKeyBag<Element,Key>
  9322.  
  9323. For polymorphism, you can use the corresponding abstract class, IAKeyBag, which 
  9324. is found in the iakb.h header file. See Polymorphism and the Collections for 
  9325. further information. 
  9326.  
  9327. The required functions are the same as the required functions of the concrete 
  9328. base class. 
  9329.  
  9330.  
  9331. ΓòÉΓòÉΓòÉ 5.7.7. Coding Example for Key Bag ΓòÉΓòÉΓòÉ
  9332.  
  9333. The following program uses the default key bag class, IKeyBag, to create a key 
  9334. bag for storing observations made on animals. The key of the class is the name 
  9335. of the animal.  The program produces various reports regarding the 
  9336. observations.  Then it removes all the extinct animals, which are stored in a 
  9337. sequence, from the key bag. 
  9338.  
  9339. The program uses the add() function to fill the key bag and the forICursor 
  9340. macro to display the observations. It uses the following functions to produce 
  9341. the reports: 
  9342.  
  9343.      numberOfElements() 
  9344.      numberOfDifferentKeys() 
  9345.      numberOfElementsWithKey() 
  9346.      locateElementWithKey() 
  9347.      setToNextElementWithKey() 
  9348.      removeAllElementsWithKey() 
  9349.  
  9350.      // animals.C  -  An example of using a Key Bag
  9351.      #include <iostream.h>
  9352.                     // Class Animal:
  9353.      #include "animal.h"
  9354.  
  9355.                     // Let's use the default Key Bag:
  9356.      #include <ikeybag.h>
  9357.      typedef IKeyBag<Animal, IString> Animals;
  9358.  
  9359.                     // For keys let's use the default Sequence:
  9360.      #include <iseq.h>
  9361.      typedef ISequence<IString> Names;
  9362.  
  9363.  
  9364.      main() {
  9365.  
  9366.         Animals animals;
  9367.         Animals::Cursor animalsCur1(animals), animalsCur2(animals);
  9368.  
  9369.         animals.add(Animal("bear", "heavy"));
  9370.         animals.add(Animal("bear", "strong"));
  9371.         animals.add(Animal("dinosaur", "heavy"));
  9372.         animals.add(Animal("dinosaur", "huge"));
  9373.         animals.add(Animal("dinosaur", "extinct"));
  9374.         animals.add(Animal("eagle", "black"));
  9375.         animals.add(Animal("eagle", "strong"));
  9376.         animals.add(Animal("lion", "dangerous"));
  9377.         animals.add(Animal("lion", "strong"));
  9378.         animals.add(Animal("mammoth", "long haired"));
  9379.         animals.add(Animal("mammoth", "extinct"));
  9380.         animals.add(Animal("sabre tooth tiger", "extinct"));
  9381.         animals.add(Animal("zebra", "striped"));
  9382.  
  9383.                       // Display all elements in animals:
  9384.         cout << endl
  9385.              << "All our observations on animals:" << endl;
  9386.         forICursor(animalsCur1)  cout << "    " << animalsCur1.element();
  9387.  
  9388.         cout << endl << endl
  9389.              << "Number of observations on animals: "
  9390.              << animals.numberOfElements() << endl;
  9391.  
  9392.         cout << endl
  9393.              << "Number of different animals: "
  9394.              << animals.numberOfDifferentKeys() << endl;
  9395.  
  9396.         Names namesOfExtinct(animals.numberOfDifferentKeys());
  9397.         Names::Cursor extinctCur1(namesOfExtinct);
  9398.  
  9399.         animalsCur1.setToFirst();
  9400.         do {
  9401.            IString name = animalsCur1.element().name();
  9402.  
  9403.            cout << endl
  9404.                 << "We have " << animals.numberOfElementsWithKey(name)
  9405.                 << " observations on " << name << ":" << endl;
  9406.  
  9407.                         // We need to use a separate cursor here
  9408.                         // because otherwise animalsCur1 would become
  9409.                         // invalid after last locateNextElement...()
  9410.            animals.locateElementWithKey(name, animalsCur2);
  9411.            do  {
  9412.               IString attribute = animalsCur2.element().attribute();
  9413.               cout << "    " << attribute << endl;
  9414.               if (attribute == "extinct") namesOfExtinct.add(name);
  9415.            } while (animals.locateNextElementWithKey(name, animalsCur2));
  9416.  
  9417.         } while (animals.setToNextWithDifferentKey(animalsCur1));
  9418.  
  9419.                       // Remove all observations on extinct animals:
  9420.         forICursor(extinctCur1)
  9421.            animals.removeAllElementsWithKey(extinctCur1.element());
  9422.  
  9423.                       // Display all elements in animals:
  9424.         cout << endl << endl
  9425.              << "After removing all observations on extinct animals:" << endl;
  9426.         forICursor(animalsCur1)  cout << "    " << animalsCur1.element();
  9427.  
  9428.         cout << endl
  9429.              << "Number of observations on animals: "
  9430.              << animals.numberOfElements() << endl;
  9431.  
  9432.         cout << endl
  9433.              << "Number of different animals: "
  9434.              << animals.numberOfDifferentKeys() << endl;
  9435.  
  9436.         return 0;
  9437.      }
  9438.  
  9439.  The program produces the following output: 
  9440.  
  9441.  
  9442.   All our observations on animals:
  9443.       The eagle is strong.
  9444.       The eagle is black.
  9445.       The bear is strong.
  9446.       The bear is heavy.
  9447.       The zebra is striped.
  9448.       The mammoth is extinct.
  9449.       The mammoth is long haired.
  9450.       The lion is strong.
  9451.       The lion is dangerous.
  9452.       The dinosaur is extinct.
  9453.       The dinosaur is huge.
  9454.       The dinosaur is heavy.
  9455.       The sabre tooth tiger is extinct.
  9456.  
  9457.  
  9458.   Number of observations on animals: 13
  9459.  
  9460.   Number of different animals: 7
  9461.  
  9462.   We have 2 observations on eagle:
  9463.       strong
  9464.       black
  9465.  
  9466.   We have 2 observations on bear:
  9467.       strong
  9468.       heavy
  9469.  
  9470.   We have 1 observations on zebra:
  9471.       striped
  9472.  
  9473.   We have 2 observations on mammoth:
  9474.       extinct
  9475.       long haired
  9476.  
  9477.   We have 2 observations on lion:
  9478.       strong
  9479.       dangerous
  9480.  
  9481.   We have 3 observations on dinosaur:
  9482.       extinct
  9483.       huge
  9484.       heavy
  9485.  
  9486.   We have 1 observations on sabre tooth tiger:
  9487.       extinct
  9488.  
  9489.  
  9490.   After removing all observations on extinct animals:
  9491.       The eagle is strong.
  9492.       The eagle is black.
  9493.       The bear is strong.
  9494.       The bear is heavy.
  9495.       The zebra is striped.
  9496.       The lion is strong.
  9497.       The lion is dangerous.
  9498.  
  9499.   Number of observations on animals: 7
  9500.  
  9501.   Number of different animals: 4
  9502.  
  9503.  
  9504. ΓòÉΓòÉΓòÉ 5.8. Key Set ΓòÉΓòÉΓòÉ
  9505.  
  9506. Description 
  9507.  
  9508. Derivation 
  9509.  
  9510. Variants/Header Files 
  9511.  
  9512. Members 
  9513.  
  9514. Template Arguments and Required Functions 
  9515.  
  9516. Abstract/Reference Classes 
  9517.  
  9518. Examples 
  9519.  
  9520. To close all the panels in a chapter, double-click on this panel's system menu. 
  9521.  
  9522.  
  9523. ΓòÉΓòÉΓòÉ 5.8.1. Class Description - Key Set ΓòÉΓòÉΓòÉ
  9524.  
  9525. A key set is an unordered collection of zero or more elements that have a key. 
  9526. Element equality is not supported.  Only unique elements are supported, in 
  9527. terms of their key. 
  9528.  
  9529. An example of using a key set is a program that allocates rooms to patrons 
  9530. checking into a hotel.  The room number serves as the element's key, and the 
  9531. patron's name is a data member of the element.  When you check in at the front 
  9532. desk, the clerk pulls a room key from the board, and enters that key's number 
  9533. and your name into the collection.  When you return the key at check-out time, 
  9534. the record for that key is removed from the collection.  You cannot add an 
  9535. element to the collection that is already present, because there is only one 
  9536. key for each room.  If you attempt to add an element that is already present, 
  9537. the add() function returns false to indicate that the element was not added. 
  9538.  
  9539. Figure Behavior of add for Unique and Multiple Collections illustrates the 
  9540. differences in behavior between map, relation, key set, and key bag when 
  9541. identical elements and elements with the same key are added. 
  9542.  
  9543. Figure Combination of Flat Collection Properties gives an overview of the 
  9544. properties of a key set and its relationship to other flat collections. 
  9545.  
  9546.  
  9547. ΓòÉΓòÉΓòÉ 5.8.2. Derivation ΓòÉΓòÉΓòÉ
  9548.  
  9549. Collection 
  9550.  
  9551.   Key Collection
  9552.    Key Set
  9553.  
  9554.  
  9555. ΓòÉΓòÉΓòÉ 5.8.3. Variants and Header Files ΓòÉΓòÉΓòÉ
  9556.  
  9557. IKeySet, the first class in the table below, is the default implementation 
  9558. variant. 
  9559.  
  9560. To use Visual Builder features with your collections, change the name of the 
  9561. desired collection class template in the list below from I... to IV..., and use 
  9562. the ivkeyset.h header file instead of the header file that you would normally 
  9563. use without Visual Builder. 
  9564.  
  9565. Class Name             Header File Implementation Variant
  9566.  
  9567. IKeySet                iks.h       AVL tree
  9568. IGKeySet               iks.h       AVL tree
  9569.  
  9570. IKeySetAsAvlTree       iksavl.h    AVL tree
  9571. IGKeySetAsAvlTree      iksavl.h    AVL tree
  9572.  
  9573. IKeySetAsBstTree       iksbst.h    B* tree
  9574. IGKeySetAsBstTree      iksbst.h    B* tree
  9575.  
  9576. IKeySetAsHshTable      ikshsh.h    Hash table
  9577. IGKeySetAsHshTable     ikshsh.h    Hash table
  9578.  
  9579. IKeySetAsList          ikslst.h    List
  9580. IGKeySetAsList         ikslst.h    List
  9581.  
  9582. IKeySetAsTable         ikstab.h    Table
  9583. IGKeySetAsTable        ikstab.h    Table
  9584.  
  9585. IKeySetAsDilTable      iksdil.h    Diluted table
  9586. IGKeySetAsDilTable     iksdil.h    Diluted table
  9587.  
  9588.  
  9589. ΓòÉΓòÉΓòÉ 5.8.4. Members ΓòÉΓòÉΓòÉ
  9590.  
  9591. All members of flat collections are described in Introduction to Flat 
  9592. Collections. The following members are provided for key set: 
  9593.  
  9594.      Constructor 
  9595.      Copy Constructor 
  9596.      Destructor 
  9597.      operator= 
  9598.      add 
  9599.      addAllFrom 
  9600.      addOrReplaceElementWithKey 
  9601.      allElementsDo 
  9602.      anyElement 
  9603.      containsAllKeysFrom 
  9604.      containsElementWithKey 
  9605.      copy 
  9606.      elementAt 
  9607.      elementWithKey 
  9608.      isBounded 
  9609.      isEmpty 
  9610.      isFull 
  9611.      key 
  9612.      locateElementWithKey 
  9613.      locateOrAddElementWithKey 
  9614.      maxNumberOfElements 
  9615.      newCursor 
  9616.      numberOfElements 
  9617.      removeAll 
  9618.      removeAt 
  9619.      removeElementWithKey 
  9620.      replaceAt 
  9621.      replaceElementWithKey 
  9622.      setToFirst 
  9623.      setToNext 
  9624.  
  9625.  Key set also defines a cursor that inherits from IElementCursor. The members 
  9626.  for IElementCursor are described in Cursor. 
  9627.  
  9628.  
  9629. ΓòÉΓòÉΓòÉ 5.8.5. Template Arguments and Required Functions ΓòÉΓòÉΓòÉ
  9630.  
  9631. The following implementation variants are defined for key sets: 
  9632.  
  9633.      Key set 
  9634.      Key set as AVL tree 
  9635.      Key set as B* tree 
  9636.      Key set as hash table 
  9637.      Key set as list 
  9638.      Key set as table 
  9639.      Key set as diluted table 
  9640.  
  9641.  
  9642. ΓòÉΓòÉΓòÉ 5.8.5.1. Key Set ΓòÉΓòÉΓòÉ
  9643.  
  9644. IKeySet  <Element, Key>
  9645. IGKeySet <Element, Key, KCOps>
  9646.  
  9647. The default implementation of the class IKeySet requires the following element 
  9648. and key-type functions: 
  9649.  
  9650. Element Type 
  9651.  
  9652.      Copy constructor 
  9653.      Destructor 
  9654.      Assignment 
  9655.      Key access 
  9656.  
  9657.  Key Type 
  9658.  
  9659.  Ordering relation 
  9660.  
  9661.  
  9662. ΓòÉΓòÉΓòÉ 5.8.5.2. Key Set as AVL Tree ΓòÉΓòÉΓòÉ
  9663.  
  9664. IKeySetAsAvlTree  <Element, Key>
  9665. IGKeySetAsAvlTree <Element, Key, KCOps>
  9666.  
  9667. The implementation of the class IKeySetAsAvlTree requires the following element 
  9668. and key-type functions: 
  9669.  
  9670. Element Type 
  9671.  
  9672.      Copy constructor 
  9673.      Destructor 
  9674.      Assignment 
  9675.      Key access 
  9676.  
  9677.  Key Type 
  9678.  
  9679.  Ordering relation 
  9680.  
  9681.  
  9682. ΓòÉΓòÉΓòÉ 5.8.5.3. Key Set as B* Tree ΓòÉΓòÉΓòÉ
  9683.  
  9684. IKeySetAsBstTree  <Element, Key>
  9685. IGKeySetAsBstTree <Element, Key, KCOps>
  9686.  
  9687. The implementation of the class IKeySetAsBstTree requires the following element 
  9688. and key-type functions: 
  9689.  
  9690. Element Type 
  9691.  
  9692.      Default constructor 
  9693.      Copy constructor 
  9694.      Destructor 
  9695.      Assignment 
  9696.      Key access 
  9697.  
  9698.  Key Type 
  9699.  
  9700.  Ordering relation 
  9701.  
  9702.  
  9703. ΓòÉΓòÉΓòÉ 5.8.5.4. Key Set as Hash Table ΓòÉΓòÉΓòÉ
  9704.  
  9705. IKeySetAsHshTable  <Element, Key>
  9706. IGKeySetAsHshTable <Element, Key, KEHOps>
  9707.  
  9708. The implementation class IKeySetAsHshTable requires the following element and 
  9709. key-type functions: 
  9710.  
  9711. Element Type 
  9712.  
  9713.      Copy constructor 
  9714.      Destructor 
  9715.      Assignment 
  9716.      Key access 
  9717.  
  9718.  Key Type 
  9719.  
  9720.      Equality test 
  9721.      Hash function 
  9722.  
  9723.  
  9724. ΓòÉΓòÉΓòÉ 5.8.5.5. Key Set as List ΓòÉΓòÉΓòÉ
  9725.  
  9726. IKeySetAsList  <Element, Key>
  9727. IGKeySetAsList <Element, Key, KCOps>
  9728.  
  9729. The implementation of the class IKeySetAsList requires the following element 
  9730. and key-type functions: 
  9731.  
  9732. Element Type 
  9733.  
  9734.      Copy constructor 
  9735.      Destructor 
  9736.      Assignment 
  9737.      Key access 
  9738.  
  9739.  Key Type 
  9740.  
  9741.  Ordering relation 
  9742.  
  9743.  
  9744. ΓòÉΓòÉΓòÉ 5.8.5.6. Key Set as Table ΓòÉΓòÉΓòÉ
  9745.  
  9746. IKeySetAsTable  <Element, Key>
  9747. IGKeySetAsTable <Element, Key, KCOps>
  9748.  
  9749. The implementation of the class IKeySetAsTable requires the following element 
  9750. and key-type functions: 
  9751.  
  9752. Element Type 
  9753.  
  9754.      Copy constructor 
  9755.      Destructor 
  9756.      Assignment 
  9757.      Key access 
  9758.  
  9759.  Key Type 
  9760.  
  9761.  Ordering relation 
  9762.  
  9763.  
  9764. ΓòÉΓòÉΓòÉ 5.8.5.7. Key Set as Diluted Table ΓòÉΓòÉΓòÉ
  9765.  
  9766. IKeySetAsDilTable  <Element, Key>
  9767. IGKeySetAsDilTable <Element, Key, KCOps>
  9768.  
  9769. The implementation of the class IKeySetAsDilTable requires the following 
  9770. element and key-type functions: 
  9771.  
  9772. Element Type 
  9773.  
  9774.      Copy constructor 
  9775.      Destructor 
  9776.      Assignment 
  9777.      Key access 
  9778.  
  9779.  Key Type 
  9780.  
  9781.  Ordering relation 
  9782.  
  9783.  
  9784. ΓòÉΓòÉΓòÉ 5.8.6. Abstract Class ΓòÉΓòÉΓòÉ
  9785.  
  9786. IAKeySet<Element,Key>
  9787.  
  9788. For polymorphism, you can use the corresponding abstract class, IAKeySet, which 
  9789. is found in the iaks.h header file. See Polymorphism and the Collections for 
  9790. further information. 
  9791.  
  9792. The required functions are the same as the required functions of the concrete 
  9793. base class. 
  9794.  
  9795.  
  9796. ΓòÉΓòÉΓòÉ 5.8.7. Coding Example for Key Set ΓòÉΓòÉΓòÉ
  9797.  
  9798. The following program implements a key set using the default class, IKeySet. 
  9799. The program adds four elements to the key set and then removes one element by 
  9800. looking for a key.  If an exception occurs, it displays the exception name and 
  9801. description. 
  9802.  
  9803. The program uses cursor iteration (the forCursor macro) to display the contents 
  9804. of the collection. To add and remove elements, it uses the add() function and 
  9805. the removeElementWithKey() function. 
  9806.  
  9807.    //  intkyset.C  -  An example of using a key set
  9808.  
  9809.    #include <iostream.h>
  9810.    #include <iglobals.h>
  9811.    #include <icursor.h>
  9812.  
  9813.    #include <ikeyset.h>
  9814.                          // Class DemoElement:
  9815.    #include "demoelem.h"
  9816.  
  9817.    typedef IKeySet < DemoElement,int > TestKeySet;
  9818.  
  9819.    ostream & operator<< ( ostream & sout, TestKeySet const & t){
  9820.      sout << t.numberOfElements() << " elements are in the set:\n";
  9821.  
  9822.      TestKeySet::Cursor cursor (t);
  9823.      //  forCursor(c)
  9824.      // expands to
  9825.      //  for ((c).setToFirst (); (c).isValid (); (c).setToNext ())
  9826.  
  9827.      forCursor (cursor)
  9828.        sout << "   " << cursor.element() << "\n";
  9829.      return sout << "\n";
  9830.    }
  9831.  
  9832.    main(){
  9833.      TestKeySet t;
  9834.     try {
  9835.         t.add(DemoElement(1,1));
  9836.         t.add(DemoElement(2,4711));
  9837.         t.add(DemoElement(3,1));
  9838.         t.add(DemoElement(4,443));
  9839.  
  9840.         cout << t;
  9841.  
  9842.         t.removeElementWithKey (3);
  9843.         cout << t;
  9844.       }
  9845.     catch (IException & exception) {
  9846.       cout << exception.name() << " : " << exception.text();
  9847.       }
  9848.  
  9849.      return 0;
  9850.    }
  9851.  
  9852. The program produces the following output: 
  9853.  
  9854.    4 elements are in the set:
  9855.       1,1
  9856.       2,4711
  9857.       3,1
  9858.       4,443
  9859.  
  9860.    3 elements are in the set:
  9861.       1,1
  9862.       2,4711
  9863.       4,443
  9864.  
  9865.  
  9866. ΓòÉΓòÉΓòÉ 5.9. Key Sorted Bag ΓòÉΓòÉΓòÉ
  9867.  
  9868. Description 
  9869.  
  9870. Derivation 
  9871.  
  9872. Variants/Header Files 
  9873.  
  9874. Members 
  9875.  
  9876. Template Arguments and Required Functions 
  9877.  
  9878. Abstract/Reference Classes 
  9879.  
  9880. Examples 
  9881.  
  9882. To close all the panels in a chapter, double-click on this panel's system menu. 
  9883.  
  9884.  
  9885. ΓòÉΓòÉΓòÉ 5.9.1. Class Description - Key Sorted Bag ΓòÉΓòÉΓòÉ
  9886.  
  9887. A key sorted bag is an ordered collection of zero or more elements that have a 
  9888. key.  Elements are sorted according to the value of their key field.  Element 
  9889. equality is not supported.  Multiple elements are supported. 
  9890.  
  9891. An example of using a key sorted bag is a program that maintains a list of 
  9892. families, sorted by the number of family members in each family.  The key is 
  9893. the number of family members.  You can add an element whose key is already in 
  9894. the collection (because two families can have the same number of members), and 
  9895. you can generate a list of families sorted by size.  You cannot locate a family 
  9896. except by its key, because a key sorted bag does not support element equality. 
  9897.  
  9898. Figure Combination of Flat Collection Properties gives an overview of the 
  9899. properties of a key sorted bag and its relationship to other flat collections. 
  9900.  
  9901.  
  9902. ΓòÉΓòÉΓòÉ 5.9.2. Derivation ΓòÉΓòÉΓòÉ
  9903.  
  9904.           Collection 
  9905.  
  9906.                Ordered Collection
  9907.   Key Collection         Sorted Collection
  9908.        Key Sorted Collection
  9909.          Key Sorted Bag
  9910.  
  9911.  
  9912. ΓòÉΓòÉΓòÉ 5.9.3. Variants and Header Files ΓòÉΓòÉΓòÉ
  9913.  
  9914. IKeySortedBag, the first class in the table below, is the default 
  9915. implementation variant. 
  9916.  
  9917. To use Visual Builder features with your collections, change the name of the 
  9918. desired collection class template in the list below from I... to IV..., and use 
  9919. the ivksbag.h header file instead of the header file that you would normally 
  9920. use without Visual Builder. 
  9921.  
  9922. Class Name                      Header File Implementation Variant
  9923.  
  9924. IKeySortedBag                   iksb.h      List
  9925. IGKeySortedBag                  iksb.h      List
  9926.  
  9927. IKeySortedBagAsList             iksblst.h   List
  9928. IGKeySortedBagAsList            iksblst.h   List
  9929.  
  9930. IKeySortedBagAsTable            iksbtab.h   Table
  9931. IGKeySortedBagAsTable           iksbtab.h   Table
  9932.  
  9933. IKeySortedBagAsDilTable         iksbdil.h   Diluted table
  9934. IGKeySortedBagAsDilTable        iksbdil.h   Diluted table
  9935.  
  9936.  
  9937. ΓòÉΓòÉΓòÉ 5.9.4. Members ΓòÉΓòÉΓòÉ
  9938.  
  9939. All members of flat collections are described in Introduction to Flat 
  9940. Collections. The following members are provided for key sorted bag: 
  9941.  
  9942.      Constructor 
  9943.      Copy Constructor 
  9944.      Destructor 
  9945.      operator= 
  9946.      add 
  9947.      addAllFrom 
  9948.      addOrReplaceElementWithKey 
  9949.      allElementsDo 
  9950.      anyElement 
  9951.      compare 
  9952.      containsAllKeysFrom 
  9953.      containsElementWithKey 
  9954.      copy 
  9955.      elementAt 
  9956.      elementAtPosition 
  9957.      elementWithKey 
  9958.      firstElement 
  9959.      isBounded 
  9960.      isEmpty 
  9961.      isFirst 
  9962.      isFull 
  9963.      isLast 
  9964.      key 
  9965.      lastElement 
  9966.      locateElementWithKey 
  9967.      locateNextElementWithKey 
  9968.      locateOrAddElementWithKey 
  9969.      maxNumberOfElements 
  9970.      newCursor 
  9971.      numberOfDifferentKeys 
  9972.      numberOfElements 
  9973.      numberOfElementsWithKey 
  9974.      positionAt 
  9975.      removeAll 
  9976.      removeAllElementsWithKey 
  9977.      removeAt 
  9978.      removeAtPosition 
  9979.      removeElementWithKey 
  9980.      removeFirst 
  9981.      removeLast 
  9982.      replaceAt 
  9983.      replaceElementWithKey 
  9984.      setToFirst 
  9985.      setToLast 
  9986.      setToNext 
  9987.      setToNextWithDifferentKey 
  9988.      setToPosition 
  9989.      setToPrevious 
  9990.  
  9991.  Key sorted bag also defines a cursor that inherits from IOrderedCursor. The 
  9992.  members for IOrderedCursor are described in Cursor. 
  9993.  
  9994.  
  9995. ΓòÉΓòÉΓòÉ 5.9.5. Template Arguments and Required Functions ΓòÉΓòÉΓòÉ
  9996.  
  9997. The following implementation variants are defined for key sorted bags: 
  9998.  
  9999.      Key Sorted Bag 
  10000.      Key Sorted Bag as List 
  10001.      Key Sorted Bag as Table 
  10002.      Key Sorted Bag as Diluted Table 
  10003.  
  10004.  
  10005. ΓòÉΓòÉΓòÉ 5.9.5.1. Key Sorted Bag ΓòÉΓòÉΓòÉ
  10006.  
  10007. IKeySortedBag  <Element, Key>
  10008. IGKeySortedBag <Element, Key, KCOps>
  10009.  
  10010. The implementation of the class IKeySortedBag requires the following element 
  10011. and key-type functions: 
  10012.  
  10013. Element Type 
  10014.  
  10015.      Copy constructor 
  10016.      Destructor 
  10017.      Assignment 
  10018.      Key access 
  10019.  
  10020.  Key Type 
  10021.  
  10022.  Ordering relation 
  10023.  
  10024.  
  10025. ΓòÉΓòÉΓòÉ 5.9.5.2. Key Sorted Bag as List ΓòÉΓòÉΓòÉ
  10026.  
  10027. IKeySortedBagAsList  <Element, Key>
  10028. IGKeySortedBagAsList <Element, Key, KCOps>
  10029.  
  10030. The implementation of the class IKeySortedBagAsList requires the following 
  10031. element and key-type functions: 
  10032.  
  10033. Element Type 
  10034.  
  10035.      Copy constructor 
  10036.      Destructor 
  10037.      Assignment 
  10038.      Key access 
  10039.  
  10040.  Key Type 
  10041.  
  10042.  Ordering relation 
  10043.  
  10044.  
  10045. ΓòÉΓòÉΓòÉ 5.9.5.3. Key Sorted Bag as Table ΓòÉΓòÉΓòÉ
  10046.  
  10047. IKeySortedBagAsTable  <Element, Key>
  10048. IGKeySortedBagAsTable <Element, Key, KCOps>
  10049.  
  10050. The implementation of the class IKeySortedBagAsTable requires the following 
  10051. element and key-type functions: 
  10052.  
  10053. Element Type 
  10054.  
  10055.      Copy constructor 
  10056.      Destructor 
  10057.      Assignment 
  10058.      Key access 
  10059.  
  10060.  Key Type 
  10061.  
  10062.  Ordering relation 
  10063.  
  10064.  
  10065. ΓòÉΓòÉΓòÉ 5.9.5.4. Key Sorted Bag as Diluted Table ΓòÉΓòÉΓòÉ
  10066.  
  10067. IKeySortedBagAsDilTable  <Element, Key>
  10068. IGKeySortedBagAsDilTable <Element, Key, KCOps>
  10069.  
  10070. The implementation of the class IKeySortedBagAsDilTable requires the following 
  10071. element and key-type functions: 
  10072.  
  10073. Element Type 
  10074.  
  10075.      Copy constructor 
  10076.      Destructor 
  10077.      Assignment 
  10078.      Key access 
  10079.  
  10080.  Key Type 
  10081.  
  10082.  Ordering relation 
  10083.  
  10084.  
  10085. ΓòÉΓòÉΓòÉ 5.9.6. Abstract Class ΓòÉΓòÉΓòÉ
  10086.  
  10087. IAKeySortedBag<Element,Key>
  10088.  
  10089. For polymorphism, you can use the corresponding abstract class, IAKeySortedBag, 
  10090. which is found in the iaksb.h header file. See Polymorphism and the Collections 
  10091. for further information. 
  10092.  
  10093. The required functions are the same as the required functions of the concrete 
  10094. base class. 
  10095.  
  10096.  
  10097. ΓòÉΓòÉΓòÉ 5.9.7. Coding Example for Key Sorted Bag ΓòÉΓòÉΓòÉ
  10098.  
  10099. The following program illustrates the use of a key sorted bag. The program 
  10100. determines the number of words that have the same length in a phrase. It stores 
  10101. the words of the phrase in a key sorted bag that it implements using the 
  10102. default class, IKeySortedBag. The program makes the key the length of the word. 
  10103. Because of the properties of a key sorted bag, it sorts the words by their 
  10104. length (the key), and it stores all duplicate words. 
  10105.  
  10106. The program determines the number of different word lengths using the 
  10107. numberOfDifferentKeys() function. It uses the numberOfElementsWithKey() 
  10108. function and the setToNextWithDifferentKey() function to iterate through the 
  10109. collection and count the number of words with the same length. 
  10110.  
  10111.    // wordbag.C  -  An example of using a Key Sorted Bag
  10112.    #include <iostream.h>
  10113.                                 // Class Word
  10114.    #include "toyword.h"
  10115.                                 // Let's use the defaults:
  10116.    #include <iksb.h>
  10117.  
  10118.    typedef IKeySortedBag <Word, unsigned> WordBag;
  10119.  
  10120.  
  10121.    int main()
  10122.    {
  10123.       IString    phrase[] = {"people", "who", "live", "in", "glass",
  10124.                       "houses", "should", "not", "throw", "stones"};
  10125.       const size_t phraseWords = sizeof(phrase) / sizeof(IString);
  10126.  
  10127.       WordBag wordbag(phraseWords);
  10128.  
  10129.       for (int cnt=0; cnt < phraseWords; cnt++)  {
  10130.        unsigned keyValue = phrase[cnt].length();
  10131.        Word theWord(phrase[cnt],keyValue);
  10132.        wordbag.add (theWord);
  10133.       }
  10134.  
  10135.       cout << "Contents of our WordBag sorted by number of letters:" << endl;
  10136.  
  10137.       WordBag::Cursor wordBagCursor(wordbag);
  10138.       forCursor(wordBagCursor)
  10139.         cout << "WB: " << wordBagCursor.element().getWord() << endl;
  10140.  
  10141.       cout << endl << "Our phrase has " << phraseWords << " words." << endl;
  10142.       cout << "In our WordBag are " << wordbag.numberOfElements()
  10143.            << " words." << endl << endl;
  10144.  
  10145.       cout << "There are " << wordbag.numberOfDifferentKeys()
  10146.            << " different word lengths." << endl << endl;
  10147.  
  10148.       wordBagCursor.setToFirst();
  10149.       do  {
  10150.          unsigned letters = wordbag.key(wordBagCursor.element());
  10151.          cout << "There are "
  10152.               << wordbag.numberOfElementsWithKey(letters)
  10153.               << " words with " << letters << " letters." << endl;
  10154.       }  while  (wordbag.setToNextWithDifferentKey(wordBagCursor));
  10155.  
  10156.       return 0;
  10157.    }
  10158.  
  10159. This program produces the following output: 
  10160.  
  10161. Contents of our WordBag sorted by number of letters:
  10162. WB: in
  10163. WB: who
  10164. WB: not
  10165. WB: live
  10166. WB: glass
  10167. WB: throw
  10168. WB: people
  10169. WB: houses
  10170. WB: should
  10171. WB: stones
  10172.  
  10173. Our phrase has 10 words.
  10174. In our WordBag are 10 words.
  10175.  
  10176. There are 5 different word lengths.
  10177.  
  10178. There are 1 words with 2 letters.
  10179. There are 2 words with 3 letters.
  10180. There are 1 words with 4 letters.
  10181. There are 2 words with 5 letters.
  10182. There are 4 words with 6 letters.
  10183.  
  10184.  
  10185. ΓòÉΓòÉΓòÉ 5.10. Key Sorted Set ΓòÉΓòÉΓòÉ
  10186.  
  10187. Description 
  10188.  
  10189. Derivation 
  10190.  
  10191. Variants/Header Files 
  10192.  
  10193. Members 
  10194.  
  10195. Template Arguments and Required Functions 
  10196.  
  10197. Abstract/Reference Classes 
  10198.  
  10199. Examples 
  10200.  
  10201. To close all the panels in a chapter, double-click on this panel's system menu. 
  10202.  
  10203.  
  10204. ΓòÉΓòÉΓòÉ 5.10.1. Class Description - Key Sorted Set ΓòÉΓòÉΓòÉ
  10205.  
  10206. A key sorted set is an ordered collection of zero or more elements that have a 
  10207. key.  Elements are sorted according to the value of their key field.  Element 
  10208. equality is not supported.  Only elements with unique keys are supported.  A 
  10209. request to add an element whose key already exists is ignored. 
  10210.  
  10211. An example of using a key sorted set is a program that keeps track of canceled 
  10212. credit card numbers and the individuals to whom they are issued.  Each card 
  10213. number occurs only once, and the collection is sorted by card number.  When a 
  10214. merchant enters a customer's card number into a point-of-sale terminal, the 
  10215. collection is checked to see if that card number is listed in the collection of 
  10216. canceled cards.  If it is found, the name of the individual is shown, and the 
  10217. merchant is given directions for contacting the card company.  If the card 
  10218. number is not found, the transaction can proceed because the card is valid. A 
  10219. list of canceled cards is printed out each month, sorted by card number, and 
  10220. distributed to all merchants who do not have an automatic point-of-sale 
  10221. terminal installed. 
  10222.  
  10223. Figure Combination of Flat Collection Properties gives an overview of the 
  10224. properties of a key sorted set and its relationship to other flat collections. 
  10225.  
  10226.  
  10227. ΓòÉΓòÉΓòÉ 5.10.2. Derivation ΓòÉΓòÉΓòÉ
  10228.  
  10229.           Collection 
  10230.  
  10231.                Ordered Collection
  10232.   Key Collection         Sorted Collection
  10233.        Key Sorted Collection
  10234.          Key Sorted Set
  10235.  
  10236.  
  10237. ΓòÉΓòÉΓòÉ 5.10.3. Variants and Header Files ΓòÉΓòÉΓòÉ
  10238.  
  10239. IKeySortedSet, the first class in the table below, is the default 
  10240. implementation variant. 
  10241.  
  10242. To use Visual Builder features with your collections, change the name of the 
  10243. desired collection class template in the list below from I... to IV..., and use 
  10244. the ivksset.h header file instead of the header file that you would normally 
  10245. use without Visual Builder. 
  10246.  
  10247. Class Name                 Header File  Implementation Variant
  10248.  
  10249. IKeySortedSet              ikss.h       AVL tree
  10250. IGKeySortedSet             ikss.h       AVL tree
  10251.  
  10252. IKeySortedSetAsAvlTree     ikssavl.h    AVL tree
  10253. IGKeySortedSetAsAvlTree    ikssavl.h    AVL tree
  10254.  
  10255. IKeySortedSetAsBstTree     ikssbst.h    B* tree
  10256. IGKeySortedSetAsBstTree    ikssbst.h    B* tree
  10257.  
  10258. IKeySortedSetAsList        iksslst.h    List
  10259. IGKeySortedSetAsList       iksslst.h    List
  10260.  
  10261. IKeySortedSetAsTable       iksstab.h    Table
  10262. IGKeySortedSetAsTable      iksstab.h    Table
  10263.  
  10264. IKeySortedSetAsDilTable    ikssdil.h    Diluted table
  10265. IGKeySortedSetAsDilTable   ikssdil.h    Diluted table
  10266.  
  10267.  
  10268. ΓòÉΓòÉΓòÉ 5.10.4. Members ΓòÉΓòÉΓòÉ
  10269.  
  10270. All members of flat collections are described in Introduction to Flat 
  10271. Collections. The following members are provided for key sorted set: 
  10272.  
  10273.      Constructor 
  10274.      Copy Constructor 
  10275.      Destructor 
  10276.      operator= 
  10277.      add 
  10278.      addAllFrom 
  10279.      addOrReplaceElementWithKey 
  10280.      allElementsDo 
  10281.      anyElement 
  10282.      compare 
  10283.      containsAllKeysFrom 
  10284.      containsElementWithKey 
  10285.      copy 
  10286.      elementAt 
  10287.      elementAtPosition 
  10288.      elementWithKey 
  10289.      firstElement 
  10290.      isBounded 
  10291.      isEmpty 
  10292.      isFirst 
  10293.      isFull 
  10294.      isLast 
  10295.      key 
  10296.      lastElement 
  10297.      locateElementWithKey 
  10298.      locateNextElementWithKey 
  10299.      locateOrAddElementWithKey 
  10300.      maxNumberOfElements 
  10301.      newCursor 
  10302.      numberOfElements 
  10303.      positionAt 
  10304.      removeAll 
  10305.      removeAt 
  10306.      removeAtPosition 
  10307.      removeElementWithKey 
  10308.      removeFirst 
  10309.      removeLast 
  10310.      replaceAt 
  10311.      replaceElementWithKey 
  10312.      setToFirst 
  10313.      setToLast 
  10314.      setToNext 
  10315.      setToPosition 
  10316.      setToPrevious 
  10317.  
  10318.  Key Sorted Set also defines a cursor that inherits from IOrderedCursor. The 
  10319.  members for IOrderedCursor are described in Cursor. 
  10320.  
  10321.  
  10322. ΓòÉΓòÉΓòÉ 5.10.5. Template Arguments and Required Functions ΓòÉΓòÉΓòÉ
  10323.  
  10324. The following implementation variants are defined for key sorted sets: 
  10325.  
  10326.      Key sorted set 
  10327.      Key sorted set as AVL tree 
  10328.      Key sorted set as B* tree 
  10329.      Key sorted set as list 
  10330.      Key sorted set as table 
  10331.      Key sorted set as diluted table 
  10332.  
  10333.  
  10334. ΓòÉΓòÉΓòÉ 5.10.5.1. Key Sorted Set ΓòÉΓòÉΓòÉ
  10335.  
  10336. IKeySortedSet  <Element, Key>
  10337. IGKeySortedSet <Element, Key, KCOps>
  10338.  
  10339. The implementation of the class IKeySortedSet requires the following element 
  10340. and key-type functions: 
  10341.  
  10342. Element Type 
  10343.  
  10344.      Copy constructor 
  10345.      Destructor 
  10346.      Assignment 
  10347.      Key access 
  10348.  
  10349.  Key Type 
  10350.  
  10351.  Ordering relation 
  10352.  
  10353.  
  10354. ΓòÉΓòÉΓòÉ 5.10.5.2. Key Sorted Set as AVL Tree ΓòÉΓòÉΓòÉ
  10355.  
  10356. IKeySortedSetAsAvlTree  <Element, Key>
  10357. IGKeySortedSetAsAvlTree <Element, Key, KCOps>
  10358.  
  10359. The implementation of the class IKeySortedSetAsAvlTree requires the following 
  10360. element and key-type functions: 
  10361.  
  10362. Element Type 
  10363.  
  10364.      Copy constructor 
  10365.      Assignment 
  10366.      Destructor 
  10367.      Key access 
  10368.  
  10369.  Key Type 
  10370.  
  10371.  Ordering relation 
  10372.  
  10373.  
  10374. ΓòÉΓòÉΓòÉ 5.10.5.3. Key Sorted Set as B* Tree ΓòÉΓòÉΓòÉ
  10375.  
  10376. IKeySortedSetAsBstTree  <Element, Key>
  10377. IKeySortedSetAsBstTree  <Element, Key, KCOps>
  10378.  
  10379. The implementation of the class IKeySortedSetAsBstTree requires the following 
  10380. element and key-type functions: 
  10381.  
  10382. Element Type 
  10383.  
  10384.      Default constructor 
  10385.      Copy constructor 
  10386.      Destructor 
  10387.      Assignment 
  10388.      Key access 
  10389.  
  10390.  Key Type 
  10391.  
  10392.  Ordering relation 
  10393.  
  10394.  
  10395. ΓòÉΓòÉΓòÉ 5.10.5.4. Key Sorted Set as List ΓòÉΓòÉΓòÉ
  10396.  
  10397. IKeySortedSetAsList  <Element, Key>
  10398. IGKeySortedSetAsList <Element, Key, KCOps>
  10399.  
  10400. The implementation of the class IKeySortedSetAsList requires the following 
  10401. element and key-type functions: 
  10402.  
  10403. Element Type 
  10404.  
  10405.      Copy constructor 
  10406.      Destructor 
  10407.      Assignment 
  10408.      Key access 
  10409.  
  10410.  Key Type 
  10411.  
  10412.  Ordering relation 
  10413.  
  10414.  
  10415. ΓòÉΓòÉΓòÉ 5.10.5.5. Key Sorted Set as Table ΓòÉΓòÉΓòÉ
  10416.  
  10417. IKeySortedSetAsTable  <Element, Key>
  10418. IGKeySortedSetAsTable <Element, Key, KCOps>
  10419.  
  10420. The implementation of the class IKeySortedSetAsTable requires the following 
  10421. element and key-type functions: 
  10422.  
  10423. Element Type 
  10424.  
  10425.      Copy constructor 
  10426.      Destructor 
  10427.      Assignment 
  10428.      Key access 
  10429.  
  10430.  Key Type 
  10431.  
  10432.  Ordering relation 
  10433.  
  10434.  
  10435. ΓòÉΓòÉΓòÉ 5.10.5.6. Key Sorted Set as Diluted Table ΓòÉΓòÉΓòÉ
  10436.  
  10437. IKeySortedSetAsDilTable  <Element, Key>
  10438. IGKeySortedSetAsDilTable <Element, Key, KCOps>
  10439.  
  10440. The implementation of the class IKeySortedSetAsDilTable requires the following 
  10441. element and key-type functions: 
  10442.  
  10443. Element Type 
  10444.  
  10445.      Copy constructor 
  10446.      Destructor 
  10447.      Assignment 
  10448.      Key access 
  10449.  
  10450.  Key Type 
  10451.  
  10452.  Ordering relation 
  10453.  
  10454.  
  10455. ΓòÉΓòÉΓòÉ 5.10.6. Abstract Class ΓòÉΓòÉΓòÉ
  10456.  
  10457. IAKeySortedSet<Element,Key>
  10458.  
  10459. For polymorphism, you can use the corresponding abstract class, IAKeySortedSet, 
  10460. which is found in the iakss.h header file. See Polymorphism and the Collections 
  10461. for further information. 
  10462.  
  10463. The required functions are the same as the required functions of the concrete 
  10464. base class. 
  10465.  
  10466.  
  10467. ΓòÉΓòÉΓòÉ 5.10.7. Coding Example for Key Sorted Set ΓòÉΓòÉΓòÉ
  10468.  
  10469. The following program uses the default classes for a key sorted set and a heap, 
  10470. IKeySortedSet and IHeap, to track parcels for a delivery service.  It uses a 
  10471. key sorted set to record the parcels that are currently in circulation.  The 
  10472. fast access of a sorted collection is not necessary to keep track of the 
  10473. delivered parcels, so the program uses a heap to keep track of them. 
  10474.  
  10475. The parcel element contains three data members: one of type PlaceTime that 
  10476. stores the origin time and place of the parcel, another of type PlaceTime that 
  10477. stores the current time and place of the parcel, and one of type ToyString that 
  10478. stores the destination. 
  10479.  
  10480. The function update() adds parcels that have arrived at their destinations to 
  10481. the heap of delivered parcels, and removes them from the key sorted set for 
  10482. circulating parcels. 
  10483.  
  10484. The program uses the add() function to update and the removeAll() function to 
  10485. remove elements from the key sorted set. 
  10486.  
  10487.    // parcel.C  -  An example of using a Key Sorted Set and a Heap
  10488.    #include <iostream.h>
  10489.  
  10490.    #include "parcel.h"
  10491.                              // Let's use the default KeySorted Set:
  10492.    #include <ikss.h>
  10493.                              // Let's use the default Heap:
  10494.    #include <iheap.h>
  10495.  
  10496.    typedef IKeySortedSet<Parcel, IString> ParcelSet;
  10497.    typedef IHeap        <Parcel>          ParcelHeap;
  10498.  
  10499.    ostream& operator<<(ostream&, ParcelSet const&);
  10500.    ostream& operator<<(ostream&, ParcelHeap const&);
  10501.  
  10502.    void update(ParcelSet&, ParcelHeap&);
  10503.  
  10504.  
  10505.    main()  {
  10506.  
  10507.        ParcelSet circulating;
  10508.        ParcelHeap delivered;
  10509.  
  10510.        int today = 8;
  10511.  
  10512.        circulating.add(Parcel("London", "Athens",
  10513.           today,      "26LoAt"));
  10514.        circulating.add(Parcel("Amsterdam", "Toronto",
  10515.           today += 2, "27AmTo"));
  10516.        circulating.add(Parcel("Washington", "Stockholm",
  10517.           today += 5, "25WaSt"));
  10518.        circulating.add(Parcel("Dublin", "Kairo",
  10519.           today += 1, "25DuKa"));
  10520.        update(circulating, delivered);
  10521.        cout << "\nThe situation at start:\n";
  10522.        cout << "Parcels in circulation:\n" << circulating;
  10523.  
  10524.        today ++;
  10525.        circulating.elementWithKey("27AmTo").arrivedAt(
  10526.           "Atlanta",   today);
  10527.        circulating.elementWithKey("25WaSt").arrivedAt(
  10528.           "Amsterdam", today);
  10529.        circulating.elementWithKey("25DuKa").arrivedAt(
  10530.           "Paris",     today);
  10531.        update(circulating, delivered);
  10532.        cout << "\n\nThe situation at day " << today << ":\n";
  10533.        cout << "Parcels in circulation:\n" << circulating;
  10534.  
  10535.        today ++;          // One day later ...
  10536.        circulating.elementWithKey("27AmTo").arrivedAt("Chicago", today);
  10537.                   // As in real life, one parcel gets lost:
  10538.        circulating.removeElementWithKey("26LoAt");
  10539.        update(circulating, delivered);
  10540.        cout << "\n\nThe situation at day " << today << ":\n";
  10541.        cout << "Parcels in circulation:\n" << circulating;
  10542.  
  10543.        today ++;
  10544.        circulating.elementWithKey("25WaSt").arrivedAt("Oslo", today);
  10545.        circulating.elementWithKey("25DuKa").arrivedAt("Kairo", today);
  10546.                   // New parcels are shipped.
  10547.        circulating.add(Parcel("Dublin", "Rome", today,   "27DuRo"));
  10548.                   // Let's try to add one with a key already there.
  10549.                   // The KeySsorted Set should ignore it:
  10550.        circulating.add(Parcel("Nowhere", "Nirvana", today, "25WaSt"));
  10551.        update(circulating, delivered);
  10552.        cout << "\n\nThe situation at day " << today << ":\n";
  10553.        cout << "Parcels in circulation:\n" << circulating;
  10554.        cout << "Parcels delivered:\n" << delivered;
  10555.  
  10556.                         // Now we make all parcels arrive today:
  10557.        today ++;
  10558.  
  10559.        ParcelSet::Cursor circulatingcursor(circulating);
  10560.        forICursor(circulatingcursor) {
  10561.           circulating.elementAt(circulatingcursor).wasDelivered(today);
  10562.        }
  10563.        update(circulating, delivered);
  10564.        cout << "\n\nThe situation at day " << today << ":\n";
  10565.        cout << "Parcels in circulation:\n" << circulating;
  10566.        cout << "Parcels delivered:\n" << delivered;
  10567.  
  10568.        if (circulating.isEmpty())
  10569.           cout << "\nAll parcels were delivered.\n";
  10570.        else
  10571.           cout << "\nSomething very strange happened here.\n";
  10572.  
  10573.        return  0;
  10574.    }
  10575.  
  10576.    ostream& operator<<(ostream& os, ParcelSet const& parcels)  {
  10577.        ParcelSet::Cursor pcursor(parcels);
  10578.        forICursor(pcursor) {
  10579.           os <<  pcursor.element() << "\n";
  10580.        }
  10581.        return os;
  10582.    }
  10583.  
  10584.    ostream& operator<<(ostream& os, ParcelHeap const& parcels)  {
  10585.        ParcelHeap::Cursor pcursor(parcels);
  10586.        forICursor(pcursor) {
  10587.           os <<  pcursor.element() << "\n";
  10588.        }
  10589.        return os;
  10590.    }
  10591.  
  10592.    IBoolean wasDelivered(Parcel const& p, void* dp) {
  10593.         if ( p.lastArrival().city() == p.destination() ) {
  10594.            ((ParcelHeap*)dp)->add(p);
  10595.            return true;
  10596.         }
  10597.         else
  10598.            return false;
  10599.    }
  10600.  
  10601.    void update(ParcelSet& p, ParcelHeap& d) {
  10602.         p.removeAll(wasDelivered, &d);
  10603.    }
  10604.  
  10605. The program produces the following output: 
  10606.  
  10607.  
  10608. The situation at start:
  10609. Parcels in circulation:
  10610. 25DuKa: From Dublin(day 16) to Kairo
  10611.             is at Dublin  since day 16.
  10612. 25WaSt: From Washington(day 15) to Stockholm
  10613.             is at Washington  since day 15.
  10614. 26LoAt: From London(day 8) to Athens
  10615.             is at London  since day 8.
  10616. 27AmTo: From Amsterdam(day 10) to Toronto
  10617.             is at Amsterdam  since day 10.
  10618.  
  10619.  
  10620. The situation at day 17:
  10621. Parcels in circulation:
  10622. 25DuKa: From Dublin(day 16) to Kairo
  10623.             is at Paris  since day 17.
  10624. 25WaSt: From Washington(day 15) to Stockholm
  10625.             is at Amsterdam  since day 17.
  10626. 26LoAt: From London(day 8) to Athens
  10627.             is at London  since day 8.
  10628. 27AmTo: From Amsterdam(day 10) to Toronto
  10629.             is at Atlanta  since day 17.
  10630.  
  10631.  
  10632. The situation at day 18:
  10633. Parcels in circulation:
  10634. 25DuKa: From Dublin(day 16) to Kairo
  10635.             is at Paris  since day 17.
  10636. 25WaSt: From Washington(day 15) to Stockholm
  10637.             is at Amsterdam  since day 17.
  10638. 27AmTo: From Amsterdam(day 10) to Toronto
  10639.             is at Chicago  since day 18.
  10640.  
  10641.  
  10642. The situation at day 19:
  10643. Parcels in circulation:
  10644. 25WaSt: From Washington(day 15) to Stockholm
  10645.             is at Oslo  since day 19.
  10646. 27AmTo: From Amsterdam(day 10) to Toronto
  10647.             is at Chicago  since day 18.
  10648. 27DuRo: From Dublin(day 19) to Rome
  10649.             is at Dublin  since day 19.
  10650. Parcels delivered:
  10651. 25DuKa: From Dublin(day 16) to Kairo
  10652.             was delivered on day 19.
  10653.  
  10654.  
  10655. The situation at day 20:
  10656. Parcels in circulation:
  10657. Parcels delivered:
  10658. 25DuKa: From Dublin(day 16) to Kairo
  10659.             was delivered on day 19.
  10660. 25WaSt: From Washington(day 15) to Stockholm
  10661.             was delivered on day 20.
  10662. 27AmTo: From Amsterdam(day 10) to Toronto
  10663.             was delivered on day 20.
  10664. 27DuRo: From Dublin(day 19) to Rome
  10665.             was delivered on day 20.
  10666.  
  10667. All parcels were delivered.
  10668.  
  10669.  
  10670. ΓòÉΓòÉΓòÉ 5.11. Map ΓòÉΓòÉΓòÉ
  10671.  
  10672. Description 
  10673.  
  10674. Derivation 
  10675.  
  10676. Variants/Header Files 
  10677.  
  10678. Members 
  10679.  
  10680. Template Arguments and Required Functions 
  10681.  
  10682. Abstract/Reference Classes 
  10683.  
  10684. Examples 
  10685.  
  10686. To close all the panels in a chapter, double-click on this panel's system menu. 
  10687.  
  10688.  
  10689. ΓòÉΓòÉΓòÉ 5.11.1. Class Description - Map ΓòÉΓòÉΓòÉ
  10690.  
  10691. A map is an unordered collection of zero or more elements that have a key. 
  10692. Element equality is supported and the values of the elements are relevant. 
  10693.  
  10694. Only elements with unique keys are supported.  A request to add an element 
  10695. whose key already exists in another element of the collection causes an 
  10696. exception to be thrown.  A request to add a duplicate element is ignored. 
  10697.  
  10698. An example of using a map is a program that translates integer values between 
  10699. the ranges of 0 and 20 to their written equivalents, or between written numbers 
  10700. and their numeric values. Two maps are created, one with the integer values as 
  10701. keys, one with the written equivalents as keys.  You can enter a number, and 
  10702. that number is used as a key to locate the written equivalent.  You can enter a 
  10703. written equivalent of a number, and that text is used as a key to locate the 
  10704. value.  A given key always matches only one element.  You cannot add an element 
  10705. with a key of 1 or "one" if that element is already present in the collection. 
  10706.  
  10707. Figure Behavior of add for Unique and Multiple Collections illustrates the 
  10708. differences in behavior between map, relation, key set, and key bag when 
  10709. identical elements and elements with the same key are added. 
  10710.  
  10711. Figure Combination of Flat Collection Properties gives an overview of the 
  10712. properties of a map and its relationship to other flat collections. 
  10713.  
  10714.  
  10715. ΓòÉΓòÉΓòÉ 5.11.2. Derivation ΓòÉΓòÉΓòÉ
  10716.  
  10717.            Collection 
  10718.  
  10719.   Key Collection          Equality Collection
  10720.          Equality Key Collection
  10721.              Map
  10722.  
  10723.  
  10724. ΓòÉΓòÉΓòÉ 5.11.3. Variants and Header Files ΓòÉΓòÉΓòÉ
  10725.  
  10726. IMap, the first class in the table below, is the default implementation 
  10727. variant. 
  10728.  
  10729. To use Visual Builder features with your collections, change the name of the 
  10730. desired collection class template in the list below from I... to IV..., and use 
  10731. the ivmap.h header file instead of the header file that you would normally use 
  10732. without Visual Builder. 
  10733.  
  10734. Class Name                   Header File Implementation Variant
  10735.  
  10736. IMap                         imap.h      AVL tree
  10737. IGMap                        imap.h      AVL tree
  10738.  
  10739. IMapAsAvlTree                imapavl.h   AVL tree
  10740. IGMapAsAvlTree               imapavl.h   AVL tree
  10741.  
  10742. IMapAsBstTree                imapbst.h   B* tree
  10743. IGMapAsBstTree               imapbst.h   B* tree
  10744.  
  10745. IMapAsList                   imaplst.h   List
  10746. IGMapAsList                  imaplst.h   List
  10747.  
  10748. IMapAsTable                  imaptab.h   Table
  10749. IGMapAsTable                 imaptab.h   Table
  10750.  
  10751. IMapAsDilTable               imapdil.h   Diluted table
  10752. IGMapAsDilTable              imapdil.h   Diluted table
  10753.  
  10754. IMapAsHshTable               imaphsh.h   Hash table
  10755. IGMapAsHshTable              imaphsh.h   Hash table
  10756.  
  10757.  
  10758. ΓòÉΓòÉΓòÉ 5.11.4. Members ΓòÉΓòÉΓòÉ
  10759.  
  10760. All members of flat collections are described in Introduction to Flat 
  10761. Collections. The following members are provided for map: 
  10762.  
  10763.      Constructor 
  10764.      Copy Constructor 
  10765.      Destructor 
  10766.      operator!= 
  10767.      operator= 
  10768.      operator== 
  10769.      add 
  10770.      addAllFrom 
  10771.      addDifference 
  10772.      addIntersection 
  10773.      addOrReplaceElementWithKey 
  10774.      addUnion 
  10775.      allElementsDo 
  10776.      anyElement 
  10777.      contains 
  10778.      containsAllFrom 
  10779.      containsAllKeysFrom 
  10780.      containsElementWithKey 
  10781.      copy 
  10782.      differenceWith 
  10783.      elementAt 
  10784.      elementWithKey 
  10785.      intersectionWith 
  10786.      isBounded 
  10787.      isEmpty 
  10788.      isFull 
  10789.      key 
  10790.      locate 
  10791.      locateElementWithKey 
  10792.      locateOrAdd 
  10793.      locateOrAddElementWithKey 
  10794.      maxNumberOfElements 
  10795.      newCursor 
  10796.      numberOfElements 
  10797.      remove 
  10798.      removeAll 
  10799.      removeAt 
  10800.      removeElementWithKey 
  10801.      replaceAt 
  10802.      replaceElementWithKey 
  10803.      setToFirst 
  10804.      setToNext 
  10805.      unionWith 
  10806.  
  10807.  Map also defines a cursor that inherits from IElementCursor. The members for 
  10808.  IElementCursor are described in Cursor. 
  10809.  
  10810.  
  10811. ΓòÉΓòÉΓòÉ 5.11.5. Template Arguments and Required Functions ΓòÉΓòÉΓòÉ
  10812.  
  10813. The following implementation variants are defined for maps: 
  10814.  
  10815.      Map 
  10816.      Map as AVL tree 
  10817.      Map as B* tree 
  10818.      Map as list 
  10819.      Map as table 
  10820.      Map as diluted table 
  10821.      Map as hash table 
  10822.  
  10823.  
  10824. ΓòÉΓòÉΓòÉ 5.11.5.1. Map ΓòÉΓòÉΓòÉ
  10825.  
  10826. IMap  <Element, Key>
  10827. IGMap <Element, Key, EKCOps>
  10828.  
  10829. The default implementation of the class IMap requires the following element and 
  10830. key-type functions: 
  10831.  
  10832. Element Type 
  10833.  
  10834.      Copy constructor 
  10835.      Destructor 
  10836.      Assignment 
  10837.      Equality test 
  10838.      Key access 
  10839.  
  10840.  Key Type 
  10841.  
  10842.  Ordering relation 
  10843.  
  10844.  
  10845. ΓòÉΓòÉΓòÉ 5.11.5.2. Map as AVL Tree ΓòÉΓòÉΓòÉ
  10846.  
  10847. IMapAsAvlTree  <Element, Key>
  10848. IGMapAsAvlTree <Element, Key, EKCOps>
  10849.  
  10850. The implementation of the class IMapAsAvlTree requires the following element 
  10851. and key-type functions: 
  10852.  
  10853. Element Type 
  10854.  
  10855.      Copy constructor 
  10856.      Destructor 
  10857.      Assignment 
  10858.      Equality test 
  10859.      Key access 
  10860.  
  10861.  Key Type 
  10862.  
  10863.  Ordering relation 
  10864.  
  10865.  
  10866. ΓòÉΓòÉΓòÉ 5.11.5.3. Map as B* Tree ΓòÉΓòÉΓòÉ
  10867.  
  10868. IMapAsBstTree  <Element, Key>
  10869. IGMapAsBstTree <Element, Key, EKCOps>
  10870.  
  10871. The implementation of the class IMapAsBstTree requires the following element 
  10872. and key-type functions: 
  10873.  
  10874. Element Type 
  10875.  
  10876.      Default constructor 
  10877.      Copy constructor 
  10878.      Destructor 
  10879.      Assignment 
  10880.      Equality test 
  10881.      Key access 
  10882.  
  10883.  Key Type 
  10884.  
  10885.  Ordering relation 
  10886.  
  10887.  
  10888. ΓòÉΓòÉΓòÉ 5.11.5.4. Map as List ΓòÉΓòÉΓòÉ
  10889.  
  10890. IMapAsList  <Element, Key>
  10891. IGMapAsList <Element, Key, EKCOps>
  10892.  
  10893. The implementation of the class IMapAsSortedList requires the following element 
  10894. and key-type functions: 
  10895.  
  10896. Element Type 
  10897.  
  10898.      Copy constructor 
  10899.      Destructor 
  10900.      Assignment 
  10901.      Equality test 
  10902.      Key access 
  10903.  
  10904.  Key Type 
  10905.  
  10906.  Ordering relation 
  10907.  
  10908.  
  10909. ΓòÉΓòÉΓòÉ 5.11.5.5. Map as Table ΓòÉΓòÉΓòÉ
  10910.  
  10911. IMapAsTable  <Element, Key>
  10912. IGMapAsTable <Element, Key, EKCOps>
  10913.  
  10914. The implementation of the class IMapAsTable requires the following element and 
  10915. key-type functions: 
  10916.  
  10917. Element Type 
  10918.  
  10919.      Copy constructor 
  10920.      Destructor 
  10921.      Assignment 
  10922.      Equality test 
  10923.      Key access 
  10924.  
  10925.  Key Type 
  10926.  
  10927.  Ordering relation 
  10928.  
  10929.  
  10930. ΓòÉΓòÉΓòÉ 5.11.5.6. Map as Diluted Table ΓòÉΓòÉΓòÉ
  10931.  
  10932. IMapAsDilTable  <Element, Key>
  10933. IGMapAsDilTable <Element, Key, EKCOps>
  10934.  
  10935. The implementation of the class IMapAsDilTable requires the following element 
  10936. and key-type functions: 
  10937.  
  10938. Element Type 
  10939.  
  10940.      Copy constructor 
  10941.      Destructor 
  10942.      Assignment 
  10943.      Equality test 
  10944.      Key access 
  10945.  
  10946.  Key Type 
  10947.  
  10948.  Ordering relation 
  10949.  
  10950.  
  10951. ΓòÉΓòÉΓòÉ 5.11.5.7. Map as Hash Table ΓòÉΓòÉΓòÉ
  10952.  
  10953. IMapAsHshTable  <Element, Key>
  10954. IGMapAsHshTable <Element, Key, EKEHOps>
  10955.  
  10956. The implementation of the class IMapAsHshTable requires the following element 
  10957. and key-type functions: 
  10958.  
  10959. Element Type 
  10960.  
  10961.      Copy constructor 
  10962.      Destructor 
  10963.      Assignment 
  10964.      Equality test 
  10965.      Key access 
  10966.  
  10967.  Key Type 
  10968.  
  10969.      Equality test 
  10970.      Hash function 
  10971.  
  10972.  
  10973. ΓòÉΓòÉΓòÉ 5.11.6. Abstract Class ΓòÉΓòÉΓòÉ
  10974.  
  10975. IAMap<Element,Key>
  10976.  
  10977. For polymorphism, you can use the corresponding abstract class, IAMap, which is 
  10978. found in the iamap.h header file. See Polymorphism and the Collections for 
  10979. further information. 
  10980.  
  10981. The required functions are the same as the required functions of the concrete 
  10982. base class. 
  10983.  
  10984.  
  10985. ΓòÉΓòÉΓòÉ 5.11.7. Coding Example for Map ΓòÉΓòÉΓòÉ
  10986.  
  10987. The following program translates a string from EBCDIC to ASCII and from ASCII 
  10988. to EBCDIC. It uses two maps, one with the EBCDIC code as key (E2AMap) and one 
  10989. with the ASCII code as key (A2EMap). It converts from EBCDIC to ASCII by 
  10990. finding the element whose key matches the EBCDIC code in E2AMap (which has the 
  10991. EBCDIC code as key) and taking the ASCII code information from that element. It 
  10992. converts from ASCII to EBCDIC by finding the key that matches the ASCII code in 
  10993. A2EMap (which has the ASCII code as key) and taking the EBCDIC code information 
  10994. for that element. 
  10995.  
  10996. The program uses the add() function to build the maps and the elementWithKey() 
  10997. function to convert the characters. 
  10998.  
  10999.    // transtab.C  -  An example of using a Map
  11000.    #include "transelm.h"
  11001.  
  11002.           // Get the standard operation classes:
  11003.    #include <istdops.h>
  11004.  
  11005.    #include "trmapops.h"
  11006.  
  11007.           //    char const translationTable[256] =  ....
  11008.    #include "xebc2asc.h"
  11009.    /*-------------------------------------------------------------*\
  11010.    |  Now we define the two Map templates and two maps.            |
  11011.    |  We want both of them to be based on the Hashtable KeySet.    |
  11012.    \*-------------------------------------------------------------*/
  11013.    #include <imaphks.h>
  11014.  
  11015.    typedef IGMapOnHashKeySet
  11016.              < TranslationElement, char, TranslationOpsE2A >  TransE2AMap;
  11017.  
  11018.    typedef IGMapOnHashKeySet
  11019.              < TranslationElement, char, TranslationOpsA2E >  TransA2EMap;
  11020.  
  11021.    void display(char*, char*);
  11022.  
  11023.    int main(int argc, char* argv[])  {
  11024.  
  11025.       TransA2EMap  A2EMap;
  11026.       TransE2AMap  E2AMap;
  11027.  
  11028.           /*-----------------------------------------------------*\
  11029.           |  Load the translation table into both maps.           |
  11030.           |  The maps organize themselves according to the key    |
  11031.           |  specification already given.                         |
  11032.           \*-----------------------------------------------------*/
  11033.       for (int i=0; i < 256; i++)
  11034.       {
  11035.                           /*      ascCode          ebcCode      */
  11036.          TranslationElement te(translationTable[i],   i   );
  11037.  
  11038.          E2AMap.add(te);
  11039.          A2EMap.add(te);
  11040.       }
  11041.           // What do we want to convert now?
  11042.       char* toConvert;
  11043.       if  (argc > 1)  toConvert = argv[1];
  11044.       else            toConvert = "$7  (=Dollar seven)";
  11045.  
  11046.       size_t textLength = strlen(toConvert) +1;
  11047.  
  11048.       char* convertedToAsc = new char[textLength];
  11049.       char* convertedToEbc = new char[textLength];
  11050.  
  11051.           // Convert the strings in place, character by character
  11052.       for (i=0; toConvert[i] != 0x00; i++)   {
  11053.          convertedToAsc[i]
  11054.            = E2AMap.elementWithKey(toConvert[i]).ascCode ();
  11055.          convertedToEbc[i]
  11056.            = A2EMap.elementWithKey(toConvert[i]).ebcCode ();
  11057.       }
  11058.  
  11059.       display("To convert", toConvert);
  11060.       display("After EBCDIC-ASCII conversion", convertedToAsc);
  11061.       display("After ASCII-EBCDIC conversion", convertedToEbc);
  11062.  
  11063.       delete[] convertedToAsc;
  11064.       delete[] convertedToEbc;
  11065.  
  11066.       return 0;
  11067.    }
  11068.  
  11069.    #include <iostream.h>
  11070.    #include <iomanip.h>
  11071.  
  11072.    void display (char* title, char* text)  {
  11073.      cout << endl << title << ':' << endl;
  11074.      cout << "  Text: '" << text << "'" << endl;
  11075.      cout << "  Hex:   " << hex;
  11076.      for (int i=0; text[i] != 0x00; i++)    {
  11077.         cout << (int)(unsigned) text[i] << " ";
  11078.      }
  11079.      cout << dec << endl;
  11080.    }
  11081.  
  11082. The program produces the following output: 
  11083.  
  11084. To convert:
  11085.   Hex:   24 37 20 20 28 3d 44 6f 6c 6c 61 72 20 73 65 76 65 6e 29
  11086.  
  11087. After EBCDIC-ASCII conversion:
  11088.   Hex:   86 4 81 81 89 15 eb 3f 25 25 2f 94 81 b0 dd fc dd 3e 91
  11089.  
  11090. After ASCII-EBCDIC conversion:
  11091.   Hex:   5b f7 40 40 4d 7e c4 96 93 93 81 99 40 a2 85 a5 85 95 5d
  11092.  
  11093.  
  11094. ΓòÉΓòÉΓòÉ 5.12. Priority Queue ΓòÉΓòÉΓòÉ
  11095.  
  11096. Description 
  11097.  
  11098. Derivation 
  11099.  
  11100. Variants/Header Files 
  11101.  
  11102. Members 
  11103.  
  11104. Template Arguments and Required Functions 
  11105.  
  11106. Abstract/Reference Classes 
  11107.  
  11108. To close all the panels in a chapter, double-click on this panel's system menu. 
  11109.  
  11110.  
  11111. ΓòÉΓòÉΓòÉ 5.12.1. Class Description - Priority Queue ΓòÉΓòÉΓòÉ
  11112.  
  11113. A priority queue is a key sorted bag with restricted access.  It is an ordered 
  11114. collection of zero or more elements.  Keys and multiple elements are supported. 
  11115. Element equality is not supported. 
  11116.  
  11117. When an element is added, it is placed in the queue according to its key value 
  11118. or priority. The highest priority is indicated by the lowest key value.  You 
  11119. can only remove the element with the highest priority.  Within the priority 
  11120. queue, elements are sorted according to ascending key values, as in other key 
  11121. collections. You can only remove the element with the lowest key value. 
  11122.  
  11123. For elements with equal priority, the priority queue has a first-in, first-out 
  11124. behavior. 
  11125.  
  11126. An example of a priority queue is a program used to assign priorities to 
  11127. service calls in a heating repair firm.  When a customer calls with a problem, 
  11128. a record with the customer's name and the seriousness of the situation is 
  11129. placed in a priority queue.  When a service person becomes available, customers 
  11130. are chosen by the program beginning with those whose situation is most severe. 
  11131. In this example, a serious problem such as a nonfunctioning furnace would be 
  11132. indicated by a low value for the priority, and a minor problem such as a noisy 
  11133. radiator would be indicated by a high value for the priority. 
  11134.  
  11135.  
  11136. ΓòÉΓòÉΓòÉ 5.12.2. Derivation ΓòÉΓòÉΓòÉ
  11137.  
  11138. Key Sorted Collection 
  11139.  
  11140.   Key Sorted Bag
  11141.    Priority Queue
  11142.  
  11143. Note that priority queue is based on key sorted bag but is not actually derived 
  11144. from it or from the other classes shown above. The diagram does not show all 
  11145. bases of priority queue. See the figure "Abstract Class Hierarchy" in section 
  11146. Abstract Classes for an illustration. See Restricted Access for further 
  11147. details. 
  11148.  
  11149.  
  11150. ΓòÉΓòÉΓòÉ 5.12.3. Variants and Header Files ΓòÉΓòÉΓòÉ
  11151.  
  11152. IPriorityQueue, the first class in the table below, is the default 
  11153. implementation variant. 
  11154.  
  11155. To use Visual Builder features with your collections, change the name of the 
  11156. desired collection class template in the list below from I... to IV..., and use 
  11157. the ivprioqu.h header file instead of the header file that you would normally 
  11158. use without Visual Builder. 
  11159.  
  11160. Class Name                 Header File  Implementation Variant
  11161.  
  11162. IPriorityQueue             ipqu.h       List
  11163. IGPriorityQueue            ipqu.h       List
  11164.  
  11165. IPriorityQueueAsList       ipqulst.h    List
  11166. IGPriorityQueueAsList      ipqulst.h    List
  11167.  
  11168. IPriorityQueueAsTable      ipqutab.h    Table
  11169. IGPriorityQueueAsTable     ipqutab.h    Table
  11170.  
  11171. IPriorityQueueAsDilTable   ipqudil.h    Diluted table
  11172. IGPriorityQueueAsDilTable  ipqudil.h    Diluted table
  11173.  
  11174.  
  11175. ΓòÉΓòÉΓòÉ 5.12.4. Members ΓòÉΓòÉΓòÉ
  11176.  
  11177. All members of flat collections are described in Introduction to Flat 
  11178. Collections. The following members are provided for priority queue: 
  11179.  
  11180.      Constructor 
  11181.      Copy Constructor 
  11182.      Destructor 
  11183.      operator= 
  11184.      add 
  11185.      addAllFrom 
  11186.      allElementsDo 
  11187.      anyElement 
  11188.      compare 
  11189.      containsAllKeysFrom 
  11190.      containsElementWithKey 
  11191.      copy 
  11192.      dequeue 
  11193.      elementAt 
  11194.      elementAtPosition 
  11195.      elementWithKey 
  11196.      enqueue 
  11197.      firstElement 
  11198.      isBounded 
  11199.      isEmpty 
  11200.      isFirst 
  11201.      isFull 
  11202.      isLast 
  11203.      key 
  11204.      lastElement 
  11205.      locateElementWithKey 
  11206.      locateNextElementWithKey 
  11207.      locateOrAddElementWithKey 
  11208.      maxNumberOfElements 
  11209.      newCursor 
  11210.      numberOfDifferentKeys 
  11211.      numberOfElements 
  11212.      numberOfElementsWithKey 
  11213.      positionAt 
  11214.      removeAll 
  11215.      removeFirst 
  11216.      setToFirst 
  11217.      setToLast 
  11218.      setToNext 
  11219.      setToNextWithDifferentKey 
  11220.      setToPosition 
  11221.      setToPrevious 
  11222.  
  11223.  Priority queue also defines a cursor that inherits from IOrderedCursor. The 
  11224.  members for IOrderedCursor are described in Cursor. 
  11225.  
  11226.  
  11227. ΓòÉΓòÉΓòÉ 5.12.5. Template Arguments and Required Functions ΓòÉΓòÉΓòÉ
  11228.  
  11229. The following implementation variants are defined for priority queues: 
  11230.  
  11231.      Priority queue 
  11232.      Priority queue as list 
  11233.      Priority queue as table 
  11234.      Priority queue as diluted table 
  11235.  
  11236.  
  11237. ΓòÉΓòÉΓòÉ 5.12.5.1. Priority Queue ΓòÉΓòÉΓòÉ
  11238.  
  11239. IPriorityQueue  <Element, Key>
  11240. IGPriorityQueue <Element, Key, KCOps>
  11241.  
  11242. The implementation of the class IPriorityQueue requires the following element 
  11243. and key-type functions: 
  11244.  
  11245. Element Type 
  11246.  
  11247.      Copy constructor 
  11248.      Destructor 
  11249.      Assignment 
  11250.      Key access 
  11251.  
  11252.  Key Type 
  11253.  
  11254.  Ordering relation 
  11255.  
  11256.  
  11257. ΓòÉΓòÉΓòÉ 5.12.5.2. Priority Queue as List ΓòÉΓòÉΓòÉ
  11258.  
  11259. IPriorityQueueAsList  <Element, Key>
  11260. IGPriorityQueueAsList <Element, Key, KCOps>
  11261.  
  11262. The implementation of the class IPriorityQueueAsList requires the following 
  11263. element and key-type functions: 
  11264.  
  11265. Element Type 
  11266.  
  11267.      Copy constructor 
  11268.      Destructor 
  11269.      Assignment 
  11270.      Key access 
  11271.  
  11272.  Key Type 
  11273.  
  11274.  Ordering relation 
  11275.  
  11276.  
  11277. ΓòÉΓòÉΓòÉ 5.12.5.3. Priority Queue as Table ΓòÉΓòÉΓòÉ
  11278.  
  11279. IPriorityQueueAsTable  <Element, Key>
  11280. IGPriorityQueueAsTable <Element, Key, KCOps>
  11281.  
  11282. The implementation of the class IPriorityQueueAsTable requires the following 
  11283. element and key-type functions: 
  11284.  
  11285. Element Type 
  11286.  
  11287.      Copy constructor 
  11288.      Destructor 
  11289.      Assignment 
  11290.      Key access 
  11291.  
  11292.  Key Type 
  11293.  
  11294.  Ordering relation 
  11295.  
  11296.  
  11297. ΓòÉΓòÉΓòÉ 5.12.5.4. Priority Queue as Diluted Table ΓòÉΓòÉΓòÉ
  11298.  
  11299. IPriorityQueueAsDilTable  <Element, Key>
  11300. IGPriorityQueueAsDilTable <Element, Key, KCOps>
  11301.  
  11302. The implementation of the class IPriorityQueueAsDilTable requires the following 
  11303. element and key-type functions: 
  11304.  
  11305. Element Type 
  11306.  
  11307.      Copy constructor 
  11308.      Destructor 
  11309.      Assignment 
  11310.      Key access 
  11311.  
  11312.  Key Type 
  11313.  
  11314.  Ordering relation 
  11315.  
  11316.  
  11317. ΓòÉΓòÉΓòÉ 5.12.6. Abstract Class ΓòÉΓòÉΓòÉ
  11318.  
  11319. IAPriorityQueue<Element,Key>
  11320.  
  11321. For polymorphism, you can use the corresponding abstract class, 
  11322. IAPriorityQueue, which is found in the iapqu.h header file. See Polymorphism 
  11323. and the Collections for further information. 
  11324.  
  11325. The required functions are the same as the required functions of the concrete 
  11326. base class. 
  11327.  
  11328.  
  11329. ΓòÉΓòÉΓòÉ 5.13. Queue ΓòÉΓòÉΓòÉ
  11330.  
  11331. Description 
  11332.  
  11333. Derivation 
  11334.  
  11335. Variants/Header Files 
  11336.  
  11337. Members 
  11338.  
  11339. Template Arguments and Required Functions 
  11340.  
  11341. Abstract/Reference Classes 
  11342.  
  11343. To close all the panels in a chapter, double-click on this panel's system menu. 
  11344.  
  11345.  
  11346. ΓòÉΓòÉΓòÉ 5.13.1. Class Description - Queue ΓòÉΓòÉΓòÉ
  11347.  
  11348. A queue is a sequence with restricted access.  It is an ordered collection of 
  11349. elements with no key and no element equality.  The elements are arranged so 
  11350. that each collection has a first and a last element, each element except the 
  11351. last has a next element, and each element but the first has a previous element. 
  11352. The type and value of the elements are irrelevant, and have no effect on the 
  11353. behavior of the collection. 
  11354.  
  11355. You can only add an element as the last element, and you can only remove the 
  11356. first element.  Consequently, the elements of a queue are in chronological 
  11357. order. 
  11358.  
  11359. A queue is characterized by a first-in, first-out (FIFO) behavior. 
  11360.  
  11361. An example of using a queue is a program that processes requests for parts at 
  11362. the cash sales desk of a warehouse.  A request for a part is added to the queue 
  11363. when the customer's order is taken, and is removed from the queue when an order 
  11364. picker receives the order form for the part.  Using a queue collection in such 
  11365. an application ensures that all orders for parts are processed on a first-come, 
  11366. first-served basis. 
  11367.  
  11368.  
  11369. ΓòÉΓòÉΓòÉ 5.13.2. Derivation ΓòÉΓòÉΓòÉ
  11370.  
  11371. Collection 
  11372.  
  11373.   Ordered Collection
  11374.    Sequential Collection
  11375.      Sequence
  11376.       Queue
  11377.  
  11378. Note that queue is based on sequence but is not actually derived from it or 
  11379. from the other classes shown above. See Restricted Access for further details. 
  11380.  
  11381.  
  11382. ΓòÉΓòÉΓòÉ 5.13.3. Variants and Header Files ΓòÉΓòÉΓòÉ
  11383.  
  11384. IQueue, the first class in the table below, is the default implementation 
  11385. variant. 
  11386.  
  11387. To use Visual Builder features with your collections, change the name of the 
  11388. desired collection class template in the list below from I... to IV..., and use 
  11389. the ivqueue.h header file instead of the header file that you would normally 
  11390. use without Visual Builder. 
  11391.  
  11392. Class Name               Header File   Implementation Variant
  11393.  
  11394. IQueue                   iqu.h         List
  11395. IGQueue                  iqu.h         List
  11396.  
  11397. IQueueAsList             iqulst.h      List
  11398. IGQueueAsList            iqulst.h      List
  11399.  
  11400. IQueueAsTable            iqutab.h      Table
  11401. IGQueueAsTable           iqutab.h      Table
  11402.  
  11403. IQueueAsDilTable         iqudil.h      Diluted table
  11404. IGQueueAsDilTable        iqudil.h      Diluted table
  11405.  
  11406.  
  11407. ΓòÉΓòÉΓòÉ 5.13.4. Members ΓòÉΓòÉΓòÉ
  11408.  
  11409. All members of flat collections are described in Introduction to Flat 
  11410. Collections. The following members are provided for queue: 
  11411.  
  11412.      Constructor 
  11413.      Copy Constructor 
  11414.      Destructor 
  11415.      operator= 
  11416.      add 
  11417.      addAllFrom 
  11418.      addAsLast 
  11419.      allElementsDo 
  11420.      anyElement 
  11421.      compare 
  11422.      copy 
  11423.      dequeue 
  11424.      elementAt 
  11425.      elementAtPosition 
  11426.      enqueue 
  11427.      firstElement 
  11428.      isBounded 
  11429.      isEmpty 
  11430.      isFirst 
  11431.      isFull 
  11432.      isLast 
  11433.      lastElement 
  11434.      maxNumberOfElements 
  11435.      newCursor 
  11436.      numberOfElements 
  11437.      positionAt 
  11438.      removeAll 
  11439.      removeFirst 
  11440.      setToFirst 
  11441.      setToLast 
  11442.      setToNext 
  11443.      setToPosition 
  11444.  
  11445.  Queue also defines a cursor that inherits from IOrderedCursor.  The members 
  11446.  for IOrderedCursor are described in Cursor. 
  11447.  
  11448.  
  11449. ΓòÉΓòÉΓòÉ 5.13.5. Template Arguments and Required Functions ΓòÉΓòÉΓòÉ
  11450.  
  11451. The following implementation variants are defined for queues: 
  11452.  
  11453.      Queue 
  11454.      Queue as list 
  11455.      Queue as table 
  11456.      Queue as diluted table 
  11457.  
  11458.  
  11459. ΓòÉΓòÉΓòÉ 5.13.5.1. Queue ΓòÉΓòÉΓòÉ
  11460.  
  11461. IQueue  <Element>
  11462. IGQueue <Element, StdOps>
  11463.  
  11464. The default implementation of the class IQueue requires the following element 
  11465. functions: 
  11466.  
  11467. Element Type 
  11468.  
  11469.      Copy constructor 
  11470.      Destructor 
  11471.      Assignment 
  11472.  
  11473.  
  11474. ΓòÉΓòÉΓòÉ 5.13.5.2. Queue as List ΓòÉΓòÉΓòÉ
  11475.  
  11476. IQueueAsList  <Element>
  11477. IGQueueAsList <Element, StdOps>
  11478.  
  11479. The implementation of the class IQueueAsList requires the following element 
  11480. functions: 
  11481.  
  11482. Element Type 
  11483.  
  11484.      Copy constructor 
  11485.      Destructor 
  11486.      Assignment 
  11487.  
  11488.  
  11489. ΓòÉΓòÉΓòÉ 5.13.5.3. Queue as Table ΓòÉΓòÉΓòÉ
  11490.  
  11491. IQueueAsTable  <Element>
  11492. IGQueueAsTable <Element, StdOps>
  11493.  
  11494. The implementation of the class IDequeAsTable requires the following element 
  11495. functions: 
  11496.  
  11497. Element Type 
  11498.  
  11499.      Copy constructor 
  11500.      Destructor 
  11501.      Assignment 
  11502.  
  11503.  
  11504. ΓòÉΓòÉΓòÉ 5.13.5.4. Queue as Diluted Table ΓòÉΓòÉΓòÉ
  11505.  
  11506. IQueueAsDilTable  <Element>
  11507. IGQueueAsDilTable <Element, StdOps>
  11508.  
  11509. The implementation of the class IQueueAsDilTable requires the following element 
  11510. functions: 
  11511.  
  11512. Element Type 
  11513.  
  11514.      Copy constructor 
  11515.      Destructor 
  11516.      Assignment 
  11517.  
  11518.  
  11519. ΓòÉΓòÉΓòÉ 5.13.6. Abstract Class ΓòÉΓòÉΓòÉ
  11520.  
  11521. IAQueue<Element>
  11522.  
  11523. For polymorphism, you can use the corresponding abstract class, IAQueue, which 
  11524. is found in the iaqu.h header file. See Polymorphism and the Collections for 
  11525. further information. 
  11526.  
  11527. The required functions are the same as the required functions of the concrete 
  11528. base class. 
  11529.  
  11530.  
  11531. ΓòÉΓòÉΓòÉ 5.14. Relation ΓòÉΓòÉΓòÉ
  11532.  
  11533. Description 
  11534.  
  11535. Derivation 
  11536.  
  11537. Variants/Header Files 
  11538.  
  11539. Members 
  11540.  
  11541. Template Arguments and Required Functions 
  11542.  
  11543. Abstract/Reference Classes 
  11544.  
  11545. To close all the panels in a chapter, double-click on this panel's system menu. 
  11546.  
  11547.  
  11548. ΓòÉΓòÉΓòÉ 5.14.1. Class Description - Relation ΓòÉΓòÉΓòÉ
  11549.  
  11550. A relation is an unordered collection of zero or more elements that have a key. 
  11551. Element equality is supported, and the values of the elements are relevant. 
  11552.  
  11553. The keys of the elements are not unique.  You can add an element whether or not 
  11554. there is already an element in the collection with the same key. 
  11555.  
  11556. Figure Behavior of add for Unique and Multiple Collections illustrates the 
  11557. differences in behavior between map, relation, key set, and key bag when 
  11558. identical elements and elements with the same key are added. 
  11559.  
  11560. An example of using a relation is a program that maintains a list of all your 
  11561. relatives, with an individual's relationship to you as the key. You can add an 
  11562. aunt, uncle, grandmother, daughter, father-in-law, and so on.  You can add an 
  11563. aunt even if an aunt is already in the collection, because you can have several 
  11564. relatives who have the same relationship to you.  (For unique relationships 
  11565. such as mother or father, your program would have to check the collection to 
  11566. make sure it did not already contain a family member with that key, before 
  11567. adding the family member.) You can locate a member of the family, but the 
  11568. family members are not in any particular order. 
  11569.  
  11570. Figure Combination of Flat Collection Properties gives an overview of the 
  11571. properties of a relation and its relationship to other flat collections. 
  11572.  
  11573.  
  11574. ΓòÉΓòÉΓòÉ 5.14.2. Derivation ΓòÉΓòÉΓòÉ
  11575.  
  11576.            Collection 
  11577. Key Collection       Equality Collection 
  11578.  
  11579.        Equality Key Collection
  11580.             Relation
  11581.  
  11582.  
  11583. ΓòÉΓòÉΓòÉ 5.14.3. Variants and Header Files ΓòÉΓòÉΓòÉ
  11584.  
  11585. IRelation is the default implementation variant.  IGRelation is the default 
  11586. implementation with generic operations class.  Both variants are declared in 
  11587. the header file irel.h. If you want to use polymorphism, you can replace these 
  11588. class implementation variants by the reference class. 
  11589.  
  11590. To use Visual Builder features with your collections, use IVRelation instead of 
  11591. IRelation, and IVGRelation instead of IGRelation.  Both variants are declared 
  11592. in the header file ivrel.h. 
  11593.  
  11594.  
  11595. ΓòÉΓòÉΓòÉ 5.14.4. Members ΓòÉΓòÉΓòÉ
  11596.  
  11597. All members of flat collections are described in Introduction to Flat 
  11598. Collections. The following members are provided for relation: 
  11599.  
  11600.      Constructor 
  11601.      Copy Constructor 
  11602.      Destructor 
  11603.      operator!= 
  11604.      operator= 
  11605.      operator== 
  11606.      add 
  11607.      addAllFrom 
  11608.      addDifference 
  11609.      addIntersection 
  11610.      addOrReplaceElementWithKey 
  11611.      addUnion 
  11612.      allElementsDo 
  11613.      anyElement 
  11614.      contains 
  11615.      containsAllFrom 
  11616.      containsAllKeysFrom 
  11617.      containsElementWithKey 
  11618.      copy 
  11619.      differenceWith 
  11620.      elementAt 
  11621.      elementWithKey 
  11622.      intersectionWith 
  11623.      isBounded 
  11624.      isEmpty 
  11625.      isFull 
  11626.      key 
  11627.      locate 
  11628.      locateElementWithKey 
  11629.      locateNextElementWithKey 
  11630.      locateOrAdd 
  11631.      locateOrAddElementWithKey 
  11632.      maxNumberOfElements 
  11633.      newCursor 
  11634.      numberOfDifferentKeys 
  11635.      numberOfElements 
  11636.      numberOfElementsWithKey 
  11637.      remove 
  11638.      removeAll 
  11639.      removeAllElementsWithKey 
  11640.      removeAt 
  11641.      removeElementWithKey 
  11642.      replaceAt 
  11643.      replaceElementWithKey 
  11644.      setToFirst 
  11645.      setToNext 
  11646.      setToNextWithDifferentKey 
  11647.      unionWith 
  11648.  
  11649.  Relation also defines a cursor that inherits from IElementCursor.  The members 
  11650.  for IElementCursor are described in Cursor. 
  11651.  
  11652.  
  11653. ΓòÉΓòÉΓòÉ 5.14.5. Template Arguments and Required Functions ΓòÉΓòÉΓòÉ
  11654.  
  11655. IRelation  <Element, Key>
  11656. IGRelation <Element, Key, EKEHOps>
  11657.  
  11658. The default implementation of the class IRelation requires the following 
  11659. element functions: 
  11660.  
  11661. Element Type 
  11662.  
  11663.      Copy constructor 
  11664.      Destructor 
  11665.      Assignment 
  11666.      Key access 
  11667.      Equality test 
  11668.  
  11669.  Key Type 
  11670.  
  11671.      Equality test 
  11672.      Hash function 
  11673.  
  11674.  
  11675. ΓòÉΓòÉΓòÉ 5.14.6. Abstract Class ΓòÉΓòÉΓòÉ
  11676.  
  11677. IARelation<Element,Key>
  11678.  
  11679. For polymorphism, you can use the corresponding abstract class, IARelation, 
  11680. which is found in the iarel.h header file. See Polymorphism and the Collections 
  11681. for further information. 
  11682.  
  11683. The required functions are the same as the required functions of the concrete 
  11684. base class. 
  11685.  
  11686.  
  11687. ΓòÉΓòÉΓòÉ 5.15. Sequence ΓòÉΓòÉΓòÉ
  11688.  
  11689. Description 
  11690.  
  11691. Derivation 
  11692.  
  11693. Variants/Header Files 
  11694.  
  11695. Members 
  11696.  
  11697. Template Arguments and Required Functions 
  11698.  
  11699. Abstract/Reference Classes 
  11700.  
  11701. Examples 
  11702.  
  11703. To close all the panels in a chapter, double-click on this panel's system menu. 
  11704.  
  11705.  
  11706. ΓòÉΓòÉΓòÉ 5.15.1. Class Description - Sequence ΓòÉΓòÉΓòÉ
  11707.  
  11708. A sequence is an ordered collection of elements.  The elements are arranged so 
  11709. that each collection has a first and a last element, each element except the 
  11710. last has a next element, and each element but the first has a previous element. 
  11711.  
  11712. The type and value of the elements are irrelevant, and have no effect on the 
  11713. behavior of the collection.  Elements can be added and deleted from any 
  11714. position in the collection.  Elements can be retrieved or replaced.  A sequence 
  11715. does not support element equality or a key. If you require element equality for 
  11716. a sequence, you can use an equality sequence. 
  11717.  
  11718. An example of a sequence is a program that maintains a list of the words in a 
  11719. paragraph.  The order of the words is obviously important, and you can add or 
  11720. remove words at a given position, but you cannot search for individual words 
  11721. except by iterating through the collection and comparing each word to the word 
  11722. you are searching for.  You can add a word that is already present in the 
  11723. sequence, because a given word may be used more than once in a paragraph. 
  11724.  
  11725. Figure Combination of Flat Collection Properties shows the properties of a 
  11726. sequence and its relationship to other flat collections. 
  11727.  
  11728.  
  11729. ΓòÉΓòÉΓòÉ 5.15.2. Derivation ΓòÉΓòÉΓòÉ
  11730.  
  11731. Collection 
  11732.  
  11733.   Ordered Collection
  11734.    Sequential Collection
  11735.      Sequence
  11736.  
  11737.  
  11738. ΓòÉΓòÉΓòÉ 5.15.3. Variants and Header Files ΓòÉΓòÉΓòÉ
  11739.  
  11740. ISequence, the first class in the table below, is the default implementation 
  11741. variant. 
  11742.  
  11743. To use Visual Builder features with your collections, change the name of the 
  11744. desired collection class template in the list below from I... to IV..., and use 
  11745. the ivseq.h header file instead of the header file that you would normally use 
  11746. without Visual Builder. 
  11747.  
  11748. Class Name             Header File  Implementation Variant
  11749.  
  11750. ISequence              iseq.h       List
  11751. IGSequence             iseq.h       List
  11752. ISequenceAsList        iseqlst.h    List
  11753. IGSequenceAsList       iseqlst.h    List
  11754.  
  11755. ISequenceAsTable       iseqtab.h    Table
  11756. IGSequenceAsTable      iseqtab.h    Table
  11757.  
  11758. ISequenceAsDilTable   iseqdil.h     Diluted table
  11759. IGSequenceAsDilTable  iseqdil.h     Diluted table
  11760.  
  11761.  
  11762. ΓòÉΓòÉΓòÉ 5.15.4. Members ΓòÉΓòÉΓòÉ
  11763.  
  11764. All members of flat collections are described in Introduction to Flat 
  11765. Collections. The following members are provided for sequence: 
  11766.  
  11767.      Constructor 
  11768.      Copy Constructor 
  11769.      Destructor 
  11770.      operator= 
  11771.      add 
  11772.      addAllFrom 
  11773.      addAsFirst 
  11774.      addAsLast 
  11775.      addAsNext 
  11776.      addAsPrevious 
  11777.      addAtPosition 
  11778.      allElementsDo 
  11779.      anyElement 
  11780.      compare 
  11781.      copy 
  11782.      elementAt 
  11783.      elementAtPosition 
  11784.      firstElement 
  11785.      isBounded 
  11786.      isEmpty 
  11787.      isFirst 
  11788.      isFull 
  11789.      isLast 
  11790.      lastElement 
  11791.      maxNumberOfElements 
  11792.      newCursor 
  11793.      numberOfElements 
  11794.      positionAt 
  11795.      removeAll 
  11796.      removeAt 
  11797.      removeAtPosition 
  11798.      removeFirst 
  11799.      removeLast 
  11800.      replaceAt 
  11801.      setToFirst 
  11802.      setToLast 
  11803.      setToNext 
  11804.      setToPosition 
  11805.      setToPrevious 
  11806.      sort 
  11807.  
  11808.  Sequence also defines a cursor that inherits from IOrderedCursor.  The members 
  11809.  for IOrderedCursor are described in Cursor. 
  11810.  
  11811.  
  11812. ΓòÉΓòÉΓòÉ 5.15.5. Template Arguments and Required Functions ΓòÉΓòÉΓòÉ
  11813.  
  11814. The following implementation variants are defined for sequences: 
  11815.  
  11816.      Sequence 
  11817.      sequence as list 
  11818.      sequence as table 
  11819.      sequence as diluted table 
  11820.  
  11821.  
  11822. ΓòÉΓòÉΓòÉ 5.15.5.1. Sequence ΓòÉΓòÉΓòÉ
  11823.  
  11824. ISequence  <Element>
  11825. IGSequence <Element, StdOps>
  11826.  
  11827. The default implementation of ISequence requires the following element 
  11828. functions: 
  11829.  
  11830. Element Type 
  11831.  
  11832.      Copy constructor 
  11833.      Destructor 
  11834.      Assignment 
  11835.  
  11836.  
  11837. ΓòÉΓòÉΓòÉ 5.15.5.2. Sequence as List ΓòÉΓòÉΓòÉ
  11838.  
  11839. ISequenceAsList  <Element>
  11840. IGSequenceAsList <Element, StdOps>
  11841.  
  11842. The implementation of the class ISequenceAsList requires the following element 
  11843. functions: 
  11844.  
  11845. Element Type 
  11846.  
  11847.      Copy constructor 
  11848.      Destructor 
  11849.      Assignment 
  11850.  
  11851.  
  11852. ΓòÉΓòÉΓòÉ 5.15.5.3. Sequence as Table ΓòÉΓòÉΓòÉ
  11853.  
  11854. ISequenceAsTable  <Element>
  11855. IGSequenceAsTable <Element, StdOps>
  11856.  
  11857. The implementation of the class ISequenceAsTable requires the following element 
  11858. functions: 
  11859.  
  11860. Element Type 
  11861.  
  11862.      Copy constructor 
  11863.      Destructor 
  11864.      Assignment 
  11865.  
  11866.  
  11867. ΓòÉΓòÉΓòÉ 5.15.5.4. Sequence as Diluted Table ΓòÉΓòÉΓòÉ
  11868.  
  11869. ISequenceAsDilTable  <Element>
  11870. IGSequenceAsDilTable <Element, StdOps>
  11871.  
  11872. The implementation of the class ISequenceAsDilTable requires the following 
  11873. element functions: 
  11874.  
  11875. Element Type 
  11876.  
  11877.      Default constructor 
  11878.      Copy constructor 
  11879.      Destructor 
  11880.      Assignment 
  11881.  
  11882.  
  11883. ΓòÉΓòÉΓòÉ 5.15.6. Abstract Class ΓòÉΓòÉΓòÉ
  11884.  
  11885. IASequence<Element>
  11886.  
  11887. For polymorphism, you can use the corresponding abstract class, IASequence, 
  11888. which is found in the iaseq.h header file. See Polymorphism and the Collections 
  11889. for further information. 
  11890.  
  11891. The required functions are the same as the required functions of the concrete 
  11892. base class. 
  11893.  
  11894.  
  11895. ΓòÉΓòÉΓòÉ 5.15.7. Coding Example for Sequence ΓòÉΓòÉΓòÉ
  11896.  
  11897. The following program creates a sequence using the default sequence class, 
  11898. ISequence, and adds a number of words to it.  The program sorts the words in 
  11899. ascending order and searches the sequence for the word "fox".  Finally, it 
  11900. prints the word that is in position 9. 
  11901.  
  11902. The program uses two types of iteration.  It uses the iterator class, 
  11903. IIterator, when printing the sequence, and it uses cursor iteration when 
  11904. searching for a word.  With the iterator object, the program uses the 
  11905. allElementsDo() function. With cursor iteration, it uses the setToFirst(), 
  11906. isValid(), and setToNext() functions. It uses the elementAt() and 
  11907. elementAtPosition() functions to find words in the sequence. 
  11908.  
  11909.    // wordseq.C  -  An example of using a Sequence
  11910.    #include <iostream.h>
  11911.  
  11912.                  // Get definition and declaration of class Word:
  11913.    #include "toyword.h"
  11914.  
  11915.                  // Define a compare function to be used for sort:
  11916.    inline long wordCompare ( Word const& w1, Word const& w2) {
  11917.       return (w1.getWord() > w2.getWord());
  11918.    }
  11919.  
  11920.    // We want to use the default Sequence called ISequence.
  11921.    #include <iseq.h>
  11922.  
  11923.    typedef ISequence <Word> WordSeq;
  11924.    typedef IApplicator <Word> WordAppl;
  11925.  
  11926.  
  11927.    // Test variables to put into the Sequence.
  11928.  
  11929.    IString wordArray[9] = {
  11930.       "the",    "quick",   "brown",   "fox",   "jumps",
  11931.       "over",   "a",       "lazy",    "dog"
  11932.    };
  11933.  
  11934.  
  11935.  
  11936.    // Our Applicator class for use with allElementsDo().
  11937.  
  11938.    // The alternative method of iteration, using a cursor, does
  11939.    // not need such an applicator class.
  11940.    class PrintClass : public WordAppl
  11941.    {
  11942.    public:
  11943.       IBoolean applyTo(Word &w)
  11944.          {
  11945.          cout << endl << w.getWord();    // Print the string
  11946.          return(true);
  11947.          }
  11948.    };
  11949.  
  11950.  
  11951.  
  11952.  
  11953.    // Main program
  11954.    int main()  {
  11955.       WordSeq WL;
  11956.       WordSeq::Cursor cursor(WL);
  11957.       PrintClass Print;
  11958.  
  11959.       int i;
  11960.  
  11961.       for (i = 0; i < 9; i ++) {     // Put all strings into Sequence
  11962.          Word aWord(wordArray[i]);   // Fill object with right value
  11963.          WL.addAsLast(aWord);        // Add it to the Sequence at end
  11964.       }
  11965.  
  11966.       cout << endl << "Sequence in initial order:" << endl;
  11967.       WL.allElementsDo(Print);
  11968.  
  11969.       WL.sort(wordCompare);       // Sort the Sequence ascending
  11970.       cout << endl << endl << "Sequence in sorted order:" << endl;
  11971.       WL.allElementsDo(Print);
  11972.  
  11973.       // Use iteration via cursor now:
  11974.  
  11975.       cout << endl << endl << "Look for \"fox\" in the Sequence:" << endl;
  11976.       for (cursor.setToFirst();
  11977.            cursor.isValid() && (WL.elementAt(cursor).getWord() != "fox");
  11978.            cursor.setToNext());
  11979.  
  11980.       if (WL.elementAt(cursor).getWord() != "fox") {
  11981.           cout << endl << "The element was not found." << endl;
  11982.       }
  11983.       else {
  11984.           cout << endl << " The element was found." << endl;
  11985.       }
  11986.  
  11987.       cout << endl << "The element at position 9: "
  11988.            << WL.elementAtPosition(9).getWord()
  11989.            << endl;
  11990.  
  11991.       return(0);
  11992.    }
  11993.  
  11994. The program produces the following output: 
  11995.  
  11996.  
  11997. Sequence in initial order:
  11998.  
  11999. the
  12000. quick
  12001. brown
  12002. fox
  12003. jumps
  12004. over
  12005. a
  12006. lazy
  12007. dog
  12008.  
  12009. Sequence in sorted order:
  12010.  
  12011. a
  12012. brown
  12013. dog
  12014. fox
  12015. jumps
  12016. lazy
  12017. over
  12018. quick
  12019. the
  12020.  
  12021. Look for "fox" in the Sequence:
  12022.  
  12023.  The element was found.
  12024.  
  12025.  
  12026. The element at position 9: the
  12027.  
  12028.  
  12029. ΓòÉΓòÉΓòÉ 5.16. Set ΓòÉΓòÉΓòÉ
  12030.  
  12031. Description 
  12032.  
  12033. Derivation 
  12034.  
  12035. Variants/Header Files 
  12036.  
  12037. Members 
  12038.  
  12039. Template Arguments and Required Functions 
  12040.  
  12041. Abstract/Reference Classes 
  12042.  
  12043. Examples 
  12044.  
  12045. To close all the panels in a chapter, double-click on this panel's system menu. 
  12046.  
  12047.  
  12048. ΓòÉΓòÉΓòÉ 5.16.1. Class Description - Set ΓòÉΓòÉΓòÉ
  12049.  
  12050. A set is an unordered collection of zero or more elements with no key.  Element 
  12051. equality is supported, and the values of the elements are relevant. 
  12052.  
  12053. Only unique elements are supported.  A request to add an element that already 
  12054. exists is ignored. 
  12055.  
  12056. An example of a set is a program that creates a packing list for a box of free 
  12057. samples to be sent to a warehouse customer.  The program searches a database of 
  12058. in-stock merchandise, and selects ten items at random whose price is below a 
  12059. threshold level.  Each item is then added to the set.  The set does not allow 
  12060. an item to be added if it is already present in the collection, ensuring that a 
  12061. customer does not get two samples of a single product.  The set is not sorted, 
  12062. and elements of the set cannot be located by key. 
  12063.  
  12064. Figure Combination of Flat Collection Properties gives an overview of the 
  12065. properties of a set and its relationship to other flat collections. 
  12066.  
  12067. The set also offers typical set functions such as union, intersection, and 
  12068. difference. 
  12069.  
  12070.  
  12071. ΓòÉΓòÉΓòÉ 5.16.2. Derivation ΓòÉΓòÉΓòÉ
  12072.  
  12073. Collection 
  12074.  
  12075.   Equality Collection
  12076.    Set
  12077.  
  12078.  
  12079. ΓòÉΓòÉΓòÉ 5.16.3. Variants and Header Files ΓòÉΓòÉΓòÉ
  12080.  
  12081. ISet, the first class in the table below, is the default implementation 
  12082. variant. 
  12083.  
  12084. To use Visual Builder features with your collections, change the name of the 
  12085. desired collection class template in the list below from I... to IV..., and use 
  12086. the ivset.h header file instead of the header file that you would normally use 
  12087. without Visual Builder. 
  12088.  
  12089. Class Name                Header File  Implementation Variant
  12090.  
  12091. ISet                      iset.h       AVL tree
  12092. IGSet                     iset.h       AVL tree
  12093.  
  12094. ISetAsAvlTree             isetavl.h    AVL tree
  12095. IGSetAsAvlTree            isetavl.h    AVL tree
  12096.  
  12097. ISetAsBstTree             isetbst.h    B* tree
  12098. IGSetAsBstTree            isetbst.h    B* tree
  12099.  
  12100. ISetAsList                isetlst.h    List
  12101. IGSetAsList               isetlst.h    List
  12102.  
  12103. ISetAsTable               isettab.h    Table
  12104. IGSetAsTable              isettab.h    Table
  12105.  
  12106. ISetAsDilTable            isetdil.h    Diluted table
  12107. IGSetAsDilTable           isetdil.h    Diluted table
  12108.  
  12109. ISetAsHshTable            isethsh.h    Hash table
  12110. IGSetAsHshTable           isethsh.h    Hash table
  12111.  
  12112.  
  12113. ΓòÉΓòÉΓòÉ 5.16.4. Members ΓòÉΓòÉΓòÉ
  12114.  
  12115. All members of flat collections are described in Introduction to Flat 
  12116. Collections. The following members are provided for set: 
  12117.  
  12118.      Constructor 
  12119.      Copy Constructor 
  12120.      Destructor 
  12121.      operator!= 
  12122.      operator= 
  12123.      operator== 
  12124.      add 
  12125.      addAllFrom 
  12126.      addDifference 
  12127.      addIntersection 
  12128.      addUnion 
  12129.      allElementsDo 
  12130.      anyElement 
  12131.      contains 
  12132.      containsAllFrom 
  12133.      copy 
  12134.      differenceWith 
  12135.      elementAt 
  12136.      intersectionWith 
  12137.      isBounded 
  12138.      isEmpty 
  12139.      isFull 
  12140.      locate 
  12141.      locateOrAdd 
  12142.      maxNumberOfElements 
  12143.      newCursor 
  12144.      numberOfElements 
  12145.      remove 
  12146.      removeAll 
  12147.      removeAt 
  12148.      replaceAt 
  12149.      setToFirst 
  12150.      setToNext 
  12151.      unionWith 
  12152.  
  12153.  Set also defines a cursor that inherits from IElementCursor. The members for 
  12154.  IElementCursor are described in Cursor. 
  12155.  
  12156.  
  12157. ΓòÉΓòÉΓòÉ 5.16.5. Template Arguments and Required Functions ΓòÉΓòÉΓòÉ
  12158.  
  12159. The following implementation variants are defined for sets: 
  12160.  
  12161.      Set 
  12162.      Set as AVL tree 
  12163.      Set as B* tree 
  12164.      Set as list 
  12165.      Set as table 
  12166.      Set as diluted table 
  12167.      Set as hash table 
  12168.  
  12169.  
  12170. ΓòÉΓòÉΓòÉ 5.16.5.1. Set ΓòÉΓòÉΓòÉ
  12171.  
  12172. ISet  <Element>
  12173. IGSet <Element, COps>
  12174.  
  12175. The default implementation of the class ISet requires the following element 
  12176. functions: 
  12177.  
  12178. Element Type 
  12179.  
  12180.      Copy constructor 
  12181.      Destructor 
  12182.      Assignment 
  12183.      Ordering relation 
  12184.  
  12185.  
  12186. ΓòÉΓòÉΓòÉ 5.16.5.2. Set as AVL Tree ΓòÉΓòÉΓòÉ
  12187.  
  12188. ISetAsAvlTree  <Element>
  12189. IGSetAsAvlTree <Element, COps>
  12190.  
  12191. The implementation of the class ISetAsAvlTree requires the following element 
  12192. functions: 
  12193.  
  12194. Element Type 
  12195.  
  12196.      Copy constructor 
  12197.      Destructor 
  12198.      Assignment 
  12199.      Ordering relation 
  12200.  
  12201.  
  12202. ΓòÉΓòÉΓòÉ 5.16.5.3. Set as B* Tree ΓòÉΓòÉΓòÉ
  12203.  
  12204. ISetAsBstTree  <Element>
  12205. IGSetAsBstTree <Element, COps>
  12206.  
  12207. The implementation of the class ISetAsBstTree requires the following element 
  12208. functions: 
  12209.  
  12210. Element Type 
  12211.  
  12212.      Copy constructor 
  12213.      Destructor 
  12214.      Assignment 
  12215.      Ordering relation 
  12216.  
  12217.  
  12218. ΓòÉΓòÉΓòÉ 5.16.5.4. Set as List ΓòÉΓòÉΓòÉ
  12219.  
  12220. ISetAsList  <Element>
  12221. IGSetAsList <Element, COps>
  12222.  
  12223. The implementation of the class ISetAsList requires the following element 
  12224. functions: 
  12225.  
  12226. Element Type 
  12227.  
  12228.      Copy constructor 
  12229.      Destructor 
  12230.      Assignment 
  12231.      Ordering relation 
  12232.  
  12233.  
  12234. ΓòÉΓòÉΓòÉ 5.16.5.5. Set as Table ΓòÉΓòÉΓòÉ
  12235.  
  12236. ISetAsSortedTable  <Element>
  12237. IGSetAsTable <Element, COps>
  12238.  
  12239. The implementation of the class ISetAsTable requires the following element 
  12240. functions: 
  12241.  
  12242. Element Type 
  12243.  
  12244.      Copy constructor 
  12245.      Destructor 
  12246.      Assignment 
  12247.      Ordering relation 
  12248.  
  12249.  
  12250. ΓòÉΓòÉΓòÉ 5.16.5.6. Set as Diluted Table ΓòÉΓòÉΓòÉ
  12251.  
  12252. ISetAsDilTable  <Element>
  12253. IGSetAsDilTable <Element, COps>
  12254.  
  12255. The implementation of the class ISetAsDilTable requires the following element 
  12256. functions: 
  12257.  
  12258. Element Type 
  12259.  
  12260.      Copy constructor 
  12261.      Destructor 
  12262.      Assignment 
  12263.      Ordering relation 
  12264.  
  12265.  
  12266. ΓòÉΓòÉΓòÉ 5.16.5.7. Set as Hash Table ΓòÉΓòÉΓòÉ
  12267.  
  12268. ISetAsHshTable  <Element>
  12269. IGSetAsHshTable <Element, EHOps>
  12270.  
  12271. The implementation of the class ISetAsHshTable requires the following element 
  12272. functions: 
  12273.  
  12274. Element Type 
  12275.  
  12276.      Copy constructor 
  12277.      Destructor 
  12278.      Assignment 
  12279.      Equality test 
  12280.      Hash function 
  12281.  
  12282.  
  12283. ΓòÉΓòÉΓòÉ 5.16.6. Abstract Class ΓòÉΓòÉΓòÉ
  12284.  
  12285. IASet<Element>
  12286.  
  12287. For polymorphism, you can use the corresponding abstract class, IASet, which is 
  12288. found in the iaset.h header file. See Polymorphism and the Collections for 
  12289. further information. 
  12290.  
  12291. The required functions are the same as the required functions of the concrete 
  12292. base class. 
  12293.  
  12294.  
  12295. ΓòÉΓòÉΓòÉ 5.16.7. Coding Example for Set ΓòÉΓòÉΓòÉ
  12296.  
  12297. The follow program creates sets using the default class, ISet. The odd set 
  12298. contains all odd numbers less than ten. The prime set contains all prime 
  12299. numbers less than ten.  The program creates a set, oddPrime, that contains all 
  12300. the prime numbers less than ten that are odd, by using the intersection of odd 
  12301. and prime. It creates another set, evenPrime, that contains all the prime 
  12302. numbers less than ten that are even, by using the difference of prime and 
  12303. oddPrime. 
  12304.  
  12305. When printing the sets, the program uses the iterator class, IIterator. It uses 
  12306. the add() function to build the odd and prime sets.  It uses the 
  12307. addIntersection() and addDifference() functions to create the oddPrime and 
  12308. evenPrime sets, respectively. 
  12309.  
  12310.    // evenodd.C  -  An example of using a Set
  12311.    #include <iostream.h>
  12312.  
  12313.    #include <iset.h>        // Take the defaults for the Set and for
  12314.                             // the required functions for integer
  12315.    typedef ISet <int> IntSet;
  12316.  
  12317.    // For printing the contents of the collection, use an object
  12318.    // of an applicator class
  12319.    class PrintClass : public IApplicator<int>  {
  12320.      public:
  12321.        virtual IBoolean applyTo(int& i)
  12322.          { cout << " " << i << " "; return true;}
  12323.    };
  12324.  
  12325.    // Local prototype for the function to display an IntSet.
  12326.    void    List(char *, IntSet &);
  12327.  
  12328.    // Main program
  12329.    int main ()  {
  12330.       IntSet odd, prime;
  12331.       IntSet oddPrime, evenPrime;
  12332.  
  12333.       int One = 1, Two = 2, Three = 3, Five = 5, Seven = 7, Nine = 9;
  12334.  
  12335.    // Fill odd set with odd integers < 10
  12336.       odd.add( One );
  12337.       odd.add( Three );
  12338.       odd.add( Five );
  12339.       odd.add( Seven );
  12340.       odd.add( Nine );
  12341.       List("Odds less than 10:  ", odd);
  12342.  
  12343.    // Fill prime set with primes < 10
  12344.       prime.add( Two );
  12345.       prime.add( Three );
  12346.       prime.add( Five );
  12347.       prime.add( Seven );
  12348.       List("Primes less than 10:  ", prime);
  12349.  
  12350.    // Intersect 'Odd' and 'Prime' to give 'OddPrime'
  12351.       oddPrime.addIntersection( odd, prime);
  12352.       List("Odd primes less than 10:  ", oddPrime);
  12353.  
  12354.    // Subtract all 'Odd' from 'Prime' to give 'EvenPrime'
  12355.       evenPrime.addDifference( prime, oddPrime);
  12356.       List("Even primes less than 10:  ", evenPrime);
  12357.  
  12358.       return(0);
  12359.    }
  12360.  
  12361.    // Local function to display an IntSet.
  12362.  
  12363.    void List(char *Message, IntSet &anIntSet)  {
  12364.       PrintClass Print;
  12365.  
  12366.       cout << Message;
  12367.       anIntSet.allElementsDo(Print);
  12368.       cout << endl;
  12369.    }
  12370.  
  12371. The program produces the following output: 
  12372.  
  12373. Odds less than 10:   1  3  5  7  9
  12374. Primes less than 10:   2  3  5  7
  12375. Odd primes less than 10:   3  5  7
  12376. Even primes less than 10:   2
  12377.  
  12378.  
  12379. ΓòÉΓòÉΓòÉ 5.17. Sorted Bag ΓòÉΓòÉΓòÉ
  12380.  
  12381. Description 
  12382.  
  12383. Derivation 
  12384.  
  12385. Variants/Header Files 
  12386.  
  12387. Members 
  12388.  
  12389. Template Arguments and Required Functions 
  12390.  
  12391. Abstract/Reference Classes 
  12392.  
  12393. To close all the panels in a chapter, double-click on this panel's system menu. 
  12394.  
  12395.  
  12396. ΓòÉΓòÉΓòÉ 5.17.1. Class Description - Sorted Bag ΓòÉΓòÉΓòÉ
  12397.  
  12398. A sorted bag is an ordered collection of zero or more elements with no key. 
  12399. Both element equality and multiple elements are supported. 
  12400.  
  12401. An example of using a sorted bag is a program for entering observations on the 
  12402. types of stones found in a riverbed.  Each time you find a stone on the 
  12403. riverbed, you enter the stone's mineral type into the collection.  You can 
  12404. enter the same mineral type for several stones, because a sorted bag supports 
  12405. multiple elements.  You can search for stones of a particular mineral type, and 
  12406. you can determine the number of observations of stones of that type.  You can 
  12407. also display the contents of the collection, sorted by mineral type, if you 
  12408. want a complete list of observations made to date. 
  12409.  
  12410. Figure Combination of Flat Collection Properties gives an overview of the 
  12411. properties of a sorted bag and its relationship to other flat collections. 
  12412.  
  12413.  
  12414. ΓòÉΓòÉΓòÉ 5.17.2. Derivation ΓòÉΓòÉΓòÉ
  12415.  
  12416.        Collection 
  12417.  
  12418.               Ordered Collection
  12419.  
  12420. Equality Collection    Sorted Collection 
  12421.  
  12422.      Equality Sorted Collection
  12423.          Sorted Bag
  12424.  
  12425.  
  12426. ΓòÉΓòÉΓòÉ 5.17.3. Variants and Header Files ΓòÉΓòÉΓòÉ
  12427.  
  12428. ISortedBag, the first class in the table below, is the default implementation 
  12429. variant. 
  12430.  
  12431. To use Visual Builder features with your collections, change the name of the 
  12432. desired collection class template in the list below from I... to IV..., and use 
  12433. the ivsrtbag.h header file instead of the header file that you would normally 
  12434. use without Visual Builder. 
  12435.  
  12436. Class Name                    Header File  Implementation Variant
  12437.  
  12438. ISortedBag                    isb.h        AVL tree
  12439. IGSortedBag                   isb.h        AVL tree
  12440.  
  12441. ISortedBagAsAvlTree           isbavl.h     AVL tree
  12442. IGSortedBagAsAvlTree          isbavl.h     AVL tree
  12443.  
  12444. ISortedBagAsBstTree           isbbst.h     B* tree
  12445. IGSortedBagAsBstTree          isbbst.h     B* tree
  12446.  
  12447. ISortedBagAsList              isblst.h     List
  12448. IGSortedBagAsList             isblst.h     List
  12449.  
  12450. ISortedBagAsTable             isbtab.h     Table
  12451. IGSortedBagAsTable            isbtab.h     Table
  12452.  
  12453. ISortedBagAsDilTable          isbdil.h     Diluted table
  12454. IGSortedBagAsDilTable         isbdil.h     Diluted table
  12455.  
  12456.  
  12457. ΓòÉΓòÉΓòÉ 5.17.4. Members ΓòÉΓòÉΓòÉ
  12458.  
  12459. All members of flat collections are described in Introduction to Flat 
  12460. Collections. The following members are provided for sorted bag: 
  12461.  
  12462.      Constructor 
  12463.      Copy Constructor 
  12464.      Destructor 
  12465.      operator!= 
  12466.      operator= 
  12467.      operator== 
  12468.      add 
  12469.      addAllFrom 
  12470.      addDifference 
  12471.      addIntersection 
  12472.      addUnion 
  12473.      allElementsDo 
  12474.      anyElement 
  12475.      compare 
  12476.      contains 
  12477.      containsAllFrom 
  12478.      copy 
  12479.      differenceWith 
  12480.      elementAt 
  12481.      elementAtPosition 
  12482.      firstElement 
  12483.      intersectionWith 
  12484.      isBounded 
  12485.      isEmpty 
  12486.      isFirst 
  12487.      isFull 
  12488.      isLast 
  12489.      lastElement 
  12490.      locate 
  12491.      locateNext 
  12492.      locateOrAdd 
  12493.      maxNumberOfElements 
  12494.      newCursor 
  12495.      numberOfDifferentElements 
  12496.      numberOfElements 
  12497.      numberOfOccurrences 
  12498.      positionAt 
  12499.      remove 
  12500.      removeAll 
  12501.      removeAllOccurrences 
  12502.      removeAt 
  12503.      removeAtPosition 
  12504.      removeFirst 
  12505.      removeLast 
  12506.      replaceAt 
  12507.      setToFirst 
  12508.      setToLast 
  12509.      setToNext 
  12510.      setToNextDifferentElement 
  12511.      setToPosition 
  12512.      setToPrevious 
  12513.      unionWith 
  12514.  
  12515.  Sorted Bag also defines a cursor that inherits from IOrderedCursor. The 
  12516.  members for IOrderedCursor are described in Cursor. 
  12517.  
  12518.  
  12519. ΓòÉΓòÉΓòÉ 5.17.5. Template Arguments and Required Functions ΓòÉΓòÉΓòÉ
  12520.  
  12521. The following implementation variants are defined for sorted bags: 
  12522.  
  12523.      Sorted bag 
  12524.      Sorted bag as AVL tree 
  12525.      Sorted bag as B* tree 
  12526.      Sorted bag as list 
  12527.      Sorted bag as table 
  12528.      Sorted bag as diluted table 
  12529.  
  12530.  
  12531. ΓòÉΓòÉΓòÉ 5.17.5.1. Sorted Bag ΓòÉΓòÉΓòÉ
  12532.  
  12533. ISortedBag  <Element>
  12534. IGSortedBag <Element, COps>
  12535.  
  12536. The default implementation of the class ISortedBag requires the following 
  12537. element functions: 
  12538.  
  12539. Element Type 
  12540.  
  12541.      Copy constructor 
  12542.      Destructor 
  12543.      Assignment 
  12544.      Ordering relation 
  12545.  
  12546.  
  12547. ΓòÉΓòÉΓòÉ 5.17.5.2. Sorted Bag as AVL Tree ΓòÉΓòÉΓòÉ
  12548.  
  12549. ISortedBagAsAvlTree <Element>
  12550. IGSortedBagAsAvlTree <Element, COps>
  12551.  
  12552. The implementation of the class ISortedBagAsAvlTree requires the following 
  12553. element functions: 
  12554.  
  12555. Element Type 
  12556.  
  12557.      Copy constructor 
  12558.      Destructor 
  12559.      Assignment 
  12560.      Ordering relation 
  12561.  
  12562.  
  12563. ΓòÉΓòÉΓòÉ 5.17.5.3. Sorted Bag as B* Tree ΓòÉΓòÉΓòÉ
  12564.  
  12565. ISortedBagAsBstTree  <Element>
  12566. IGSortedBagAsBstTree <Element, COps>
  12567.  
  12568. The implementation of the class ISortedBagAsBstTree requires the following 
  12569. element functions: 
  12570.  
  12571. Element Type 
  12572.  
  12573.      Copy constructor 
  12574.      Destructor 
  12575.      Assignment 
  12576.      Ordering relation 
  12577.  
  12578.  
  12579. ΓòÉΓòÉΓòÉ 5.17.5.4. Sorted Bag as List ΓòÉΓòÉΓòÉ
  12580.  
  12581. ISortedBagAsList  <Element>
  12582. IGSortedBagAsList <Element, COps>
  12583.  
  12584. The implementation of the class ISortedBagAsList requires the following element 
  12585. functions: 
  12586.  
  12587. Element Type 
  12588.  
  12589.      Constructor 
  12590.      Assignment 
  12591.      Ordering relation 
  12592.  
  12593.  
  12594. ΓòÉΓòÉΓòÉ 5.17.5.5. Sorted Bag as Table ΓòÉΓòÉΓòÉ
  12595.  
  12596. ISortedBagAsTable  <Element>
  12597. IGSortedBagAsTable <Element, COps>
  12598.  
  12599. The implementation of the class ISortedBagAsTable requires the following 
  12600. element functions: 
  12601.  
  12602. Element Type 
  12603.  
  12604.      Copy constructor 
  12605.      Destructor 
  12606.      Assignment 
  12607.      Ordering relation 
  12608.  
  12609.  
  12610. ΓòÉΓòÉΓòÉ 5.17.5.6. Sorted Bag as Diluted Table ΓòÉΓòÉΓòÉ
  12611.  
  12612. ISortedBagAsDilTable  <Element>
  12613. IGSortedBagAsDilTable <Element, COps>
  12614.  
  12615. The implementation of the class ISortedBagAsDilTable requires the following 
  12616. element functions: 
  12617.  
  12618. Element Type 
  12619.  
  12620.      Copy constructor 
  12621.      Destructor 
  12622.      Assignment 
  12623.      Ordering relation 
  12624.  
  12625.  
  12626. ΓòÉΓòÉΓòÉ 5.17.6. Abstract Class ΓòÉΓòÉΓòÉ
  12627.  
  12628. IASortedBag<ELement>
  12629.  
  12630. For polymorphism, you can use the corresponding abstract class, IASortedBag, 
  12631. which is found in the iasb.h header file. See Polymorphism and the Collections 
  12632. for further information. 
  12633.  
  12634. The required functions are the same as the required functions of the concrete 
  12635. base class. 
  12636.  
  12637.  
  12638. ΓòÉΓòÉΓòÉ 5.18. Sorted Map ΓòÉΓòÉΓòÉ
  12639.  
  12640. Description 
  12641.  
  12642. Derivation 
  12643.  
  12644. Variants/Header Files 
  12645.  
  12646. Members 
  12647.  
  12648. Template Arguments and Required Functions 
  12649.  
  12650. Abstract/Reference Classes 
  12651.  
  12652. Examples 
  12653.  
  12654. To close all the panels in a chapter, double-click on this panel's system menu. 
  12655.  
  12656.  
  12657. ΓòÉΓòÉΓòÉ 5.18.1. Class Description - Sorted Map ΓòÉΓòÉΓòÉ
  12658.  
  12659. A sorted map is an ordered collection of zero or more elements that have a key. 
  12660. Element equality is supported and the values of the elements are relevant. 
  12661. Elements are sorted by the value of their keys. 
  12662.  
  12663. Only elements with unique keys are supported.  A request to add an element 
  12664. whose key already exists in another element of the collection causes an 
  12665. exception to be thrown.  A request to add a duplicate element is ignored. 
  12666.  
  12667. An example of using a sorted map is a program that matches the names of rivers 
  12668. and lakes to their coordinates on a topographical map. The river or lake name 
  12669. is the key.  You cannot add a lake or river to the collection if it is already 
  12670. present in the collection.  You can display a list of all lakes and rivers, 
  12671. sorted by their names, and you can locate a given lake or river by its key, to 
  12672. determine its coordinates. 
  12673.  
  12674. Figure Combination of Flat Collection Properties gives an overview of the 
  12675. properties of a sorted map and its relationship to other flat collections. 
  12676.  
  12677.  
  12678. ΓòÉΓòÉΓòÉ 5.18.2. Derivation ΓòÉΓòÉΓòÉ
  12679.  
  12680. Equality Key Collection     Equality Sorted Collection 
  12681.  
  12682.        Equality Key Sorted Collection
  12683.             Sorted Map
  12684.  
  12685. The diagram does not show all bases of sorted map. See the figure "Abstract 
  12686. Class Hierarchy" in the section Abstract Classes for an illustration. 
  12687.  
  12688.  
  12689. ΓòÉΓòÉΓòÉ 5.18.3. Variants and Header Files ΓòÉΓòÉΓòÉ
  12690.  
  12691. ISortedMap, the first class in the table below, is the default implementation 
  12692. variant. 
  12693.  
  12694. To use Visual Builder features with your collections, change the name of the 
  12695. desired collection class template in the list below from I... to IV..., and use 
  12696. the ivsrtmap.h header file instead of the header file that you would normally 
  12697. use without Visual Builder. 
  12698.  
  12699. Class Name                   Header File  Implementation Variant
  12700.  
  12701. ISortedMap                   ism.h        AVL tree
  12702. IGSortedMap                  ism.h        AVL tree
  12703.  
  12704. ISortedMapAsAvlTree          ismavl.h     AVL tree
  12705. IGSortedMapAsAvlTree         ismavl.h     AVL tree
  12706.  
  12707. ISortedMapAsBstTree          ismbst.h     B* tree
  12708. IGSortedMapAsBstTree         ismbst.h     B* tree
  12709.  
  12710. ISortedMapAsList             ismlst.h     List
  12711. IGSortedMapAsList            ismlst.h     List
  12712.  
  12713. ISortedMapAsTable            ismtab.h     Table
  12714. IGSortedMapAsTable           ismtab.h     Table
  12715.  
  12716. ISortedMapAsDilTable         ismdil.h     Diluted table
  12717. IGSortedMapAsDilTable        ismdil.h     Diluted table
  12718.  
  12719.  
  12720. ΓòÉΓòÉΓòÉ 5.18.4. Members ΓòÉΓòÉΓòÉ
  12721.  
  12722. All members of flat collections are described in Introduction to Flat 
  12723. Collections. The following members are provided for sorted maps: 
  12724.  
  12725.      Constructor 
  12726.      Copy Constructor 
  12727.      Destructor 
  12728.      operator!= 
  12729.      operator= 
  12730.      operator== 
  12731.      add 
  12732.      addAllFrom 
  12733.      addDifference 
  12734.      addIntersection 
  12735.      addOrReplaceElementWithKey 
  12736.      addUnion 
  12737.      allElementsDo 
  12738.      anyElement 
  12739.      compare 
  12740.      contains 
  12741.      containsAllFrom 
  12742.      containsAllKeysFrom 
  12743.      containsElementWithKey 
  12744.      copy 
  12745.      differenceWith 
  12746.      elementAt 
  12747.      elementAtPosition 
  12748.      elementWithKey 
  12749.      firstElement 
  12750.      intersectionWith 
  12751.      isBounded 
  12752.      isEmpty 
  12753.      isFirst 
  12754.      isFull 
  12755.      isLast 
  12756.      key 
  12757.      lastElement 
  12758.      locate 
  12759.      locateElementWithKey 
  12760.      locateNext 
  12761.      locateNextElementWithKey 
  12762.      locateOrAdd 
  12763.      locateOrAddElementWithKey 
  12764.      maxNumberOfElements 
  12765.      newCursor 
  12766.      numberOfElements 
  12767.      positionAt 
  12768.      remove 
  12769.      removeAll 
  12770.      removeAt 
  12771.      removeAtPosition 
  12772.      removeElementWithKey 
  12773.      removeFirst 
  12774.      removeLast 
  12775.      replaceAt 
  12776.      replaceElementWithKey 
  12777.      setToFirst 
  12778.      setToLast 
  12779.      setToNext 
  12780.      setToPosition 
  12781.      setToPrevious 
  12782.      unionWith 
  12783.  
  12784.  Sorted map also defines a cursor that inherits from IOrderedCursor. The 
  12785.  members for IOrderedCursor are described in Cursor. 
  12786.  
  12787.  
  12788. ΓòÉΓòÉΓòÉ 5.18.5. Template Arguments and Required Functions ΓòÉΓòÉΓòÉ
  12789.  
  12790. The following implementation variants are defined for sorted maps: 
  12791.  
  12792.      Sorted map 
  12793.      Sorted map as AVL tree 
  12794.      Sorted map as B* tree 
  12795.      Sorted map as list 
  12796.      Sorted map as table 
  12797.      Sorted map as diluted table 
  12798.  
  12799.  
  12800. ΓòÉΓòÉΓòÉ 5.18.5.1. Sorted Map ΓòÉΓòÉΓòÉ
  12801.  
  12802. ISortedMap  <Element, Key>
  12803. IGSortedMap <Element, Key, EKCOps>
  12804.  
  12805. The implementation of the class ISortedMap requires the following element and 
  12806. key-type functions: 
  12807.  
  12808. Element Type 
  12809.  
  12810.      Copy constructor 
  12811.      Destructor 
  12812.      Assignment 
  12813.      Key access 
  12814.      Equality test 
  12815.  
  12816.  Key Type 
  12817.  
  12818.  Ordering relation 
  12819.  
  12820.  
  12821. ΓòÉΓòÉΓòÉ 5.18.5.2. Sorted Map as AVL Tree ΓòÉΓòÉΓòÉ
  12822.  
  12823. ISortedMapAsAvlTree  <Element, Key>
  12824. IGSortedMapAsAvlTree <Element, Key, EKCOps>
  12825.  
  12826. The implementation of the class ISortedMapAsAvlTree requires the following 
  12827. element and key-type functions: 
  12828.  
  12829. Element Type 
  12830.  
  12831.      Copy constructor 
  12832.      Destructor 
  12833.      Assignment 
  12834.      Key access 
  12835.      Equality test 
  12836.  
  12837.  Key Type 
  12838.  
  12839.  Ordering relation 
  12840.  
  12841.  
  12842. ΓòÉΓòÉΓòÉ 5.18.5.3. Sorted Map as B* Tree ΓòÉΓòÉΓòÉ
  12843.  
  12844. ISortedMapAsBstTree  <Element, Key>
  12845. IGSortedMapAsBstTree <Element, Key, EKCOps>
  12846.  
  12847. The implementation of the class ISortedMapAsBstTree requires the following 
  12848. element and key-type functions: 
  12849.  
  12850. Element Type 
  12851.  
  12852.      Default constructor 
  12853.      Copy constructor 
  12854.      Destructor 
  12855.      Assignment 
  12856.      Key access 
  12857.      Equality test 
  12858.  
  12859.  Key Type 
  12860.  
  12861.  Ordering relation 
  12862.  
  12863.  
  12864. ΓòÉΓòÉΓòÉ 5.18.5.4. Sorted Map as List ΓòÉΓòÉΓòÉ
  12865.  
  12866. ISortedMapAsList  <Element, Key>
  12867. IGSortedMapAsList <Element, Key, EKCOps>
  12868.  
  12869. The implementation of the class ISortedMapAsList requires the following element 
  12870. and key-type functions: 
  12871.  
  12872. Element Type 
  12873.  
  12874.      Copy constructor 
  12875.      Destructor 
  12876.      Assignment 
  12877.      Key access 
  12878.      Equality test 
  12879.  
  12880.  Key Type 
  12881.  
  12882.  Ordering relation 
  12883.  
  12884.  
  12885. ΓòÉΓòÉΓòÉ 5.18.5.5. Sorted Map as Table ΓòÉΓòÉΓòÉ
  12886.  
  12887. ISortedMapAsTable  <Element, Key>
  12888. IGSortedMapAsTable <Element, Key, EKCOps>
  12889.  
  12890. The implementation of the class ISortedMapAsTable requires the following 
  12891. element and key-type functions: 
  12892.  
  12893. Element Type 
  12894.  
  12895.      Copy constructor 
  12896.      Destructor 
  12897.      Assignment 
  12898.      Key access 
  12899.      Equality test 
  12900.  
  12901.  Key Type 
  12902.  
  12903.  Ordering relation 
  12904.  
  12905.  
  12906. ΓòÉΓòÉΓòÉ 5.18.5.6. Sorted Map as Diluted Table ΓòÉΓòÉΓòÉ
  12907.  
  12908. ISortedMapAsDilTable  <Element, Key>
  12909. IGSortedMapAsDilTable <Element, Key, EKCOps>
  12910.  
  12911. The implementation of the class ISortedMapAsDilTable requires the following 
  12912. element and key-type functions: 
  12913.  
  12914. Element Type 
  12915.  
  12916.      Copy constructor 
  12917.      Destructor 
  12918.      Assignment 
  12919.      Key access 
  12920.      Equality test 
  12921.  
  12922.  Key Type 
  12923.  
  12924.  Ordering relation 
  12925.  
  12926.  
  12927. ΓòÉΓòÉΓòÉ 5.18.6. Abstract Class ΓòÉΓòÉΓòÉ
  12928.  
  12929. IASortedMap<Element,Key>
  12930.  
  12931. For polymorphism, you can use the corresponding abstract class, IASortedMap, 
  12932. which is found in the iasm.h header file. See Polymorphism and the Collections 
  12933. for further information. 
  12934.  
  12935. The required functions are the same as the required functions of the concrete 
  12936. base class. 
  12937.  
  12938.  
  12939. ΓòÉΓòÉΓòÉ 5.18.7. Coding Example for Sorted Map ΓòÉΓòÉΓòÉ
  12940.  
  12941. The following program uses a sorted map and a sorted relation to display sorted 
  12942. lists of the name and size of files contained on a disk. It uses the default 
  12943. classes, ISortedMap and ISortedRelation, to implement the collections. The 
  12944. program uses the sorted map to store the name of the file, because all elements 
  12945. in a sorted map are unique and all names on a disk are unique.  It uses a 
  12946. sorted relation for the file size, because there may be identical file sizes, 
  12947. and identical values are permissible in sorted relations. 
  12948.  
  12949. The program uses the add() function to fill both collections.  To print the 
  12950. collections, it uses the forICursor macro and the allElementsDo() function. 
  12951.  
  12952. The program produces a list of files sorted by name (in ascending order) and a 
  12953. list of the same files sorted by file size (in descending order). The program 
  12954. uses an input file, dsu.dat, rather than call an operating system function to 
  12955. get disk usage information.  The input file was created using the du command on 
  12956. an AIX system. The input file is contained in the same directory as the sample 
  12957. program. 
  12958.  
  12959.    // dskusage.C -  An example of using a Sorted Map and a Sorted Relation
  12960.    #include "dsur.h"
  12961.                         // Our own common exit for all errors:
  12962.    void errorExit(int, char*, char* = "");
  12963.  
  12964.                         // Use the default Sorted Map as is:
  12965.    #include <isrtmap.h>
  12966.                         // Use the default Sorted Relation as is:
  12967.    #include <isrtrel.h>
  12968.  
  12969.    int main (int argc, char* argv[]) {
  12970.        char* fspec = "dsu.dat"; // Default for input file
  12971.        if (argc > 1)   fspec = argv[1];
  12972.        ifstream  inputfile(fspec);
  12973.        if (!inputfile)
  12974.            errorExit(20, "Unable to open input file", fspec);
  12975.  
  12976.        ISortedMap     <DiskSpaceUR, char*> dsurByName;
  12977.        ISortedMap     <DiskSpaceUR, char*>::Cursor
  12978.                                             curByName(dsurByName);
  12979.  
  12980.        IGSortedRelation <DiskSpaceUR, int, DSURBySpaceOps>
  12981.           dsurBySpace;
  12982.        IGSortedRelation <DiskSpaceUR, int, DSURBySpaceOps>::Cursor
  12983.           curBySpace(dsurBySpace);
  12984.  
  12985.                             // Read all records into dsurByName
  12986.        while (inputfile.good()) {
  12987.           DiskSpaceUR dsur(inputfile);
  12988.           if (dsur.isValid()) {
  12989.              dsurByName.add(dsur);
  12990.              dsurBySpace.add(dsur);
  12991.           }
  12992.        }
  12993.        if (! inputfile.eof())
  12994.                 errorExit(39, "Error during read of", fspec);
  12995.  
  12996.        cout << "\n\nAll Disk Space Usage records "
  12997.             << "sorted (ascending) by name:\n" << endl;
  12998.  
  12999.        forICursor(curByName)
  13000.           cout << "  " << dsurByName.elementAt(curByName) << endl;
  13001.  
  13002.        cout << "\n\nAll Disk Space Usage records "
  13003.             << "sorted (descending) by space:\n" << endl;
  13004.  
  13005.        forICursor(curBySpace)
  13006.           cout << "  " << dsurBySpace.elementAt(curBySpace) << endl;
  13007.  
  13008.        return 0;
  13009.    }
  13010.  
  13011.    #include <stdlib.h>
  13012.                                        // for exit() definition
  13013.    void errorExit (int rc, char* s1, char* s2) {
  13014.        cerr << s1 << " " << s2 << endl;
  13015.        exit(rc);
  13016.    }
  13017.  
  13018.  
  13019. ΓòÉΓòÉΓòÉ 5.19. Sorted Relation ΓòÉΓòÉΓòÉ
  13020.  
  13021. Description 
  13022.  
  13023. Derivation 
  13024.  
  13025. Variants/Header Files 
  13026.  
  13027. Members 
  13028.  
  13029. Template Arguments and Required Functions 
  13030.  
  13031. Abstract/Reference Classes 
  13032.  
  13033. Examples 
  13034.  
  13035. To close all the panels in a chapter, double-click on this panel's system menu. 
  13036.  
  13037.  
  13038. ΓòÉΓòÉΓòÉ 5.19.1. Class Description - Sorted Relation ΓòÉΓòÉΓòÉ
  13039.  
  13040. A sorted relation is an ordered collection of zero or more elements that have a 
  13041. key.  The elements are sorted by the value of their key.  Element equality is 
  13042. supported, and the values of the elements are relevant. 
  13043.  
  13044. The keys of the elements are not unique.  You can add an element whether or not 
  13045. there is already an element in the collection with the same key. 
  13046.  
  13047. An example of using a sorted relation is a program used by telephone operators 
  13048. to provide directory assistance.  The computerized directory is a sorted 
  13049. relation whose key is the name of the individual or business associated with a 
  13050. telephone number.  When a caller requests the number of a given person or 
  13051. company, the operator enters the name of that person or company to access the 
  13052. phone number.  The collection can have multiple identical keys, because two 
  13053. individuals or companies might have the same name.  The collection is sorted 
  13054. alphabetically, because once a year it is used as the source material for a 
  13055. printed telephone directory. 
  13056.  
  13057. Figure Combination of Flat Collection Properties gives an overview of the 
  13058. properties of a sorted relation and its relationship to other flat collections. 
  13059.  
  13060.  
  13061. ΓòÉΓòÉΓòÉ 5.19.2. Derivation ΓòÉΓòÉΓòÉ
  13062.  
  13063. Equality Key Collection    Equality Collection 
  13064.  
  13065.      Equality Key Sorted Collection
  13066.          Sorted Relation
  13067.  
  13068. The diagram does not show all bases of sorted relation. See the figure 
  13069. "Abstract Class Hierarchy" in section Abstract Classes for an illustration. 
  13070.  
  13071.  
  13072. ΓòÉΓòÉΓòÉ 5.19.3. Variants and Header Files ΓòÉΓòÉΓòÉ
  13073.  
  13074. ISortedRelation, the first class in the table below, is the default 
  13075. implementation variant. 
  13076.  
  13077. Note:  In the table, some class names have been hyphenated to fit in their 
  13078. column.  In your code you should not include these hyphens in the class names. 
  13079.  
  13080. To use Visual Builder features with your collections, change the name of the 
  13081. desired collection class template in the list below from I... to IV..., and use 
  13082. the ivsrtrel.h header file instead of the header file that you would normally 
  13083. use without Visual Builder. 
  13084.  
  13085. Class Name                  Header File  Implementation Variant
  13086.  
  13087. ISortedRelation             isr.h        List
  13088. IGSortedRelation            isr.h        List
  13089.  
  13090. ISortedRelationAsList       isrslst.h    List
  13091. IGSortedRelationAsList      isrslst.h    List
  13092.  
  13093. ISortedRelationAsTable      isrtab.h     Table
  13094. IGSortedRelationAsTable     isrtab.h     Table
  13095.  
  13096. ISortedRelationAsDilTable   isrdil.h     Diluted table
  13097. IGSortedRelationAsDilTable  isrdil.h     Diluted table
  13098.  
  13099.  
  13100. ΓòÉΓòÉΓòÉ 5.19.4. Members ΓòÉΓòÉΓòÉ
  13101.  
  13102. All members of flat collections are described in Introduction to Flat 
  13103. Collections. The following members are provided for sorted relation: 
  13104.  
  13105.      Constructor 
  13106.      Copy Constructor 
  13107.      Destructor 
  13108.      operator!= 
  13109.      operator= 
  13110.      operator== 
  13111.      add 
  13112.      addAllFrom 
  13113.      addDifference 
  13114.      addIntersection 
  13115.      addOrReplaceElementWithKey 
  13116.      addUnion 
  13117.      allElementsDo 
  13118.      anyElement 
  13119.      compare 
  13120.      contains 
  13121.      containsAllFrom 
  13122.      containsAllKeysFrom 
  13123.      containsElementWithKey 
  13124.      copy 
  13125.      differenceWith 
  13126.      elementAt 
  13127.      elementAtPosition 
  13128.      elementWithKey 
  13129.      firstElement 
  13130.      intersectionWith 
  13131.      isBounded 
  13132.      isEmpty 
  13133.      isFirst 
  13134.      isFull 
  13135.      isLast 
  13136.      key 
  13137.      lastElement 
  13138.      locate 
  13139.      locateElementWithKey 
  13140.      locateNext 
  13141.      locateNextElementWithKey 
  13142.      locateOrAdd 
  13143.      locateOrAddElementWithKey 
  13144.      maxNumberOfElements 
  13145.      newCursor 
  13146.      numberOfDifferentKeys 
  13147.      numberOfElements 
  13148.      numberOfElementsWithKey 
  13149.      positionAt 
  13150.      remove 
  13151.      removeAll 
  13152.      removeAllElementsWithKey 
  13153.      removeAt 
  13154.      removeAtPosition 
  13155.      removeElementWithKey 
  13156.      removeFirst 
  13157.      removeLast 
  13158.      replaceAt 
  13159.      replaceElementWithKey 
  13160.      setToFirst 
  13161.      setToLast 
  13162.      setToNext 
  13163.      setToNextWithDifferentKey 
  13164.      setToPosition 
  13165.      setToPrevious 
  13166.      unionWith 
  13167.  
  13168.  Sorted relation also defines a cursor that inherits from IOrderedCursor. The 
  13169.  members for IOrderedCursor are described in Cursor. 
  13170.  
  13171.  
  13172. ΓòÉΓòÉΓòÉ 5.19.5. Template Arguments and Required Functions ΓòÉΓòÉΓòÉ
  13173.  
  13174. The following implementation variants are defined for sorted relations: 
  13175.  
  13176.      Sorted relation 
  13177.      Sorted relation as list 
  13178.      Sorted relation as table 
  13179.      Sorted relation as diluted table 
  13180.  
  13181.  
  13182. ΓòÉΓòÉΓòÉ 5.19.5.1. Sorted Relation ΓòÉΓòÉΓòÉ
  13183.  
  13184. ISortedRelation  <Element, Key>
  13185. IGSortedRelation <Element, Key, EKCOps>
  13186.  
  13187. The default implementation of the class ISortedRelation requires the following 
  13188. element and key-type functions: 
  13189.  
  13190. Element Type 
  13191.  
  13192.      Copy constructor 
  13193.      Destructor 
  13194.      Assignment 
  13195.      Key access 
  13196.      Equality test 
  13197.  
  13198.  Key Type 
  13199.  
  13200.  Ordering relation 
  13201.  
  13202.  
  13203. ΓòÉΓòÉΓòÉ 5.19.5.2. Sorted Relation as List ΓòÉΓòÉΓòÉ
  13204.  
  13205. ISortedRelationAsList  <Element, Key>
  13206. IGSortedRelationAsList <Element, Key, EKCOps>
  13207.  
  13208. The implementation of the class ISortedRelationAsKey requires the following 
  13209. element and key-type functions: 
  13210.  
  13211. Element Type 
  13212.  
  13213.      Copy constructor 
  13214.      Destructor 
  13215.      Assignment 
  13216.      Key access 
  13217.      Equality test 
  13218.  
  13219.  Key Type 
  13220.  
  13221.  Ordering relation 
  13222.  
  13223.  
  13224. ΓòÉΓòÉΓòÉ 5.19.5.3. Sorted Relation as Table ΓòÉΓòÉΓòÉ
  13225.  
  13226. ISortedRelationAsTable  <Element, Key>
  13227. IGSortedRelationAsTable <Element, Key, EKCOps>
  13228.  
  13229. The implementation of the class ISortedRelationAsTable requires the following 
  13230. element and key-type functions: 
  13231.  
  13232. Element Type 
  13233.  
  13234.      Copy constructor 
  13235.      Destructor 
  13236.      Assignment 
  13237.      Key access 
  13238.      Equality test 
  13239.  
  13240.  Key Type 
  13241.  
  13242.  Ordering relation 
  13243.  
  13244.  
  13245. ΓòÉΓòÉΓòÉ 5.19.5.4. Sorted Relation as Diluted Table ΓòÉΓòÉΓòÉ
  13246.  
  13247. ISortedRelationAsDilTable  <Element, Key>
  13248. IGSortedRelationAsDilTable <Element, Key, EKCOps>
  13249.  
  13250. The implementation of the class ISortedRelationAsDilTable requires the 
  13251. following element and key-type functions: 
  13252.  
  13253. Element Type 
  13254.  
  13255.      Copy constructor 
  13256.      Destructor 
  13257.      Assignment 
  13258.      Key access 
  13259.      Equality test 
  13260.  
  13261.  Key Type 
  13262.  
  13263.  Ordering relation 
  13264.  
  13265.  
  13266. ΓòÉΓòÉΓòÉ 5.19.6. Abstract Class ΓòÉΓòÉΓòÉ
  13267.  
  13268. IASortedRelation<Element,Key>
  13269.  
  13270. For polymorphism, you can use the corresponding abstract class, 
  13271. IASortedRelation, which is found in the iasr.h header file. See Polymorphism 
  13272. and the Collections for further information. 
  13273.  
  13274. The required functions are the same as the required functions of the concrete 
  13275. base class. 
  13276.  
  13277.  
  13278. ΓòÉΓòÉΓòÉ 5.19.7. Coding Example for Sorted Relation ΓòÉΓòÉΓòÉ
  13279.  
  13280. See Coding Example for Sorted Map for an example of a sorted relation. 
  13281.  
  13282.  
  13283. ΓòÉΓòÉΓòÉ 5.20. Sorted Set ΓòÉΓòÉΓòÉ
  13284.  
  13285. Description 
  13286.  
  13287. Derivation 
  13288.  
  13289. Variants/Header Files 
  13290.  
  13291. Members 
  13292.  
  13293. Template Arguments and Required Functions 
  13294.  
  13295. Abstract/Reference Classes 
  13296.  
  13297. Examples 
  13298.  
  13299. To close all the panels in a chapter, double-click on this panel's system menu. 
  13300.  
  13301.  
  13302. ΓòÉΓòÉΓòÉ 5.20.1. Class Description - Sorted Set ΓòÉΓòÉΓòÉ
  13303.  
  13304. A sorted set is an ordered collection of zero or more elements with element 
  13305. equality but no key.  Only unique elements are supported.  A request to add an 
  13306. element that already exists is ignored. The value of the elements is relevant. 
  13307.  
  13308. The elements of a sorted set are ordered such that the value of each element is 
  13309. less than or equal to the value of its successor. 
  13310.  
  13311. The element with the smallest value currently in a sorted set is called the 
  13312. first element.  The element with the largest value is called the last element. 
  13313. When an element is added, it is placed in the sorted set according to the 
  13314. defined ordering relation. 
  13315.  
  13316. An example of using a sorted set is a program that tests numbers to see if they 
  13317. are prime.  Two complementary sorted sets are used, one for prime numbers, and 
  13318. one for nonprime numbers.  When you enter a number, the program first looks in 
  13319. the set of nonprime numbers.  If the value is found there, the number is 
  13320. nonprime.  If the value is not found there, the program looks in the set of 
  13321. prime numbers.  If the value is found there, the number is prime.  Otherwise 
  13322. the program determines whether the number is prime or nonprime, and places it 
  13323. in the appropriate sorted set.  The program can also display a list of prime or 
  13324. nonprime numbers, beginning at the first prime or nonprime following a given 
  13325. value, because the numbers in a sorted set are sorted from smallest to largest. 
  13326.  
  13327. Figure Combination of Flat Collection Properties gives an overview of the 
  13328. properties of a sorted set and its relationship to other flat collections. 
  13329.  
  13330.  
  13331. ΓòÉΓòÉΓòÉ 5.20.2. Derivation ΓòÉΓòÉΓòÉ
  13332.  
  13333.         Collection 
  13334. Ordered Collection 
  13335.  
  13336.   Sorted Collection     Equality Collection
  13337.       Equality Sorted Collection
  13338.           Sorted Set
  13339.  
  13340.  
  13341. ΓòÉΓòÉΓòÉ 5.20.3. Variants and Header Files ΓòÉΓòÉΓòÉ
  13342.  
  13343. ISortedSet, the first class in the table below, is the default implementation 
  13344. variant. 
  13345.  
  13346. To use Visual Builder features with your collections, change the name of the 
  13347. desired collection class template in the list below from I... to IV..., and use 
  13348. the ivsrtset.h header file instead of the header file that you would normally 
  13349. use without Visual Builder. 
  13350.  
  13351. Class Name            Header File  Implementation Variant
  13352.  
  13353. ISortedSet            iss.h        AVL tree
  13354. IGSortedSet           iss.h        AVL tree
  13355.  
  13356. ISortedSetAsAvlTree   issavl.h     AVL tree
  13357. IGSortedSetAsAvlTree  issavl.h     AVL tree
  13358.  
  13359. ISortedSetAsBstTree   issbst.h     B* tree
  13360. IGSortedSetAsBstTree  issbst.h     B* tree
  13361.  
  13362. ISortedSetAsList      isslst.h     List
  13363. IGSortedSetAsList     isslst.h     List
  13364.  
  13365. ISortedSetAsTable     isstab.h     Table
  13366. IGSortedSetAsTable    isstab.h     Table
  13367.  
  13368. ISortedSetAsDilTable  issdil.h     Diluted table
  13369. IGSortedSetAsDilTable issdil.h     Diluted table
  13370.  
  13371.  
  13372. ΓòÉΓòÉΓòÉ 5.20.4. Members ΓòÉΓòÉΓòÉ
  13373.  
  13374. All members of flat collections are described in Introduction to Flat 
  13375. Collections. The following members are provided for sorted sets: 
  13376.  
  13377.      Constructor 
  13378.      Copy Constructor 
  13379.      Destructor 
  13380.      operator!= 
  13381.      operator= 
  13382.      operator== 
  13383.      add 
  13384.      addAllFrom 
  13385.      addDifference 
  13386.      addIntersection 
  13387.      addUnion 
  13388.      allElementsDo 
  13389.      anyElement 
  13390.      compare 
  13391.      contains 
  13392.      containsAllFrom 
  13393.      copy 
  13394.      differenceWith 
  13395.      elementAt 
  13396.      elementAtPosition 
  13397.      firstElement 
  13398.      intersectionWith 
  13399.      isBounded 
  13400.      isEmpty 
  13401.      isFirst 
  13402.      isFull 
  13403.      isLast 
  13404.      lastElement 
  13405.      locate 
  13406.      locateNext 
  13407.      locateOrAdd 
  13408.      maxNumberOfElements 
  13409.      newCursor 
  13410.      positionAt 
  13411.      remove 
  13412.      removeAll 
  13413.      removeAt 
  13414.      removeAtPosition 
  13415.      removeFirst 
  13416.      removeLast 
  13417.      replaceAt 
  13418.      setToFirst 
  13419.      setToLast 
  13420.      setToNext 
  13421.      setToPosition 
  13422.      setToPrevious 
  13423.      unionWith 
  13424.  
  13425.  Sorted Set also defines a cursor that inherits from IOrderedCursor. The 
  13426.  members for IOrderedCursor are described in Cursor. 
  13427.  
  13428.  
  13429. ΓòÉΓòÉΓòÉ 5.20.5. Template Arguments and Required Functions ΓòÉΓòÉΓòÉ
  13430.  
  13431. The following implementation variants are defined for sorted sets: 
  13432.  
  13433.      Sorted set 
  13434.      Sorted set as AVL tree 
  13435.      Sorted set as B* tree 
  13436.      Sorted set as list 
  13437.      Sorted set as table 
  13438.      Sorted set as diluted table 
  13439.  
  13440.  
  13441. ΓòÉΓòÉΓòÉ 5.20.5.1. Sorted Set ΓòÉΓòÉΓòÉ
  13442.  
  13443. ISortedSet  <Element>
  13444. IGSortedSet <Element, COps>
  13445.  
  13446. The default implementation of the class ISortedSet requires the following 
  13447. element functions: 
  13448.  
  13449. Element Type 
  13450.  
  13451.      Copy constructor 
  13452.      Destructor 
  13453.      Assignment 
  13454.      Ordering relation 
  13455.  
  13456.  
  13457. ΓòÉΓòÉΓòÉ 5.20.5.2. Sorted Set as AVL Tree ΓòÉΓòÉΓòÉ
  13458.  
  13459. ISortedSetAsAvlTree  <Element>
  13460. IGSortedSetAsAvlTree <Element, EOps>
  13461.  
  13462. The implementation of the class ISortedSetAsAvlTree requires the following 
  13463. element functions: 
  13464.  
  13465. Element Type 
  13466.  
  13467.      Copy constructor 
  13468.      Destructor 
  13469.      Assignment 
  13470.      Ordering relation 
  13471.  
  13472.  
  13473. ΓòÉΓòÉΓòÉ 5.20.5.3. Sorted Set as B* Tree ΓòÉΓòÉΓòÉ
  13474.  
  13475. ISortedSetAsBstTree  <Element>
  13476. IGSortedSetAsBstTree <Element, COps>
  13477.  
  13478. The default implementation of the class ISortedSetAsBstTree requires the 
  13479. following element functions: 
  13480.  
  13481. Element Type 
  13482.  
  13483.      Copy constructor 
  13484.      Destructor 
  13485.      Assignment 
  13486.      Ordering relation 
  13487.  
  13488.  
  13489. ΓòÉΓòÉΓòÉ 5.20.5.4. Sorted Set as List ΓòÉΓòÉΓòÉ
  13490.  
  13491. ISortedSetAsList  <Element>
  13492. IGSortedSetAsList <Element, COps>
  13493.  
  13494. The implementation of the class ISortedSetAsList requires the following element 
  13495. functions: 
  13496.  
  13497. Element Type 
  13498.  
  13499.      Copy constructor 
  13500.      Assignment 
  13501.      Destructor 
  13502.      Ordering relation 
  13503.  
  13504.  
  13505. ΓòÉΓòÉΓòÉ 5.20.5.5. Sorted Set as Table ΓòÉΓòÉΓòÉ
  13506.  
  13507. ISortedSetAsTable  <Element>
  13508. IGSortedSetAsTable <Element, COps>
  13509.  
  13510. The implementation of the class ISortedSetAsTable requires the following 
  13511. element functions: 
  13512.  
  13513. Element Type 
  13514.  
  13515.      Copy constructor 
  13516.      Destructor 
  13517.      Assignment 
  13518.      Ordering relation 
  13519.  
  13520.  
  13521. ΓòÉΓòÉΓòÉ 5.20.5.6. Sorted Set as Diluted Table ΓòÉΓòÉΓòÉ
  13522.  
  13523. ISortedSetAsDilTable  <Element>
  13524. IGSortedSetAsDilTable <Element, COps>
  13525.  
  13526. The implementation of the class ISortedSetAsDilTable requires the following 
  13527. element functions: 
  13528.  
  13529. Element Type 
  13530.  
  13531.      Copy constructor 
  13532.      Destructor 
  13533.      Assignment 
  13534.      Ordering relation 
  13535.  
  13536.  
  13537. ΓòÉΓòÉΓòÉ 5.20.6. Abstract Class ΓòÉΓòÉΓòÉ
  13538.  
  13539. IASortedSet<Element>
  13540.  
  13541. For polymorphism, you can use the corresponding abstract class, IASortedSet, 
  13542. which is found in the iass.h header file. See Polymorphism and the Collections 
  13543. for further information. 
  13544.  
  13545. The required functions are the same as the required functions of the concrete 
  13546. base class. 
  13547.  
  13548.  
  13549. ΓòÉΓòÉΓòÉ 5.20.7. Coding Example for Sorted Set ΓòÉΓòÉΓòÉ
  13550.  
  13551. The following program uses the default class, ISortedSet, to create sorted 
  13552. lists of planets with different properties. The program stores all planets in 
  13553. our solar system, all heavy planets in our solar system, all bright planets in 
  13554. our solar system, and all heavy or bright planets in our solar system in a 
  13555. number of sorted sets.  Each set sorts the planets by its distance from the 
  13556. sun. 
  13557.  
  13558. The program uses the forICursor macro to create the heavyPlanets and the 
  13559. brightPlanets collections. It uses the allElementsDo() function to display the 
  13560. planets in each collection and the unionWith() function when creating the 
  13561. bright-or-heavy planets category. 
  13562.  
  13563.    // planets.C  -  An example of using a Sorted Set
  13564.    #include <iostream.h>
  13565.  
  13566.                      // Let's use the Sorted Set Default Variant:
  13567.    #include <isrtset.h>
  13568.  
  13569.                      // Get Class Planet:
  13570.    #include "planet.h"
  13571.  
  13572.  
  13573.    int main()    {
  13574.       ISortedSet<Planet>  allPlanets, heavyPlanets, brightPlanets;
  13575.                           // A cursor to cursor through allPlanets:
  13576.       ISortedSet<Planet>::Cursor aPCursor(allPlanets);
  13577.  
  13578.       SayPlanetName showPlanet;
  13579.  
  13580.       allPlanets.add( Planet("Earth",   149.60f,   1.0000f, 99.9f));
  13581.       allPlanets.add( Planet("Jupiter", 778.3f,  317.818f,  -2.4f));
  13582.       allPlanets.add( Planet("Mars",    227.9f,    0.1078f, -1.9f));
  13583.       allPlanets.add( Planet("Mercury",  57.91f,   0.0558f, -0.2f));
  13584.       allPlanets.add( Planet("Neptun", 4498.f,    17.216f,  +7.6f));
  13585.       allPlanets.add( Planet("Pluto",  5910.f,     0.18f,  +14.7f));
  13586.       allPlanets.add( Planet("Saturn", 1428.f,    95.112f,  +0.8f));
  13587.       allPlanets.add( Planet("Uranus", 2872.f,    14.517f,  +5.8f));
  13588.       allPlanets.add( Planet("Venus",   108.21f,   0.8148f, -4.1f));
  13589.  
  13590.       forICursor(aPCursor)    {
  13591.          if (allPlanets.elementAt(aPCursor).isHeavy())
  13592.             heavyPlanets.add(allPlanets.elementAt(aPCursor));
  13593.  
  13594.          if (allPlanets.elementAt(aPCursor).isBright())
  13595.             brightPlanets.add(allPlanets.elementAt(aPCursor));
  13596.       }
  13597.  
  13598.       cout << endl << endl << "All Planets: " << endl;
  13599.       allPlanets.allElementsDo(showPlanet);
  13600.  
  13601.       cout << endl << endl << "Heavy Planets: " << endl;
  13602.       heavyPlanets.allElementsDo(showPlanet);
  13603.  
  13604.       cout << endl << endl << "Bright Planets: " << endl;
  13605.       brightPlanets.allElementsDo(showPlanet);
  13606.  
  13607.       cout << endl << endl << "Bright-or-Heavy Planets: " << endl;
  13608.       brightPlanets.unionWith(heavyPlanets);
  13609.       brightPlanets.allElementsDo(showPlanet);
  13610.  
  13611.       cout << endl << endl
  13612.            << "Did you notice that all these Sets are sorted"
  13613.            << " in the same order"
  13614.            << endl
  13615.            << " (distance of planet from sun) ? " << endl;
  13616.  
  13617.       return 0;
  13618.  
  13619.    }
  13620.  
  13621. The program produces the following output: 
  13622.  
  13623.  
  13624.  
  13625. All Planets:
  13626.  Mercury  Venus  Earth  Mars  Jupiter  Saturn  Uranus  Neptune  Pluto
  13627.  
  13628. Heavy Planets:
  13629.  Jupiter  Saturn  Uranus  Neptune
  13630.  
  13631. Bright Planets:
  13632.  Mercury  Venus  Mars  Jupiter
  13633.  
  13634. Bright-or-Heavy Planets:
  13635.  Mercury  Venus  Mars  Jupiter  Saturn  Uranus  Neptune
  13636.  
  13637. Did you notice that all these Sets are sorted in the same order
  13638.  (distance of planet from sun) ?
  13639.  
  13640.  
  13641. ΓòÉΓòÉΓòÉ 5.21. Stack ΓòÉΓòÉΓòÉ
  13642.  
  13643. Description 
  13644.  
  13645. Derivation 
  13646.  
  13647. Variants/Header Files 
  13648.  
  13649. Members 
  13650.  
  13651. Template Arguments and Required Functions 
  13652.  
  13653. Abstract/Reference Classes 
  13654.  
  13655. Examples 
  13656.  
  13657. To close all the panels in a chapter, double-click on this panel's system menu. 
  13658.  
  13659.  
  13660. ΓòÉΓòÉΓòÉ 5.21.1. Class Description - Stack ΓòÉΓòÉΓòÉ
  13661.  
  13662. A stack is a sequence with restricted access.  It is an ordered collection of 
  13663. elements with no key and no element equality.  The elements are arranged so 
  13664. that each collection has a first and a last element, each element except the 
  13665. last has a next element, and each element but the first has a previous element. 
  13666. The type and value of the elements are irrelevant and have no effect on the 
  13667. behavior of the stack. 
  13668.  
  13669. Elements are added to and deleted from the top of the stack.  Consequently, the 
  13670. elements of a stack are in reverse chronological order. 
  13671.  
  13672. A stack is characterized by a last-in, first-out (LIFO) behavior. 
  13673.  
  13674. An example of using a stack is a program that keeps track of daily tasks that 
  13675. you have begun to work on but that have been interrupted. When you are working 
  13676. on a task and something else comes up that is more urgent, you enter a 
  13677. description of the interrupted task and where you stopped it into your program, 
  13678. and the task is pushed onto the stack. Whenever you complete a task, you ask 
  13679. the program for the most recently saved task that was interrupted.  This task 
  13680. is popped off the stack, and you resume your work where you left off.  When you 
  13681. attempt to pop an item off the stack and no item is available, you have 
  13682. completed all your tasks and you can go home. 
  13683.  
  13684.  
  13685. ΓòÉΓòÉΓòÉ 5.21.2. Derivation ΓòÉΓòÉΓòÉ
  13686.  
  13687. Collection 
  13688.  
  13689.   Ordered Collection
  13690.    Sequential Collection
  13691.      Sequence
  13692.       Stack
  13693.  
  13694. Note that stack is based on sequence but is not actually derived from it or 
  13695. from the other classes shown above. See Restricted Access for further details. 
  13696.  
  13697.  
  13698. ΓòÉΓòÉΓòÉ 5.21.3. Variants and Header Files ΓòÉΓòÉΓòÉ
  13699.  
  13700. IStack, the first class in the table below, is the default implementation 
  13701. variant. 
  13702.  
  13703. To use Visual Builder features with your collections, change the name of the 
  13704. desired collection class template in the list below from I... to IV..., and use 
  13705. the ivstack.h header file instead of the header file that you would normally 
  13706. use without Visual Builder. 
  13707.  
  13708. Class Name                 Header File   Implementation Variant
  13709.  
  13710. IStack                     istk.h        List
  13711. IGStack                    istk.h        List
  13712.  
  13713. IStackAsList               istklst.h     List
  13714. IGStackAsList              istklst.h     List
  13715.  
  13716. IStackAsTable              istktab.h     Table
  13717. IGStackAsTable             istktab.h     Table
  13718.  
  13719. IStackAsDilTable           istkdil.h     Diluted table
  13720. IGStackAsDilTable          istkdil.h     Diluted table
  13721.  
  13722.  
  13723. ΓòÉΓòÉΓòÉ 5.21.4. Members ΓòÉΓòÉΓòÉ
  13724.  
  13725. All members of flat collections are described in Introduction to Flat 
  13726. Collections. The following members are provided for stack: 
  13727.  
  13728.      Constructor 
  13729.      Copy Constructor 
  13730.      Destructor 
  13731.      operator= 
  13732.      add 
  13733.      addAllFrom 
  13734.      addAsLast 
  13735.      allElementsDo 
  13736.      anyElement 
  13737.      compare 
  13738.      copy 
  13739.      elementAt 
  13740.      elementAtPosition 
  13741.      firstElement 
  13742.      isBounded 
  13743.      isEmpty 
  13744.      isFirst 
  13745.      isFull 
  13746.      isLast 
  13747.      lastElement 
  13748.      maxNumberOfElements 
  13749.      newCursor 
  13750.      numberOfElements 
  13751.      pop 
  13752.      positionAt 
  13753.      push 
  13754.      removeAll 
  13755.      removeLast 
  13756.      setToFirst 
  13757.      setToLast 
  13758.      setToNext 
  13759.      setToPosition 
  13760.      setToPrevious 
  13761.      top 
  13762.  
  13763.  Stack also defines a cursor that inherits from IOrderedCursor.  The members 
  13764.  for IOrderedCursor are described in Cursor. 
  13765.  
  13766.  
  13767. ΓòÉΓòÉΓòÉ 5.21.5. Template Arguments and Required Functions ΓòÉΓòÉΓòÉ
  13768.  
  13769. The following implementation variants are defined for stacks: 
  13770.  
  13771.      Stack 
  13772.      Stack as list 
  13773.      Stack as table 
  13774.      Stack as diluted table 
  13775.  
  13776.  
  13777. ΓòÉΓòÉΓòÉ 5.21.5.1. Stack ΓòÉΓòÉΓòÉ
  13778.  
  13779. IStack  <Element>
  13780. IGStack <Element, StdOps>
  13781.  
  13782. The default implementation of the class IStack requires the following element 
  13783. functions: 
  13784.  
  13785. Element Type 
  13786.  
  13787.      Copy constructor 
  13788.      Destructor 
  13789.      Assignment 
  13790.  
  13791.  
  13792. ΓòÉΓòÉΓòÉ 5.21.5.2. Stack as List ΓòÉΓòÉΓòÉ
  13793.  
  13794. IStackAsList  <Element>
  13795. IGStackAsList <Element, StdOps>
  13796.  
  13797. The implementation of the class IStackAsList requires the following element 
  13798. functions: 
  13799.  
  13800. Element Type 
  13801.  
  13802.      Copy constructor 
  13803.      Destructor 
  13804.      Assignment 
  13805.  
  13806.  
  13807. ΓòÉΓòÉΓòÉ 5.21.5.3. Stack as Table ΓòÉΓòÉΓòÉ
  13808.  
  13809. IStackAsTable  <Element>
  13810. IGStackAsTable <Element, StdOps>
  13811.  
  13812. The implementation of the class IStackAsTable requires the following element 
  13813. functions: 
  13814.  
  13815. Element Type 
  13816.  
  13817.      Copy constructor 
  13818.      Destructor 
  13819.      Assignment 
  13820.  
  13821.  
  13822. ΓòÉΓòÉΓòÉ 5.21.5.4. Stack as Diluted Table ΓòÉΓòÉΓòÉ
  13823.  
  13824. IStackAsDilTable  <Element>
  13825. IGStackAsDilTable <Element, StdOps>
  13826.  
  13827. The implementation of the class IStackAsDilTable requires the following element 
  13828. functions: 
  13829.  
  13830. Element Type 
  13831.  
  13832.      Copy constructor 
  13833.      Destructor 
  13834.      Assignment 
  13835.  
  13836.  
  13837. ΓòÉΓòÉΓòÉ 5.21.6. Abstract Class ΓòÉΓòÉΓòÉ
  13838.  
  13839. IAStack<Element>
  13840.  
  13841. For polymorphism, you can use the corresponding abstract class, IAStack, which 
  13842. is found in the iastk.h header file. See Polymorphism and the Collections for 
  13843. further information. 
  13844.  
  13845. The required functions are the same as the required functions of the concrete 
  13846. base class. 
  13847.  
  13848.  
  13849. ΓòÉΓòÉΓòÉ 5.21.7. Coding Example for Stack ΓòÉΓòÉΓòÉ
  13850.  
  13851. The following program creates two stacks (Stack1 and Stack2) using the default 
  13852. class, IStack. It adds a number of words to Stack1, removes them from Stack1, 
  13853. adds them to Stack2, and finally removes them from Stack2 so that they can be 
  13854. printed.  The push() and pop() functions are used for adding and removing 
  13855. elements, respectively. 
  13856.  
  13857. Between these stack operations the stacks are printed. To prevent the stack 
  13858. from changing during printing, the program uses the constant version of the 
  13859. applicator class, IConstantApplicator with the allElementsDo() function.  The 
  13860. words print in the same order as they were originally added to Stack1. 
  13861.  
  13862. Because of the nature of the stack class, the program must use the constant 
  13863. applicator class, IConstantApplicator, when printing the stacks. It uses the 
  13864. push() and pop() functions for adding and removing elements, respectively.  The 
  13865. allElementsDo() function is used when the collection is printed. 
  13866.  
  13867.    // pushpop.C  -  An example of using a Stack
  13868.    #include <string.h>
  13869.    #include <iostream.h>
  13870.                          // Let's use the default stack: IStack
  13871.    #include <istack.h>
  13872.  
  13873.    typedef IStack <char*> SimpleStack;
  13874.                          // The stack requires iteration to be const.
  13875.    typedef IConstantApplicator <char*> StackIterator;
  13876.  
  13877.  
  13878.    // Test variables to put into our Stack:
  13879.  
  13880.    char *String[9] = {    "The",  "quick",  "brown",  "fox",
  13881.                           "jumps",  "over",  "a",  "lazy",  "dog." };
  13882.  
  13883.    // A class to display the contents of our Stack:
  13884.  
  13885.    class PrintClass : public StackApplicator
  13886.    {
  13887.    public:
  13888.       IBoolean applyTo(char* const& w)
  13889.          {
  13890.          cout << w << endl;
  13891.          return(true);
  13892.          }
  13893.    };
  13894.  
  13895.  
  13896.    // Main program
  13897.    int main()
  13898.    {
  13899.       SimpleStack Stack1, Stack2;
  13900.       char *S;
  13901.       PrintClass Print;
  13902.  
  13903.       // We specify two stacks.
  13904.       // First all the strings are pushed onto the first stack.
  13905.       // Next, they are popped from the first and pushed onto
  13906.       // the second.
  13907.       // Finally they are popped from the second and printed.
  13908.       // During this final print the strings must appear
  13909.       // in their original order.
  13910.  
  13911.       int i;
  13912.  
  13913.       for (i = 0; i < 9; i ++) {
  13914.          Stack1.push(String[i]);
  13915.          }
  13916.  
  13917.       cout << "Contents of Stack1:" << endl;
  13918.       Stack1.allElementsDo(Print);
  13919.       cout << "----------------------------" << endl;
  13920.  
  13921.       while (!Stack1.isEmpty()) {
  13922.          Stack1.pop(S);             // Pop from stack 1
  13923.          Stack2.push(S);            // Add it on top of stack 2
  13924.          }
  13925.  
  13926.       cout << "Contents of Stack2:" << endl;
  13927.       Stack2.allElementsDo(Print);
  13928.       cout << "----------------------------" << endl;
  13929.  
  13930.       while (!Stack2.isEmpty()) {
  13931.          Stack2.pop(S);
  13932.          cout << "Popped from Stack 2: " << S << endl;
  13933.          }
  13934.  
  13935.       return(0);
  13936.    }
  13937.  
  13938. This program produces the following output: 
  13939.  
  13940. Contents of Stack1:
  13941. The
  13942. quick
  13943. brown
  13944. fox
  13945. jumps
  13946. over
  13947. a
  13948. lazy
  13949. dog.
  13950. ----------------------------
  13951. Contents of Stack2:
  13952. dog.
  13953. lazy
  13954. a
  13955. over
  13956. jumps
  13957. fox
  13958. brown
  13959. quick
  13960. The
  13961. ----------------------------
  13962. Popped from Stack 2: The
  13963. Popped from Stack 2: quick
  13964. Popped from Stack 2: brown
  13965. Popped from Stack 2: fox
  13966. Popped from Stack 2: jumps
  13967. Popped from Stack 2: over
  13968. Popped from Stack 2: a
  13969. Popped from Stack 2: lazy
  13970. Popped from Stack 2: dog.
  13971.  
  13972.  
  13973. ΓòÉΓòÉΓòÉ 6. Tree Collection Classes ΓòÉΓòÉΓòÉ
  13974.  
  13975. This section contains the following chapters: 
  13976.  
  13977.  Introduction to Trees                           Introduces the concept of 
  13978.                                                  trees. 
  13979.  
  13980.  Multiway Tree                                   Describes n-ary tree, the tree 
  13981.                                                  collection of the Collection 
  13982.                                                  Class Library. Defines the 
  13983.                                                  class implementation variants, 
  13984.                                                  template arguments, and 
  13985.                                                  required functions for n-ary 
  13986.                                                  tree.  Declarations for n-ary 
  13987.                                                  tree are provided, terms are 
  13988.                                                  defined, and the public member 
  13989.                                                  functions of n-ary tree are 
  13990.                                                  described. 
  13991.  
  13992.  
  13993. ΓòÉΓòÉΓòÉ 6.1. Introduction to Trees ΓòÉΓòÉΓòÉ
  13994.  
  13995. A tree is a collection of nodes that can have an arbitrary number of references 
  13996. to other nodes.  There can be no cycles or short-circuit references. A unique 
  13997. path connects every two nodes. One node is designated as the root of the tree. 
  13998.  
  13999. Formally, a tree can be defined recursively in the following manner: 
  14000.  
  14001.    1. A single node by itself is a tree.  This node is also the root of the 
  14002.       tree. 
  14003.  
  14004.    2. If N is a node and T-1, T-2, ..., T-k are trees with roots R-1, R-2, ..., 
  14005.       R-k, respectively, then a new tree can be constructed by making N the 
  14006.       parent of the nodes R-1, R-2, ..., R-k. In this new tree, N is the root 
  14007.       and T-1, T-2, ..., T-k are the subtrees of the root N.  Nodes R-1, R-2, 
  14008.       ..., R-k are called children of node N. 
  14009.  
  14010.  Associated with each node is a data item called element. 
  14011.  
  14012.  Nodes without children are called leaves or terminals. The number of children 
  14013.  in a node is called the degree of that node. The level of a given node is the 
  14014.  number of steps in the path from the root to the given node. The root is at 
  14015.  level 0 by definition. The height of a tree is the length of the longest path 
  14016.  from the root to any node. 
  14017.  
  14018.  
  14019. ΓòÉΓòÉΓòÉ 6.1.1. Defining the Traversal Order of Tree Elements ΓòÉΓòÉΓòÉ
  14020.  
  14021. You can define the order in which nodes of a tree are traversed by specifying a 
  14022. parameter of type IMultiwayTreeIterationOrder in calls to the following member 
  14023. functions: 
  14024.  
  14025.      setToFirst 
  14026.      setToLast 
  14027.      setToNext 
  14028.      setToPrevious 
  14029.      allElementsDo, allSubtreeElementsDo 
  14030.  
  14031.  These functions are described in Multiway Tree. 
  14032.  
  14033.  The IMultiwayTreeIterationOrder parameter can have one of two values: 
  14034.  IPreorder or IPostorder. The effect of each of these values is explained 
  14035.  below. 
  14036.  
  14037.  IPreorder 
  14038.  
  14039.  The search begins at the root of the tree, and continues with the leftmost 
  14040.  child of the root.  If the child is the root of a subtree, the search 
  14041.  continues with the leftmost child of the subtree, and so on, until a terminal 
  14042.  node is detected.  The search continues with all siblings of the terminal 
  14043.  node, from left to right.  If any of these siblings is the root of a subtree, 
  14044.  the subtree is searched the same way as described above for the tree. 
  14045.  
  14046.  The preorder method can be summarized by the following recursive rules: 
  14047.  
  14048.    1. Visit the root. 
  14049.    2. Traverse the subtrees from left to right in preorder. 
  14050.  
  14051.  IPostorder 
  14052.  
  14053.  The IPostorder method is the opposite of IPreorder.  The search begins with 
  14054.  the leftmost terminal node in the tree.  Then that node's siblings are 
  14055.  searched from left to right.  If any of these siblings is the root of a 
  14056.  subtree, the subtree is searched for its leftmost terminal node. 
  14057.  
  14058.  The postorder method can be sumarized by the following recursive rules: 
  14059.  
  14060.    1. Traverse the subtrees from left to right in postorder. 
  14061.    2. Visit the root. 
  14062.  
  14063.  The following figure shows a tree with 12 nodes, and the order of traversal 
  14064.  for both preorder and postorder methods. Numbers indicate the preorder method 
  14065.  (node 1 is searched before node 2) while letters indicate the postorder method 
  14066.  (node A is searched before node B). 
  14067.  
  14068.  
  14069.   Preorder and Postorder Iteration Methods for Trees
  14070.  
  14071.  
  14072. ΓòÉΓòÉΓòÉ 6.2. Multiway Tree ΓòÉΓòÉΓòÉ
  14073.  
  14074. Description 
  14075.  
  14076. Derivation 
  14077.  
  14078. Variants/Header Files 
  14079.  
  14080. Members 
  14081.  
  14082. Template Arguments and Required Functions 
  14083.  
  14084. Examples 
  14085.  
  14086. To close all the panels in a chapter, double-click on this panel's system menu. 
  14087.  
  14088.  
  14089. ΓòÉΓòÉΓòÉ 6.2.1. Class Description - Multiway Tree ΓòÉΓòÉΓòÉ
  14090.  
  14091. A multiway tree, also known as an n-ary tree, is a special tree where each node 
  14092. can have up to n children. 
  14093.  
  14094. n must be greater than one.  If n is one, the tree is a list.  If n is zero, 
  14095. the structure loses its meaning. 
  14096.  
  14097. An example of using an multiway tree is a program used to build a family tree. 
  14098. (For simplicity, assume that the family tree is not concerned with information 
  14099. about spouses.) Whenever you discover a relative who is not already in your 
  14100. family tree, you enter the relative's name. If you know the parent's name, and 
  14101. the parent is already in the collection, the new relative is added as a child 
  14102. of the existing parent. If the parent is known but is not in the collection, a 
  14103. new collection is created, with the parent as the root element and the child as 
  14104. a child node of the parent.  If you do not know the parent, the relative is 
  14105. entered as the root element of a new collection.  You can also enter 
  14106. information about the children of a given relative; this information is used to 
  14107. attach a subtree, whose root node is the child, to the node of the parent of 
  14108. that child. Once you have established the collection, you can determine who is 
  14109. the parent or oldest known ancestor of a given relative, and you can display a 
  14110. list of all descendents of a given family member. 
  14111.  
  14112.  
  14113. ΓòÉΓòÉΓòÉ 6.2.2. Derivation ΓòÉΓòÉΓòÉ
  14114.  
  14115. Tree 
  14116.  
  14117.  Multiway Tree
  14118.  
  14119.  
  14120. ΓòÉΓòÉΓòÉ 6.2.3. Variants and Header Files ΓòÉΓòÉΓòÉ
  14121.  
  14122. IMultiwayTree is the default implementation variant based on tabular tree. 
  14123. IGMultiwayTree is the default implementation variant with generic operations 
  14124. class.  Both classes are declared in imwt.h. No reference class exists for tree 
  14125. classes. 
  14126.  
  14127.  
  14128. ΓòÉΓòÉΓòÉ 6.2.4. Members ΓòÉΓòÉΓòÉ
  14129.  
  14130. Tree Functions lists the member functions for Multiway Tree. 
  14131.  
  14132.  
  14133. ΓòÉΓòÉΓòÉ 6.2.5. Template Arguments and Required Functions ΓòÉΓòÉΓòÉ
  14134.  
  14135. IMultiwayTree  <numberOfChildren, Element>
  14136. IGMultiwayTree <numberOfChildren, Element, StdOps>
  14137.  
  14138. The default implementation of IMultiwayTree requires the following element 
  14139. functions: 
  14140.  
  14141. Element Type 
  14142.  
  14143.      Copy constructor 
  14144.      Destructor 
  14145.      Assignment 
  14146.  
  14147.  The argument value of numberOfChildren specifies the maximum number of 
  14148.  children for each node. 
  14149.  
  14150.  
  14151. ΓòÉΓòÉΓòÉ 6.2.6. Terms Used ΓòÉΓòÉΓòÉ
  14152.  
  14153. Some of the terms used in this chapter are defined below. You can also use the 
  14154. Glossary to look up terms you are unfamiliar with. 
  14155.  
  14156.  this tree           The tree to which a function is applied, in contrast to 
  14157.                      the given tree. 
  14158.  
  14159.  given ...           Referring to a tree, element, or function that is given as 
  14160.                      a function argument. 
  14161.  
  14162.  returned element    An element returned as a function return value. 
  14163.  
  14164.  iteration order     The order in which elements are visited in functions 
  14165.                      allElementsDo(), allSubtreeElementsDo(), setToNext(), and 
  14166.                      setToPrevious(). 
  14167.  
  14168.  
  14169. ΓòÉΓòÉΓòÉ 6.2.7. Coding Example for Multiway Tree ΓòÉΓòÉΓòÉ
  14170.  
  14171. The following sample constructs a binary tree for the following expression: 
  14172. (8+2) * (2+4) / (7-5). The program prints this tree in preorder, using prefix 
  14173. notation. It then calculates the result of the expression. The program 
  14174. identifies subtrees consisting of an operand and two operators, calculates the 
  14175. result and replaces the subtree by its result. Finally, the tree consists of 
  14176. one node that is the result of the expression. 
  14177.  
  14178. Note that the code does not respect precedence of "/" and "*" over "+" and "-". 
  14179.  
  14180.    // nary.C  -  An example of using an multiway tree
  14181.    #include <imwt.h>
  14182.    #include <istring.hpp>
  14183.    #include <iostream.h>
  14184.  
  14185.    ////////////////////////////////////////////////////////////
  14186.    // The tree for this expression is as follows:            //
  14187.    //                                                        //
  14188.    //                              /                         //
  14189.    //                     *                -                 //
  14190.    //                +         +      7         5            //
  14191.    //              8   2     2   4                           //
  14192.    ////////////////////////////////////////////////////////////
  14193.  
  14194.    typedef IMultiwayTree <2, IString> BinaryTree;
  14195.  
  14196.    IBoolean printNode(IString const& node, void* dummy) {
  14197.    // Prints one node of an multiway tree
  14198.       cout << node << "|";
  14199.       return  true;
  14200.     }
  14201.  
  14202.    void prefixedNotation(BinaryTree const& naryTree) {
  14203.    // Prints an multiway tree in prefixed notation
  14204.       naryTree.allElementsDo(printNode , IPreorder);
  14205.       cout << endl;
  14206.     }
  14207.  
  14208.  
  14209.    void identifyChildren  (IString &child1,
  14210.                            IString &child2,
  14211.                            BinaryTree &binTree,
  14212.                            IMultiwayTreeCursor &binTreeCursor) {
  14213.    // Identifies the children of a node
  14214.  
  14215.      binTree.setToNext(binTreeCursor, IPreorder);
  14216.      child1 = binTree.elementAt(binTreeCursor);
  14217.      binTree.setToNextExistingChild(binTreeCursor);
  14218.      child2 = binTree.elementAt(binTreeCursor);
  14219.      binTree.setToParent(binTreeCursor);
  14220.     }
  14221.  
  14222.  
  14223.    IBoolean isNumber(IString child) {
  14224.    // Checks whether a node contains a number
  14225.      if ((child != '+') &&
  14226.          (child != '-') &&
  14227.          (child != '*') &&
  14228.          (child != '/'))
  14229.         { return true; }
  14230.      else { return false; }
  14231.    }
  14232.  
  14233.  
  14234.    void lookForNextOperator(BinaryTree &binTree,
  14235.                             IMultiwayTreeCursor &binTreeCursor) {
  14236.    // Looks for the next operator in the tree
  14237.       IBoolean operatorFound = false;
  14238.  
  14239.       do {
  14240.        if (!isNumber(binTree.elementAt(binTreeCursor))) {
  14241.             operatorFound = true;
  14242.           }
  14243.        else {
  14244.             binTree.setToNext(binTreeCursor, IPreorder);
  14245.           }
  14246.       }
  14247.       while (! operatorFound);
  14248.     }
  14249.  
  14250.  
  14251.    void calculateSubtree(double &result, double &operand1,
  14252.                          double &operand2, IString &operatorSign) {
  14253.    // Calculates the result from a subtree in the complete tree
  14254.       switch (*(char*)operatorSign) {
  14255.           case '+':
  14256.              result = operand1+operand2;
  14257.              break;
  14258.           case '-':
  14259.              result = operand1-operand2;
  14260.              break;
  14261.           case '/':
  14262.              result = operand1/operand2;
  14263.              break;
  14264.           case '*':
  14265.              result = operand1*operand2;
  14266.              break;
  14267.         } // end of switch
  14268.     }
  14269.  
  14270.    /************************ main ****************************/
  14271.    int main () {
  14272.      // Construct the tree:
  14273.  
  14274.      BinaryTree  binTree;
  14275.      BinaryTree::Cursor binTreeCursor(binTree);
  14276.      BinaryTree::Cursor binTreeSaveCursor(binTree);
  14277.  
  14278.  
  14279.      binTree.addAsRoot("/");
  14280.      binTree.setToRoot(binTreeCursor);
  14281.      binTree.addAsChild(binTreeCursor, 1, "*");
  14282.      binTree.setToChild(1, binTreeCursor);
  14283.      binTree.addAsChild(binTreeCursor, 1, "+");
  14284.      binTree.setToChild(1, binTreeCursor);
  14285.      binTree.addAsChild(binTreeCursor, 1, "8");
  14286.      binTree.addAsChild(binTreeCursor, 2, "2");
  14287.      binTree.setToParent(binTreeCursor);
  14288.      binTree.addAsChild(binTreeCursor, 2, "+");
  14289.      binTree.setToChild(2, binTreeCursor);
  14290.      binTree.addAsChild(binTreeCursor, 1, "2");
  14291.      binTree.addAsChild(binTreeCursor, 2, "4");
  14292.      binTree.setToRoot(binTreeCursor);
  14293.      binTree.addAsChild(binTreeCursor, 2, "-");
  14294.      binTree.setToChild(2, binTreeCursor);
  14295.      binTree.addAsChild(binTreeCursor, 1, "7");
  14296.      binTree.addAsChild(binTreeCursor, 2, "5");
  14297.  
  14298.      // Print complete tree in prefix notation
  14299.  
  14300.      cout << "Printing the original tree in prefixed notation:"
  14301.           << endl;
  14302.      prefixedNotation(binTree);
  14303.      cout << " " << endl;
  14304.  
  14305.      // Calculate tree
  14306.  
  14307.      double      operand1 = 0;
  14308.      double      operand2 = 0;
  14309.      double      result = 0;
  14310.      INumber     replacePosition;
  14311.      IString     operatorSign, child1, child2;
  14312.  
  14313.      binTree.setToRoot(binTreeCursor);
  14314.      do
  14315.      {
  14316.       lookForNextOperator(binTree, binTreeCursor);
  14317.       operatorSign = binTree.elementAt(binTreeCursor);
  14318.       identifyChildren  (child1, child2, binTree, binTreeCursor);
  14319.       if ((isNumber(child1)) && (isNumber(child2)))
  14320.          {
  14321.            operand1 = child1.asDouble();
  14322.            operand2 = child2.asDouble();
  14323.            calculateSubtree(result, operand1, operand2,
  14324.                             operatorSign);
  14325.            if (binTree.numberOfElements() > 3)
  14326.            {
  14327.            // If tree contains more than three elements, replace
  14328.            // the calculated subtree by its result as follows.
  14329.            // (Save the cursor, because it will become invalidated after
  14330.            // removeSubtree)
  14331.             binTreeSaveCursor = binTreeCursor;
  14332.             binTree.setToParent(binTreeSaveCursor);
  14333.             replacePosition = binTree.position(binTreeCursor);
  14334.             binTree.removeSubtree(binTreeCursor);
  14335.             binTree.addAsChild(binTreeSaveCursor,
  14336.                                replacePosition,
  14337.                                (IString)result);
  14338.            cout << "Tree with calculated subtree replaced: "
  14339.                 << endl;
  14340.            prefixedNotation(binTree);
  14341.            binTree.setToRoot(binTreeCursor);
  14342.            }
  14343.            else
  14344.            {
  14345.            // If tree contains root with two children only, replace
  14346.            // this calculated subtree by its result as follows:
  14347.             binTree.removeAll();
  14348.             binTree.addAsRoot(IString(result));
  14349.             cout << "Now the tree contains the result only:" << endl;
  14350.             prefixedNotation(binTree);
  14351.            }
  14352.          }
  14353.       else
  14354.          {
  14355.          binTree.setToNext(binTreeCursor, IPreorder);
  14356.          }
  14357.      }
  14358.      while (binTree.numberOfElements() > 1);
  14359.  
  14360.      return 0;
  14361.    }
  14362.  
  14363. The program produces the following output: 
  14364.  
  14365. Printing the original tree in prefixed notation:
  14366. /|*|+|8|2|+|2|4|-|7|5|
  14367.  
  14368. Tree with calculated subtree replaced:
  14369. /|*|10|+|2|4|-|7|5|
  14370. Tree with calculated subtree replaced:
  14371. /|*|10|6|-|7|5|
  14372. Tree with calculated subtree replaced:
  14373. /|60|-|7|5|
  14374. Tree with calculated subtree replaced:
  14375. /|60|2|
  14376. Now the tree contains the result only:
  14377. 30|
  14378.  
  14379.  
  14380. ΓòÉΓòÉΓòÉ 6.2.8. Tree Functions ΓòÉΓòÉΓòÉ
  14381.  
  14382. This section lists the public member functions of multiway trees. The following 
  14383. member functions are described: 
  14384.  
  14385. Constructor
  14386. Copy Constructor
  14387. Destructor
  14388. operator=
  14389. addAsChild
  14390. addAsRoot
  14391. allElementsDo
  14392. allElementsDo
  14393. allSubtreeElementsDo
  14394. allSubtreeElementsDo
  14395. attachAsChild
  14396. attachSubtreeAsChild
  14397. attachAsRoot
  14398. attachSubtreeAsRoot
  14399. copy
  14400. copySubtree
  14401. elementAt
  14402. hasChild
  14403. isEmpty
  14404. isLeaf
  14405. isRoot
  14406. newCursor
  14407. numberOfChildren
  14408. numberOfElements
  14409. numberOfSubtreeElements
  14410. numberOfLeaves
  14411. numberOfSubtreeLeaves
  14412. position
  14413. removeAll
  14414. removeSubtree
  14415. replaceAt
  14416. setToChild
  14417. setToFirst
  14418. setToFirstExistingChild
  14419. setToLast
  14420. setToLastExistingChild
  14421. setToNext
  14422. setToNextExistingChild
  14423. setToParent
  14424. setToPrevious
  14425. setToPreviousExistingChild
  14426. setToRoot
  14427.  
  14428.  
  14429. ΓòÉΓòÉΓòÉ 6.2.8.1. Constructor ΓòÉΓòÉΓòÉ
  14430.  
  14431. IMultiwayTree ( ) ;
  14432.  
  14433. Constructs a tree. The tree is initially empty; that is, it does not contain 
  14434. any nodes. 
  14435.  
  14436.  
  14437. ΓòÉΓòÉΓòÉ 6.2.8.2. Copy Constructor ΓòÉΓòÉΓòÉ
  14438.  
  14439. IMultiwayTree ( IMultiwayTree <numberOfChildren, Element> const& tree ) ;
  14440.  
  14441. Constructs a tree by copying all elements from the given tree. 
  14442.  
  14443. Exception 
  14444.  
  14445. IOutOfMemory 
  14446.  
  14447.  
  14448. ΓòÉΓòÉΓòÉ 6.2.8.3. Destructor ΓòÉΓòÉΓòÉ
  14449.  
  14450. ~IMultiwayTree ( ) ;
  14451.  
  14452. Removes all elements from this tree. 
  14453.  
  14454. Side Effects 
  14455.  
  14456. All cursors of the tree become undefined. 
  14457.  
  14458.  
  14459. ΓòÉΓòÉΓòÉ 6.2.8.4. operator= ΓòÉΓòÉΓòÉ
  14460.  
  14461. IMultiwayTree <numberOfChildren, Element>& operator= (
  14462.    IMultiwayTree <numberOfChildren, Element> const& tree ) ;
  14463.  
  14464. Copies all elements of the given tree to this tree. 
  14465.  
  14466. Return Value 
  14467.  
  14468. A reference to this tree. 
  14469.  
  14470. Side Effects 
  14471.  
  14472. All cursors of this tree become undefined. 
  14473.  
  14474. Exception 
  14475.  
  14476. IOutOfMemory 
  14477.  
  14478.  
  14479. ΓòÉΓòÉΓòÉ 6.2.8.5. addAsChild ΓòÉΓòÉΓòÉ
  14480.  
  14481. void addAsChild ( ITreeCursor const& cursor,
  14482.    IPosition position, Element const& element ) ;
  14483.  
  14484. Adds the given element as a child with the given position to the node of this 
  14485. tree denoted by the given cursor. 
  14486.  
  14487. Preconditions 
  14488.  
  14489.      The cursor must point to an element of this tree. 
  14490.      (1 <= position <= numberOfChildren). 
  14491.      The node denoted by the given cursor (of this tree) must not have a child 
  14492.       at the given position. 
  14493.  
  14494.  Exceptions 
  14495.  
  14496.      IOutOfMemory 
  14497.      ICursorInvalidException 
  14498.      IPositionInvalidException 
  14499.      IChildAlreadyExistsException 
  14500.  
  14501.  
  14502. ΓòÉΓòÉΓòÉ 6.2.8.6. addAsRoot ΓòÉΓòÉΓòÉ
  14503.  
  14504. void addAsRoot ( Element const& element ) ;
  14505.  
  14506. Adds the given element as root of the tree. 
  14507.  
  14508. Precondition 
  14509.  
  14510. The tree must not have a root; that is, it must be empty. 
  14511.  
  14512. Exceptions 
  14513.  
  14514.      IOutOfMemory 
  14515.      IRootAlreadyExistsException 
  14516.  
  14517.  
  14518. ΓòÉΓòÉΓòÉ 6.2.8.7. allElementsDo, allSubtreeElementsDo ΓòÉΓòÉΓòÉ
  14519.  
  14520. IBoolean allElementsDo (
  14521.    IBoolean (*function) (Element&, void*),
  14522.    ITreeIterationOrder iterationOrder,
  14523.    void* additionalArgument = 0 ) ;
  14524.  
  14525. IBoolean allElementsDo (
  14526.    IBoolean (*function) (Element const&, void*),
  14527.    ITreeIterationOrder iterationOrder,
  14528.    void* additionalArgument = 0 ) const;
  14529.  
  14530. IBoolean allSubtreeElementsDo ( ITreeCursor const& cursor,
  14531.    IBoolean (*function) (Element const&, void*),
  14532.    ITreeIterationOrder iterationOrder,
  14533.    void* additionalArgument = 0 ) const;
  14534.  
  14535. IBoolean allSubtreeElementsDo (
  14536.    ITreeCursor const& cursor,
  14537.    IBoolean (*function) (Element&, void*),
  14538.    ITreeIterationOrder iterationOrder,
  14539.    void* additionalArgument = 0 ) ;
  14540.  
  14541. Calls the given function for all elements of the subtree denoted by the given 
  14542. cursor (of this tree) until the given function returns false. The elements are 
  14543. visited in the given iteration order. Additional arguments can be passed to the 
  14544. given function using additionalArgument. The additional argument defaults to 
  14545. zero if no additional argument is given. The allElementsDo() function (without 
  14546. a subtree cursor argument) iterates over all elements of the tree. 
  14547.  
  14548. Note:  The given function must not remove elements from or add elements to the 
  14549. tree. 
  14550.  
  14551. Return Value 
  14552.  
  14553. Returns true if the given function returns true for every element it is applied 
  14554. to. 
  14555.  
  14556. Preconditions 
  14557.  
  14558.      The cursor must belong to this tree. 
  14559.      The cursor must point to an element of this tree. 
  14560.  
  14561.  Exception 
  14562.  
  14563.  ICursorInvalidException 
  14564.  
  14565.  
  14566. ΓòÉΓòÉΓòÉ 6.2.8.8. allElementsDo, allSubtreeElementsDo ΓòÉΓòÉΓòÉ
  14567.  
  14568. IBoolean allElementsDo (
  14569.    IApplicator <Element>& applicator,
  14570.    ITreeIterationOrder iterationOrder ) ;
  14571.  
  14572. IBoolean allElementsDo (
  14573.    IConstantApplicator <Element>& applicator,
  14574.    ITreeIterationOrder iterationOrder ) const;
  14575.  
  14576. IBoolean allSubtreeElementsDo ( ITreeCursor const& cursor,
  14577.    IApplicator <Element>& applicator,
  14578.    ITreeIterationOrder iterationOrder ) ;
  14579.  
  14580. IBoolean allSubtreeElementsDo ( ITreeCursor const& cursor,
  14581.    IConstantApplicator <Element>& applicator,
  14582.    ITreeIterationOrder iterationOrder ) const;
  14583.  
  14584. Calls the applyTo() function of the given applicator for all elements of the 
  14585. subtree denoted by the given cursor (of this tree) until the applyTo() function 
  14586. returns false. The elements are visited in the given iteration order. The 
  14587. allElementsDo() function (without a subtree cursor argument) iterates over all 
  14588. elements of the tree. 
  14589.  
  14590. Note:  The applyTo() function must not remove elements from or add elements to 
  14591. the tree. 
  14592.  
  14593. Preconditions 
  14594.  
  14595.      The cursor must belong to this tree. 
  14596.      The cursor must point to an element of this tree. 
  14597.  
  14598.  Return Value 
  14599.  
  14600.  Returns true if the applyTo() function returns true for every element it is 
  14601.  applied to. 
  14602.  
  14603.  Exceptions 
  14604.  
  14605.  ICursorInvalidException 
  14606.  
  14607.  
  14608. ΓòÉΓòÉΓòÉ 6.2.8.9. attachAsChild, attachSubtreeAsChild ΓòÉΓòÉΓòÉ
  14609.  
  14610. void attachAsChild ( ITreeCursor const& cursor,
  14611.    IPosition position,
  14612.    IMultiwayTree <numberOfChildren, Element>& tree ) ;
  14613.  
  14614. void attachSubtreeAsChild ( ITreeCursor const& cursor,
  14615.    IPosition position,
  14616.    IMultiwayTree <numberOfChildren, Element>& tree,
  14617.    ITreeCursor const& subTreeCursor ) ;
  14618.  
  14619. Copies the subtree denoted by the given subtree cursor as a child with the 
  14620. given position of the node (of this tree) denoted by the given cursor. Removes 
  14621. this subtree from the given tree. The attachAsChild() function (without a 
  14622. subtree cursor argument) copies and removes the whole given tree. 
  14623.  
  14624. Be careful when this tree and the given tree are the same. In such cases you 
  14625. must not attach a subtree to one of its own children, because a cyclic tree 
  14626. structure would result. Because attachSubtreeAsChild() removes this subtree 
  14627. from this tree, you will never be able to access either this subtree or the 
  14628. given subtree attached to it.  This practice can also lead to memory not being 
  14629. properly freed. 
  14630.  
  14631. This warning applies to both attachAsChild() and attachSubtreeAsChild(). 
  14632.  
  14633. Note:  These functions are implemented by copying a pointer to the subtree, 
  14634. rather than by copying all elements in the subtree. 
  14635.  
  14636. Preconditions 
  14637.  
  14638.      The cursor must point to an element of this tree. 
  14639.      The subtree cursor must point to an element of the given tree. 
  14640.      (1 <= position <= numberOfChildren). 
  14641.      The node denoted by the given cursor (of this tree) must not have a child 
  14642.       at the given position. 
  14643.      If this tree and the given tree are the same, a subtree must not be 
  14644.       attached to one of its own children. 
  14645.  
  14646.  Exceptions 
  14647.  
  14648.      ICursorInvalidException 
  14649.      IPositionInvalidException 
  14650.      IChildAlreadyExistsException 
  14651.      ICyclicAttachException 
  14652.  
  14653.  
  14654. ΓòÉΓòÉΓòÉ 6.2.8.10. attachAsRoot, attachSubtreeAsRoot ΓòÉΓòÉΓòÉ
  14655.  
  14656. void attachAsRoot (
  14657.    IMultiwayTree <numberOfChildren, Element>& tree ) ;
  14658.  
  14659. void attachSubtreeAsRoot (
  14660.    IMultiwayTree <numberOfChildren, Element>& tree,
  14661.    ITreeCursor const& cursor ) ;
  14662.  
  14663. Copies the subtree denoted by the cursor of the given tree to (the root of) 
  14664. this tree, and removes this subtree from the given tree. The attachAsRoot() 
  14665. function (without a cursor argument) copies and removes the whole given tree. 
  14666.  
  14667. Note:  These functions are implemented by copying a pointer to the subtree, 
  14668. rather than by copying all elements in the subtree. 
  14669.  
  14670. Preconditions 
  14671.  
  14672.      The cursor must point to an element of this tree. 
  14673.      The tree must not have a root; that is, it must be empty. 
  14674.  
  14675.  Exceptions 
  14676.  
  14677.      ICursorInvalidException 
  14678.      IRootAlreadyExistsException 
  14679.  
  14680.  
  14681. ΓòÉΓòÉΓòÉ 6.2.8.11. childPositionAt ΓòÉΓòÉΓòÉ
  14682.  
  14683. IPosition childPositionAt (
  14684.    ITreeCursor const& cursor ) const;
  14685.  
  14686. Returns the position of the node pointed to by the given cursor as a child with 
  14687. respect to its parent node. The position of the root node is 1. 
  14688.  
  14689. Precondition 
  14690.  
  14691. The cursor must point to an element of this tree. 
  14692.  
  14693. Exception 
  14694.  
  14695. ICursorInvalidException 
  14696.  
  14697.  
  14698. ΓòÉΓòÉΓòÉ 6.2.8.12. copy, copySubtree ΓòÉΓòÉΓòÉ
  14699.  
  14700. void copy (
  14701.    (IMultiwayTree <numberOfChildren, Element> const& tree ) ;
  14702.  
  14703. void copySubtree (
  14704.    IMultiwayTree <numberOfChildren, Element> const& tree,
  14705.    ITreeCursor const& cursor ) ;
  14706.  
  14707. Removes all elements from this tree, and copies the subtree denoted by the 
  14708. given cursor of the given tree to (the root of) this tree. The copy function 
  14709. (without a cursor argument) copies the whole given tree. 
  14710.  
  14711. Preconditions 
  14712.  
  14713. The cursor must point to an element of the given tree. 
  14714.  
  14715. Exceptions 
  14716.  
  14717.      IOutOfMemory 
  14718.      ICursorInvalidException 
  14719.  
  14720.  
  14721. ΓòÉΓòÉΓòÉ 6.2.8.13. elementAt ΓòÉΓòÉΓòÉ
  14722.  
  14723. Element const& elementAt (
  14724.    ITreeCursor const& cursor ) const;
  14725.  
  14726. Element& elementAt ( ITreeCursor const& cursor ) ;
  14727.  
  14728. Returns a reference to the element pointed to by the given cursor. 
  14729.  
  14730. Precondition 
  14731.  
  14732. The cursor must point to an element of this tree. 
  14733.  
  14734. Exception 
  14735.  
  14736. ICursorInvalidException 
  14737.  
  14738.  
  14739. ΓòÉΓòÉΓòÉ 6.2.8.14. hasChild ΓòÉΓòÉΓòÉ
  14740.  
  14741. IBoolean hasChild ( IPosition position,
  14742.    ITreeCursor const& cursor ) const;
  14743.  
  14744. Returns true if the node pointed to by the given cursor has a child at the 
  14745. given position. 
  14746.  
  14747. Preconditions 
  14748.  
  14749.      The cursor must point to an element of this tree. 
  14750.      (1 <= position <= numberOfChildren) 
  14751.  
  14752.  Exceptions 
  14753.  
  14754.      ICursorInvalidException 
  14755.      IPositionInvalidException 
  14756.  
  14757.  
  14758. ΓòÉΓòÉΓòÉ 6.2.8.15. isEmpty ΓòÉΓòÉΓòÉ
  14759.  
  14760. IBoolean isEmpty ( ) const;
  14761.  
  14762. Returns true if the tree is empty. 
  14763.  
  14764.  
  14765. ΓòÉΓòÉΓòÉ 6.2.8.16. isLeaf ΓòÉΓòÉΓòÉ
  14766.  
  14767. IBoolean isLeaf ( ITreeCursor const& cursor ) const;
  14768.  
  14769. Returns true if the node pointed to by the given cursor is a leaf node of the 
  14770. tree.  A leaf node is a node with no children. 
  14771.  
  14772. Precondition 
  14773.  
  14774. The cursor must point to an element of this tree. 
  14775.  
  14776. Exception 
  14777.  
  14778. ICursorInvalidException 
  14779.  
  14780.  
  14781. ΓòÉΓòÉΓòÉ 6.2.8.17. isRoot ΓòÉΓòÉΓòÉ
  14782.  
  14783. IBoolean isRoot ( ITreeCursor const& cursor ) const;
  14784.  
  14785. Returns true if the node pointed to by the given cursor is the root node of the 
  14786. tree. 
  14787.  
  14788. Precondition 
  14789.  
  14790. The cursor must point to an element of this tree. 
  14791.  
  14792. Exception 
  14793.  
  14794. ICursorInvalidException 
  14795.  
  14796.  
  14797. ΓòÉΓòÉΓòÉ 6.2.8.18. newCursor ΓòÉΓòÉΓòÉ
  14798.  
  14799. ITreeCursor* newCursor ( ) const;
  14800.  
  14801. Creates a cursor for the tree. The cursor is initially invalid. 
  14802.  
  14803. Return Value 
  14804.  
  14805. Pointer to the cursor. 
  14806.  
  14807. Exception 
  14808.  
  14809. IOutOfMemory 
  14810.  
  14811.  
  14812. ΓòÉΓòÉΓòÉ 6.2.8.19. numberOfChildren ΓòÉΓòÉΓòÉ
  14813.  
  14814. INumber numberOfChildren ( ) const;
  14815.  
  14816. Returns the number of children a node can possibly have. The actual number of 
  14817. children of any node will always be less than or equal to this number. 
  14818.  
  14819.  
  14820. ΓòÉΓòÉΓòÉ 6.2.8.20. numberOfElements, numberOfSubtreeElements ΓòÉΓòÉΓòÉ
  14821.  
  14822. INumber numberOfElements ( ) const;
  14823.  
  14824. INumber numberOfSubtreeElements (
  14825.    ITreeCursor const& cursor ) const;
  14826.  
  14827. Returns the number of elements that the subtree denoted by the given cursor 
  14828. contains. The subtree root, inner, and leaf nodes are counted. The 
  14829. numberOfElements() function (without a cursor argument) counts the number of 
  14830. elements in the whole tree. 
  14831.  
  14832. Preconditions 
  14833.  
  14834. The cursor must belong to the tree and must point to an element in the tree. 
  14835.  
  14836. Exception 
  14837.  
  14838. ICursorInvalidException 
  14839.  
  14840.  
  14841. ΓòÉΓòÉΓòÉ 6.2.8.21. numberOfLeaves, numberOfSubtreeLeaves ΓòÉΓòÉΓòÉ
  14842.  
  14843. INumber numberOfLeaves ( ) const;
  14844.  
  14845. INumber numberOfSubtreeLeaves (
  14846.    ITreeCursor const& cursor ) const;
  14847.  
  14848. Returns the number of leaf elements that the subtree denoted by the given 
  14849. cursor contains. Leaves are nodes that have no children. The numberOfLeaves() 
  14850. function (without a cursor argument) counts the number of leaves in the whole 
  14851. tree. 
  14852.  
  14853. Preconditions 
  14854.  
  14855. The cursor must belong to the tree and must point to an element in the tree. 
  14856.  
  14857. Exception 
  14858.  
  14859. ICursorInvalidException 
  14860.  
  14861.  
  14862. ΓòÉΓòÉΓòÉ 6.2.8.22. removeAll, removeSubtree ΓòÉΓòÉΓòÉ
  14863.  
  14864. INumber removeAll ( ) ;
  14865.  
  14866. INumber removeSubtree ( ITreeCursor& cursor ) ;
  14867.  
  14868. Removes the subtree denoted by the given cursor (of this tree). The removeAll() 
  14869. function (without a cursor argument) removes all elements from this tree. 
  14870.  
  14871. Precondition 
  14872.  
  14873. The cursor must point to an element of this tree. 
  14874.  
  14875. Side Effects 
  14876.  
  14877. For removeSubtree(), the given cursor is invalidated after removal. 
  14878.  
  14879. Exception 
  14880.  
  14881. ICursorInvalidException 
  14882.  
  14883.  
  14884. ΓòÉΓòÉΓòÉ 6.2.8.23. replaceAt ΓòÉΓòÉΓòÉ
  14885.  
  14886. void replaceAt ( ITreeCursor const& cursor,
  14887.    Element const& element ) ;
  14888.  
  14889. Replaces the element pointed to by the cursor with the given element. 
  14890.  
  14891. Precondition 
  14892.  
  14893. The cursor must point to an element of this tree. 
  14894.  
  14895. Exception 
  14896.  
  14897. ICursorInvalidException 
  14898.  
  14899.  
  14900. ΓòÉΓòÉΓòÉ 6.2.8.24. setToChild ΓòÉΓòÉΓòÉ
  14901.  
  14902. IBoolean setToChild ( IPosition position,
  14903.    ITreeCursor& cursor ) const;
  14904.  
  14905. Sets the cursor to the child with the given position of the node denoted by the 
  14906. given cursor (of this tree). Invalidates the cursor if this child does not 
  14907. exist. 
  14908.  
  14909. Preconditions 
  14910.  
  14911.      The cursor must point to an element of this tree. 
  14912.      (1 <= position <= numberOfChildren). 
  14913.  
  14914.  Return Value 
  14915.  
  14916.  Returns true if the child exists. 
  14917.  
  14918.  Exceptions 
  14919.  
  14920.      ICursorInvalidException 
  14921.      IPositionInvalidException 
  14922.  
  14923.  
  14924. ΓòÉΓòÉΓòÉ 6.2.8.25. setToFirst ΓòÉΓòÉΓòÉ
  14925.  
  14926. IBoolean setToFirst ( ITreeCursor& cursor,
  14927.    ITreeIterationOrder iterationOrder ) const;
  14928.  
  14929. Sets the cursor to the first node in the given iteration order. Invalidates the 
  14930. cursor if the tree is empty. 
  14931.  
  14932. Precondition 
  14933.  
  14934. The cursor must belong to this tree. 
  14935.  
  14936. Return Value 
  14937.  
  14938. Returns true if the tree is not empty. 
  14939.  
  14940. Exception 
  14941.  
  14942. ICursorInvalidException 
  14943.  
  14944.  
  14945. ΓòÉΓòÉΓòÉ 6.2.8.26. setToFirstExistingChild ΓòÉΓòÉΓòÉ
  14946.  
  14947. IBoolean setToFirstExistingChild (
  14948.    ITreeCursor& cursor ) const;
  14949.  
  14950. Sets the cursor to the first child of the node denoted by the given cursor (of 
  14951. this tree). Invalidates the cursor if the node has no child.  A node with no 
  14952. child is a leaf node of the tree. 
  14953.  
  14954. Preconditions 
  14955.  
  14956. The cursor must point to an element of this tree. 
  14957.  
  14958. Return Value 
  14959.  
  14960. Returns true if the node has a child. 
  14961.  
  14962. Exception 
  14963.  
  14964. ICursorInvalidException 
  14965.  
  14966.  
  14967. ΓòÉΓòÉΓòÉ 6.2.8.27. setToLast ΓòÉΓòÉΓòÉ
  14968.  
  14969. IBoolean setToLast ( ITreeCursor& cursor,
  14970.    ITreeIterationOrder iterationOrder ) const;
  14971.  
  14972. Sets the cursor to the last node in the given iteration order. Invalidates the 
  14973. cursor if the tree is empty. 
  14974.  
  14975. Precondition 
  14976.  
  14977. The cursor must belong to this tree. 
  14978.  
  14979. Return Value 
  14980.  
  14981. Returns true if the tree is not empty. 
  14982.  
  14983. Exception 
  14984.  
  14985. ICursorInvalidException 
  14986.  
  14987.  
  14988. ΓòÉΓòÉΓòÉ 6.2.8.28. setToLastExistingChild ΓòÉΓòÉΓòÉ
  14989.  
  14990. IBoolean setToLastExistingChild (
  14991.    ITreeCursor& cursor ) const;
  14992.  
  14993. Sets the cursor to the last child of the node denoted by the given cursor (of 
  14994. this tree). Invalidates the cursor if the node has no child.  A node with no 
  14995. child is a leaf node of the tree. 
  14996.  
  14997. Precondition 
  14998.  
  14999. The cursor must point to an element of this tree. 
  15000.  
  15001. Return Value 
  15002.  
  15003. Returns true if the node has a child. 
  15004.  
  15005. Exception 
  15006.  
  15007. ICursorInvalidException 
  15008.  
  15009.  
  15010. ΓòÉΓòÉΓòÉ 6.2.8.29. setToNext ΓòÉΓòÉΓòÉ
  15011.  
  15012. IBoolean setToNext ( ITreeCursor& cursor,
  15013.    ITreeIterationOrder iterationOrder ) const;
  15014.  
  15015. Sets the cursor to the next node in the given iteration order. Invalidates the 
  15016. cursor if there is no next node. 
  15017.  
  15018. Precondition 
  15019.  
  15020. The cursor must point to an element of this tree. 
  15021.  
  15022. Return Value 
  15023.  
  15024. Returns true if the given cursor does not point to the last node (in iteration 
  15025. order). 
  15026.  
  15027. Exception 
  15028.  
  15029. ICursorInvalidException 
  15030.  
  15031.  
  15032. ΓòÉΓòÉΓòÉ 6.2.8.30. setToNextExistingChild ΓòÉΓòÉΓòÉ
  15033.  
  15034. IBoolean setToNextExistingChild (
  15035.    ITreeCursor& cursor ) const;
  15036.  
  15037. Sets the cursor to the next existing sibling of the node denoted by the given 
  15038. cursor (of this tree). Invalidates the cursor if the node has no next sibling. 
  15039. A node with no next sibling is the last existing child of its parent. 
  15040.  
  15041. Precondition 
  15042.  
  15043. The cursor must point to an element of this tree. 
  15044.  
  15045. Return Value 
  15046.  
  15047. Returns true if the node has a next sibling. 
  15048.  
  15049. Exception 
  15050.  
  15051. ICursorInvalidException 
  15052.  
  15053.  
  15054. ΓòÉΓòÉΓòÉ 6.2.8.31. setToParent ΓòÉΓòÉΓòÉ
  15055.  
  15056. IBoolean setToParent ( ITreeCursor& cursor ) const;
  15057.  
  15058. Sets the cursor to the parent of the node denoted by the given cursor (of this 
  15059. tree). Invalidates the cursor if the node has no parent. A node with no parent 
  15060. is the root node of its tree. 
  15061.  
  15062. Precondition 
  15063.  
  15064. The cursor must point to an element of this tree. 
  15065.  
  15066. Return Value 
  15067.  
  15068. Returns true if the node has a parent. 
  15069.  
  15070. Exception 
  15071.  
  15072. ICursorInvalidException 
  15073.  
  15074.  
  15075. ΓòÉΓòÉΓòÉ 6.2.8.32. setToPrevious ΓòÉΓòÉΓòÉ
  15076.  
  15077. IBoolean setToPrevious ( ITreeCursor& cursor,
  15078.    ITreeIterationOrder iterationOrder ) const;
  15079.  
  15080. Sets the cursor to the previous node in the given iteration order. Invalidates 
  15081. the cursor if there is no previous node. 
  15082.  
  15083. Precondition 
  15084.  
  15085. The cursor must point to an element of this tree. 
  15086.  
  15087. Return Value 
  15088.  
  15089. Returns true if the given cursor does not point to the first node (in iteration 
  15090. order). 
  15091.  
  15092. Exception 
  15093.  
  15094. ICursorInvalidException 
  15095.  
  15096.  
  15097. ΓòÉΓòÉΓòÉ 6.2.8.33. setToPreviousExistingChild ΓòÉΓòÉΓòÉ
  15098.  
  15099. IBoolean setToPreviousExistingChild (
  15100.    ITreeCursor& cursor ) const;
  15101.  
  15102. Sets the cursor to the previous existing sibling of the node denoted by the 
  15103. given cursor (of this tree). Invalidates the cursor if the node has no previous 
  15104. sibling. A node with no previous sibling is the first existing child of its 
  15105. parent. 
  15106.  
  15107. Precondition 
  15108.  
  15109. The cursor must point to an element of this tree. 
  15110.  
  15111. Return Value 
  15112.  
  15113. Returns true if the node has a previous sibling. 
  15114.  
  15115. Exception 
  15116.  
  15117. ICursorInvalidException 
  15118.  
  15119.  
  15120. ΓòÉΓòÉΓòÉ 6.2.8.34. setToRoot ΓòÉΓòÉΓòÉ
  15121.  
  15122. IBoolean setToRoot ( ITreeCursor& cursor ) const;
  15123.  
  15124. Sets the cursor to the root node of the tree. Invalidates the cursor if the 
  15125. tree is empty (that is, if no root node exists). 
  15126.  
  15127. Precondition 
  15128.  
  15129. The cursor must belong to this tree. 
  15130.  
  15131. Return Value 
  15132.  
  15133. Returns true if the tree is not empty. 
  15134.  
  15135. Exception 
  15136.  
  15137. ICursorInvalidException 
  15138.  
  15139.  
  15140. ΓòÉΓòÉΓòÉ 7. Auxiliary Collection Classes ΓòÉΓòÉΓòÉ
  15141.  
  15142. This section contains the following chapters: 
  15143.  
  15144.  Cursor                                       Describes the declarations and 
  15145.                                               public member functions for the 
  15146.                                               cursor classes. 
  15147.  
  15148.  Tree Cursor                                  Describes the declarations and 
  15149.                                               public member functions for the 
  15150.                                               tree cursor classes. 
  15151.  
  15152.  Applicator and Constant Applicator Classes   Describes the declarations and 
  15153.                                               public member functions for the 
  15154.                                               classes that define the interface 
  15155.                                               for iterator objects. 
  15156.  
  15157.  Pointer Classes                              Describes the declarations and 
  15158.                                               public member functions for the 
  15159.                                               classes that allow you to access 
  15160.                                               collection classes through 
  15161.                                               pointers. 
  15162.  
  15163.  
  15164. ΓòÉΓòÉΓòÉ 7.1. Cursor ΓòÉΓòÉΓòÉ
  15165.  
  15166. Description 
  15167.  
  15168. Header File 
  15169.  
  15170. Constructors 
  15171.  
  15172. Members 
  15173.  
  15174. To close all the panels in a chapter, double-click on this panel's system menu. 
  15175.  
  15176.  
  15177. ΓòÉΓòÉΓòÉ 7.1.1. Class Description - Cursor Classes ΓòÉΓòÉΓòÉ
  15178.  
  15179. Each collection class defines its own nested cursor class. All of these cursor 
  15180. classes are derived from one of the following classes: 
  15181.  
  15182.      IElementCursor 
  15183.      IOrderedCursor 
  15184.  
  15185.  IOrderedCursor is derived from IElementCursor, and IElementCursor is in turn 
  15186.  derived from ICursor. Only cursors of ordered collections are derived from 
  15187.  IOrderedCursor. Cursors from unordered collections are derived from 
  15188.  IElementCursor, and only know the member functions from IElementCursor and 
  15189.  ICursor. 
  15190.  
  15191.  This chapter describes the general member functions of these three cursor 
  15192.  classes as well as the specific member functions provided for specific 
  15193.  collections. Because the cursor classes are all abstract classes, no objects 
  15194.  of type IOrderedCursor, IElementCursor, or ICursor can be declared. You can 
  15195.  obtain cursor objects by using the collection member newCursor(), or by 
  15196.  defining a cursor of a specific collection cursor class. The newCursor() 
  15197.  member creates a cursor of the collection to which it is applied. 
  15198.  
  15199.  The newCursor() member returns a pointer to the newly created cursor object. 
  15200.  
  15201.  Each cursor object is associated with a collection object. A cursor function 
  15202.  merely calls the corresponding function for this collection. For example, 
  15203.  cursor.setToFirst() is the same as collection.setToFirst(cursor), where 
  15204.  collection is the object associated with cursor. 
  15205.  
  15206.  
  15207. ΓòÉΓòÉΓòÉ 7.1.2. Header File ΓòÉΓòÉΓòÉ
  15208.  
  15209. The cursor classes are declared in icursor.h. Note that individual collection 
  15210. header files already include icursor.h; you do not need to include the file in 
  15211. your programs. 
  15212.  
  15213.  
  15214. ΓòÉΓòÉΓòÉ 7.1.3. Members ΓòÉΓòÉΓòÉ
  15215.  
  15216. The following member functions are described: 
  15217.  
  15218.      Constructor 
  15219.      copy 
  15220.      isValid 
  15221.      invalidate 
  15222.      element 
  15223.      operator!= 
  15224.      operator== 
  15225.      setToFirst 
  15226.      setToLast 
  15227.      setToNext 
  15228.      setToPrevious 
  15229.  
  15230.  
  15231. ΓòÉΓòÉΓòÉ 7.1.3.1. Constructor ΓòÉΓòÉΓòÉ
  15232.  
  15233. Cursor ( Collection const& collection ) ;
  15234.  
  15235. Constructs the cursor and associates it with the given collection. The cursor 
  15236. is initially invalid.  The name of the constructor is that of the nested cursor 
  15237. class. 
  15238.  
  15239.  
  15240. ΓòÉΓòÉΓòÉ 7.1.3.2. copy ΓòÉΓòÉΓòÉ
  15241.  
  15242. void copy (ICursor const& cursor) ;
  15243.  
  15244. Copies the given cursor to this cursor. This cursor now points to where the 
  15245. given cursor points. 
  15246.  
  15247. Precondition 
  15248.  
  15249. The given cursor and this cursor must refer to the same collection type. 
  15250.  
  15251. Note:  This precondition cannot be checked. 
  15252.  
  15253.  
  15254. ΓòÉΓòÉΓòÉ 7.1.3.3. isValid ΓòÉΓòÉΓòÉ
  15255.  
  15256. IBoolean isValid ( ) const;
  15257.  
  15258. Returns true if the cursor points to an element of the associated collection. 
  15259.  
  15260.  
  15261. ΓòÉΓòÉΓòÉ 7.1.3.4. invalidate ΓòÉΓòÉΓòÉ
  15262.  
  15263. void invalidate ( ) ;
  15264.  
  15265. Invalidates the cursor; that is, it no longer points to an element of the 
  15266. associated collection. 
  15267.  
  15268.  
  15269. ΓòÉΓòÉΓòÉ 7.1.3.5. element ΓòÉΓòÉΓòÉ
  15270.  
  15271. Element const& element ( ) const;
  15272.  
  15273. Returns a constant reference to the element of the associated collection to 
  15274. which the cursor points. 
  15275.  
  15276. Precondition 
  15277.  
  15278. The cursor must point to an element of the associated collection. 
  15279.  
  15280. Exception 
  15281.  
  15282. ICursorInvalidException 
  15283.  
  15284.  
  15285. ΓòÉΓòÉΓòÉ 7.1.3.6. operator!= ΓòÉΓòÉΓòÉ
  15286.  
  15287. IBoolean operator!= ( ICursor const& cursor ) const;
  15288.  
  15289. Returns true if the cursor does not point to the same element (of the same 
  15290. collection) as the given cursor. 
  15291.  
  15292.  
  15293. ΓòÉΓòÉΓòÉ 7.1.3.7. operator== ΓòÉΓòÉΓòÉ
  15294.  
  15295. IBoolean operator== ( ICursor const& cursor ) const;
  15296.  
  15297. Returns true if the cursor points to the same element (of the same collection) 
  15298. as the given cursor. 
  15299.  
  15300.  
  15301. ΓòÉΓòÉΓòÉ 7.1.3.8. setToFirst ΓòÉΓòÉΓòÉ
  15302.  
  15303. IBoolean setToFirst ( ) ;
  15304.  
  15305. Sets the cursor to the first element of the associated collection in iteration 
  15306. order. Invalidates the cursor if the collection is empty (if no first element 
  15307. exists). 
  15308.  
  15309. Return Value 
  15310.  
  15311. Returns true if the associated collection is not empty. 
  15312.  
  15313.  
  15314. ΓòÉΓòÉΓòÉ 7.1.3.9. setToLast ΓòÉΓòÉΓòÉ
  15315.  
  15316. IBoolean setToLast ( ) ;
  15317.  
  15318. Sets the cursor to the last element of the associated collection in iteration 
  15319. order. Invalidates the cursor if the collection is empty (no last element 
  15320. exists). This function is only available for cursors of ordered collections. 
  15321. Returns true if the associated collection was not empty. 
  15322.  
  15323.  
  15324. ΓòÉΓòÉΓòÉ 7.1.3.10. setToNext ΓòÉΓòÉΓòÉ
  15325.  
  15326. IBoolean setToNext ( ) ;
  15327.  
  15328. Sets the cursor to the next element in the associated collection in iteration 
  15329. order. Invalidates the cursor if no more elements are left to be visited. 
  15330. Returns true if there was a next element. 
  15331.  
  15332. Precondition 
  15333.  
  15334. The cursor must point to an element of the associated collection. 
  15335.  
  15336. Exception 
  15337.  
  15338. ICursorInvalidException 
  15339.  
  15340.  
  15341. ΓòÉΓòÉΓòÉ 7.1.3.11. setToPrevious ΓòÉΓòÉΓòÉ
  15342.  
  15343. IBoolean setToPrevious ( ) ;
  15344.  
  15345. Sets the cursor to the previous element of the associated collection in 
  15346. iteration order. Invalidates the cursor if no such element exists. This 
  15347. function is only available for cursors of ordered collections. 
  15348.  
  15349. Return Value 
  15350.  
  15351. Returns true if a previous element exists. 
  15352.  
  15353. Precondition 
  15354.  
  15355. The cursor must point to an element of the associated collection. 
  15356.  
  15357. Exception 
  15358.  
  15359. ICursorInvalidException 
  15360.  
  15361.  
  15362. ΓòÉΓòÉΓòÉ 7.2. Tree Cursor ΓòÉΓòÉΓòÉ
  15363.  
  15364. Description 
  15365.  
  15366. Header File 
  15367.  
  15368. Members 
  15369.  
  15370. To close all the panels in a chapter, double-click on this panel's system menu. 
  15371.  
  15372.  
  15373. ΓòÉΓòÉΓòÉ 7.2.1. Class Description - ITreeCursor ΓòÉΓòÉΓòÉ
  15374.  
  15375. For n-ary trees, cursors are used to point to nodes in the tree. Unlike cursors 
  15376. of flat collections, tree cursors stay defined when elements are added to the 
  15377. tree, or when elements other than the one pointed to are removed.  Cursors are 
  15378. used in operations to access the element information stored in a node.  They 
  15379. are also used to designate a subtree of the tree, namely the subtree whose root 
  15380. node the cursor points to. 
  15381.  
  15382. As for flat collections, a distinction is made between the abstract base class 
  15383. ITreeCursor, and cursor classes local to the tree classes themselves.  The 
  15384. local, or nested, cursor classes are derived from the abstract base class. 
  15385.  
  15386.  
  15387. ΓòÉΓòÉΓòÉ 7.2.2. Header Files ΓòÉΓòÉΓòÉ
  15388.  
  15389. The declarations for ITreeCursor can be found in ibtree.h. 
  15390.  
  15391.  
  15392. ΓòÉΓòÉΓòÉ 7.2.3. Members ΓòÉΓòÉΓòÉ
  15393.  
  15394. Tree Cursor defines the following member functions: 
  15395.  
  15396.      Constructor 
  15397.      operator!= 
  15398.      operator== 
  15399.      element 
  15400.      isValid 
  15401.      invalidate 
  15402.      setToChild 
  15403.      setToFirstExistingChild 
  15404.      setToLastExistingChild 
  15405.      setToNextExistingChild 
  15406.      setToParent 
  15407.      setToPreviousExistingChild 
  15408.      setToRoot 
  15409.  
  15410.  
  15411. ΓòÉΓòÉΓòÉ 7.2.4. Constructor ΓòÉΓòÉΓòÉ
  15412.  
  15413. Cursor ( Tree const& tree ) ;
  15414.  
  15415. Constructs the cursor and associates it with the given tree. The cursor is 
  15416. initially invalid. 
  15417.  
  15418.  
  15419. ΓòÉΓòÉΓòÉ 7.2.5. operator!= ΓòÉΓòÉΓòÉ
  15420.  
  15421. IBoolean operator!= ( Cursor const& cursor ) ;
  15422.  
  15423. Returns true if the cursor does not point to the same node of the same tree as 
  15424. the given cursor. 
  15425.  
  15426.  
  15427. ΓòÉΓòÉΓòÉ 7.2.6. operator== ΓòÉΓòÉΓòÉ
  15428.  
  15429. IBoolean operator== ( Cursor const& cursor ) ;
  15430.  
  15431. Returns true if the cursor points to the same node of the same tree as the 
  15432. given cursor. 
  15433.  
  15434.  
  15435. ΓòÉΓòÉΓòÉ 7.2.7. element ΓòÉΓòÉΓòÉ
  15436.  
  15437. Element const& element ( ) ;
  15438.  
  15439. Returns a reference to the element of the associated tree to which the cursor 
  15440. points. 
  15441.  
  15442. Preconditions 
  15443.  
  15444. The cursor must point to a node of the associated tree. 
  15445.  
  15446. Exception 
  15447.  
  15448. ICursorInvalidException 
  15449.  
  15450.  
  15451. ΓòÉΓòÉΓòÉ 7.2.8. isValid ΓòÉΓòÉΓòÉ
  15452.  
  15453. IBoolean isValid ( ) ;
  15454.  
  15455. Returns true if the cursor points to a node of the associated tree. 
  15456.  
  15457.  
  15458. ΓòÉΓòÉΓòÉ 7.2.9. invalidate ΓòÉΓòÉΓòÉ
  15459.  
  15460. void invalidate ( ) ;
  15461.  
  15462. Invalidates the cursor so that it no longer points to a node of the associated 
  15463. tree. 
  15464.  
  15465.  
  15466. ΓòÉΓòÉΓòÉ 7.2.10. setToChild ΓòÉΓòÉΓòÉ
  15467.  
  15468. IBoolean setToChild ( IPosition position ) ;
  15469.  
  15470. Sets the cursor to the child node with the given position. If the child does 
  15471. not exist, the cursor is invalidated. If the child at the given position 
  15472. exists, setToChild() returns true. 
  15473.  
  15474. Preconditions 
  15475.  
  15476.      (1 <= position <= numberOfChildren). 
  15477.      The cursor must point to a node of the associated tree. 
  15478.  
  15479.  Exceptions 
  15480.  
  15481.      IPositionInvalidException 
  15482.  
  15483.      ICursorInvalidException 
  15484.  
  15485.  
  15486. ΓòÉΓòÉΓòÉ 7.2.11. setToFirstExistingChild ΓòÉΓòÉΓòÉ
  15487.  
  15488. IBoolean setToFirstExistingChild ( ) ;
  15489.  
  15490. Sets the cursor to the first existing child of the associated tree. If the node 
  15491. pointed to by the cursor has no children (that is, if the node is a leaf) the 
  15492. cursor is invalidated.  If the node pointed to by the cursor has a child, 
  15493. setToFirstExistingChild() returns true. 
  15494.  
  15495.  
  15496. ΓòÉΓòÉΓòÉ 7.2.12. setToLastExistingChild ΓòÉΓòÉΓòÉ
  15497.  
  15498. IBoolean setToLastExistingChild ( ) ;
  15499.  
  15500. Sets the cursor to the last existing child of the associated tree. If the node 
  15501. pointed to by the cursor has no children (that is, if the node is a leaf) the 
  15502. cursor is invalidated. If the node pointed to by the cursor has a child, 
  15503. setToLastExistingChild() returns true. 
  15504.  
  15505.  
  15506. ΓòÉΓòÉΓòÉ 7.2.13. setToNextExistingChild ΓòÉΓòÉΓòÉ
  15507.  
  15508. IBoolean setToNextExistingChild ( ) ;
  15509.  
  15510. Sets the cursor to the next existing sibling of the node to which the cursor 
  15511. points. If the node to which the cursor points is the last child of its parent, 
  15512. no next existing child exists and the cursor is invalidated. 
  15513.  
  15514. Return Value 
  15515.  
  15516. Returns false if a next existing child exists. 
  15517.  
  15518. Preconditions 
  15519.  
  15520. The cursor must point to a node of the associated tree. 
  15521.  
  15522. Exception 
  15523.  
  15524. ICursorInvalidException 
  15525.  
  15526.  
  15527. ΓòÉΓòÉΓòÉ 7.2.14. setToParent ΓòÉΓòÉΓòÉ
  15528.  
  15529. IBoolean setToParent ( ) ;
  15530.  
  15531. Sets the cursor to the parent of the node pointed to by the cursor. If the 
  15532. cursor points to the root, the node has no parent, and the cursor is 
  15533. invalidated. 
  15534.  
  15535. Return Value 
  15536.  
  15537. Returns true if the node has a parent. 
  15538.  
  15539. Preconditions 
  15540.  
  15541. The cursor must point to a node of the associated tree. 
  15542.  
  15543. Exception 
  15544.  
  15545. ICursorInvalidException 
  15546.  
  15547.  
  15548. ΓòÉΓòÉΓòÉ 7.2.15. setToPreviousExistingChild ΓòÉΓòÉΓòÉ
  15549.  
  15550. IBoolean setToPreviousExistingChild ( ) ;
  15551.  
  15552. Sets the cursor to the previous existing sibling of the node to which the 
  15553. cursor points. If the node to which the cursor points is the last child of its 
  15554. parent, no more children exist and the cursor is invalidated. 
  15555.  
  15556. Return Value 
  15557.  
  15558. Returns true if there was a previous child. 
  15559.  
  15560. Precondition 
  15561.  
  15562. The cursor must point to a node of the associated tree. 
  15563.  
  15564. Exception 
  15565.  
  15566. ICursorInvalidException 
  15567.  
  15568.  
  15569. ΓòÉΓòÉΓòÉ 7.2.16. setToRoot ΓòÉΓòÉΓòÉ
  15570.  
  15571. IBoolean setToRoot ( ) ;
  15572.  
  15573. Sets the cursor to the root of the associated tree. If the collection is empty 
  15574. (if no root element exists), the cursor is invalidated.  Otherwise, setToRoot() 
  15575. returns true. 
  15576.  
  15577.  
  15578. ΓòÉΓòÉΓòÉ 7.3. Applicator and Constant Applicator Classes ΓòÉΓòÉΓòÉ
  15579.  
  15580. Description 
  15581.  
  15582. Derivation 
  15583.  
  15584. Header File 
  15585.  
  15586. Members 
  15587.  
  15588. To close all the panels in a chapter, double-click on this panel's system menu. 
  15589.  
  15590.  
  15591. ΓòÉΓòÉΓòÉ 7.3.1. Class Description - Applicator Classes ΓòÉΓòÉΓòÉ
  15592.  
  15593. The classes IApplicator and IConstantApplicator define the interface for 
  15594. applicator objects. The redefinition of the function applyTo() defines the 
  15595. actions that are performed with the version of allElementsDo() that takes an 
  15596. applicator argument. (See allElementsDo for more information on this function.) 
  15597. Iteration stops when applyTo() returns false. 
  15598.  
  15599.  
  15600. ΓòÉΓòÉΓòÉ 7.3.2. Derivation ΓòÉΓòÉΓòÉ
  15601.  
  15602. These classes do not derive from any other class. 
  15603.  
  15604.  
  15605. ΓòÉΓòÉΓòÉ 7.3.3. Header File ΓòÉΓòÉΓòÉ
  15606.  
  15607. iiter.h 
  15608.  
  15609.  
  15610. ΓòÉΓòÉΓòÉ 7.3.4. Members ΓòÉΓòÉΓòÉ
  15611.  
  15612. These classes define only one function, as a virtual function. 
  15613.  
  15614.      applyTo() 
  15615.  
  15616.  
  15617. ΓòÉΓòÉΓòÉ 7.3.5. applyTo ΓòÉΓòÉΓòÉ
  15618.  
  15619. virtual IBoolean applyTo (Element const& element) = 0;
  15620.  
  15621. This function applies a series of specified statements or a function to all 
  15622. elements of a collection for which you use the applicator.  For example, 
  15623. myCollection.allElementsDo(myApplicator); causes the code in the applyTo() 
  15624. function that you code for your applicator object myApplicator to be applied to 
  15625. all elements of the collection myCollection. 
  15626.  
  15627. For an example on how to use applicators, see Iteration Using Applicators in 
  15628. the Open Class Library User's Guide. 
  15629.  
  15630.  
  15631. ΓòÉΓòÉΓòÉ 7.4. Pointer Classes ΓòÉΓòÉΓòÉ
  15632.  
  15633. Description 
  15634.  
  15635. Header File 
  15636.  
  15637. Members 
  15638.  
  15639. Examples 
  15640.  
  15641. To close all the panels in a chapter, double-click on this panel's system menu. 
  15642.  
  15643.  
  15644. ΓòÉΓòÉΓòÉ 7.4.1. Class Description - Pointer Classes ΓòÉΓòÉΓòÉ
  15645.  
  15646. The Collection Class Library defines five pointer classes: 
  15647.  
  15648.      IAutoPointer 
  15649.      IAutoElemPointer 
  15650.      IElemPointer 
  15651.      IMngPointer 
  15652.      IMngElemPointer 
  15653.  
  15654.  You can select from these classes depending on your requirements: 
  15655.  
  15656.      Pointers from classes named I...ElemPointer (also called element 
  15657.       pointers) route the operations on the pointers to the referenced 
  15658.       elements. 
  15659.      Pointers from classes named IAuto...Pointer (also called automatic 
  15660.       pointers) delete the elements they reference when the pointers are 
  15661.       destructed. No reference count is kept. 
  15662.      Pointers from classes named IMng...Pointer (also called managed pointers) 
  15663.       keep a reference count for each referenced element. When the last managed 
  15664.       pointer to the element is destructed, the element is automatically 
  15665.       deleted. 
  15666.  
  15667.  For further information on the characteristics of these pointer types and how 
  15668.  to use them, see Using Pointer Classes. 
  15669.  
  15670.  
  15671. ΓòÉΓòÉΓòÉ 7.4.2. Header File ΓòÉΓòÉΓòÉ
  15672.  
  15673. The pointer classes are declared in the header file iptr.h. 
  15674.  
  15675.  
  15676. ΓòÉΓòÉΓòÉ 7.4.3. Members ΓòÉΓòÉΓòÉ
  15677.  
  15678. The pointer classes define constructors, a destructor, and four operators. An 
  15679. equality test operator, although not actually a member of the pointer classes, 
  15680. is also available. 
  15681.  
  15682.      Constructors 
  15683.      Constructors from a Given C++ Pointer 
  15684.      Copy Constructors from a Given Collection Class Pointer 
  15685.      Destructors 
  15686.      operator* 
  15687.      Conversion operator 
  15688.      operator-> 
  15689.      operator= 
  15690.      operator== 
  15691.  
  15692.  
  15693. ΓòÉΓòÉΓòÉ 7.4.3.1. Constructors ΓòÉΓòÉΓòÉ
  15694.  
  15695. IAutoPointer ();
  15696. IElemPointer ();
  15697. IMngPointer ();
  15698.  
  15699. Constructs a pointer of the indicated type and initializes it with NULL. 
  15700.  
  15701.  
  15702. ΓòÉΓòÉΓòÉ 7.4.3.2. Constructors from a Given C++ Pointer ΓòÉΓòÉΓòÉ
  15703.  
  15704. IAutoPointer (Element *ptr, IExplicitInit)
  15705. IAutoElemPointer (Element *ptr, IExplicitInit)
  15706. IElemPointer (Element *ptr, IExplicitInit = IINIT)
  15707. IMngPointer (Element *ptr, IExplicitInit)
  15708. IMngElemPointer (Element *ptr, IExplicitInit)
  15709. Constructs a pointer object of the indicated type from a given C++ pointer. For 
  15710. managed pointers, the reference count of the referenced element is set to 1. 
  15711.  
  15712.  
  15713. ΓòÉΓòÉΓòÉ 7.4.3.3. Copy Constructors from a Given Collection Class Pointer ΓòÉΓòÉΓòÉ
  15714.  
  15715. IAutoPointer (IAutoPointer < Element > const& ptr)
  15716. IMngPointer (IMngPointer < Element > const& ptr)
  15717.  
  15718. Constructs a new pointer and initializes it with the given pointer. For 
  15719. automatic pointers, the given pointer is set to NULL. For managed pointers, the 
  15720. reference count of the referenced element is incremented by 1. 
  15721.  
  15722.  
  15723. ΓòÉΓòÉΓòÉ 7.4.3.4. Destructors ΓòÉΓòÉΓòÉ
  15724.  
  15725. ~IAutoPointer ()
  15726. ~IAutoElemPointer ()
  15727.  
  15728. Deletes the object referenced to by the automatic pointer. 
  15729.  
  15730. ~IMngPointer ()
  15731. ~IMngElemPointer ()
  15732.  
  15733. Destructs the pointer and decrements the reference count of the referenced 
  15734. element. If the reference count is 0, the referenced element is deleted. 
  15735.  
  15736.  
  15737. ΓòÉΓòÉΓòÉ 7.4.3.5. operator* ΓòÉΓòÉΓòÉ
  15738.  
  15739. Element& operator * () const;
  15740.  
  15741. Returns a reference to the object to which the pointer refers. 
  15742.  
  15743.  
  15744. ΓòÉΓòÉΓòÉ 7.4.3.6. Conversion operator ΓòÉΓòÉΓòÉ
  15745.  
  15746. operator Element* () const
  15747.  
  15748. Implicitly convert this pointer to a C++ pointer. 
  15749.  
  15750.  
  15751. ΓòÉΓòÉΓòÉ 7.4.3.7. operator-> ΓòÉΓòÉΓòÉ
  15752.  
  15753. Element* operator-> () const
  15754.  
  15755. Returns a C pointer to the object to which the pointer refers. 
  15756.  
  15757.  
  15758. ΓòÉΓòÉΓòÉ 7.4.3.8. operator= ΓòÉΓòÉΓòÉ
  15759.  
  15760. void                         operator = (IAutoPointer < Element > const& ptr)
  15761. IMngPointer < Element >&     operator = (IMngPointer < Element > const& ptr)
  15762. IMngElemPointer < Element >& operator = (IMngElemPointer < Element > const& ptr)
  15763.  
  15764. Assigns the given pointer to this pointer. For automatic pointers, the given 
  15765. pointer is set to NULL and the previously referenced element is deleted. For 
  15766. managed pointers, the reference count of the referenced element is incremented 
  15767. and the reference count of the previously referenced element is decremented. 
  15768.  
  15769.  
  15770. ΓòÉΓòÉΓòÉ 7.4.3.9. operator== ΓòÉΓòÉΓòÉ
  15771.  
  15772. The pointer classes do not have an operator== explicitly defined for them. 
  15773. However, for equality test you can use the syntax: 
  15774.  
  15775.    pointerVariable1 == pointerVariable2;
  15776.  
  15777. The conversion operator (operator Element*) implicitly converts the objects to 
  15778. C pointers, and then the operator== for C pointers is invoked. 
  15779.  
  15780. Because the operator== is not actually a member of the class, you cannot write 
  15781. an equality test like the following: 
  15782.  
  15783.    if (pointerVariable1.operator==(pointerVariable2)) {/* ... */}
  15784.  
  15785.  
  15786. ΓòÉΓòÉΓòÉ 7.4.4. Coding Example for Managed Element Pointer ΓòÉΓòÉΓòÉ
  15787.  
  15788. The following sample allows you to store managed pointers for various graphical 
  15789. objects into a key sorted set. The graphical objects, namely lines, curves, and 
  15790. circles, inherit from a base class Graphics. Using these pointers, you can draw 
  15791. the various shapes from the collection. 
  15792.  
  15793. // graph.C  - An example of using Collection Class pointers
  15794.  
  15795. #include <iostream.h>
  15796. #include "graph.h"
  15797. #include "line.h"
  15798. #include "circle.h"
  15799. #include "curve.h"
  15800. #include <iptr.h>
  15801. #include <ikss.h>
  15802.  
  15803. typedef IMngElemPointer <Graphics> MngGraphicsPointer;
  15804. typedef IKeySortedSet <MngGraphicsPointer, int> MngPointerKSet;
  15805.  
  15806. ostream & operator << (ostream & sout,
  15807.                        MngPointerKSet const& mgdPointerKSet) {
  15808.    MngGraphicsPointer drawObject;
  15809.    MngPointerKSet::Cursor
  15810.    gpsCursor(mgdPointerKSet);
  15811.  
  15812.    forCursor(gpsCursor) {
  15813.         drawObject = gpsCursor.element();
  15814.  
  15815.         sout << "\n Key is: " <<  drawObject->graphicsKey()
  15816.              << "\n ID is: " <<  drawObject->id() << endl;
  15817.  
  15818.         drawObject->draw();
  15819.      } /* endfor */
  15820.  
  15821.    return sout;
  15822. }
  15823.  
  15824.  int main () {
  15825.      MngPointerKSet graphMngPointerKSet;
  15826.      //   Add curve pointers, circle pointers and line
  15827.      //   pointers to the graphMngPointerKSet.
  15828.  
  15829.       //Creating curve objects and adding pointers to the collections
  15830.       MngGraphicsPointer pcurve1 (new Curve
  15831.        (10, "Curve 1",
  15832.        1.1, 4.3,  2.1, 6.4,  3.1, 9.7,  4.1, 6.5,  5.1, 7.4),
  15833.        IINIT);
  15834.       MngGraphicsPointer pcurve2 (new Curve
  15835.        (20 ,"Curve 2",
  15836.        1.2, 3.9,  2.2, 5.9,  3.2, 8.8,  4.2, 7.5,  5.2, 9.4),
  15837.        IINIT);
  15838.  
  15839.       graphMngPointerKSet.add(pcurve1);
  15840.       graphMngPointerKSet.add(pcurve2);
  15841.  
  15842.       //Creating circle objects and adding pointers to the collections
  15843.  
  15844.       MngGraphicsPointer pcircle1 (new Circle
  15845.        (40 , "Circle 1" , 1.0, 1.0, 1.0), IINIT);
  15846.       MngGraphicsPointer pcircle2 (new Circle
  15847.        (50 , "Circle  2", 2.0, 2.0, 2.0), IINIT);
  15848.  
  15849.       graphMngPointerKSet.add(pcircle1);
  15850.       graphMngPointerKSet.add(pcircle2);
  15851.  
  15852.       //Creating line objects and adding pointers to the collections
  15853.  
  15854.       MngGraphicsPointer pline1 (new Line
  15855.        (70 , "Line 1" , 1.1 , 1.1 , 5.1 , 5.1), IINIT);
  15856.       MngGraphicsPointer pline2 (new Line
  15857.        (80 , "Line 2" , 2.2 , 2.2 , 5.2 , 5.2), IINIT);
  15858.       // if you want to have a normal C-pointer:
  15859.       Line* cPointerToLine = new Line
  15860.        (90 , "Line 3" , 3.3 , 3.3 , 5.3 , 5.3);
  15861.       MngGraphicsPointer pline3 (cPointerToLine, IINIT);
  15862.  
  15863.       graphMngPointerKSet.add(pline1);
  15864.       graphMngPointerKSet.add(pline2);
  15865.       graphMngPointerKSet.add(pline3);
  15866.  
  15867.       cout << "Drawing the shapes from the key set "
  15868.            << "of Managed Pointers: \n"
  15869.            << graphMngPointerKSet << "\n " << endl;
  15870.  
  15871.       graphMngPointerKSet.elementWithKey(70)->draw();
  15872.       cPointerToLine->draw();
  15873.       pline3->draw();
  15874.  
  15875.   // Now we are about to end the program.  The objects referenced
  15876.   // by managed pointers are automatically deleted.  See what
  15877.   // happens in the output of the program.
  15878.   return 0;
  15879.  }
  15880.  
  15881.  
  15882. ΓòÉΓòÉΓòÉ 8. Abstract Collection Classes ΓòÉΓòÉΓòÉ
  15883.  
  15884. This part describes the abstract Collection Classes. The following classes are 
  15885. described: 
  15886.  
  15887.      Collection 
  15888.      Equality collection 
  15889.      Equality key collection 
  15890.      Equality key sorted collection 
  15891.      Equality sorted collection 
  15892.      Key collection 
  15893.      Key sorted collection 
  15894.      Ordered collection 
  15895.      Sequential collection 
  15896.      Sorted collection 
  15897.  
  15898.  
  15899. ΓòÉΓòÉΓòÉ 8.1. Collection ΓòÉΓòÉΓòÉ
  15900.  
  15901. Description 
  15902.  
  15903. Derivation 
  15904.  
  15905. Variants/Header Files 
  15906.  
  15907. Members 
  15908.  
  15909. To close all the panels in a chapter, double-click on this panel's system menu. 
  15910.  
  15911.  
  15912. ΓòÉΓòÉΓòÉ 8.1.1. Class Description - Collection ΓòÉΓòÉΓòÉ
  15913.  
  15914. Collection is the base class for almost all classes defined by the Collection 
  15915. Class Library. Because collection is an abstract class, it cannot be used to 
  15916. create any objects. 
  15917.  
  15918.  
  15919. ΓòÉΓòÉΓòÉ 8.1.2. Derivation ΓòÉΓòÉΓòÉ
  15920.  
  15921. Collection does not have any bases. The following abstract classes are derived 
  15922. from collection: 
  15923.  
  15924.      Key collection 
  15925.      Equality collection 
  15926.      Ordered collection 
  15927.  
  15928.  The concrete class heap is defined by collection. 
  15929.  
  15930.  The Abstract Class Hierarchy shows the relationship of collection to the class 
  15931.  hierarchy. 
  15932.  
  15933.  
  15934. ΓòÉΓòÉΓòÉ 8.1.3. Header File ΓòÉΓòÉΓòÉ
  15935.  
  15936. Collection is declared in the header file iacllct.h. 
  15937.  
  15938.  
  15939. ΓòÉΓòÉΓòÉ 8.1.4. Members ΓòÉΓòÉΓòÉ
  15940.  
  15941. All the member functions of collection are defined as virtual functions and are 
  15942. described in Introduction to Flat Collections. The following member functions 
  15943. are provided for collection: 
  15944.  
  15945.      Destructor 
  15946.      add 
  15947.      addAllFrom 
  15948.      anyElement 
  15949.      compare 
  15950.      Copy Constructor 
  15951.      elementAtPosition 
  15952.      isBounded 
  15953.      isEmpty 
  15954.      isFull 
  15955.      maxNumberOfElements 
  15956.      newCursor 
  15957.      numberOfElements 
  15958.      removeAll 
  15959.      removeAt 
  15960.      replaceAt 
  15961.      setToFirst 
  15962.      setToNext 
  15963.  
  15964.  
  15965. ΓòÉΓòÉΓòÉ 8.2. Equality Collection ΓòÉΓòÉΓòÉ
  15966.  
  15967. Description 
  15968.  
  15969. Derivation 
  15970.  
  15971. Variants/Header Files 
  15972.  
  15973. Members 
  15974.  
  15975. To close all the panels in a chapter, double-click on this panel's system menu. 
  15976.  
  15977.  
  15978. ΓòÉΓòÉΓòÉ 8.2.1. Class Description - Equality Collection ΓòÉΓòÉΓòÉ
  15979.  
  15980. Because equality collection is an abstract class, it cannot be used to create 
  15981. any objects. The equality collection defines the interfaces for the property of 
  15982. element equality. 
  15983.  
  15984.  
  15985. ΓòÉΓòÉΓòÉ 8.2.2. Derivation ΓòÉΓòÉΓòÉ
  15986.  
  15987. Collection 
  15988.  
  15989.   Equality Collection
  15990.  
  15991. The following abstract classes are derived from equality collection: 
  15992.  
  15993.      Equality key collection 
  15994.      Equality sorted collection 
  15995.  
  15996.  The following concrete classes are defined by equality collection: 
  15997.  
  15998.      Set 
  15999.      Bag 
  16000.      Equality Sequence 
  16001.  
  16002.  The Abstract Class Hierarchy shows the relationship of equality collection to 
  16003.  the class hierarchy. 
  16004.  
  16005.  
  16006. ΓòÉΓòÉΓòÉ 8.2.3. Header File ΓòÉΓòÉΓòÉ
  16007.  
  16008. The equality collection class is declared in the header file iaequal.h. 
  16009.  
  16010.  
  16011. ΓòÉΓòÉΓòÉ 8.2.4. Members ΓòÉΓòÉΓòÉ
  16012.  
  16013. The equality collection class defines the following member functions, described 
  16014. in Introduction to Flat Collections, as virtual functions: 
  16015.  
  16016.      Destructor 
  16017.      contains 
  16018.      containsAllFrom 
  16019.      locate 
  16020.      locateNext 
  16021.      locateOrAdd 
  16022.      numberOfOccurrences 
  16023.      remove 
  16024.      removeAllOccurrences 
  16025.  
  16026.  
  16027. ΓòÉΓòÉΓòÉ 8.3. Equality Key Collection ΓòÉΓòÉΓòÉ
  16028.  
  16029. Description 
  16030.  
  16031. Derivation 
  16032.  
  16033. Variants/Header Files 
  16034.  
  16035. Members 
  16036.  
  16037. To close all the panels in a chapter, double-click on this panel's system menu. 
  16038.  
  16039.  
  16040. ΓòÉΓòÉΓòÉ 8.3.1. Class Description - Equality Key Collection ΓòÉΓòÉΓòÉ
  16041.  
  16042. Because equality key collection is an abstract class, it cannot be used to 
  16043. create any objects. It defines the interfaces for the following properties: 
  16044.  
  16045.      Element equality 
  16046.      Key equality 
  16047.  
  16048.  
  16049. ΓòÉΓòÉΓòÉ 8.3.2. Derivation ΓòÉΓòÉΓòÉ
  16050.  
  16051.           Collection 
  16052.  
  16053.   Equality Collection      Key Collection
  16054.         Equality Key Collection
  16055.  
  16056. Equality key sorted collection is an abstract class that is derived from 
  16057. equality key collection. The following concrete classes are defined by equality 
  16058. key collection: 
  16059.  
  16060.      Map 
  16061.      Relation 
  16062.  
  16063.  The Abstract Class Hierarchy shows the relationship of equality key collection 
  16064.  to the whole class hierarchy. 
  16065.  
  16066.  
  16067. ΓòÉΓòÉΓòÉ 8.3.3. Header File ΓòÉΓòÉΓòÉ
  16068.  
  16069. The equality key collection class is declared in the header file iaeqkey.h. 
  16070.  
  16071.  
  16072. ΓòÉΓòÉΓòÉ 8.3.4. Members ΓòÉΓòÉΓòÉ
  16073.  
  16074. All the members of equality key sorted collection are inherited from its base 
  16075. classes. 
  16076.  
  16077.  
  16078. ΓòÉΓòÉΓòÉ 8.4. Equality Key Sorted Collection ΓòÉΓòÉΓòÉ
  16079.  
  16080. Description 
  16081.  
  16082. Derivation 
  16083.  
  16084. Variants/Header Files 
  16085.  
  16086. Members 
  16087.  
  16088. To close all the panels in a chapter, double-click on this panel's system menu. 
  16089.  
  16090.  
  16091. ΓòÉΓòÉΓòÉ 8.4.1. Class Description - Equality Key Sorted Collection ΓòÉΓòÉΓòÉ
  16092.  
  16093. Equality key sorted collection is an abstract class that defines the interfaces 
  16094. for the following properties: 
  16095.  
  16096.      Element equality 
  16097.      Key equality 
  16098.      Sorted elements 
  16099.  
  16100.  Because equality key sorted collection is an abstract class, it cannot be used 
  16101.  to create any objects. 
  16102.  
  16103.  
  16104. ΓòÉΓòÉΓòÉ 8.4.2. Derivation ΓòÉΓòÉΓòÉ
  16105.  
  16106. Equality key sorted collection is derived from the following three abstract 
  16107. classes: 
  16108.  
  16109.      Key sorted collection 
  16110.      Equality sorted collection 
  16111.      Equality key sorted collection 
  16112.  
  16113.  For information on the bases of these classes, see the figure "Abstract Class 
  16114.  Hierarchy" in section Abstract Classes. 
  16115.  
  16116.  The following concrete classes are defined by equality key sorted collection: 
  16117.  
  16118.      Sorted map 
  16119.      Sorted relation 
  16120.  
  16121.  The Abstract Class Hierarchy shows the relationship of equality key sorted 
  16122.  collection to the class hierarchy. 
  16123.  
  16124.  
  16125. ΓòÉΓòÉΓòÉ 8.4.3. Header File ΓòÉΓòÉΓòÉ
  16126.  
  16127. The equality key sorted collection class is declared in the header file 
  16128.  
  16129. iaeqksrt.h. 
  16130.  
  16131.  
  16132. ΓòÉΓòÉΓòÉ 8.4.4. Members ΓòÉΓòÉΓòÉ
  16133.  
  16134. All the members of equality key sorted collection are inherited from its base 
  16135. classes. 
  16136.  
  16137.  
  16138. ΓòÉΓòÉΓòÉ 8.5. Equality Sorted Collection ΓòÉΓòÉΓòÉ
  16139.  
  16140. Description 
  16141.  
  16142. Derivation 
  16143.  
  16144. Variants/Header Files 
  16145.  
  16146. Members 
  16147.  
  16148. To close all the panels in a chapter, double-click on this panel's system menu. 
  16149.  
  16150.  
  16151. ΓòÉΓòÉΓòÉ 8.5.1. Class Description - Equality Sorted Collection ΓòÉΓòÉΓòÉ
  16152.  
  16153. Because equality sorted collection is an abstract class, it cannot be used to 
  16154. create any objects. It defines the interfaces for the following properties: 
  16155.  
  16156.      Element equality 
  16157.      Sorted elements 
  16158.  
  16159.  
  16160. ΓòÉΓòÉΓòÉ 8.5.2. Derivation ΓòÉΓòÉΓòÉ
  16161.  
  16162.             Collection 
  16163.  
  16164.                   Ordered Collection
  16165.   Equality Collection      Sorted Collection
  16166.        Equality Sorted Collection
  16167.  
  16168. Equality key sorted collection is an abstract class that is derived from 
  16169. equality sorted collection. The following concrete classes are defined by 
  16170. equality sorted collection: 
  16171.  
  16172.      Sorted set 
  16173.      Sorted bag 
  16174.  
  16175.  The Abstract Class Hierarchy shows the relationship of equality sorted 
  16176.  collection to the class hierarchy. 
  16177.  
  16178.  
  16179. ΓòÉΓòÉΓòÉ 8.5.3. Header File ΓòÉΓòÉΓòÉ
  16180.  
  16181. The equality sorted collection class is declared in the header file iaeqsrt.h. 
  16182.  
  16183.  
  16184. ΓòÉΓòÉΓòÉ 8.5.4. Members ΓòÉΓòÉΓòÉ
  16185.  
  16186. All members of equality sorted collection are inherited from its base classes. 
  16187.  
  16188.  
  16189. ΓòÉΓòÉΓòÉ 8.6. Key Collection ΓòÉΓòÉΓòÉ
  16190.  
  16191. Description 
  16192.  
  16193. Derivation 
  16194.  
  16195. Variants/Header Files 
  16196.  
  16197. Members 
  16198.  
  16199. To close all the panels in a chapter, double-click on this panel's system menu. 
  16200.  
  16201.  
  16202. ΓòÉΓòÉΓòÉ 8.6.1. Class Description - Key Collection ΓòÉΓòÉΓòÉ
  16203.  
  16204. Because key collection is an abstract class, it cannot be used to create any 
  16205. objects. The key collection inherits from collection and defines the interfaces 
  16206. for the key property. 
  16207.  
  16208.  
  16209. ΓòÉΓòÉΓòÉ 8.6.2. Derivation ΓòÉΓòÉΓòÉ
  16210.  
  16211. Collection 
  16212.  
  16213.   Key Collection
  16214.  
  16215. The following abstract classes are derived from key collection: 
  16216.  
  16217.      Equality key collection 
  16218.      Key sorted collection 
  16219.  
  16220.  The following concrete classes are defined by key collection: 
  16221.  
  16222.      Key set 
  16223.      Key bag 
  16224.  
  16225.  The Abstract Class Hierarchy shows the relationship of key collection to the 
  16226.  class hierarchy. 
  16227.  
  16228.  
  16229. ΓòÉΓòÉΓòÉ 8.6.3. Header File ΓòÉΓòÉΓòÉ
  16230.  
  16231. The key collection class is declared in the header file iakey.h. 
  16232.  
  16233.  
  16234. ΓòÉΓòÉΓòÉ 8.6.4. Members ΓòÉΓòÉΓòÉ
  16235.  
  16236. The key collection class defines the following member functions, described in 
  16237. Introduction to Flat Collections, as virtual functions: 
  16238.  
  16239.      Destructor 
  16240.      addOrReplaceElementWithKey 
  16241.      containsAllKeysFrom 
  16242.      containsElementWithKey 
  16243.      elementWithKey 
  16244.      key 
  16245.      locateElementWithKey 
  16246.      locateNextElementWithKey 
  16247.      locateOrAddElementWithKey 
  16248.      numberOfDifferentKeys 
  16249.      numberOfElementsWithKey 
  16250.      removeAllElementsWithKey 
  16251.      removeElementWithKey 
  16252.      replaceElementWithKey 
  16253.      setToNextWithDifferentKey 
  16254.  
  16255.  
  16256. ΓòÉΓòÉΓòÉ 8.7. Key Sorted Collection ΓòÉΓòÉΓòÉ
  16257.  
  16258. Description 
  16259.  
  16260. Derivation 
  16261.  
  16262. Variants/Header Files 
  16263.  
  16264. Members 
  16265.  
  16266. To close all the panels in a chapter, double-click on this panel's system menu. 
  16267.  
  16268.  
  16269. ΓòÉΓòÉΓòÉ 8.7.1. Class Description - Key Sorted Collection ΓòÉΓòÉΓòÉ
  16270.  
  16271. Because key sorted collection is an abstract class, it cannot be used to create 
  16272. any objects. The key sorted collection inherits from sorted collection and key 
  16273. collection. It defines the interfaces for the following properties: 
  16274.  
  16275.      Key equality 
  16276.      Sorted elements 
  16277.  
  16278.  
  16279. ΓòÉΓòÉΓòÉ 8.7.2. Derivation ΓòÉΓòÉΓòÉ
  16280.  
  16281.           Collection 
  16282.  
  16283.               Ordered Collection
  16284.   Key Collection    Sorted Collection
  16285.        Key Sorted Collection
  16286.  
  16287. The equality key sorted collection is an abstract class that is derived from 
  16288. key sorted collection. The following concrete classes are defined by key sorted 
  16289. collection: 
  16290.  
  16291.      Key sorted set 
  16292.      Key sorted bag 
  16293.  
  16294.  The Abstract Class Hierarchy shows the relationship of key sorted collection 
  16295.  to the class hierarchy. 
  16296.  
  16297.  
  16298. ΓòÉΓòÉΓòÉ 8.7.3. Header File ΓòÉΓòÉΓòÉ
  16299.  
  16300. The key sorted collection class is declared in the header file iaksrt.h. 
  16301.  
  16302.  
  16303. ΓòÉΓòÉΓòÉ 8.7.4. Members ΓòÉΓòÉΓòÉ
  16304.  
  16305. The key sorted collection class inherits all member functions from its base 
  16306. classes. 
  16307.  
  16308.  
  16309. ΓòÉΓòÉΓòÉ 8.8. Ordered Collection ΓòÉΓòÉΓòÉ
  16310.  
  16311. Description 
  16312.  
  16313. Derivation 
  16314.  
  16315. Variants/Header Files 
  16316.  
  16317. Members 
  16318.  
  16319. To close all the panels in a chapter, double-click on this panel's system menu. 
  16320.  
  16321.  
  16322. ΓòÉΓòÉΓòÉ 8.8.1. Class Description - Ordered Collection ΓòÉΓòÉΓòÉ
  16323.  
  16324. Because ordered collection is an abstract class, it cannot be used to create 
  16325. any objects. The ordered collection defines the interfaces for the property of 
  16326. ordered elements. 
  16327.  
  16328.  
  16329. ΓòÉΓòÉΓòÉ 8.8.2. Derivation ΓòÉΓòÉΓòÉ
  16330.  
  16331. Collection 
  16332.  
  16333.   Ordered Collection
  16334.  
  16335. The following abstract classes are derived from ordered collection: 
  16336.  
  16337.      Sorted collection 
  16338.      Sequential collection 
  16339.  
  16340.  The Abstract Class Hierarchy shows the relationship of ordered collection to 
  16341.  the class hierarchy. 
  16342.  
  16343.  
  16344. ΓòÉΓòÉΓòÉ 8.8.3. Header File ΓòÉΓòÉΓòÉ
  16345.  
  16346. The ordered collection class is declared in the header file iaorder.h. 
  16347.  
  16348.  
  16349. ΓòÉΓòÉΓòÉ 8.8.4. Members ΓòÉΓòÉΓòÉ
  16350.  
  16351. The ordered collection class defines the following member functions, described 
  16352. in  Introduction to Flat Collections, as pure virtual functions: 
  16353.  
  16354.      Destructor 
  16355.      elementAtPosition 
  16356.      firstElement 
  16357.      isFirst 
  16358.      isLast 
  16359.      lastElement 
  16360.      positionAt 
  16361.      removeAtPosition 
  16362.      removeFirst 
  16363.      removeLast 
  16364.      setToLast 
  16365.      setToPosition 
  16366.      setToPrevious 
  16367.  
  16368.  
  16369. ΓòÉΓòÉΓòÉ 8.9. Sequential Collection ΓòÉΓòÉΓòÉ
  16370.  
  16371. Description 
  16372.  
  16373. Derivation 
  16374.  
  16375. Variants/Header Files 
  16376.  
  16377. Members 
  16378.  
  16379. To close all the panels in a chapter, double-click on this panel's system menu. 
  16380.  
  16381.  
  16382. ΓòÉΓòÉΓòÉ 8.9.1. Class Description - Sequential Collection ΓòÉΓòÉΓòÉ
  16383.  
  16384. Because sequential collection is an abstract class, it cannot be used to create 
  16385. any objects. The sequential collection inherits from ordered collection and 
  16386. defines the interfaces for the properties of ordered elements. 
  16387.  
  16388.  
  16389. ΓòÉΓòÉΓòÉ 8.9.2. Derivation ΓòÉΓòÉΓòÉ
  16390.  
  16391. Collection 
  16392.  
  16393.   Ordered Collection
  16394.    Sequential Collection
  16395.  
  16396. The following concrete classes are defined by sequential collection: 
  16397.  
  16398.      Sequence 
  16399.      Equality sequence 
  16400.  
  16401.  The Abstract Class Hierarchy shows the relationship of sequential collection 
  16402.  to the class hierarchy. 
  16403.  
  16404.  
  16405. ΓòÉΓòÉΓòÉ 8.9.3. Header File ΓòÉΓòÉΓòÉ
  16406.  
  16407. The sequential collection class is declared in the header file iasqntl.h. 
  16408.  
  16409.  
  16410. ΓòÉΓòÉΓòÉ 8.9.4. Members ΓòÉΓòÉΓòÉ
  16411.  
  16412. Sequential collection defines the following member functions as pure virtual 
  16413. functions: 
  16414.  
  16415.      Destructor 
  16416.      operator= 
  16417.      add 
  16418.      addAllFrom 
  16419.      addAsFirst 
  16420.      addAsLast 
  16421.      addAsNext 
  16422.      addAsPrevious 
  16423.      addAtPosition 
  16424.      allElementsDo 
  16425.      anyElement 
  16426.      compare 
  16427.      elementAt 
  16428.      elementAtPosition 
  16429.      firstElement 
  16430.      isBounded 
  16431.      isEmpty 
  16432.      isFirst 
  16433.      isFull 
  16434.      isLast 
  16435.      lastElement 
  16436.      maxNumberOfElements 
  16437.      newCursor 
  16438.      positionAt 
  16439.      removeAll 
  16440.      removeAt 
  16441.      removeAtPosition 
  16442.      removeFirst 
  16443.      removeLast 
  16444.      replaceAt 
  16445.      setToFirst 
  16446.      setToLast 
  16447.      setToNext 
  16448.      setToPosition 
  16449.      setToPrevious 
  16450.      sort 
  16451.  
  16452.  
  16453. ΓòÉΓòÉΓòÉ 8.10. Sorted Collection ΓòÉΓòÉΓòÉ
  16454.  
  16455. Description 
  16456.  
  16457. Derivation 
  16458.  
  16459. Variants/Header Files 
  16460.  
  16461. Members 
  16462.  
  16463. Examples 
  16464.  
  16465. To close all the panels in a chapter, double-click on this panel's system menu. 
  16466.  
  16467.  
  16468. ΓòÉΓòÉΓòÉ 8.10.1. Class Description - Sorted Collection ΓòÉΓòÉΓòÉ
  16469.  
  16470. Because sorted collection is an abstract class, it cannot be used to create any 
  16471. objects. The sorted collection inherits from ordered collection and defines the 
  16472. interfaces for the properties of sorted elements. 
  16473.  
  16474.  
  16475. ΓòÉΓòÉΓòÉ 8.10.2. Derivation ΓòÉΓòÉΓòÉ
  16476.  
  16477. Collection 
  16478.  
  16479.   Ordered Collection
  16480.    Sorted Collection
  16481.  
  16482. The following abstract classes are derived from sorted collection: 
  16483.  
  16484.      Equality sorted collection 
  16485.      Key sorted collection 
  16486.  
  16487.  The Abstract Class Hierarchy shows the relationship of sorted collection to 
  16488.  the class hierarchy. 
  16489.  
  16490.  
  16491. ΓòÉΓòÉΓòÉ 8.10.3. Header File ΓòÉΓòÉΓòÉ
  16492.  
  16493. The sorted collection class is declared in the header file iasrt.h. 
  16494.  
  16495.  
  16496. ΓòÉΓòÉΓòÉ 8.10.4. Members ΓòÉΓòÉΓòÉ
  16497.  
  16498. The sorted collection class inherits all its members from its bases. 
  16499.  
  16500.  
  16501. ΓòÉΓòÉΓòÉ 8.11. Header Files for Collection Class Library Coding Examples ΓòÉΓòÉΓòÉ
  16502.  
  16503. This appendix contains edited header files used by some coding examples found 
  16504. in this book.  The following header files are shown: 
  16505.  
  16506.       animal.h 
  16507.       circle.h 
  16508.       curve.h 
  16509.       demoelem.h 
  16510.       dsur.h 
  16511.       graph.h 
  16512.       line.h 
  16513.       parcel.h 
  16514.       planet.h 
  16515.       toyword.h 
  16516.       transelm.h 
  16517.       trmapops.h 
  16518.       xebc2asc.h 
  16519.  
  16520.  These header files can be found in ...\ibmclass\samples\iclcc. Some comments 
  16521.  and white space have been removed. 
  16522.  
  16523.  
  16524. ΓòÉΓòÉΓòÉ 8.11.1. animal.h ΓòÉΓòÉΓòÉ
  16525.  
  16526. // animal.h  -  Class Animal for use with the example animals.C
  16527.  
  16528.   #include <iglobals.h>           // For definition of Boolean
  16529.   #include <istring.hpp>          // Class IString
  16530.   #include <iostream.h>
  16531.  
  16532. class Animal {
  16533.   IString nm;
  16534.   IString attr;
  16535.  
  16536. public:
  16537.  
  16538.   Animal(IString n, IString a) : nm(n), attr(a)  {}
  16539.  
  16540.   // For copy constructor we use the compiler generated default.
  16541.   // For assignment we use the compiler generated default.
  16542.  
  16543.   IBoolean operator==(Animal const& p) const  {
  16544.      return  ((nm == p.name()) && (attr == p.attribute()));
  16545.   }
  16546.  
  16547.   IString const& name() const {
  16548.      return nm;
  16549.   }
  16550.  
  16551.   IString const& attribute() const {
  16552.      return attr;
  16553.   }
  16554.  
  16555.   friend ostream& operator<<(ostream& os, Animal const& p)  {
  16556.      return os << "The " << p.name() << " is " << p.attribute()
  16557.      << "." << endl;
  16558.   }
  16559.  
  16560. };
  16561.  
  16562.   // Key access:
  16563. inline IString const& key(Animal const& p)  {
  16564.   return p.name();
  16565. }
  16566.  
  16567.   // We need a hash function for the key type as well.
  16568.   // Let's just use the default provided for IString.
  16569. inline unsigned long hash(Animal const& animal, unsigned long n) {
  16570.   return hash(animal.name(), n);
  16571. }
  16572.  
  16573.  
  16574. ΓòÉΓòÉΓòÉ 8.11.2. circle.h ΓòÉΓòÉΓòÉ
  16575.  
  16576. // circle.h
  16577.  
  16578. #include <istring.hpp>
  16579.  
  16580. class Circle : public Graphics {
  16581. public:
  16582.   float ivXCenter;
  16583.   float ivYCenter;
  16584.   float ivRadius;
  16585.  
  16586.   Circle(int graphicsKey, IString id ,
  16587.          double xCenter, double yCenter,
  16588.          double radius)
  16589.                           : Graphics(graphicsKey, id),
  16590.                             ivXCenter(xCenter),
  16591.                             ivYCenter(yCenter),
  16592.                             ivRadius(radius) { }
  16593.  
  16594.   IBoolean operator== (Circle const& circle) const {
  16595.      return (this->ivXCenter == circle.ivXCenter &&
  16596.              this->ivYCenter == circle.ivYCenter &&
  16597.              this->ivRadius == circle.ivRadius);
  16598.     }
  16599.  
  16600.  
  16601.   void          draw() const {
  16602.      cout << "drawing "
  16603.           << Graphics::id() << endl
  16604.           << "with center: "
  16605.           << "(" << this->ivXCenter << "|"
  16606.           << this->ivYCenter << ")"
  16607.           << " and with radius: "
  16608.           << this->ivRadius << endl;
  16609.     }
  16610.  
  16611.   void          circumference() const {
  16612.      cout << "The circumference of "
  16613.           << Graphics::id() << " is: "
  16614.           << ((this->ivRadius)*2*3.14) << endl;
  16615.     }
  16616. };
  16617.  
  16618.  
  16619. ΓòÉΓòÉΓòÉ 8.11.3. curve.h ΓòÉΓòÉΓòÉ
  16620.  
  16621. // curve.h
  16622.  
  16623. #include <istring.hpp>
  16624.  
  16625. class Curve : public Graphics {
  16626. public:
  16627.  
  16628.   float ivXStart, ivYStart;
  16629.   float ivXFix1, ivYFix1;
  16630.   float ivXFix2, ivYFix2;
  16631.   float ivXFix3, ivYFix3;
  16632.   float ivXEnd,  ivYEnd;
  16633.  
  16634.   Curve(int graphicsKey, IString id,
  16635.         float xstart, float ystart,
  16636.         float xfix1, float yfix1,
  16637.         float xfix2, float yfix2,
  16638.         float xfix3, float yfix3,
  16639.         float xend, float yend)  :
  16640.   Graphics(graphicsKey, id),
  16641.   ivXStart(xstart), ivYStart(ystart),
  16642.   ivXFix1(xfix1),   ivYFix1(yfix1),
  16643.   ivXFix2(xfix2),   ivYFix2(yfix2),
  16644.   ivXFix3(xfix3),   ivYFix3(yfix3),
  16645.   ivXEnd(xend),     ivYEnd(yend) { }
  16646.  
  16647.   IBoolean operator== (Curve const& curve) const {
  16648.      return (this->ivXStart == curve.ivXStart &&
  16649.              this->ivYStart == curve.ivYStart &&
  16650.              this->ivXFix1  == curve.ivXFix1  &&
  16651.              this->ivYFix1  == curve.ivYFix1  &&
  16652.              this->ivXFix2  == curve.ivXFix2  &&
  16653.              this->ivYFix2  == curve.ivYFix2  &&
  16654.              this->ivXFix3  == curve.ivXFix3  &&
  16655.              this->ivYFix3  == curve.ivYFix3  &&
  16656.              this->ivXEnd   == curve.ivXEnd   &&
  16657.              this->ivYEnd   == curve.ivYEnd);
  16658.     }
  16659.  
  16660.   void           draw() const {
  16661.      cout << "drawing " << Graphics::id()
  16662.           << "\nwith starting point: "
  16663.           << "(" << this->ivXStart << "|"
  16664.           << this->ivYStart << ")"
  16665.           << " and with fix points: "
  16666.           << "(" << this->ivXFix1 << "|" << this->ivYFix1 << ")"
  16667.           << "(" << this->ivXFix2 << "|" << this->ivYFix2 << ")"
  16668.           << "(" << this->ivXFix3 << "|" << this->ivYFix3 << ")\n"
  16669.           << "and with ending point: "
  16670.           << "(" << this->ivXEnd << "|" << this->ivYEnd << ")"
  16671.           << endl;
  16672.     }
  16673.  
  16674.   void           lengthOfCurve() const {
  16675.      cout << "Length of "
  16676.           << Graphics::id()
  16677.           << " is: "
  16678.           << (sqrt(pow(((this->ivXFix1) - (this->ivXStart)),2)
  16679.                  + pow(((this->ivYFix1) - (this->ivYStart)),2))
  16680.             + sqrt(pow(((this->ivXFix2) - (this->ivXFix1)),2)
  16681.                  + pow(((this->ivYFix2) - (this->ivYFix1)),2))
  16682.             + sqrt(pow(((this->ivXFix3) - (this->ivXFix2)),2)
  16683.                  + pow(((this->ivYFix3) - (this->ivYFix2)),2))
  16684.             + sqrt(pow(((this->ivXEnd) -  (this->ivXFix3)),2)
  16685.                  + pow(((this->ivYEnd) - (this->ivYFix3)),2)))
  16686.           << endl;
  16687.     }
  16688. };
  16689.  
  16690.  
  16691. ΓòÉΓòÉΓòÉ 8.11.4. demoelem.h ΓòÉΓòÉΓòÉ
  16692.  
  16693. // demoelem.h  -  DemoElement for use with Key Collections
  16694. #ifndef _DEMOELEM_H
  16695. #define _DEMOELEM_H
  16696.  
  16697. #include <stdlib.h>
  16698. #include <iglobals.h>
  16699. #include <iostream.h>
  16700. #include <istdops.h>
  16701.  
  16702. class DemoElement {
  16703.   int i, j;
  16704.  
  16705. public:
  16706.            DemoElement () : i(0), j(0) {}
  16707.            DemoElement (int i,int j) : i (i), j(j) {}
  16708.            operator int () const { return i; }
  16709.  
  16710.   IBoolean operator == (DemoElement const& k) const
  16711.            { return i == k.i && j == k.j; }
  16712.  
  16713.   IBoolean operator < (DemoElement const& k) const
  16714.            { return i < k.i || (i == k.i && j < k.j); }
  16715.  
  16716.   friend unsigned long hash (DemoElement const& k, unsigned long n)
  16717.            { return k.i % n; }
  16718.  
  16719.   int const & geti () const { return i; }
  16720.   int const & getj () const { return j; }
  16721. };
  16722.  
  16723. inline ostream & operator << (ostream &sout, DemoElement const& e)
  16724. { sout << e.geti () << "," << e.getj ();
  16725.   return sout;
  16726. }
  16727.  
  16728. inline int const& key (DemoElement const& k) { return k.geti (); }
  16729.  
  16730. // NOTE: You must return a const & in the key function!  Otherwise the
  16731. // standard element operations will return a reference to a temporary.
  16732. // This would lead to incorrect behavior of the collection operations.
  16733.  
  16734. // The key function must be declared in the header file of
  16735. // the collection's element type.
  16736.  
  16737. // If either of these is not possible or is undesirable,
  16738. // an element operations class must be used.
  16739. #endif
  16740.  
  16741.  
  16742. ΓòÉΓòÉΓòÉ 8.11.5. dsur.h ΓòÉΓòÉΓòÉ
  16743.  
  16744. // dsur.h  -  Class for Disk Space Usage Records
  16745. //            Used by Sorted Map and Sorted Relation example
  16746.   #include <fstream.h>
  16747.   #include <string.h>
  16748.   #include <iglobals.h>
  16749.   const int bufSize = 62;
  16750.  
  16751.   class DiskSpaceUR    {
  16752.      int       blocks;
  16753.      char*     name;
  16754.  
  16755.    public:
  16756.      DiskSpaceUR() {}
  16757.      DiskSpaceUR (DiskSpaceUR const& dsur)  { init(dsur); }
  16758.      void operator= (DiskSpaceUR const& dsur)   {
  16759.        deInit();
  16760.        init(dsur);
  16761.      }
  16762.  
  16763.      DiskSpaceUR (istream& DSURfile) { DSURfile >> *this; }
  16764.      ~DiskSpaceUR () { deInit(); }
  16765.  
  16766.      IBoolean operator == (DiskSpaceUR const& dsur) const  {
  16767.        return (blocks == dsur.blocks)
  16768.            && strcmp (name, dsur.name) == 0;
  16769.      }
  16770.  
  16771.  
  16772.      friend istream& operator >> (istream& DSURfile,
  16773.                                   DiskSpaceUR& dsur)     {
  16774.          DSURfile >> dsur.blocks;
  16775.  
  16776.          char temp[bufSize];
  16777.          DSURfile.get(temp, bufSize);
  16778.  
  16779.          if (DSURfile.good())  {
  16780.                                 // Remove leading tabs and blanks
  16781.             for (int cnt=0;
  16782.                  (temp[cnt] == '\t') || (temp[cnt] == ' ');
  16783.                  cnt++) {}
  16784.             dsur.name = new char[strlen(temp+cnt)+1];
  16785.             strcpy(dsur.name, temp+cnt);
  16786.          }
  16787.          else   {
  16788.             dsur.setInvalid();
  16789.             dsur.name = new char[1];
  16790.             dsur.name[0] = '\0';
  16791.          }
  16792.  
  16793.          return DSURfile;
  16794.      }
  16795.  
  16796.      friend ostream& operator << (ostream& outstream,
  16797.                                   DiskSpaceUR& dsur)     {
  16798.          outstream.width(bufSize);
  16799.          outstream.setf(ios::left, ios::adjustfield);
  16800.          outstream << dsur.name;
  16801.  
  16802.          outstream.width(9);
  16803.          outstream.setf(ios::right, ios::adjustfield);
  16804.          outstream << dsur.blocks;
  16805.  
  16806.          return outstream;
  16807.      }
  16808.  
  16809.      inline int const& space () const {return blocks;}
  16810.      inline char* const& id () const {return name;}
  16811.      inline IBoolean isValid () const {return (blocks > 0);}
  16812.  
  16813.    protected:
  16814.  
  16815.      inline void init (DiskSpaceUR const& dsur)     {
  16816.         blocks = dsur.blocks;
  16817.         name = new char[strlen(dsur.name) + 1];
  16818.         strcpy(name, dsur.name);
  16819.      }
  16820.  
  16821.      inline void deInit() {  delete[] name;  }
  16822.      inline void setInvalid () { blocks = -1;}
  16823.   };
  16824.  
  16825.  
  16826.      // Key access on name
  16827.   inline  char* const& key (DiskSpaceUR const& dsur)  {
  16828.      return dsur.id();
  16829.   }
  16830.  
  16831.      // Key access on space used
  16832.      // Since we can not have two key functions with same args
  16833.      // in global name space, we need to use an operations class.
  16834.   #include <istdops.h>
  16835.      // We can inherit all from the default operations class
  16836.      // and then define just the key access function ourselves.
  16837.      // We cannot use StdKeyOps here, because they in turn
  16838.      // use the key function in global name space, which is
  16839.      // already defined for keys of type char* above.
  16840.   class DSURBySpaceOps :  public IStdMemOps,
  16841.                           public IStdAsOps< DiskSpaceUR >,
  16842.                           public IStdEqOps< DiskSpaceUR >    {
  16843.     public:
  16844.        IStdCmpOps < int > keyOps;
  16845.  
  16846.      // Key Access
  16847.        int const& key (DiskSpaceUR const& dsur) const
  16848.        { return dsur.space(); }
  16849.   };
  16850.  
  16851.  
  16852. ΓòÉΓòÉΓòÉ 8.11.6. graph.h ΓòÉΓòÉΓòÉ
  16853.  
  16854. #include <istring.hpp>
  16855. #include <iostream.h>
  16856.  
  16857. class Graphics {
  16858. protected:
  16859.   IString ivId;    //*** graphics ID ****/
  16860.   int     ivKey;   //*** graphics key ****/
  16861.  
  16862. public:
  16863.   Graphics (int graphicsKey, IString id) : ivKey(graphicsKey),
  16864.                                            ivId(id) { }
  16865.  
  16866.   ~Graphics() {
  16867.      cout << this->ivId  << " will now be deleted ... "  << endl;
  16868.     }
  16869.  
  16870.   IBoolean operator== (Graphics const& graphics) const {
  16871.      return (this->ivId == graphics.ivId);
  16872.     }
  16873.  
  16874.   IString const& id() const   { return ivId; }
  16875.  
  16876.   virtual void draw() const =0;
  16877.  
  16878.   /**** This member function returns the graphic's key ****/
  16879.   /*    Note that we are returning the int by reference,  */
  16880.   /*    because this member function will be used by the  */
  16881.   /*    key(...) function, which must return a reference. */
  16882.   /********************************************************/
  16883.   int const& graphicsKey() const {
  16884.      return ivKey;
  16885.     }
  16886. };
  16887.  
  16888. /****************       key function       *********************/
  16889. /****   note that this interface must always be used with:  ****/
  16890. /****              Keytype const& key(....)                 ****/
  16891. /****   We are providing this key function for the element  ****/
  16892. /****   type Graphics  and not for the managed pointer.     ****/
  16893. /***************************************************************/
  16894.   inline int const& key (Graphics const& graphics) {
  16895.      return graphics.graphicsKey();
  16896.     }
  16897.  
  16898.  
  16899. ΓòÉΓòÉΓòÉ 8.11.7. line.h ΓòÉΓòÉΓòÉ
  16900.  
  16901. #include <istring.hpp>
  16902. #include <math.h>
  16903.  
  16904. class Line : public Graphics {
  16905. public:
  16906.  
  16907.   double ivXStart, ivYStart;
  16908.   double ivXEnd, ivYEnd;
  16909.  
  16910.   Line(int graphicsKey, IString id, double xstart, double ystart,
  16911.                                     double xend,   double yend) :
  16912.  
  16913.      Graphics(graphicsKey, id),
  16914.      ivXStart(xstart), ivYStart(ystart),
  16915.      ivXEnd(xend), ivYEnd(yend) { }
  16916.  
  16917.   IBoolean operator== (Line const& line) const {
  16918.      return (this->ivXStart == line.ivXStart &&
  16919.              this->ivYStart == line.ivYStart &&
  16920.              this->ivXEnd == line.ivXEnd &&
  16921.              this->ivYEnd == line.ivYEnd);
  16922.     }
  16923.  
  16924.   void           draw() const {
  16925.      cout << "drawing " << Graphics::id() << endl
  16926.           << "with starting point: "
  16927.           << "(" << this->ivXStart << "|" << this->ivYStart << ")"
  16928.           << " and with ending point: "
  16929.           << "(" << this->ivXEnd   << "|" << this->ivYEnd << ")" << endl;
  16930.     }
  16931.  
  16932.   void           lengthOfLine() const {
  16933.      cout << "The length of line " << Graphics::id() << " is: "
  16934.           << sqrt(pow(((this->ivXEnd) - (this->ivXStart)),2)
  16935.                 + pow(((this->ivYEnd) - (this->ivYStart)),2))
  16936.           << endl;
  16937.     }
  16938. };
  16939.  
  16940.  
  16941. ΓòÉΓòÉΓòÉ 8.11.8. parcel.h ΓòÉΓòÉΓòÉ
  16942.  
  16943. // parcel.h  -  Class Parcel and its parts for use with the
  16944. //              example for Key Sorted Set and Heap.
  16945. #include <iostream.h>
  16946.  
  16947.                         // For definition of Boolean:
  16948. #include <iglobals.h>
  16949.                         // Class IString:
  16950. #include <istring.hpp>
  16951.  
  16952. class PlaceTime {
  16953.  
  16954.   IString cty;
  16955.   int   daynum;  // Keeping it simple:  January 9 is day 9
  16956.  
  16957. public:
  16958.   PlaceTime(IString acity, int aday) : cty(acity), daynum(aday) {}
  16959.   PlaceTime(IString acity) : cty(acity) {daynum = 0;}
  16960.   IString const& city() const { return cty; }
  16961.   int const& day() const { return daynum; }
  16962.   void operator=(PlaceTime const& pt) {
  16963.       cty = pt.cty;
  16964.       daynum = pt.daynum;
  16965.   }
  16966.  
  16967.   IBoolean operator==(PlaceTime const& pt)  const {
  16968.      return ( (cty == pt.cty)
  16969.            && (daynum == pt.daynum) );
  16970.   }
  16971. };
  16972.  
  16973.  
  16974. class Parcel {
  16975.   PlaceTime org, lstAr;
  16976.   IString dst, id;
  16977.  
  16978. public:
  16979.  
  16980.   Parcel(IString orig,  IString dest, int day, IString ident)
  16981.      :  org(orig, day),  lstAr(orig, day),  dst(dest), id(ident) {}
  16982.  
  16983.   void arrivedAt(IString const& acity, int const& day) {
  16984.      PlaceTime nowAt(acity, day);
  16985.                               // Only if not already there before
  16986.      if (nowAt.city() != lstAr.city())
  16987.         lstAr = nowAt;
  16988.   }
  16989.  
  16990.   void wasDelivered(int const& day) {arrivedAt(dst, day);  }
  16991.   PlaceTime const& origin() const { return org; }
  16992.   IString const& destination() const { return dst; }
  16993.   PlaceTime const& lastArrival() const { return lstAr; }
  16994.   IString const& ID() const { return id; }
  16995.  
  16996.   friend ostream& operator<<(ostream& os, Parcel const& p) {
  16997.     os << p.id << ": From " << p.org.city()
  16998.        << "(day "  << p.org.day() << ") to " << p.dst;
  16999.  
  17000.     if (p.lstAr.city() != p.dst) {
  17001.        os << endl << "            is at " << p.lstAr.city()
  17002.           << "  since day " << p.lstAr.day() << ".";
  17003.     }
  17004.     else {
  17005.        os << endl << "            was delivered on day "
  17006.           << p.lstAr.day() << ".";
  17007.     }
  17008.     return os;
  17009.   }
  17010. };
  17011.  
  17012.                         // Key access:
  17013.   inline  IString const& key( Parcel const&  p) { return p.ID(); }
  17014.                         // We need a compare function for the key.
  17015.                         // Let's use the default provided for IString:
  17016.   inline long compare(Parcel const& p1, Parcel const& p2) {
  17017.      return compare(p1.ID(), p2.ID());
  17018.   }
  17019.  
  17020.  
  17021. ΓòÉΓòÉΓòÉ 8.11.9. planet.h ΓòÉΓòÉΓòÉ
  17022.  
  17023. // planet.h  -  Class Planet for use in our Sorted Set example
  17024.  
  17025. class Planet   {
  17026.  private:
  17027.    char* plname;
  17028.    float dist, mass, bright;
  17029.  
  17030.  public:
  17031.      // Use the compiler generated default for the copy constructor
  17032.  
  17033.    Planet(char* aname, float adist, float amass, float abright) :
  17034.      plname(aname), dist(adist),  mass(amass), bright(abright) {}
  17035.  
  17036.      // For any Set we need to provide element equality.
  17037.    IBoolean operator== (Planet const& aPlanet) const
  17038.       { return plname == aPlanet.plname; }
  17039.  
  17040.      // For a Sorted Set we need to provide element comparision.
  17041.    IBoolean operator< (Planet const& aPlanet) const
  17042.       { return dist < aPlanet.dist; }
  17043.  
  17044.    char*   name()     { return  plname; }
  17045.  
  17046.    IBoolean isHeavy()  { return (mass   > 1.0); }
  17047.    IBoolean isBright() { return (bright < 0.0); }
  17048. };
  17049.  
  17050.  
  17051. // Iterator
  17052. #include <iostream.h>
  17053.  
  17054. class SayPlanetName : public IApplicator<Planet>   {
  17055.  public:
  17056.    virtual IBoolean applyTo(Planet& p)
  17057.          { cout << " " << p.name() << " "; return True;}
  17058. };
  17059.  
  17060.  
  17061. ΓòÉΓòÉΓòÉ 8.11.10. toyword.h ΓòÉΓòÉΓòÉ
  17062.  
  17063. // toyword.h  -  Class Word for use with coding examples.
  17064.  
  17065. #include <istring.hpp>
  17066.  
  17067. class Word  {
  17068.         IString       ivWord;
  17069.         unsigned      ivKey;
  17070.  
  17071. public:
  17072.  
  17073.   //Constructor to be used for sample: wordbag.c
  17074.   Word (IString word, unsigned theLength) : ivWord(word),
  17075.                                             ivKey(theLength)
  17076.                                             {}
  17077.  
  17078.   //Constructor to be used for sample: wordseq.c
  17079.   Word (IString word) : ivWord(word) {}
  17080.  
  17081.   IBoolean operator> (Word const& w1) {
  17082.             return this->ivWord > w1.ivWord;
  17083.             }
  17084.  
  17085.   unsigned setKey() {
  17086.             this->ivKey = this->ivWord.length();
  17087.             return this->ivKey;
  17088.             }
  17089.  
  17090.   IString const& getWord() const { return this->ivWord; }
  17091.   unsigned const& getKey() const { return this->ivKey; }
  17092. };
  17093.  
  17094.        // Key access.  The length of the word is the key.
  17095. inline unsigned const& key (Word const &aWord)
  17096. { return aWord.getKey(); }
  17097.  
  17098.  
  17099. ΓòÉΓòÉΓòÉ 8.11.11. transelm.h ΓòÉΓòÉΓòÉ
  17100.  
  17101. // transelm.h  -  For use with the Translation Table example.
  17102. #ifndef _TRANSELM_H
  17103. #define _TRANSELM_H
  17104.  
  17105. #include <iglobals.h>
  17106.  
  17107. class TranslationElement  {
  17108.  
  17109.   char ivAscCode;
  17110.   char ivEbcCode;
  17111.  
  17112. public:
  17113.  
  17114.   /* Let the compiler generate Default and Copy Constructor,*/
  17115.   /* Destructor and Assignment for us.                      */
  17116.  
  17117.   char const& ascCode () const { return ivAscCode; }
  17118.   char const& ebcCode () const { return ivEbcCode; }
  17119.  
  17120.   TranslationElement (char asc, char ebc)
  17121.        : ivAscCode(asc), ivEbcCode(ebc) {};
  17122.  
  17123.   /* We need to define the equality relation.               */
  17124.   IBoolean operator == (TranslationElement const& te) const  {
  17125.      return ivAscCode == te.ivAscCode
  17126.         &&  ivEbcCode == te.ivEbcCode;
  17127.    };
  17128.  
  17129.   /* An ordering relation must not be defined for           */
  17130.   /* elements in a map.                                     */
  17131.  
  17132.   /* We need to define the key access for the elements.     */
  17133.   /* We decided to define all key operations in a           */
  17134.   /* separate operations class in file trmapops.h.          */
  17135.  
  17136. };
  17137. #endif
  17138.  
  17139.  
  17140. ΓòÉΓòÉΓòÉ 8.11.12. trmapops.h ΓòÉΓòÉΓòÉ
  17141.  
  17142. // trmapops.h  -  Translation Map Operations
  17143. //  Base class for element operations for Translation Map example
  17144. #ifndef _TRMAPOPS_H
  17145. #define _TRMAPOPS_H
  17146.  
  17147. // Get the standard operation classes.
  17148. #include <istdops.h>
  17149.  
  17150. #include "transelm.h"
  17151.  
  17152. class TranslationOps : public IEOps < TranslationElement >
  17153. {
  17154. public:
  17155.   class KeyOps : public IStdEqOps < char >, public IStdHshOps < char >
  17156.   {
  17157.   }  keyOps;
  17158. };
  17159.  
  17160. // Operations Class for the EBCDIC-ASCII mapping:
  17161. class TranslationOpsE2A : public TranslationOps
  17162. {
  17163. public:              // Key Access
  17164.   char const& key (TranslationElement const& te) const
  17165.     { return te.ebcCode (); }
  17166. };
  17167.  
  17168. // Operations Class for the ASCII-EBCDIC mapping:
  17169. class TranslationOpsA2E : public TranslationOps
  17170. {
  17171. public:              // Key Access
  17172.   char const& key (TranslationElement const& te) const
  17173.     { return te.ascCode (); }
  17174. };
  17175. #endif
  17176.  
  17177.  
  17178. ΓòÉΓòÉΓòÉ 8.11.13. xebc2asc.h ΓòÉΓòÉΓòÉ
  17179.  
  17180. // xebc2asc.h :   EBCDIC - ASCII Translation Table.
  17181.  const unsigned char translationTable[256] = {
  17182. 0x00,0x01,0x02,0x03,0xCF,0x09,0xD3,0x7F,0xD4,0xD5,0xC3,0x0B,0x0C,0x0D,0x0E,0x0F,
  17183. 0x10,0x11,0x12,0x13,0xC7,0xB4,0x08,0xC9,0x18,0x19,0xCC,0xCD,0x83,0x1D,0xD2,0x1F,
  17184. 0x81,0x82,0x1C,0x84,0x86,0x0A,0x17,0x1B,0x89,0x91,0x92,0x95,0xA2,0x05,0x06,0x07,
  17185. 0xE0,0xEE,0x16,0xE5,0xD0,0x1E,0xEA,0x04,0x8A,0xF6,0xC6,0xC2,0x14,0x15,0xC1,0x1A,
  17186. 0x20,0xA6,0xE1,0x80,0xEB,0x90,0x9F,0xE2,0xAB,0x8B,0x9B,0x2E,0x3C,0x28,0x2B,0x7C,
  17187. 0x26,0xA9,0xAA,0x9C,0xDB,0xA5,0x99,0xE3,0xA8,0x9E,0x21,0x24,0x2A,0x29,0x3B,0x5E,
  17188. 0x2D,0x2F,0xDF,0xDC,0x9A,0xDD,0xDE,0x98,0x9D,0xAC,0xBA,0x2C,0x25,0x5F,0x3E,0x3F,
  17189. 0xD7,0x88,0x94,0xB0,0xB1,0xB2,0xFC,0xD6,0xFB,0x60,0x3A,0x23,0x40,0x27,0x3D,0x22,
  17190. 0xF8,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x96,0xA4,0xF3,0xAF,0xAE,0xC5,
  17191. 0x8C,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,0x70,0x71,0x72,0x97,0x87,0xCE,0x93,0xF1,0xFE,
  17192. 0xC8,0x7E,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0xEF,0xC0,0xDA,0x5B,0xF2,0xF9,
  17193. 0xB5,0xB6,0xFD,0xB7,0xB8,0xB9,0xE6,0xBB,0xBC,0xBD,0x8D,0xD9,0xBF,0x5D,0xD8,0xC4,
  17194. 0x7B,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0xCB,0xCA,0xBE,0xE8,0xEC,0xED,
  17195. 0x7D,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,0x50,0x51,0x52,0xA1,0xAD,0xF5,0xF4,0xA3,0x8F,
  17196. 0x5C,0xE7,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0xA0,0x85,0x8E,0xE9,0xE4,0xD1,
  17197. 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0xB3,0xF7,0xF0,0xFA,0xA7,0xFF
  17198. };
  17199.  
  17200.  
  17201. ΓòÉΓòÉΓòÉ 9. Data Access Builder C++ Classes and Exception Classes ΓòÉΓòÉΓòÉ
  17202.  
  17203. Use the database access classes to connect to and to disconnect from your DB2 
  17204. and other supported databases, and to apply transactions against those 
  17205. databases. 
  17206.  
  17207. This section describes the C++ version of the database access classes. Use 
  17208. these classes when you generate native C++ code or Visual Builder parts. 
  17209.  
  17210.  
  17211. ΓòÉΓòÉΓòÉ 9.1. Class Hierarchy ΓòÉΓòÉΓòÉ
  17212.  
  17213. IBase
  17214.    IPersistentObject
  17215.    IVBase
  17216.       INotifier
  17217.          IStandardNotifier
  17218.             IDatastoreBase
  17219.                IDatastore
  17220.                IDatastoreDB2
  17221.                IDatastoreODBC
  17222. IException
  17223.    IDAException
  17224. IPOManager
  17225.  
  17226.  
  17227. ΓòÉΓòÉΓòÉ 9.2. IDAException ΓòÉΓòÉΓòÉ
  17228.  
  17229. Description 
  17230.  
  17231. Derivation 
  17232.  
  17233. Public Functions 
  17234.  
  17235. To close all the panels in a chapter, double click on this panel's system menu. 
  17236.  
  17237.  
  17238. ΓòÉΓòÉΓòÉ <hidden> Derivation - IDAException ΓòÉΓòÉΓòÉ
  17239.  
  17240. IException
  17241.   Γöé
  17242. IDAException
  17243.  
  17244. Inherited by none. 
  17245.  
  17246.  
  17247. ΓòÉΓòÉΓòÉ <hidden> Class Description - IDAException ΓòÉΓòÉΓòÉ
  17248.  
  17249. Header File: idsexc.hpp 
  17250.  
  17251. The following are the C++ exception classes in Data Access Builder: 
  17252.  
  17253.  IDAException 
  17254.            The base class for all exception classes in Data Access Builder. 
  17255.  IDAAccessError 
  17256.            An object of this class is thrown when an error occurs during an 
  17257.            attempt to access data in the datastore. 
  17258.  IDAAdaptorException 
  17259.            The base class for a number of exception classes that create and 
  17260.            throw objects when database access errors occur. 
  17261.  IDAConnectionInUse 
  17262.            An object of this class is thrown when a connection is attempted 
  17263.            using a connection that is already in use. 
  17264.  IDAConnectionNotOpen 
  17265.            An object of this class is thrown when an operation that requires a 
  17266.            connection is attempted before a connection has been established. An 
  17267.            example is a call to disconnect before a connection was made. 
  17268.  IDAConnectFailed 
  17269.            An object of this class is thrown when a database connection attempt 
  17270.            fails. 
  17271.  IDADataObjectAlreadyExists 
  17272.            An object of this class is thrown when the data object specified in 
  17273.            an add operation already exists in the datastore. 
  17274.  IDADataObjectAttributeError 
  17275.            An object of this class is thrown when an attempt is made to set an 
  17276.            attribute with an invalid value. An example is setting a string 
  17277.            attribute longer than the database permits. 
  17278.  IDADataObjectInvalid 
  17279.            An object of this class is thrown when an attempt to update or to 
  17280.            delete an object results in changes to more than one row in the 
  17281.            datastore. 
  17282.  IDADataObjectNotFound 
  17283.            An object of this class is thrown when the data object specified in 
  17284.            a retrieve, update, or delete operation cannot be found in the 
  17285.            datastore. 
  17286.  IDADisconnectError 
  17287.            An object of this class is thrown when a disconnection error occurs. 
  17288.  IDALogoffFailed 
  17289.            An object of this class is thrown when a logoff fails. 
  17290.  IDALogonFailed 
  17291.            An object of this class is thrown when a logon attempt fails. 
  17292.  
  17293.  
  17294. ΓòÉΓòÉΓòÉ <hidden> Public Functions - IDAException ΓòÉΓòÉΓòÉ
  17295.  
  17296. Queries
  17297. errorAsString
  17298. errorCode
  17299. errorProvided
  17300. errorState
  17301. getSqlca
  17302.  
  17303.  
  17304. ΓòÉΓòÉΓòÉ <hidden> IDAException - Queries ΓòÉΓòÉΓòÉ
  17305.  
  17306. These members are used to access information about an object. 
  17307.  
  17308.  
  17309. ΓòÉΓòÉΓòÉ 9.2.1. IDAException::errorAsString ΓòÉΓòÉΓòÉ
  17310.  
  17311. Returns the sqlcode and the sqlstate as a string. If errorProvided has a value 
  17312. of true, returns "SQLCODE: " + IString (sqlcode) + " SQLSTATE: " + IString 
  17313. (sqlstate,5); otherwise returns IString (). 
  17314.  
  17315. public:
  17316. IString errorAsString() const;
  17317.  
  17318.  
  17319. ΓòÉΓòÉΓòÉ 9.2.2. IDAException::errorCode ΓòÉΓòÉΓòÉ
  17320.  
  17321. Returns the sqlcode at the time of exception. Valid only when errorProvided has 
  17322. a value of true. 
  17323.  
  17324. public:
  17325. long errorCode() const;
  17326.  
  17327.  
  17328. ΓòÉΓòÉΓòÉ 9.2.3. IDAException::errorProvided ΓòÉΓòÉΓòÉ
  17329.  
  17330. A Boolean flag indicating whether the exception is the result of an error 
  17331. reported by the datastore. 
  17332.  
  17333. public:
  17334. Boolean errorProvided() const;
  17335.  
  17336.  
  17337. ΓòÉΓòÉΓòÉ 9.2.4. IDAException::errorState ΓòÉΓòÉΓòÉ
  17338.  
  17339. Returns the sqlstate at the time of exception. Valid only when errorProvided 
  17340. has a value of true. 
  17341.  
  17342. public:
  17343. const char* errorState() const;
  17344.  
  17345.  
  17346. ΓòÉΓòÉΓòÉ 9.2.5. IDAException::getSqlca ΓòÉΓòÉΓòÉ
  17347.  
  17348. Returns the sqlcode and the sqlstate information contained in the sqlca at the 
  17349. time of exception. This method is maintained for compatibility with Data Access 
  17350. Builder version 1.0. 
  17351.  
  17352. public:
  17353. struct DA_sqlca getSqlca() const;
  17354.  
  17355.  
  17356. ΓòÉΓòÉΓòÉ 9.3. IDatastore ΓòÉΓòÉΓòÉ
  17357.  
  17358. Description 
  17359.  
  17360. Derivation 
  17361.  
  17362. Constructors 
  17363.  
  17364. Public Functions 
  17365.  
  17366. Public Data 
  17367.  
  17368. Public Data includes Styles and Notification IDs if they exist. 
  17369.  
  17370. To close all the panels in a chapter, double click on this panel's system menu. 
  17371.  
  17372.  
  17373. ΓòÉΓòÉΓòÉ <hidden> Derivation - IDatastore ΓòÉΓòÉΓòÉ
  17374.  
  17375. IBase
  17376.   
  17377. IVBase
  17378.   
  17379. INotifier
  17380.   
  17381. IStandardNotifier
  17382.   
  17383. IDatastoreBase
  17384.   
  17385. IDatastore
  17386.  
  17387. Inherited by none. 
  17388.  
  17389.  
  17390. ΓòÉΓòÉΓòÉ <hidden> Class Description - IDatastore ΓòÉΓòÉΓòÉ
  17391.  
  17392. Header File: idsmcon.hpp 
  17393.  
  17394. Use IDatastore with persistent objects that were generated using the embedded 
  17395. SQL option to access DB2 version 1.2 or 2.1 embedded SQL. Data Access Builder 
  17396. permits only one IDatastore instance connection to DB2 per application process. 
  17397. To access DB2 version 2.1 or later using CLI, use IDatastoreDB2. 
  17398.  
  17399. Only one connection should be active at a time when using embedded SQL. 
  17400.  
  17401. An IDatastore can be used with an IDatastoreODBC, and an IDatastoreDB2 can be 
  17402. used with an IDatastoreODBC, but an IDatastore cannot be used with an 
  17403. IDatastoreDB2. 
  17404.  
  17405. For DB2 version 1.2 and 2.1 embedded SQL, if userName and authentication are 
  17406. both specified, these attributes are used to request access to the database; 
  17407. otherwise, an attempt is made to access the database without this information. 
  17408.  
  17409. Important 
  17410.  
  17411. When IDatastore for embedded SQL is used, the bind file associated with the 
  17412. class library (cppwacl.bnd) must be bound to each database to which an 
  17413. application will be connecting. This file is located in the bnd directory of 
  17414. VisualAge C++. product directory (X). However, if Data Access Builder is used 
  17415. to create any embedded SQL classes for the database, the bind step is done 
  17416. automatically. 
  17417.  
  17418. Windows Information 
  17419.  
  17420. Data Access Builder does not support DB2 version 1.2 on Windows platforms. 
  17421.  
  17422.  
  17423. ΓòÉΓòÉΓòÉ <hidden> Public Functions - IDatastore ΓòÉΓòÉΓòÉ
  17424.  
  17425. Constructors
  17426. IDatastore
  17427. ~IDatastore
  17428.  
  17429. Data Manipulation
  17430. executeSQL
  17431.  
  17432. Database Connection
  17433. connect
  17434. disconnect
  17435.  
  17436. Queries
  17437. isShareModeExclusive
  17438.  
  17439. State Modifiers
  17440. enableShareModeExclusive
  17441. setAuthentication
  17442. setDatastoreName
  17443. setUserName
  17444.  
  17445. Transaction Handling
  17446. commit
  17447. rollback
  17448.  
  17449.  
  17450. ΓòÉΓòÉΓòÉ <hidden> IDatastore - Constructors ΓòÉΓòÉΓòÉ
  17451.  
  17452. IDatastore has two public constructors and a destructor. 
  17453.  
  17454.  
  17455. ΓòÉΓòÉΓòÉ <hidden> IDatastore - Data Manipulation ΓòÉΓòÉΓòÉ
  17456.  
  17457. This member is used to execute a dynamic SQL statement. 
  17458.  
  17459.  
  17460. ΓòÉΓòÉΓòÉ <hidden> IDatastore - Database Connection ΓòÉΓòÉΓòÉ
  17461.  
  17462. These members are used to connect to or to disconnect from a datastore. 
  17463.  
  17464.  
  17465. ΓòÉΓòÉΓòÉ <hidden> IDatastore - Queries ΓòÉΓòÉΓòÉ
  17466.  
  17467. These members are used to access information about an object. 
  17468.  
  17469.  
  17470. ΓòÉΓòÉΓòÉ <hidden> IDatastore - State Modifiers ΓòÉΓòÉΓòÉ
  17471.  
  17472. These members are used to modify the state of an object. 
  17473.  
  17474.  
  17475. ΓòÉΓòÉΓòÉ <hidden> IDatastore - Transaction Handling ΓòÉΓòÉΓòÉ
  17476.  
  17477. These members are used to commit or to roll back transactions. 
  17478.  
  17479.  
  17480. ΓòÉΓòÉΓòÉ <hidden> Public Data - IDatastore ΓòÉΓòÉΓòÉ
  17481.  
  17482. readyId
  17483. shareModeExclusiveId
  17484.  
  17485.  
  17486. ΓòÉΓòÉΓòÉ 9.3.1. IDatastore::commit ΓòÉΓòÉΓòÉ
  17487.  
  17488. For a description of this function, see IDatastoreBase::commit. 
  17489.  
  17490. Note:  Methods implemented in the base class return a reference to the calling 
  17491. class type. 
  17492.  
  17493. public:
  17494. virtual IDatastore& commit();
  17495.  
  17496.  
  17497. ΓòÉΓòÉΓòÉ 9.3.2. IDatastore::connect ΓòÉΓòÉΓòÉ
  17498.  
  17499. For a description of this function, see IDatastoreBase::connect. 
  17500.  
  17501. Note:  Methods implemented in the base class return a reference to the calling 
  17502. class type. 
  17503.  
  17504. Overload 1 
  17505.  
  17506. public:
  17507. virtual IDatastore& connect(const char* datastoreName);
  17508.  
  17509. Overload 2 
  17510.  
  17511. public:
  17512. virtual IDatastore& connect();
  17513.  
  17514. Overload 3 
  17515.  
  17516. public:
  17517. virtual IDatastore&
  17518.   connect( const char* datastoreName,
  17519.            const char* userName,
  17520.            const char* authentication);
  17521.  
  17522. Overload 4 
  17523.  
  17524. public:
  17525. virtual IDatastore&
  17526.   connect( const char* userName,
  17527.            const char* authentication);
  17528.  
  17529.  
  17530. ΓòÉΓòÉΓòÉ 9.3.3. IDatastore::disconnect ΓòÉΓòÉΓòÉ
  17531.  
  17532. For a description of this function, see IDatastoreBase::disconnect. 
  17533.  
  17534. Note:  Methods implemented in the base class return a reference to the calling 
  17535. class type. 
  17536.  
  17537. public:
  17538. virtual IDatastore& disconnect();
  17539.  
  17540.  
  17541. ΓòÉΓòÉΓòÉ 9.3.4. IDatastore::enableShareModeExclusive ΓòÉΓòÉΓòÉ
  17542.  
  17543. Enables or disables the exclusive mode in a database connection. Enabling this 
  17544. option specifies exclusive access to the database; no other user will be able 
  17545. to connect to the database until the original connection is reset. 
  17546.  
  17547. public:
  17548. virtual IDatastore&
  17549.   enableShareModeExclusive( Boolean enable = true);
  17550.  
  17551.  
  17552. ΓòÉΓòÉΓòÉ 9.3.5. IDatastore::executeSQL ΓòÉΓòÉΓòÉ
  17553.  
  17554. For a description of this function, see IDatastoreBase::executeSQL. 
  17555.  
  17556. Note:  Methods implemented in the base class return a reference to the calling 
  17557. class type. 
  17558.  
  17559. public:
  17560. virtual IDatastore& executeSQL(const char* aCmd);
  17561.  
  17562.  
  17563. ΓòÉΓòÉΓòÉ 9.3.6. IDatastore::IDatastore ΓòÉΓòÉΓòÉ
  17564.  
  17565. This class has two constructors; one takes no parameters, and the other takes 
  17566. one required parameter and two optional parameters. 
  17567.  
  17568. Overload 1 
  17569.  
  17570. public:
  17571. IDatastore();
  17572.  
  17573. Overload 2 
  17574.  
  17575. public:
  17576. IDatastore( const char* datastoreName,
  17577.             const char* userName = "",
  17578.             const char* authentication = "");
  17579.  
  17580.  
  17581. ΓòÉΓòÉΓòÉ 9.3.7. IDatastore::isShareModeExclusive ΓòÉΓòÉΓòÉ
  17582.  
  17583. Returns true if the exclusive mode has been enabled, or false if it has been 
  17584. disabled for this connection. 
  17585.  
  17586. public:
  17587. virtual Boolean isShareModeExclusive();
  17588.  
  17589.  
  17590. ΓòÉΓòÉΓòÉ 9.3.8. IDatastore::readyId ΓòÉΓòÉΓòÉ
  17591.  
  17592. Notification identifier sent when a part is initialized. 
  17593.  
  17594. public:
  17595. static const INotificationId readyId;
  17596.  
  17597.  
  17598. ΓòÉΓòÉΓòÉ 9.3.9. IDatastore::rollback ΓòÉΓòÉΓòÉ
  17599.  
  17600. For a description of this function, see IDatastoreBase::rollback. 
  17601.  
  17602. Note:  Methods implemented in the base class return a reference to the calling 
  17603. class type. 
  17604.  
  17605. public:
  17606. virtual IDatastore& rollback();
  17607.  
  17608.  
  17609. ΓòÉΓòÉΓòÉ 9.3.10. IDatastore::setAuthentication ΓòÉΓòÉΓòÉ
  17610.  
  17611. Sets the authentication. 
  17612.  
  17613. public:
  17614. virtual IDatastore&
  17615.   setAuthentication( const char* aAuthentication);
  17616.  
  17617.  
  17618. ΓòÉΓòÉΓòÉ 9.3.11. IDatastore::setDatastoreName ΓòÉΓòÉΓòÉ
  17619.  
  17620. Sets the datastore name that is used when a connection is established. 
  17621.  
  17622. public:
  17623. virtual IDatastore&
  17624.   setDatastoreName( const char* aDatastoreName);
  17625.  
  17626.  
  17627. ΓòÉΓòÉΓòÉ 9.3.12. IDatastore::setUserName ΓòÉΓòÉΓòÉ
  17628.  
  17629. Sets the user name. 
  17630.  
  17631. public:
  17632. virtual IDatastore& setUserName(const char* aUserName);
  17633.  
  17634.  
  17635. ΓòÉΓòÉΓòÉ 9.3.13. IDatastore::shareModeExclusiveId ΓòÉΓòÉΓòÉ
  17636.  
  17637. Notification identifier sent when the shareModeExclusive attribute is modified. 
  17638.  
  17639. public:
  17640. static const INotificationId shareModeExclusiveId;
  17641.  
  17642.  
  17643. ΓòÉΓòÉΓòÉ 9.3.14. IDatastore::~IDatastore ΓòÉΓòÉΓòÉ
  17644.  
  17645. The IDatastore destructor frees space allocated by the constructor, and 
  17646. executes a disconnect if the application has not explicitly done so. 
  17647.  
  17648. public:
  17649. virtual ~IDatastore();
  17650.  
  17651.  
  17652. ΓòÉΓòÉΓòÉ 9.4. IDatastoreBase ΓòÉΓòÉΓòÉ
  17653.  
  17654. Description 
  17655.  
  17656. Derivation 
  17657.  
  17658. Public Functions 
  17659.  
  17660. Protected Functions 
  17661.  
  17662. Public Data 
  17663.  
  17664. Public Data includes Styles and Notification IDs if they exist. 
  17665.  
  17666. To close all the panels in a chapter, double click on this panel's system menu. 
  17667.  
  17668.  
  17669. ΓòÉΓòÉΓòÉ <hidden> Derivation - IDatastoreBase ΓòÉΓòÉΓòÉ
  17670.  
  17671. IBase
  17672.   
  17673. IVBase
  17674.   
  17675. INotifier
  17676.   
  17677. IStandardNotifier
  17678.   
  17679. IDatastoreBase
  17680.  
  17681. Inherited by: 
  17682.  
  17683.       IDatastore 
  17684.       IDatastoreDB2 
  17685.       IDatastoreODBC 
  17686.  
  17687.  
  17688. ΓòÉΓòÉΓòÉ <hidden> Class Description - IDatastoreBase ΓòÉΓòÉΓòÉ
  17689.  
  17690. Header File: idsmcbs.hpp 
  17691.  
  17692. IDatastoreBase is an abstract base class for all Data Access Builder C++ 
  17693. classes that represent datastore connections. IDatastoreBase provides client 
  17694. connection to the database, disconnection from the database, and commit and 
  17695. rollback of transactions. Objects of this class are not instantiated, but the 
  17696. class may be used as a generic reference or pointer to objects instantiated 
  17697. from the concrete derived classes. The datastore classes are enabled with the 
  17698. notification framework so that they can be used with applications generated 
  17699. with the Visual Builder. 
  17700.  
  17701. The following attributes are used by IDatastoreBase: 
  17702.  
  17703.      authentication 
  17704.  
  17705.       Authentication is the password for the user identified by userName. An 
  17706.       unspecified value is indicated by " ". 
  17707.  
  17708.      datastoreName 
  17709.  
  17710.       Name of the datastore to which the user wishes to connect. In DB2, 
  17711.       datastoreName represents the name of the database; in ODBC, it represents 
  17712.       the name of the datasource. 
  17713.  
  17714.      userName 
  17715.  
  17716.       Name of the user to be passed to the datasource. This name and the 
  17717.       password are used to complete authorization of the user. If unspecified 
  17718.       (or set to " "), the userName is not passed to the datasource, and a 
  17719.       connection attempt may fail, or the datasource may attempt to determine 
  17720.       the user's authorization independently. 
  17721.  
  17722.  
  17723. ΓòÉΓòÉΓòÉ <hidden> Public Functions - IDatastoreBase ΓòÉΓòÉΓòÉ
  17724.  
  17725. Constructors
  17726. ~IDatastoreBase
  17727.  
  17728. Data Manipulation
  17729. executeSQL
  17730.  
  17731. Database Connection
  17732. connect
  17733. disconnect
  17734.  
  17735. Queries
  17736. asString
  17737. authentication
  17738. datastoreName
  17739. isConnected
  17740. userName
  17741.  
  17742. State Modifiers
  17743. setAuthentication
  17744. setDatastoreName
  17745. setUserName
  17746.  
  17747. Transaction Handling
  17748. commit
  17749. rollback
  17750.  
  17751.  
  17752. ΓòÉΓòÉΓòÉ <hidden> IDatastoreBase - Constructors ΓòÉΓòÉΓòÉ
  17753.  
  17754. IDatastoreBase has three protected constructors and a destructor. 
  17755.  
  17756.  
  17757. ΓòÉΓòÉΓòÉ <hidden> IDatastoreBase - Data Manipulation ΓòÉΓòÉΓòÉ
  17758.  
  17759. This member is used to execute a dynamic SQL statement. 
  17760.  
  17761.  
  17762. ΓòÉΓòÉΓòÉ <hidden> IDatastoreBase - Database Connection ΓòÉΓòÉΓòÉ
  17763.  
  17764. These members are used to connect to or to disconnect from a datastore. 
  17765.  
  17766.  
  17767. ΓòÉΓòÉΓòÉ <hidden> IDatastoreBase - Queries ΓòÉΓòÉΓòÉ
  17768.  
  17769. These members are used to access information about an object. 
  17770.  
  17771.  
  17772. ΓòÉΓòÉΓòÉ <hidden> IDatastoreBase - State Modifiers ΓòÉΓòÉΓòÉ
  17773.  
  17774. These members are used to modify the state of an object. 
  17775.  
  17776.  
  17777. ΓòÉΓòÉΓòÉ <hidden> IDatastoreBase - Transaction Handling ΓòÉΓòÉΓòÉ
  17778.  
  17779. These members are used to commit or to roll back transactions. 
  17780.  
  17781.  
  17782. ΓòÉΓòÉΓòÉ <hidden> Protected Functions - IDatastoreBase ΓòÉΓòÉΓòÉ
  17783.  
  17784. Constructors
  17785. IDatastoreBase
  17786.  
  17787.  
  17788. ΓòÉΓòÉΓòÉ <hidden> Public Data - IDatastoreBase ΓòÉΓòÉΓòÉ
  17789.  
  17790. AuthenticationId
  17791. connectedId
  17792. DatastoreNameId
  17793. disconnectedId
  17794. isConnectedId
  17795. transactedId
  17796. UserNameId
  17797.  
  17798.  
  17799. ΓòÉΓòÉΓòÉ 9.4.1. IDatastoreBase::asString ΓòÉΓòÉΓòÉ
  17800.  
  17801. Returns a string representing the connection.  The string contains the name of 
  17802. the datastore set with the constructor or with the setDatastoreName method. 
  17803.  
  17804. public:
  17805. virtual IString asString() const;
  17806.  
  17807.  
  17808. ΓòÉΓòÉΓòÉ 9.4.2. IDatastoreBase::authentication ΓòÉΓòÉΓòÉ
  17809.  
  17810. Returns the current authentication setting. 
  17811.  
  17812. public:
  17813. virtual IString authentication() const;
  17814.  
  17815.  
  17816. ΓòÉΓòÉΓòÉ 9.4.3. IDatastoreBase::AuthenticationId ΓòÉΓòÉΓòÉ
  17817.  
  17818. Notification identifier sent when the authentication attribute is modified. 
  17819.  
  17820. public:
  17821. static const INotificationId AuthenticationId;
  17822.  
  17823.  
  17824. ΓòÉΓòÉΓòÉ 9.4.4. IDatastoreBase::commit ΓòÉΓòÉΓòÉ
  17825.  
  17826. Commits a transaction. 
  17827.  
  17828. public:
  17829. virtual IDatastoreBase& commit();
  17830.  
  17831. Exceptions 
  17832.  
  17833. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  17834. ΓöéIDAConnectionNotOpenΓöéAn object of this class is thrown when  Γöé
  17835. Γöé                    Γöéan operation that requires a connection Γöé
  17836. Γöé                    Γöéis attempted before a connection has    Γöé
  17837. Γöé                    Γöébeen established. An example is a call  Γöé
  17838. Γöé                    Γöéto disconnect before a connection was   Γöé
  17839. Γöé                    Γöémade.                                   Γöé
  17840. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  17841. ΓöéIDAAccessError      ΓöéAn object of this class is thrown when  Γöé
  17842. Γöé                    Γöéan error occurs during an attempt to    Γöé
  17843. Γöé                    Γöéaccess data in the datastore.           Γöé
  17844. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  17845.  
  17846.  
  17847. ΓòÉΓòÉΓòÉ 9.4.5. IDatastoreBase::connect ΓòÉΓòÉΓòÉ
  17848.  
  17849. Connects to a datastore. If a connection already exists, performs a disconnect, 
  17850. and then reconnects using the current settings. 
  17851.  
  17852. Overload 1 
  17853.  
  17854. public:
  17855. virtual IDatastoreBase& connect();
  17856.  
  17857. Connects to a datastore using the currently specified datastore settings. 
  17858.  
  17859. Exceptions 
  17860.  
  17861. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  17862. ΓöéIDAConnectFailed    ΓöéAn object of this class is thrown when aΓöé
  17863. Γöé                    Γöédatabase connection attempt fails.      Γöé
  17864. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  17865. ΓöéIDAAccessError      ΓöéAn object of this class is thrown when  Γöé
  17866. Γöé                    Γöéan error occurs during an attempt to    Γöé
  17867. Γöé                    Γöéaccess data in the datastore.           Γöé
  17868. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  17869. ΓöéIDALogoffFailed     ΓöéAn object of this class is thrown when aΓöé
  17870. Γöé                    Γöélogoff fails.                           Γöé
  17871. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  17872. ΓöéIDALogonFailed      ΓöéAn object of this class is thrown when aΓöé
  17873. Γöé                    Γöélogon attempt fails.                    Γöé
  17874. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  17875.  
  17876. Overload 2 
  17877.  
  17878. public:
  17879. virtual IDatastoreBase&
  17880.   connect( const char* userName,
  17881.            const char* authentication);
  17882.  
  17883. Connects to a datastore using the specified input parameters and the current 
  17884. datastoreName setting. The values of userName and authentication are not saved. 
  17885.  
  17886. Overload 3 
  17887.  
  17888. public:
  17889. virtual IDatastoreBase& connect(const char* datastoreName);
  17890.  
  17891. Connects to a datastore using the specified datastoreName and the current user 
  17892. ID and authentication settings. 
  17893.  
  17894. Overload 4 
  17895.  
  17896. public:
  17897. virtual IDatastoreBase&
  17898.   connect( const char* datastoreName,
  17899.            const char* userName,
  17900.            const char* authentication);
  17901.  
  17902. Connects to a datastore using the specified input parameters. The values of 
  17903. userName and authentication are not saved. 
  17904.  
  17905.  
  17906. ΓòÉΓòÉΓòÉ 9.4.6. IDatastoreBase::connectedId ΓòÉΓòÉΓòÉ
  17907.  
  17908. Notification identifier sent when a connection is established. 
  17909.  
  17910. public:
  17911. static const INotificationId connectedId;
  17912.  
  17913.  
  17914. ΓòÉΓòÉΓòÉ 9.4.7. IDatastoreBase::datastoreName ΓòÉΓòÉΓòÉ
  17915.  
  17916. Returns the current datastore name setting. 
  17917.  
  17918. public:
  17919. virtual IString datastoreName() const;
  17920.  
  17921.  
  17922. ΓòÉΓòÉΓòÉ 9.4.8. IDatastoreBase::DatastoreNameId ΓòÉΓòÉΓòÉ
  17923.  
  17924. Notification identifier sent when the datastoreName attribute is modified. 
  17925.  
  17926. public:
  17927. static const INotificationId DatastoreNameId;
  17928.  
  17929.  
  17930. ΓòÉΓòÉΓòÉ 9.4.9. IDatastoreBase::disconnect ΓòÉΓòÉΓòÉ
  17931.  
  17932. Closes the connection to a database. 
  17933.  
  17934. public:
  17935. virtual IDatastoreBase& disconnect();
  17936.  
  17937. Exceptions 
  17938.  
  17939. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  17940. ΓöéIDAConnectionNotOpenΓöéAn object of this class is thrown when  Γöé
  17941. Γöé                    Γöéan operation that requires a connection Γöé
  17942. Γöé                    Γöéis attempted before a connection has    Γöé
  17943. Γöé                    Γöébeen established. An example is a call  Γöé
  17944. Γöé                    Γöéto disconnect before a connection was   Γöé
  17945. Γöé                    Γöémade.                                   Γöé
  17946. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  17947. ΓöéIDALogoffFailed     ΓöéAn object of this class is thrown when aΓöé
  17948. Γöé                    Γöélogoff fails.                           Γöé
  17949. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  17950. ΓöéIDADisconnectError  ΓöéAn object of this class is thrown when aΓöé
  17951. Γöé                    Γöédisconnection error occurs.             Γöé
  17952. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  17953.  
  17954.  
  17955. ΓòÉΓòÉΓòÉ 9.4.10. IDatastoreBase::disconnectedId ΓòÉΓòÉΓòÉ
  17956.  
  17957. Notification identifier sent when a connection is terminated. 
  17958.  
  17959. public:
  17960. static const INotificationId disconnectedId;
  17961.  
  17962.  
  17963. ΓòÉΓòÉΓòÉ 9.4.11. IDatastoreBase::executeSQL ΓòÉΓòÉΓòÉ
  17964.  
  17965. Executes a dynamic SQL statement. If a select statement is passed in: 
  17966.  
  17967.      IDatastore always returns an exception 
  17968.      IDatastoreDB2 and IDatastoreODBC ignore any result other than an access 
  17969.       error message. 
  17970.  
  17971.   public:
  17972.   virtual IDatastoreBase& executeSQL(const char* aCmd);
  17973.  
  17974.  Exceptions 
  17975.  
  17976.   ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  17977.   ΓöéIDAAccessError      ΓöéAn object of this class is thrown when  Γöé
  17978.   Γöé                    Γöéan error occurs during an attempt to    Γöé
  17979.   Γöé                    Γöéaccess data in the datastore.           Γöé
  17980.   ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  17981.  
  17982.  
  17983. ΓòÉΓòÉΓòÉ 9.4.12. IDatastoreBase::IDatastoreBase ΓòÉΓòÉΓòÉ
  17984.  
  17985. These protected constructors can only be called from derived classes. 
  17986.  
  17987. protected:
  17988. IDatastoreBase(const char* datastoreName);
  17989.  
  17990.  
  17991. ΓòÉΓòÉΓòÉ 9.4.13. IDatastoreBase::isConnected ΓòÉΓòÉΓòÉ
  17992.  
  17993. Returns true if a connection to the database exists. 
  17994.  
  17995. public:
  17996. virtual Boolean isConnected();
  17997.  
  17998.  
  17999. ΓòÉΓòÉΓòÉ 9.4.14. IDatastoreBase::isConnectedId ΓòÉΓòÉΓòÉ
  18000.  
  18001. Notification identifier sent when the Boolean attribute indicating the connect 
  18002. state changes. 
  18003.  
  18004. public:
  18005. static const INotificationId isConnectedId;
  18006.  
  18007.  
  18008. ΓòÉΓòÉΓòÉ 9.4.15. IDatastoreBase::rollback ΓòÉΓòÉΓòÉ
  18009.  
  18010. Performs a rollback on the transactions. 
  18011.  
  18012. public:
  18013. virtual IDatastoreBase& rollback();
  18014.  
  18015. Exceptions 
  18016.  
  18017. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  18018. ΓöéIDAConnectionNotOpenΓöéAn object of this class is thrown when  Γöé
  18019. Γöé                    Γöéan operation that requires a connection Γöé
  18020. Γöé                    Γöéis attempted before a connection has    Γöé
  18021. Γöé                    Γöébeen established. An example is a call  Γöé
  18022. Γöé                    Γöéto disconnect before a connection was   Γöé
  18023. Γöé                    Γöémade.                                   Γöé
  18024. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  18025. ΓöéIDAAccessError      ΓöéAn object of this class is thrown when  Γöé
  18026. Γöé                    Γöéan error occurs during an attempt to    Γöé
  18027. Γöé                    Γöéaccess data in the datastore.           Γöé
  18028. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  18029.  
  18030.  
  18031. ΓòÉΓòÉΓòÉ 9.4.16. IDatastoreBase::setAuthentication ΓòÉΓòÉΓòÉ
  18032.  
  18033. Sets the authentication. 
  18034.  
  18035. public:
  18036. virtual IDatastoreBase&
  18037.   setAuthentication( const char* aAuthentication);
  18038.  
  18039.  
  18040. ΓòÉΓòÉΓòÉ 9.4.17. IDatastoreBase::setDatastoreName ΓòÉΓòÉΓòÉ
  18041.  
  18042. Sets the datastore name that is used when a connection is established. 
  18043.  
  18044. public:
  18045. virtual IDatastoreBase&
  18046.   setDatastoreName( const char* aDatastoreName);
  18047.  
  18048.  
  18049. ΓòÉΓòÉΓòÉ 9.4.18. IDatastoreBase::setUserName ΓòÉΓòÉΓòÉ
  18050.  
  18051. Sets the user name. 
  18052.  
  18053. public:
  18054. virtual IDatastoreBase& setUserName(const char* aUserName);
  18055.  
  18056.  
  18057. ΓòÉΓòÉΓòÉ 9.4.19. IDatastoreBase::transactedId ΓòÉΓòÉΓòÉ
  18058.  
  18059. Notification identifier sent when a commit or a rollback is completed. 
  18060.  
  18061. public:
  18062. static const INotificationId transactedId;
  18063.  
  18064.  
  18065. ΓòÉΓòÉΓòÉ 9.4.20. IDatastoreBase::userName ΓòÉΓòÉΓòÉ
  18066.  
  18067. Returns the current user name setting. 
  18068.  
  18069. public:
  18070. virtual IString userName() const;
  18071.  
  18072.  
  18073. ΓòÉΓòÉΓòÉ 9.4.21. IDatastoreBase::UserNameId ΓòÉΓòÉΓòÉ
  18074.  
  18075. Notification identifier sent when the userName attribute is modified. 
  18076.  
  18077. public:
  18078. static const INotificationId UserNameId;
  18079.  
  18080.  
  18081. ΓòÉΓòÉΓòÉ 9.4.22. IDatastoreBase::~IDatastoreBase ΓòÉΓòÉΓòÉ
  18082.  
  18083. public:
  18084. virtual ~IDatastoreBase();
  18085.  
  18086.  
  18087. ΓòÉΓòÉΓòÉ 9.5. IDatastoreDB2 ΓòÉΓòÉΓòÉ
  18088.  
  18089. Description 
  18090.  
  18091. Derivation 
  18092.  
  18093. Constructors 
  18094.  
  18095. Public Functions 
  18096.  
  18097. Public Data 
  18098.  
  18099. Nested Types 
  18100.  
  18101. Public Data includes Styles and Notification IDs if they exist. 
  18102.  
  18103. To close all the panels in a chapter, double click on this panel's system menu. 
  18104.  
  18105.  
  18106. ΓòÉΓòÉΓòÉ <hidden> Derivation - IDatastoreDB2 ΓòÉΓòÉΓòÉ
  18107.  
  18108. IBase
  18109.   
  18110. IVBase
  18111.   
  18112. INotifier
  18113.   
  18114. IStandardNotifier
  18115.   
  18116. IDatastoreBase
  18117.   
  18118. IDatastoreDB2
  18119.  
  18120. Inherited by none. 
  18121.  
  18122.  
  18123. ΓòÉΓòÉΓòÉ <hidden> Class Description - IDatastoreDB2 ΓòÉΓòÉΓòÉ
  18124.  
  18125. Header File: idsmcdb.hpp 
  18126.  
  18127. Use IDatastoreDB2 with persistent objects that were generated using the CLI 
  18128. option to access DB2 version 1.2 or 2.1 CLI. This class can also be used with 
  18129. embedded SQL. If the user of the application has the authority to use dynamic 
  18130. SQL, the application can be built using IDatastoreDB2, even when generated as 
  18131. embedded SQL. To access DB2 version 1.2 or 2.1 static embedded SQL, use 
  18132. IDatastore. 
  18133.  
  18134. Windows Information 
  18135.  
  18136. Data Access Builder does not support DB2 version 1.2 on Windows platforms. 
  18137.  
  18138.  
  18139. ΓòÉΓòÉΓòÉ <hidden> Public Functions - IDatastoreDB2 ΓòÉΓòÉΓòÉ
  18140.  
  18141. Constructors
  18142. IDatastoreDB2
  18143. ~IDatastoreDB2
  18144.  
  18145. Data Manipulation
  18146. executeSQL
  18147.  
  18148. Database Connection
  18149. connect
  18150. disconnect
  18151.  
  18152. Queries
  18153. accessMode
  18154. connectString
  18155. driverPrompt
  18156. isAutoCommit
  18157. isolationLevel
  18158.  
  18159. State Modifiers
  18160. enableAutoCommit
  18161. setAccessMode
  18162. setAuthentication
  18163. setConnectString
  18164. setDatastoreName
  18165. setDriverPrompt
  18166. setIsolationLevel
  18167. setUserName
  18168.  
  18169. Transaction Handling
  18170. commit
  18171. rollback
  18172.  
  18173.  
  18174. ΓòÉΓòÉΓòÉ <hidden> IDatastoreDB2 - Constructors ΓòÉΓòÉΓòÉ
  18175.  
  18176. IDatastoreDB2 has two public constructors and a destructor. 
  18177.  
  18178.  
  18179. ΓòÉΓòÉΓòÉ <hidden> IDatastoreDB2 - Data Manipulation ΓòÉΓòÉΓòÉ
  18180.  
  18181. This member is used to execute a dynamic SQL statement. 
  18182.  
  18183.  
  18184. ΓòÉΓòÉΓòÉ <hidden> IDatastoreDB2 - Database Connection ΓòÉΓòÉΓòÉ
  18185.  
  18186. These members are used to connect to or to disconnect from a datastore. 
  18187.  
  18188.  
  18189. ΓòÉΓòÉΓòÉ <hidden> IDatastoreDB2 - Queries ΓòÉΓòÉΓòÉ
  18190.  
  18191. These members are used to access information about an object. 
  18192.  
  18193.  
  18194. ΓòÉΓòÉΓòÉ <hidden> IDatastoreDB2 - State Modifiers ΓòÉΓòÉΓòÉ
  18195.  
  18196. These members are used to modify the state of an object. 
  18197.  
  18198.  
  18199. ΓòÉΓòÉΓòÉ <hidden> IDatastoreDB2 - Transaction Handling ΓòÉΓòÉΓòÉ
  18200.  
  18201. These members are used to commit or to roll back transactions. 
  18202.  
  18203.  
  18204. ΓòÉΓòÉΓòÉ <hidden> Public Data - IDatastoreDB2 ΓòÉΓòÉΓòÉ
  18205.  
  18206. accessModeId
  18207. autoCommitId
  18208. connectStringId
  18209. driverPromptId
  18210. isolationLevelId
  18211. readyId
  18212.  
  18213.  
  18214. ΓòÉΓòÉΓòÉ 9.5.1. IDatastoreDB2::accessMode ΓòÉΓòÉΓòÉ
  18215.  
  18216. Returns the current access mode setting. 
  18217.  
  18218. public:
  18219. virtual IDatastoreDB2::AccessMode accessMode() const;
  18220.  
  18221.  
  18222. ΓòÉΓòÉΓòÉ 9.5.2. IDatastoreDB2::accessModeId ΓòÉΓòÉΓòÉ
  18223.  
  18224. Notification identifier sent when the accessMode attribute is modified. 
  18225.  
  18226. public:
  18227. static const INotificationId accessModeId;
  18228.  
  18229.  
  18230. ΓòÉΓòÉΓòÉ 9.5.3. IDatastoreDB2::autoCommitId ΓòÉΓòÉΓòÉ
  18231.  
  18232. Notification identifier sent when the autoCommit attribute is modified. 
  18233.  
  18234. public:
  18235. static const INotificationId autoCommitId;
  18236.  
  18237.  
  18238. ΓòÉΓòÉΓòÉ 9.5.4. IDatastoreDB2::commit ΓòÉΓòÉΓòÉ
  18239.  
  18240. For a description of this function, see IDatastoreBase::commit. 
  18241.  
  18242. Note:  Methods implemented in the base class return a reference to the calling 
  18243. class type. 
  18244.  
  18245. public:
  18246. virtual IDatastoreDB2& commit();
  18247.  
  18248.  
  18249. ΓòÉΓòÉΓòÉ 9.5.5. IDatastoreDB2::connect ΓòÉΓòÉΓòÉ
  18250.  
  18251. For a description of this function, see IDatastoreBase::connect. 
  18252.  
  18253. Note:  Methods implemented in the base class return a reference to the calling 
  18254. class type. 
  18255.  
  18256. Overload 1 
  18257.  
  18258. public:
  18259. virtual IDatastoreDB2&
  18260.   connect( const char* datastoreName,
  18261.            const char* userName,
  18262.            const char* authentication);
  18263.  
  18264. Overload 2 
  18265.  
  18266. public:
  18267. virtual IDatastoreDB2& connect();
  18268.  
  18269. Overload 3 
  18270.  
  18271. public:
  18272. virtual IDatastoreDB2& connect(const char* datastoreName);
  18273.  
  18274. Overload 4 
  18275.  
  18276. public:
  18277. virtual IDatastoreDB2&
  18278.   connect( const char* userName,
  18279.            const char* authentication);
  18280.  
  18281. Overload 5 
  18282.  
  18283. public:
  18284. virtual IDatastoreDB2&
  18285.   connect( const char* datastoreName,
  18286.            const char* connectString,
  18287.            const char* userName,
  18288.            const char* authentication);
  18289.  
  18290. Exceptions 
  18291.  
  18292. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  18293. ΓöéIDAConnectFailed    ΓöéAn object of this class is thrown when aΓöé
  18294. Γöé                    Γöédatabase connection attempt fails.      Γöé
  18295. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  18296. ΓöéIDAAccessError      ΓöéAn object of this class is thrown when  Γöé
  18297. Γöé                    Γöéan error occurs during an attempt to    Γöé
  18298. Γöé                    Γöéaccess data in the datastore.           Γöé
  18299. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  18300.  
  18301.  
  18302. ΓòÉΓòÉΓòÉ 9.5.6. IDatastoreDB2::connectString ΓòÉΓòÉΓòÉ
  18303.  
  18304. Returns the current connect string setting. This string, which enables a user 
  18305. to specify additional connect string keywords and values, is concatenated with 
  18306. DSN=<value> (datastoreName) and, if provided, UID=<value> (userName), and 
  18307. PWD=<value> (authentication), to form the connect string for the 
  18308. SQLDriverConnect call. For example: 
  18309.  
  18310. "DSN=SAMPLE; UID=STUDENT; PWD=student1; AUTOCOMMIT=0; CONNECTTYPE=1;"
  18311.  
  18312. public:
  18313. virtual IString connectString() const;
  18314.  
  18315.  
  18316. ΓòÉΓòÉΓòÉ 9.5.7. IDatastoreDB2::connectStringId ΓòÉΓòÉΓòÉ
  18317.  
  18318. Notification identifier sent when the connectString attribute is modified. 
  18319.  
  18320. public:
  18321. static const INotificationId connectStringId;
  18322.  
  18323.  
  18324. ΓòÉΓòÉΓòÉ 9.5.8. IDatastoreDB2::disconnect ΓòÉΓòÉΓòÉ
  18325.  
  18326. For a description of this function, see IDatastoreBase::disconnect. 
  18327.  
  18328. Note:  Methods implemented in the base class return a reference to the calling 
  18329. class type. 
  18330.  
  18331. public:
  18332. virtual IDatastoreDB2& disconnect();
  18333.  
  18334.  
  18335. ΓòÉΓòÉΓòÉ 9.5.9. IDatastoreDB2::driverPrompt ΓòÉΓòÉΓòÉ
  18336.  
  18337. Returns the current driver prompt parameter setting. 
  18338.  
  18339. public:
  18340. virtual IDatastoreDB2::DriverPrompt driverPrompt() const;
  18341.  
  18342.  
  18343. ΓòÉΓòÉΓòÉ 9.5.10. IDatastoreDB2::driverPromptId ΓòÉΓòÉΓòÉ
  18344.  
  18345. Notification identifier sent when the driverPrompt attribute changes. 
  18346.  
  18347. public:
  18348. static const INotificationId driverPromptId;
  18349.  
  18350.  
  18351. ΓòÉΓòÉΓòÉ 9.5.11. IDatastoreDB2::enableAutoCommit ΓòÉΓòÉΓòÉ
  18352.  
  18353. Enables or disables the autocommit mode. 
  18354.  
  18355. public:
  18356. virtual IDatastoreDB2&
  18357.   enableAutoCommit( IBoolean enable = True);
  18358.  
  18359.  
  18360. ΓòÉΓòÉΓòÉ 9.5.12. IDatastoreDB2::executeSQL ΓòÉΓòÉΓòÉ
  18361.  
  18362. For a description of this function, see IDatastoreBase::executeSQL. 
  18363.  
  18364. Note:  Methods implemented in the base class return a reference to the calling 
  18365. class type. 
  18366.  
  18367. public:
  18368. virtual IDatastoreDB2& executeSQL(const char* aCmd);
  18369.  
  18370.  
  18371. ΓòÉΓòÉΓòÉ 9.5.13. IDatastoreDB2::IDatastoreDB2 ΓòÉΓòÉΓòÉ
  18372.  
  18373. This class has two constructors; one takes no parameters, and the other takes 
  18374. one required parameter and one optional parameter. 
  18375.  
  18376. Overload 1 
  18377.  
  18378. public:
  18379. IDatastoreDB2( const char* datastoreName,
  18380.                const char* connectString = "");
  18381.  
  18382. Overload 2 
  18383.  
  18384. public:
  18385. IDatastoreDB2();
  18386.  
  18387.  
  18388. ΓòÉΓòÉΓòÉ 9.5.14. IDatastoreDB2::isAutoCommit ΓòÉΓòÉΓòÉ
  18389.  
  18390. Returns true if the autocommit mode is enabled; otherwise, returns false. 
  18391.  
  18392. public:
  18393. virtual IBoolean isAutoCommit() const;
  18394.  
  18395.  
  18396. ΓòÉΓòÉΓòÉ 9.5.15. IDatastoreDB2::isolationLevel ΓòÉΓòÉΓòÉ
  18397.  
  18398. Returns the current isolation level setting. 
  18399.  
  18400. public:
  18401. virtual IDatastoreDB2::IsolationLevel
  18402.   isolationLevel() const;
  18403.  
  18404.  
  18405. ΓòÉΓòÉΓòÉ 9.5.16. IDatastoreDB2::isolationLevelId ΓòÉΓòÉΓòÉ
  18406.  
  18407. Notification identifier sent when the isolationLevel attribute changes. 
  18408.  
  18409. public:
  18410. static const INotificationId isolationLevelId;
  18411.  
  18412.  
  18413. ΓòÉΓòÉΓòÉ 9.5.17. IDatastoreDB2::readyId ΓòÉΓòÉΓòÉ
  18414.  
  18415. Notification identifier sent when a part is initialized. 
  18416.  
  18417. public:
  18418. static const INotificationId readyId;
  18419.  
  18420.  
  18421. ΓòÉΓòÉΓòÉ 9.5.18. IDatastoreDB2::rollback ΓòÉΓòÉΓòÉ
  18422.  
  18423. For a description of this function, see IDatastoreBase::rollback. 
  18424.  
  18425. Note:  Methods implemented in the base class return a reference to the calling 
  18426. class type. 
  18427.  
  18428. public:
  18429. virtual IDatastoreDB2& rollback();
  18430.  
  18431.  
  18432. ΓòÉΓòÉΓòÉ 9.5.19. IDatastoreDB2::setAccessMode ΓòÉΓòÉΓòÉ
  18433.  
  18434. Enables a user to set the access mode. 
  18435.  
  18436. public:
  18437. virtual IDatastoreDB2& setAccessMode(AccessMode option);
  18438.  
  18439.  
  18440. ΓòÉΓòÉΓòÉ 9.5.20. IDatastoreDB2::setAuthentication ΓòÉΓòÉΓòÉ
  18441.  
  18442. Sets the authentication. 
  18443.  
  18444. public:
  18445. virtual IDatastoreDB2&
  18446.   setAuthentication( const char* aAuthentication);
  18447.  
  18448.  
  18449. ΓòÉΓòÉΓòÉ 9.5.21. IDatastoreDB2::setConnectString ΓòÉΓòÉΓòÉ
  18450.  
  18451. Sets the connect string. For a description of the connect string, see 
  18452. IDatastoreDB2::connectString. 
  18453.  
  18454. public:
  18455. virtual IDatastoreDB2&
  18456.   setConnectString( const char* aConnectString);
  18457.  
  18458.  
  18459. ΓòÉΓòÉΓòÉ 9.5.22. IDatastoreDB2::setDatastoreName ΓòÉΓòÉΓòÉ
  18460.  
  18461. Sets the datastore name that is used when a connection is established. 
  18462.  
  18463. public:
  18464. virtual IDatastoreDB2&
  18465.   setDatastoreName( const char* aDatastoreName);
  18466.  
  18467.  
  18468. ΓòÉΓòÉΓòÉ 9.5.23. IDatastoreDB2::setDriverPrompt ΓòÉΓòÉΓòÉ
  18469.  
  18470. Enables a user to set the driver prompt parameter, and to pass in the window 
  18471. handle of the parent application. 
  18472.  
  18473. public:
  18474. virtual IDatastoreDB2&
  18475.   setDriverPrompt( DriverPrompt option,
  18476.                    IWindowHandle aHandle = IWindowHandle ( ));
  18477.  
  18478.  
  18479. ΓòÉΓòÉΓòÉ 9.5.24. IDatastoreDB2::setIsolationLevel ΓòÉΓòÉΓòÉ
  18480.  
  18481. Enables a user to set the isolation level. 
  18482.  
  18483. public:
  18484. virtual IDatastoreDB2&
  18485.   setIsolationLevel( IsolationLevel option);
  18486.  
  18487.  
  18488. ΓòÉΓòÉΓòÉ 9.5.25. IDatastoreDB2::setUserName ΓòÉΓòÉΓòÉ
  18489.  
  18490. Sets the user name. 
  18491.  
  18492. public:
  18493. virtual IDatastoreDB2& setUserName(const char* aUserName);
  18494.  
  18495.  
  18496. ΓòÉΓòÉΓòÉ 9.5.26. IDatastoreDB2::~IDatastoreDB2 ΓòÉΓòÉΓòÉ
  18497.  
  18498. The IDatastoreDB2 destructor frees space allocated by the constructor, and 
  18499. executes a disconnect if the application has not explicitly done so. 
  18500.  
  18501. public:
  18502. virtual ~IDatastoreDB2();
  18503.  
  18504.  
  18505. ΓòÉΓòÉΓòÉ <hidden> Nested Types - IDatastoreDB2 ΓòÉΓòÉΓòÉ
  18506.  
  18507. Enumerations 
  18508.  
  18509.        AccessMode 
  18510.        DriverPrompt 
  18511.        IsolationLevel 
  18512.  
  18513.  
  18514. ΓòÉΓòÉΓòÉ <hidden> Enums - AccessMode ΓòÉΓòÉΓòÉ
  18515.  
  18516. enum AccessMode { readOnly, readWrite };
  18517.  
  18518.  readOnly 
  18519.            Access mode is read-only. 
  18520.  readWrite 
  18521.            Access mode is updateable. 
  18522.  
  18523.  
  18524. ΓòÉΓòÉΓòÉ <hidden> Enums - DriverPrompt ΓòÉΓòÉΓòÉ
  18525.  
  18526. enum DriverPrompt { driverPromptRequest,
  18527.                     driverComplete,
  18528.                     driverCompleteRequired,
  18529.                     noDriverPrompt };
  18530.  
  18531.  driverPromptRequest 
  18532.            Dialog is always initiated. 
  18533.  driverComplete 
  18534.            Dialog is only initiated if there is insufficent information in the 
  18535.            connection string. 
  18536.  driverCompleteRequired 
  18537.            Dialog is only initiated if there is insufficent information in the 
  18538.            connection string. Only mandatory information is requested. 
  18539.  noDriverPrompt 
  18540.            The user is not prompted for any information. 
  18541.  
  18542.  
  18543. ΓòÉΓòÉΓòÉ <hidden> Enums - IsolationLevel ΓòÉΓòÉΓòÉ
  18544.  
  18545. enum IsolationLevel { readUncommitted,
  18546.                       readCommitted,
  18547.                       repeatableRead,
  18548.                       serializable,
  18549.                       databaseDefault };
  18550.  
  18551.  readUncommittted 
  18552.            Permits an application to access uncommitted changes caused by other 
  18553.            transactions. 
  18554.  readCommitted 
  18555.            Ensures that the current row of every updateable cursor is not 
  18556.            changed by other application processes. 
  18557.  repeatableRead 
  18558.            Keeps a lock on all rows accessed since the last commit point. 
  18559.  serializable 
  18560.            Data affected by pending transactions is not available to other 
  18561.            transactions. 
  18562.  databaseDefault 
  18563.            The default isolation level for the specified database product. 
  18564.  
  18565.  
  18566. ΓòÉΓòÉΓòÉ 9.6. IDatastoreODBC ΓòÉΓòÉΓòÉ
  18567.  
  18568. Description 
  18569.  
  18570. Derivation 
  18571.  
  18572. Constructors 
  18573.  
  18574. Public Functions 
  18575.  
  18576. Public Data 
  18577.  
  18578. Nested Types 
  18579.  
  18580. Public Data includes Styles and Notification IDs if they exist. 
  18581.  
  18582. To close all the panels in a chapter, double click on this panel's system menu. 
  18583.  
  18584.  
  18585. ΓòÉΓòÉΓòÉ <hidden> Derivation - IDatastoreODBC ΓòÉΓòÉΓòÉ
  18586.  
  18587. IBase
  18588.   
  18589. IVBase
  18590.   
  18591. INotifier
  18592.   
  18593. IStandardNotifier
  18594.   
  18595. IDatastoreBase
  18596.   
  18597. IDatastoreODBC
  18598.  
  18599. Inherited by none. 
  18600.  
  18601.  
  18602. ΓòÉΓòÉΓòÉ <hidden> Class Description - IDatastoreODBC ΓòÉΓòÉΓòÉ
  18603.  
  18604. Header File: idsmcod.hpp 
  18605.  
  18606. Use IDatastoreODBC with persistent objects that were generated using the ODBC 
  18607. option to access databases that are managed through ODBC. 
  18608.  
  18609.  
  18610. ΓòÉΓòÉΓòÉ <hidden> Public Functions - IDatastoreODBC ΓòÉΓòÉΓòÉ
  18611.  
  18612. Constructors
  18613. IDatastoreODBC
  18614. ~IDatastoreODBC
  18615.  
  18616. Data Manipulation
  18617. executeSQL
  18618.  
  18619. Database Connection
  18620. connect
  18621. disconnect
  18622.  
  18623. Queries
  18624. accessMode
  18625. connectString
  18626. driverPrompt
  18627. isAutoCommit
  18628. isolationLevel
  18629.  
  18630. State Modifiers
  18631. enableAutoCommit
  18632. setAccessMode
  18633. setAuthentication
  18634. setConnectString
  18635. setDatastoreName
  18636. setDriverPrompt
  18637. setIsolationLevel
  18638. setUserName
  18639.  
  18640. Transaction Handling
  18641. commit
  18642. rollback
  18643.  
  18644.  
  18645. ΓòÉΓòÉΓòÉ <hidden> IDatastoreODBC - Constructors ΓòÉΓòÉΓòÉ
  18646.  
  18647. IDatastoreODBC has two public constructors and a destructor. 
  18648.  
  18649.  
  18650. ΓòÉΓòÉΓòÉ <hidden> IDatastoreODBC - Data Manipulation ΓòÉΓòÉΓòÉ
  18651.  
  18652. This member is used to execute a dynamic SQL statement. 
  18653.  
  18654.  
  18655. ΓòÉΓòÉΓòÉ <hidden> IDatastoreODBC - Database Connection ΓòÉΓòÉΓòÉ
  18656.  
  18657. These members are used to connect to or to disconnect from a datastore. 
  18658.  
  18659.  
  18660. ΓòÉΓòÉΓòÉ <hidden> IDatastoreODBC - Queries ΓòÉΓòÉΓòÉ
  18661.  
  18662. These members are used to access information about an object. 
  18663.  
  18664.  
  18665. ΓòÉΓòÉΓòÉ <hidden> IDatastoreODBC - State Modifiers ΓòÉΓòÉΓòÉ
  18666.  
  18667. These members are used to modify the state of an object. 
  18668.  
  18669.  
  18670. ΓòÉΓòÉΓòÉ <hidden> IDatastoreODBC - Transaction Handling ΓòÉΓòÉΓòÉ
  18671.  
  18672. These members are used to commit or to roll back transactions. 
  18673.  
  18674.  
  18675. ΓòÉΓòÉΓòÉ <hidden> Public Data - IDatastoreODBC ΓòÉΓòÉΓòÉ
  18676.  
  18677. accessModeId
  18678. autoCommitId
  18679. connectStringId
  18680. driverPromptId
  18681. isolationLevelId
  18682. readyId
  18683.  
  18684.  
  18685. ΓòÉΓòÉΓòÉ 9.6.1. IDatastoreODBC::accessMode ΓòÉΓòÉΓòÉ
  18686.  
  18687. Returns the current access mode setting. 
  18688.  
  18689. public:
  18690. virtual IDatastoreODBC::AccessMode accessMode() const;
  18691.  
  18692.  
  18693. ΓòÉΓòÉΓòÉ 9.6.2. IDatastoreODBC::accessModeId ΓòÉΓòÉΓòÉ
  18694.  
  18695. Notification identifier sent when the accessMode attribute is modified. 
  18696.  
  18697. public:
  18698. static const INotificationId accessModeId;
  18699.  
  18700.  
  18701. ΓòÉΓòÉΓòÉ 9.6.3. IDatastoreODBC::autoCommitId ΓòÉΓòÉΓòÉ
  18702.  
  18703. Notification identifier sent when the autoCommit attribute is modified. 
  18704.  
  18705. public:
  18706. static const INotificationId autoCommitId;
  18707.  
  18708.  
  18709. ΓòÉΓòÉΓòÉ 9.6.4. IDatastoreODBC::commit ΓòÉΓòÉΓòÉ
  18710.  
  18711. For a description of this function, see IDatastoreBase::commit. 
  18712.  
  18713. Note:  Methods implemented in the base class return a reference to the calling 
  18714. class type. 
  18715.  
  18716. public:
  18717. virtual IDatastoreODBC& commit();
  18718.  
  18719.  
  18720. ΓòÉΓòÉΓòÉ 9.6.5. IDatastoreODBC::connect ΓòÉΓòÉΓòÉ
  18721.  
  18722. For a description of this function, see IDatastoreBase::connect. 
  18723.  
  18724. Note:  Methods implemented in the base class return a reference to the calling 
  18725. class type. 
  18726.  
  18727. Overload 1 
  18728.  
  18729. public:
  18730. virtual IDatastoreODBC&
  18731.   connect( const char* datastoreName,
  18732.            const char* userName,
  18733.            const char* authentication);
  18734.  
  18735. Overload 2 
  18736.  
  18737. public:
  18738. virtual IDatastoreODBC& connect();
  18739.  
  18740. Overload 3 
  18741.  
  18742. public:
  18743. virtual IDatastoreODBC& connect(const char* datastoreName);
  18744.  
  18745. Overload 4 
  18746.  
  18747. public:
  18748. virtual IDatastoreODBC&
  18749.   connect( const char* userName,
  18750.            const char* authentication);
  18751.  
  18752. Overload 5 
  18753.  
  18754. public:
  18755. virtual IDatastoreODBC&
  18756.   connect( const char* datastoreName,
  18757.            const char* connectString,
  18758.            const char* userName,
  18759.            const char* authentication);
  18760.  
  18761. Exceptions 
  18762.  
  18763. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  18764. ΓöéIDAConnectFailed    ΓöéAn object of this class is thrown when aΓöé
  18765. Γöé                    Γöédatabase connection attempt fails.      Γöé
  18766. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  18767. ΓöéIDAAccessError      ΓöéAn object of this class is thrown when  Γöé
  18768. Γöé                    Γöéan error occurs during an attempt to    Γöé
  18769. Γöé                    Γöéaccess data in the datastore.           Γöé
  18770. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  18771.  
  18772.  
  18773. ΓòÉΓòÉΓòÉ 9.6.6. IDatastoreODBC::connectString ΓòÉΓòÉΓòÉ
  18774.  
  18775. Returns the current connect string setting. This string, which enables a user 
  18776. to specify additional connect string keywords and values, is concatenated with 
  18777. DSN=<value> (datastoreName) and, if provided, UID=<value> (userName), and 
  18778. PWD=<value> (authentication), to form the connect string for the 
  18779. SQLDriverConnect call. For example: 
  18780.  
  18781. "DSN=SAMPLE; UID=STUDENT; PWD=student1; AUTOCOMMIT=0; CONNECTTYPE=1;"
  18782.  
  18783. public:
  18784. virtual IString connectString() const;
  18785.  
  18786.  
  18787. ΓòÉΓòÉΓòÉ 9.6.7. IDatastoreODBC::connectStringId ΓòÉΓòÉΓòÉ
  18788.  
  18789. Notification identifier sent when the connectString attribute is modified. 
  18790.  
  18791. public:
  18792. static const INotificationId connectStringId;
  18793.  
  18794.  
  18795. ΓòÉΓòÉΓòÉ 9.6.8. IDatastoreODBC::disconnect ΓòÉΓòÉΓòÉ
  18796.  
  18797. For a description of this function, see IDatastoreBase::disconnect. 
  18798.  
  18799. Note:  Methods implemented in the base class return a reference to the calling 
  18800. class type. 
  18801.  
  18802. public:
  18803. virtual IDatastoreODBC& disconnect();
  18804.  
  18805.  
  18806. ΓòÉΓòÉΓòÉ 9.6.9. IDatastoreODBC::driverPrompt ΓòÉΓòÉΓòÉ
  18807.  
  18808. Returns the current driver prompt parameter setting. 
  18809.  
  18810. public:
  18811. virtual IDatastoreODBC::DriverPrompt driverPrompt() const;
  18812.  
  18813.  
  18814. ΓòÉΓòÉΓòÉ 9.6.10. IDatastoreODBC::driverPromptId ΓòÉΓòÉΓòÉ
  18815.  
  18816. Notification identifier sent when the driverPrompt attribute changes. 
  18817.  
  18818. public:
  18819. static const INotificationId driverPromptId;
  18820.  
  18821.  
  18822. ΓòÉΓòÉΓòÉ 9.6.11. IDatastoreODBC::enableAutoCommit ΓòÉΓòÉΓòÉ
  18823.  
  18824. Enables or disables the autocommit mode. 
  18825.  
  18826. public:
  18827. virtual IDatastoreODBC&
  18828.   enableAutoCommit( IBoolean enable = True);
  18829.  
  18830.  
  18831. ΓòÉΓòÉΓòÉ 9.6.12. IDatastoreODBC::executeSQL ΓòÉΓòÉΓòÉ
  18832.  
  18833. For a description of this function, see IDatastoreBase::executeSQL. 
  18834.  
  18835. Note:  Methods implemented in the base class return a reference to the calling 
  18836. class type. 
  18837.  
  18838. public:
  18839. virtual IDatastoreODBC& executeSQL(const char* aCmd);
  18840.  
  18841.  
  18842. ΓòÉΓòÉΓòÉ 9.6.13. IDatastoreODBC::IDatastoreODBC ΓòÉΓòÉΓòÉ
  18843.  
  18844. This class has two constructors; one takes no parameters, and the other takes 
  18845. one required parameter and one optional parameter. 
  18846.  
  18847. Overload 1 
  18848.  
  18849. public:
  18850. IDatastoreODBC( const char* datastoreName,
  18851.                 const char* connectString = "");
  18852.  
  18853. Overload 2 
  18854.  
  18855. public:
  18856. IDatastoreODBC();
  18857.  
  18858.  
  18859. ΓòÉΓòÉΓòÉ 9.6.14. IDatastoreODBC::isAutoCommit ΓòÉΓòÉΓòÉ
  18860.  
  18861. Returns true if the autocommit mode is enabled; otherwise, returns false. 
  18862.  
  18863. public:
  18864. virtual IBoolean isAutoCommit() const;
  18865.  
  18866.  
  18867. ΓòÉΓòÉΓòÉ 9.6.15. IDatastoreODBC::isolationLevel ΓòÉΓòÉΓòÉ
  18868.  
  18869. Returns the current isolation level setting. 
  18870.  
  18871. public:
  18872. virtual IDatastoreODBC::IsolationLevel
  18873.   isolationLevel() const;
  18874.  
  18875.  
  18876. ΓòÉΓòÉΓòÉ 9.6.16. IDatastoreODBC::isolationLevelId ΓòÉΓòÉΓòÉ
  18877.  
  18878. Notification identifier sent when the isolationLevel attribute changes. 
  18879.  
  18880. public:
  18881. static const INotificationId isolationLevelId;
  18882.  
  18883.  
  18884. ΓòÉΓòÉΓòÉ 9.6.17. IDatastoreODBC::readyId ΓòÉΓòÉΓòÉ
  18885.  
  18886. Notification identifier sent when a part is initialized. 
  18887.  
  18888. public:
  18889. static const INotificationId readyId;
  18890.  
  18891.  
  18892. ΓòÉΓòÉΓòÉ 9.6.18. IDatastoreODBC::rollback ΓòÉΓòÉΓòÉ
  18893.  
  18894. For a description of this function, see IDatastoreBase::rollback. 
  18895.  
  18896. Note:  Methods implemented in the base class return a reference to the calling 
  18897. class type. 
  18898.  
  18899. public:
  18900. virtual IDatastoreODBC& rollback();
  18901.  
  18902.  
  18903. ΓòÉΓòÉΓòÉ 9.6.19. IDatastoreODBC::setAccessMode ΓòÉΓòÉΓòÉ
  18904.  
  18905. Enables a user to set the access mode. 
  18906.  
  18907. public:
  18908. virtual IDatastoreODBC& setAccessMode(AccessMode option);
  18909.  
  18910.  
  18911. ΓòÉΓòÉΓòÉ 9.6.20. IDatastoreODBC::setAuthentication ΓòÉΓòÉΓòÉ
  18912.  
  18913. Sets the authentication. 
  18914.  
  18915. public:
  18916. virtual IDatastoreODBC&
  18917.   setAuthentication( const char* aAuthentication);
  18918.  
  18919.  
  18920. ΓòÉΓòÉΓòÉ 9.6.21. IDatastoreODBC::setConnectString ΓòÉΓòÉΓòÉ
  18921.  
  18922. Sets the connect string. For a description of the connect string, see 
  18923. IDatastoreODBC::connectString. 
  18924.  
  18925. public:
  18926. virtual IDatastoreODBC&
  18927.   setConnectString( const char* aConnectString);
  18928.  
  18929.  
  18930. ΓòÉΓòÉΓòÉ 9.6.22. IDatastoreODBC::setDatastoreName ΓòÉΓòÉΓòÉ
  18931.  
  18932. Sets the datastore name that is used when a connection is established. 
  18933.  
  18934. public:
  18935. virtual IDatastoreODBC&
  18936.   setDatastoreName( const char* aDatastoreName);
  18937.  
  18938.  
  18939. ΓòÉΓòÉΓòÉ 9.6.23. IDatastoreODBC::setDriverPrompt ΓòÉΓòÉΓòÉ
  18940.  
  18941. Enables a user to set the driver prompt parameter, and to pass in the window 
  18942. handle of the parent application. 
  18943.  
  18944. A description of the logon dialog box can be found in the appropriate database 
  18945. section of the supported ODBC drivers chapter of the VisualAge C++ User's 
  18946. Guide. 
  18947.  
  18948. public:
  18949. virtual IDatastoreODBC&
  18950.   setDriverPrompt( DriverPrompt option,
  18951.                    IWindowHandle aHandle = IWindowHandle ( ));
  18952.  
  18953.  
  18954. ΓòÉΓòÉΓòÉ 9.6.24. IDatastoreODBC::setIsolationLevel ΓòÉΓòÉΓòÉ
  18955.  
  18956. Enables a user to set the isolation level. 
  18957.  
  18958. public:
  18959. virtual IDatastoreODBC&
  18960.   setIsolationLevel( IsolationLevel option);
  18961.  
  18962.  
  18963. ΓòÉΓòÉΓòÉ 9.6.25. IDatastoreODBC::setUserName ΓòÉΓòÉΓòÉ
  18964.  
  18965. Sets the user name. 
  18966.  
  18967. public:
  18968. virtual IDatastoreODBC& setUserName(const char* aUserName);
  18969.  
  18970.  
  18971. ΓòÉΓòÉΓòÉ 9.6.26. IDatastoreODBC::~IDatastoreODBC ΓòÉΓòÉΓòÉ
  18972.  
  18973. The IDatastoreODBC destructor frees space allocated by the constructor, and 
  18974. executes a disconnect if the application has not explicitly done so. 
  18975.  
  18976. public:
  18977. virtual ~IDatastoreODBC();
  18978.  
  18979.  
  18980. ΓòÉΓòÉΓòÉ <hidden> Nested Types - IDatastoreODBC ΓòÉΓòÉΓòÉ
  18981.  
  18982. Enumerations 
  18983.  
  18984.        AccessMode 
  18985.        DriverPrompt 
  18986.        IsolationLevel 
  18987.  
  18988.  
  18989. ΓòÉΓòÉΓòÉ <hidden> Enums - AccessMode ΓòÉΓòÉΓòÉ
  18990.  
  18991. enum AccessMode { readOnly, readWrite };
  18992.  
  18993.  readOnly 
  18994.            Access mode is read-only. 
  18995.  readWrite 
  18996.            Access mode is updateable. 
  18997.  
  18998.  
  18999. ΓòÉΓòÉΓòÉ <hidden> Enums - DriverPrompt ΓòÉΓòÉΓòÉ
  19000.  
  19001. enum DriverPrompt { driverPromptRequest,
  19002.                     driverComplete,
  19003.                     driverCompleteRequired,
  19004.                     noDriverPrompt };
  19005.  
  19006.  driverPromptRequest 
  19007.            Dialog is always initiated. 
  19008.  driverComplete 
  19009.            Dialog is only initiated if there is insufficent information in the 
  19010.            connection string. 
  19011.  driverCompleteRequired 
  19012.            Dialog is only initiated if there is insufficent information in the 
  19013.            connection string. Only mandatory information is requested. 
  19014.  noDriverPrompt 
  19015.            The user is not prompted for any information. 
  19016.  
  19017.  
  19018. ΓòÉΓòÉΓòÉ <hidden> Enums - IsolationLevel ΓòÉΓòÉΓòÉ
  19019.  
  19020. enum IsolationLevel { readUncommitted,
  19021.                       readCommitted,
  19022.                       repeatableRead,
  19023.                       serializable,
  19024.                       databaseDefault };
  19025.  
  19026.  readUncommittted 
  19027.            Permits an application to access uncommitted changes caused by other 
  19028.            transactions. 
  19029.  readCommitted 
  19030.            Ensures that the current row of every updateable cursor is not 
  19031.            changed by other application processes. 
  19032.  repeatableRead 
  19033.            Keeps a lock on all rows accessed since the last commit point. 
  19034.  serializable 
  19035.            Data affected by pending transactions is not available to other 
  19036.            transactions. 
  19037.  databaseDefault 
  19038.            The default isolation level for the specified database product. 
  19039.  
  19040.  
  19041. ΓòÉΓòÉΓòÉ 9.7. IPersistentObject ΓòÉΓòÉΓòÉ
  19042.  
  19043. Description 
  19044.  
  19045. Derivation 
  19046.  
  19047. Public Functions 
  19048.  
  19049. Protected Functions 
  19050.  
  19051. To close all the panels in a chapter, double click on this panel's system menu. 
  19052.  
  19053.  
  19054. ΓòÉΓòÉΓòÉ <hidden> Derivation - IPersistentObject ΓòÉΓòÉΓòÉ
  19055.  
  19056. IBase
  19057.   
  19058. IPersistentObject
  19059.  
  19060. Inherited by none. 
  19061.  
  19062.  
  19063. ΓòÉΓòÉΓòÉ <hidden> Class Description - IPersistentObject ΓòÉΓòÉΓòÉ
  19064.  
  19065. Header File: ipersist.hpp 
  19066.  
  19067. The IPersistentObject class provides the basic data manipulation operations 
  19068. that a client can call directly to retrieve, update, add, or delete rows from a 
  19069. table. It is the abstract base class for some of the parts generated by the 
  19070. tool. Objects of this class are not instantiated, but the class may be used as 
  19071. a generic reference or pointer to objects instantiated from the concrete 
  19072. derived classes. 
  19073.  
  19074. The Data Access Builder generates classes derived from this class. For more 
  19075. information, see the Open Class Library User's Guide. 
  19076.  
  19077.  
  19078. ΓòÉΓòÉΓòÉ <hidden> Public Functions - IPersistentObject ΓòÉΓòÉΓòÉ
  19079.  
  19080. Constructors
  19081. ~IPersistentObject
  19082.  
  19083. Data Manipulation
  19084. add
  19085. del
  19086. retrieve
  19087. update
  19088.  
  19089. Queries
  19090. asString
  19091. forDisplay
  19092. isDefaultReadOnly
  19093. isReadOnly
  19094. isRetrievable
  19095.  
  19096. State Modifiers
  19097. setReadOnly
  19098. setRetrievable
  19099.  
  19100.  
  19101. ΓòÉΓòÉΓòÉ <hidden> IPersistentObject - Constructors ΓòÉΓòÉΓòÉ
  19102.  
  19103. IPersistentObject has two protected constructors, a public destructor, and a 
  19104. protected assignment operator. 
  19105.  
  19106.  
  19107. ΓòÉΓòÉΓòÉ <hidden> IPersistentObject - Data Manipulation ΓòÉΓòÉΓòÉ
  19108.  
  19109. These members are used to retrieve, update, add, or delete rows from a table. 
  19110.  
  19111.  
  19112. ΓòÉΓòÉΓòÉ <hidden> IPersistentObject - Queries ΓòÉΓòÉΓòÉ
  19113.  
  19114. These members are used to access information about an object. 
  19115.  
  19116.  
  19117. ΓòÉΓòÉΓòÉ <hidden> IPersistentObject - State Modifiers ΓòÉΓòÉΓòÉ
  19118.  
  19119. These members are used to modify the state of an object. 
  19120.  
  19121.  
  19122. ΓòÉΓòÉΓòÉ <hidden> Protected Functions - IPersistentObject ΓòÉΓòÉΓòÉ
  19123.  
  19124. Constructors
  19125. IPersistentObject
  19126. operator =
  19127. operator ==
  19128.  
  19129.  
  19130. ΓòÉΓòÉΓòÉ 9.7.1. IPersistentObject::add ΓòÉΓòÉΓòÉ
  19131.  
  19132. In the generated part, the derived class adds a row to a table using the data 
  19133. attribute values set in the object. The object should be uniquely identified by 
  19134. the data identifier. Attention: If the identifier is not unique, the object may 
  19135. not be retrievable. 
  19136.  
  19137. public:
  19138. virtual IPersistentObject& add();
  19139.  
  19140. Exceptions 
  19141.  
  19142. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  19143. ΓöéIDAAccessError      ΓöéAn object of this class is thrown when  Γöé
  19144. Γöé                    Γöéan error occurs during an attempt to    Γöé
  19145. Γöé                    Γöéaccess data in the datastore.           Γöé
  19146. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  19147. ΓöéIDADataObjectAlreadyΓöéAn object of this class is thrown when  Γöé
  19148. Γöé                    Γöéthe data object specified in an add     Γöé
  19149. Γöé                    Γöéoperation already exists in the         Γöé
  19150. Γöé                    Γöédatastore.                              Γöé
  19151. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  19152.  
  19153.  
  19154. ΓòÉΓòÉΓòÉ 9.7.2. IPersistentObject::asString ΓòÉΓòÉΓòÉ
  19155.  
  19156. This function is defined in the generated code. Returns a string containing the 
  19157. concatenated asString representation of each of the attributes of this class. 
  19158. The separator is inserted between each attribute. 
  19159.  
  19160. public:
  19161. virtual IString
  19162.   asString( const char* separator = ".") const = 0;
  19163.  
  19164.  
  19165. ΓòÉΓòÉΓòÉ 9.7.3. IPersistentObject::del ΓòÉΓòÉΓòÉ
  19166.  
  19167. In the generated part, the derived class deletes a row from a table using the 
  19168. data identifier set in the object. The composition of the data identifier is 
  19169. defined for the concrete class. Attention: If the identifier is not unique, 
  19170. several rows may be deleted. In this case, catch the IDAAccessError exception, 
  19171. and rollback as required. 
  19172.  
  19173. public:
  19174. virtual IPersistentObject& del();
  19175.  
  19176. Exceptions 
  19177.  
  19178. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  19179. ΓöéIDAAccessError      ΓöéAn object of this class is thrown when  Γöé
  19180. Γöé                    Γöéan error occurs during an attempt to    Γöé
  19181. Γöé                    Γöéaccess data in the datastore.           Γöé
  19182. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  19183. ΓöéIDADataObjectNotFounΓöéAn object of this class is thrown when  Γöé
  19184. Γöé                    Γöéthe data object specified in a retrieve,Γöé
  19185. Γöé                    Γöéupdate, or delete operation cannot be   Γöé
  19186. Γöé                    Γöéfound in the datastore.                 Γöé
  19187. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  19188.  
  19189.  
  19190. ΓòÉΓòÉΓòÉ 9.7.4. IPersistentObject::forDisplay ΓòÉΓòÉΓòÉ
  19191.  
  19192. This function is defined in the generated code. Returns a string containing the 
  19193. concatenated asString representation of each attribute of this class that has 
  19194. been marked in the Data Access Builder to be returned by this method. The 
  19195. separator is inserted between each attribute. 
  19196.  
  19197. public:
  19198. virtual IString
  19199.   forDisplay( const char* separator = " ") const = 0;
  19200.  
  19201.  
  19202. ΓòÉΓòÉΓòÉ 9.7.5. IPersistentObject::IPersistentObject ΓòÉΓòÉΓòÉ
  19203.  
  19204. These protected constructors can only be called from derived classes. 
  19205.  
  19206. protected:
  19207. IPersistentObject(const IPersistentObject& partCopy);
  19208.  
  19209.  
  19210. ΓòÉΓòÉΓòÉ 9.7.6. IPersistentObject::isDefaultReadOnly ΓòÉΓòÉΓòÉ
  19211.  
  19212. Returns true if the derived class to which the object belongs is read-only by 
  19213. default; otherwise, returns false. If true: 
  19214.  
  19215.      An exception occurs following an add, delete, or update statement. You 
  19216.       can use only the retrieve statement to read the object from the table. 
  19217.  
  19218.      You cannot use setReadOnly to change the setting. 
  19219.  
  19220.   public:
  19221.   Boolean isDefaultReadOnly() const;
  19222.  
  19223.  
  19224. ΓòÉΓòÉΓòÉ 9.7.7. IPersistentObject::isReadOnly ΓòÉΓòÉΓòÉ
  19225.  
  19226. Returns true if the table or the object is read-only; otherwise, returns false. 
  19227. If true, an exception occurs when an add, delete, or update method is called. 
  19228.  
  19229. public:
  19230. Boolean isReadOnly() const;
  19231.  
  19232.  
  19233. ΓòÉΓòÉΓòÉ 9.7.8. IPersistentObject::isRetrievable ΓòÉΓòÉΓòÉ
  19234.  
  19235. Returns true if the retrieve method applies to the object; otherwise, returns 
  19236. false. 
  19237.  
  19238. public:
  19239. Boolean isRetrievable() const;
  19240.  
  19241.  
  19242. ΓòÉΓòÉΓòÉ 9.7.9. IPersistentObject::operator = ΓòÉΓòÉΓòÉ
  19243.  
  19244. Assigns one persistent object to another. 
  19245.  
  19246. protected:
  19247. IPersistentObject&
  19248.   operator =( const IPersistentObject& aIPersistentObject);
  19249.  
  19250.  
  19251. ΓòÉΓòÉΓòÉ 9.7.10. IPersistentObject::operator == ΓòÉΓòÉΓòÉ
  19252.  
  19253. Compares the attribute values of two persistent objects. 
  19254.  
  19255. protected:
  19256. Boolean
  19257.   operator ==( const IPersistentObject& aIPersistentObject) const;
  19258.  
  19259.  
  19260. ΓòÉΓòÉΓòÉ 9.7.11. IPersistentObject::retrieve ΓòÉΓòÉΓòÉ
  19261.  
  19262. In the generated part, the derived class retrieves a row from a table using the 
  19263. data identifier set in the object. The composition of the data identifier is 
  19264. defined by the concrete class. The data identifier must be set in the object 
  19265. before calling retrieve. If the identifier is not unique, this function simply 
  19266. retrieves the first row of the table. 
  19267.  
  19268. public:
  19269. virtual IPersistentObject& retrieve();
  19270.  
  19271. Exceptions 
  19272.  
  19273. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  19274. ΓöéIDAAccessError      ΓöéAn object of this class is thrown when  Γöé
  19275. Γöé                    Γöéan error occurs during an attempt to    Γöé
  19276. Γöé                    Γöéaccess data in the datastore.           Γöé
  19277. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  19278. ΓöéIDADataObjectNotFounΓöéAn object of this class is thrown when  Γöé
  19279. Γöé                    Γöéthe data object specified in a retrieve,Γöé
  19280. Γöé                    Γöéupdate, or delete operation cannot be   Γöé
  19281. Γöé                    Γöéfound in the datastore.                 Γöé
  19282. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  19283.  
  19284.  
  19285. ΓòÉΓòÉΓòÉ 9.7.12. IPersistentObject::setReadOnly ΓòÉΓòÉΓòÉ
  19286.  
  19287. Sets this object to read-only or to updateable. 
  19288.  
  19289. public:
  19290. IPersistentObject& setReadOnly(Boolean flag = true);
  19291.  
  19292. Exceptions 
  19293.  
  19294. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  19295. ΓöéIDAAccessError      ΓöéAn object of this class is thrown when  Γöé
  19296. Γöé                    Γöéan error occurs during an attempt to    Γöé
  19297. Γöé                    Γöéaccess data in the datastore.           Γöé
  19298. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  19299.  
  19300.  
  19301. ΓòÉΓòÉΓòÉ 9.7.13. IPersistentObject::setRetrievable ΓòÉΓòÉΓòÉ
  19302.  
  19303. Specifies whether the retrieve method may be called for this object. 
  19304.  
  19305. public:
  19306. IPersistentObject& setRetrievable(Boolean flag = true);
  19307.  
  19308.  
  19309. ΓòÉΓòÉΓòÉ 9.7.14. IPersistentObject::update ΓòÉΓòÉΓòÉ
  19310.  
  19311. In the generated part, the derived class updates a row using the data 
  19312. identifier set in the object. The composition of the data identifier is defined 
  19313. by the concrete class. Attention: If the identifier is not unique, several rows 
  19314. may be updated. In this case, catch the IDAAccessError exception, and rollback 
  19315. as required. 
  19316.  
  19317. public:
  19318. virtual IPersistentObject& update();
  19319.  
  19320. Exceptions 
  19321.  
  19322. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  19323. ΓöéIDAAccessError      ΓöéAn object of this class is thrown when  Γöé
  19324. Γöé                    Γöéan error occurs during an attempt to    Γöé
  19325. Γöé                    Γöéaccess data in the datastore.           Γöé
  19326. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  19327.  
  19328.  
  19329. ΓòÉΓòÉΓòÉ 9.7.15. IPersistentObject::~IPersistentObject ΓòÉΓòÉΓòÉ
  19330.  
  19331. The IPersistentObject destructor frees space allocated by the constructor. 
  19332.  
  19333. public:
  19334. virtual ~IPersistentObject();
  19335.  
  19336.  
  19337. ΓòÉΓòÉΓòÉ 9.8. IPOManager ΓòÉΓòÉΓòÉ
  19338.  
  19339. Description 
  19340.  
  19341. Derivation 
  19342.  
  19343. Public Functions 
  19344.  
  19345. Protected Functions 
  19346.  
  19347. To close all the panels in a chapter, double click on this panel's system menu. 
  19348.  
  19349.  
  19350. ΓòÉΓòÉΓòÉ <hidden> Derivation - IPOManager ΓòÉΓòÉΓòÉ
  19351.  
  19352. Inherits from none. 
  19353.  
  19354. Inherited by none. 
  19355.  
  19356.  
  19357. ΓòÉΓòÉΓòÉ <hidden> Class Description - IPOManager ΓòÉΓòÉΓòÉ
  19358.  
  19359. Header File: ipersist.hpp 
  19360.  
  19361. The IPOManager class provides operations for the retrieval of a set of results 
  19362. from a table. These results are kept in a collection using the IOC collection 
  19363. classes. Objects of the IPOManager class are not instantiated, but the class 
  19364. may be used as a generic reference or pointer to objects instantiated from the 
  19365. concrete derived classes. 
  19366.  
  19367. For more information, see the Open Class Library User's Guide. 
  19368.  
  19369.  
  19370. ΓòÉΓòÉΓòÉ <hidden> Public Functions - IPOManager ΓòÉΓòÉΓòÉ
  19371.  
  19372. Constructors
  19373. ~IPOManager
  19374.  
  19375. Data Manipulation
  19376. refresh
  19377. select
  19378.  
  19379.  
  19380. ΓòÉΓòÉΓòÉ <hidden> IPOManager - Constructors ΓòÉΓòÉΓòÉ
  19381.  
  19382. IPOManager has two protected constructors, a public destructor, and a protected 
  19383. assignment operator. 
  19384.  
  19385.  
  19386. ΓòÉΓòÉΓòÉ <hidden> IPOManager - Data Manipulation ΓòÉΓòÉΓòÉ
  19387.  
  19388. These members are used to retrieve rows from a table. 
  19389.  
  19390.  
  19391. ΓòÉΓòÉΓòÉ <hidden> Protected Functions - IPOManager ΓòÉΓòÉΓòÉ
  19392.  
  19393. Constructors
  19394. IPOManager
  19395. operator =
  19396.  
  19397.  
  19398. ΓòÉΓòÉΓòÉ 9.8.1. IPOManager::IPOManager ΓòÉΓòÉΓòÉ
  19399.  
  19400. These protected constructors can only be called from derived classes. 
  19401.  
  19402. protected:
  19403. IPOManager(const IPOManager& partCopy);
  19404.  
  19405.  
  19406. ΓòÉΓòÉΓòÉ 9.8.2. IPOManager::operator = ΓòÉΓòÉΓòÉ
  19407.  
  19408. Assigns one persistent object manager to another. 
  19409.  
  19410. protected:
  19411. IPOManager& operator =(const IPOManager& aIPOManager);
  19412.  
  19413.  
  19414. ΓòÉΓòÉΓòÉ 9.8.3. IPOManager::refresh ΓòÉΓòÉΓòÉ
  19415.  
  19416. Retrieves all the rows from a table. 
  19417.  
  19418. public:
  19419. virtual IPOManager& refresh() = 0;
  19420.  
  19421.  
  19422. ΓòÉΓòÉΓòÉ 9.8.4. IPOManager::select ΓòÉΓòÉΓòÉ
  19423.  
  19424. In the generated part, the derived class retrieves all the rows from a table 
  19425. that match the criteria specified by the clause string, an SQL where clause. 
  19426. The keyword is added by the class library code. The clause may be followed by 
  19427. additional parameters, as permitted in select clauses by the datastore. 
  19428.  
  19429. public:
  19430. virtual IPOManager& select(const char* clause) = 0;
  19431.  
  19432.  
  19433. ΓòÉΓòÉΓòÉ 9.8.5. IPOManager::~IPOManager ΓòÉΓòÉΓòÉ
  19434.  
  19435. The IPOManager destructor frees space allocated by the constructor. 
  19436.  
  19437. public:
  19438. virtual ~IPOManager();
  19439.  
  19440.  
  19441. ΓòÉΓòÉΓòÉ 10. Data Access Builder SOM Classes and Exceptions ΓòÉΓòÉΓòÉ
  19442.  
  19443. Use the database access classes to connect to and to disconnect from your DB2 
  19444. and other supported databases, and to apply transactions against those 
  19445. databases. 
  19446.  
  19447. This section describes the SOM version of the database access classes. Use 
  19448. these classes when you want to use SOM objects. 
  19449.  
  19450.  
  19451. ΓòÉΓòÉΓòÉ 10.1. Class Hierarchy ΓòÉΓòÉΓòÉ
  19452.  
  19453. SOMObject
  19454.    DatastoreBase
  19455.       Datastore
  19456.       DatastoreDB2
  19457.       DatastoreODBC
  19458.    PersistentObject
  19459.    SOMClass
  19460.       DatastoreDB2Factory
  19461.       DatastoreFactory
  19462.       DatastoreODBCFactory
  19463.       POFactory
  19464.  
  19465.  
  19466. ΓòÉΓòÉΓòÉ 10.2. Datastore ΓòÉΓòÉΓòÉ
  19467.  
  19468. Description 
  19469.  
  19470. Derivation 
  19471.  
  19472. Public Functions 
  19473.  
  19474. To close all the panels in a chapter, double click on this panel's system menu. 
  19475.  
  19476.  
  19477. ΓòÉΓòÉΓòÉ <hidden> Derivation - Datastore ΓòÉΓòÉΓòÉ
  19478.  
  19479. SOMObject
  19480.   Γöé
  19481. DatastoreBase
  19482.   Γöé
  19483. Datastore
  19484.  
  19485. Inherited by none. 
  19486.  
  19487.  
  19488. ΓòÉΓòÉΓòÉ <hidden> Class Description - Datastore ΓòÉΓòÉΓòÉ
  19489.  
  19490. Header File: sdsmcon.idl 
  19491.  
  19492. Use Datastore with persistent objects that were generated using the embedded 
  19493. SQL option to access DB2 version 1.2 or 2.1 embedded SQL. Data Access Builder 
  19494. permits only one Datastore instance connection to DB2 per application process. 
  19495. To access DB2 version 2.1 or later using CLI, use DatastoreDB2. 
  19496.  
  19497. Only one connection should be active at a time when using embedded SQL. 
  19498.  
  19499. A Datastore can be used with a DatastoreODBC, and a DatastoreDB2 can be used 
  19500. with a DatastoreODBC, but a Datastore cannot be used with a DatastoreDB2. 
  19501.  
  19502. For DB2 version 1.2 and 2.1 embedded SQL, if user_name and authentication are 
  19503. both specified, these attributes are used to request access to the database; 
  19504. otherwise, an attempt is made to access the database without this information. 
  19505.  
  19506. Windows Information 
  19507.  
  19508. Data Access Builder does not support DB2 version 1.2 on Windows platforms. 
  19509.  
  19510.  
  19511. ΓòÉΓòÉΓòÉ <hidden> Public Functions - Datastore ΓòÉΓòÉΓòÉ
  19512.  
  19513. Queries
  19514. is_sharemode_exclusive
  19515.  
  19516. State Modifiers
  19517. enable_sharemode_exclusive
  19518.  
  19519.  
  19520. ΓòÉΓòÉΓòÉ <hidden> Datastore - Queries ΓòÉΓòÉΓòÉ
  19521.  
  19522. These methods are used to access information about an object. 
  19523.  
  19524.  
  19525. ΓòÉΓòÉΓòÉ <hidden> Datastore - State Modifiers ΓòÉΓòÉΓòÉ
  19526.  
  19527. These methods are used to modify the state of an object. 
  19528.  
  19529.  
  19530. ΓòÉΓòÉΓòÉ 10.2.1. Datastore::enable_sharemode_exclusive ΓòÉΓòÉΓòÉ
  19531.  
  19532. Enables or disables the share mode in a database connection. Enabling this 
  19533. option specifies exclusive access to the database; no other process will be 
  19534. able to connect to the database until the original connection is reset. 
  19535.  
  19536. public:
  19537. void enable_sharemode_exclusive(in boolean enable);
  19538.  
  19539.  
  19540. ΓòÉΓòÉΓòÉ 10.2.2. Datastore::is_sharemode_exclusive ΓòÉΓòÉΓòÉ
  19541.  
  19542. Returns true if the share mode has been enabled, or false if it has been 
  19543. disabled for this connection. 
  19544.  
  19545. public:
  19546. boolean is_sharemode_exclusive();
  19547.  
  19548.  
  19549. ΓòÉΓòÉΓòÉ 10.3. DatastoreBase ΓòÉΓòÉΓòÉ
  19550.  
  19551. Description 
  19552.  
  19553. Derivation 
  19554.  
  19555. Public Functions 
  19556.  
  19557. To close all the panels in a chapter, double click on this panel's system menu. 
  19558.  
  19559.  
  19560. ΓòÉΓòÉΓòÉ <hidden> Derivation - DatastoreBase ΓòÉΓòÉΓòÉ
  19561.  
  19562. SOMObject
  19563.   Γöé
  19564. DatastoreBase
  19565.  
  19566. Inherited by: 
  19567.  
  19568.       Datastore 
  19569.       DatastoreDB2 
  19570.       DatastoreODBC 
  19571.  
  19572.  
  19573. ΓòÉΓòÉΓòÉ <hidden> Class Description - DatastoreBase ΓòÉΓòÉΓòÉ
  19574.  
  19575. Header File: sdsmcbs.idl 
  19576.  
  19577. DatastoreBase is an abstract base class for all Data Access Builder SOM classes 
  19578. that represent datastore connections. DatastoreBase provides client connection 
  19579. to the database, disconnection from the database, and commit and rollback of 
  19580. transactions. 
  19581.  
  19582. The following attributes are used by DatastoreBase: 
  19583.  
  19584.      authentication 
  19585.  
  19586.       Authentication is the password for the user identified by user_name. An 
  19587.       unspecified value is indicated by " ". 
  19588.  
  19589.      datastore_name 
  19590.  
  19591.       Name of the datastore to which the user wishes to connect. In DB2, 
  19592.       datastore_name represents the name of the database; in ODBC, it 
  19593.       represents the name of the datasource. 
  19594.  
  19595.      user_name 
  19596.  
  19597.       Name of the user to be passed to the datasource. This name and the 
  19598.       password are used to complete authorization of the user. If unspecified 
  19599.       (or set to " "), the user_name is not passed to the datasource, and a 
  19600.       connection attempt may fail, or the datasource may attempt to determine 
  19601.       the user's authorization independently. 
  19602.  
  19603.  
  19604. ΓòÉΓòÉΓòÉ <hidden> Public Functions - DatastoreBase ΓòÉΓòÉΓòÉ
  19605.  
  19606. Data Manipulation
  19607. executeSQL
  19608.  
  19609. Database Connection
  19610. connect
  19611. connect_datastorename
  19612. connect_defaults
  19613. connect_user
  19614. disconnect
  19615.  
  19616. Queries
  19617. is_connected
  19618. _get_authentication
  19619. _get_datastorename
  19620. _get_datastore_type
  19621. _get_user_name
  19622.  
  19623. State Modifiers
  19624. _set_authentication
  19625. _set_datastore_name
  19626. _set_datastore_type
  19627. _set_user_name
  19628.  
  19629. Transaction Handling
  19630. commit
  19631. rollback
  19632.  
  19633.  
  19634. ΓòÉΓòÉΓòÉ <hidden> DatastoreBase - Data Manipulation ΓòÉΓòÉΓòÉ
  19635.  
  19636. This method is used to execute a dynamic SQL statement. 
  19637.  
  19638.  
  19639. ΓòÉΓòÉΓòÉ <hidden> DatastoreBase - Database Connection ΓòÉΓòÉΓòÉ
  19640.  
  19641. These methods are used to connect to or to disconnect from a datastore. 
  19642.  
  19643.  
  19644. ΓòÉΓòÉΓòÉ <hidden> DatastoreBase - Queries ΓòÉΓòÉΓòÉ
  19645.  
  19646. These methods are used to access information about an object. 
  19647.  
  19648.  
  19649. ΓòÉΓòÉΓòÉ <hidden> DatastoreBase - State Modifiers ΓòÉΓòÉΓòÉ
  19650.  
  19651. These methods are used to modify the state of an object. 
  19652.  
  19653.  
  19654. ΓòÉΓòÉΓòÉ <hidden> DatastoreBase - Transaction Handling ΓòÉΓòÉΓòÉ
  19655.  
  19656. These methods are used to commit or to roll back transactions. 
  19657.  
  19658.  
  19659. ΓòÉΓòÉΓòÉ 10.3.1. DatastoreBase::commit ΓòÉΓòÉΓòÉ
  19660.  
  19661. Commits a transaction. 
  19662.  
  19663. public:
  19664. void commit();
  19665.  
  19666. Exceptions 
  19667.  
  19668. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  19669. ΓöéDatastoreConnectionNΓöéSet when an operation that requires a   Γöé
  19670. Γöé                    Γöéconnection is attempted before a        Γöé
  19671. Γöé                    Γöéconnection has been established. An     Γöé
  19672. Γöé                    Γöéexample is a call to disconnect before aΓöé
  19673. Γöé                    Γöéconnection was made.                    Γöé
  19674. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  19675. ΓöéDatastoreAccessErrorΓöéSet when an error occurs during an      Γöé
  19676. Γöé                    Γöéattempt to access data in the datastore.Γöé
  19677. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  19678.  
  19679.  
  19680. ΓòÉΓòÉΓòÉ 10.3.2. DatastoreBase::connect ΓòÉΓòÉΓòÉ
  19681.  
  19682. Connects to a datastore using the specified input parameters. If a connection 
  19683. already exists, performs a disconnect, and then reconnects using the current 
  19684. settings. The values of user_name and authentication are not saved. 
  19685.  
  19686. public:
  19687. void
  19688.   connect( in string datastore_name,
  19689.            in string user_name,
  19690.            in string authentication);
  19691.  
  19692. Exceptions 
  19693.  
  19694. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  19695. ΓöéConnectFailed       ΓöéSet when a database connection attempt  Γöé
  19696. Γöé                    Γöéfails.                                  Γöé
  19697. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  19698. ΓöéDatastoreAccessErrorΓöéSet when an error occurs during an      Γöé
  19699. Γöé                    Γöéattempt to access data in the datastore.Γöé
  19700. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  19701. ΓöéDatastoreLogoffFaileΓöéSet when a logoff fails.                Γöé
  19702. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  19703. ΓöéDatastoreLogonFailedΓöéSet when a logon attempt fails.         Γöé
  19704. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  19705.  
  19706.  
  19707. ΓòÉΓòÉΓòÉ 10.3.3. DatastoreBase::connect_datastorename ΓòÉΓòÉΓòÉ
  19708.  
  19709. Connects to a datastore using the specified datastore_name and the current user 
  19710. ID and authentication settings. 
  19711.  
  19712. public:
  19713. void connect_datastorename(in string datastore_name);
  19714.  
  19715.  
  19716. ΓòÉΓòÉΓòÉ 10.3.4. DatastoreBase::connect_defaults ΓòÉΓòÉΓòÉ
  19717.  
  19718. Connects to a datastore using the currently specified datastore settings. 
  19719.  
  19720. public:
  19721. void connect_defaults();
  19722.  
  19723.  
  19724. ΓòÉΓòÉΓòÉ 10.3.5. DatastoreBase::connect_user ΓòÉΓòÉΓòÉ
  19725.  
  19726. Connects to a datastore using the specified input parameters and the current 
  19727. datastore_name setting. The values of user_name and authentication are not 
  19728. saved. 
  19729.  
  19730. public:
  19731. void
  19732.   connect_user( in string user_name,
  19733.                 in string authentication);
  19734.  
  19735.  
  19736. ΓòÉΓòÉΓòÉ 10.3.6. DatastoreBase::disconnect ΓòÉΓòÉΓòÉ
  19737.  
  19738. Closes the connection to a database. If a logon was performed on the connect, 
  19739. user_name is logged off. 
  19740.  
  19741. public:
  19742. void disconnect();
  19743.  
  19744. Exceptions 
  19745.  
  19746. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  19747. ΓöéDatastoreConnectionNΓöéSet when an operation that requires a   Γöé
  19748. Γöé                    Γöéconnection is attempted before a        Γöé
  19749. Γöé                    Γöéconnection has been established. An     Γöé
  19750. Γöé                    Γöéexample is a call to disconnect before aΓöé
  19751. Γöé                    Γöéconnection was made.                    Γöé
  19752. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  19753. ΓöéDatastoreLogoffFaileΓöéSet when a logoff fails.                Γöé
  19754. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  19755. ΓöéDisconnectError     ΓöéSet when a disconnection error occurs.  Γöé
  19756. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  19757.  
  19758.  
  19759. ΓòÉΓòÉΓòÉ 10.3.7. DatastoreBase::executeSQL ΓòÉΓòÉΓòÉ
  19760.  
  19761. Executes a dynamic SQL statement. If a select statement is passed in: 
  19762.  
  19763.      Datastore always returns an exception 
  19764.      DatastoreDB2 and DatastoreODBC ignore any result other than an access 
  19765.       error message. 
  19766.  
  19767.   public:
  19768.   void executeSQL(in string command);
  19769.  
  19770.  Exceptions 
  19771.  
  19772.   ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  19773.   ΓöéDatastoreAccessErrorΓöéSet when an error occurs during an      Γöé
  19774.   Γöé                    Γöéattempt to access data in the datastore.Γöé
  19775.   ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  19776.  
  19777.  
  19778. ΓòÉΓòÉΓòÉ 10.3.8. DatastoreBase::is_connected ΓòÉΓòÉΓòÉ
  19779.  
  19780. Returns true if a connection to the database exists. 
  19781.  
  19782. public:
  19783. boolean is_connected();
  19784.  
  19785.  
  19786. ΓòÉΓòÉΓòÉ 10.3.9. DatastoreBase::rollback ΓòÉΓòÉΓòÉ
  19787.  
  19788. Performs a rollback on the transactions. 
  19789.  
  19790. public:
  19791. void rollback();
  19792.  
  19793. Exceptions 
  19794.  
  19795. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  19796. ΓöéDatastoreConnectionNΓöéSet when an operation that requires a   Γöé
  19797. Γöé                    Γöéconnection is attempted before a        Γöé
  19798. Γöé                    Γöéconnection has been established. An     Γöé
  19799. Γöé                    Γöéexample is a call to disconnect before aΓöé
  19800. Γöé                    Γöéconnection was made.                    Γöé
  19801. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  19802. ΓöéDatastoreAccessErrorΓöéSet when an error occurs during an      Γöé
  19803. Γöé                    Γöéattempt to access data in the datastore.Γöé
  19804. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  19805.  
  19806.  
  19807. ΓòÉΓòÉΓòÉ 10.3.10. DatastoreBase::_get_authentication ΓòÉΓòÉΓòÉ
  19808.  
  19809. Returns the current authentication setting. 
  19810.  
  19811. public:
  19812. _get_authentication();
  19813.  
  19814.  
  19815. ΓòÉΓòÉΓòÉ 10.3.11. DatastoreBase::_get_datastorename ΓòÉΓòÉΓòÉ
  19816.  
  19817. Returns the current datastore name setting. 
  19818.  
  19819. public:
  19820. _get_datastorename();
  19821.  
  19822.  
  19823. ΓòÉΓòÉΓòÉ 10.3.12. DatastoreBase::_get_datastore_type ΓòÉΓòÉΓòÉ
  19824.  
  19825. Returns the current datastore type setting. 
  19826.  
  19827. public:
  19828. _get_datastore_type();
  19829.  
  19830.  
  19831. ΓòÉΓòÉΓòÉ 10.3.13. DatastoreBase::_get_user_name ΓòÉΓòÉΓòÉ
  19832.  
  19833. Returns the current user name setting. 
  19834.  
  19835. public:
  19836. _get_user_name();
  19837.  
  19838.  
  19839. ΓòÉΓòÉΓòÉ 10.3.14. DatastoreBase::_set_authentication ΓòÉΓòÉΓòÉ
  19840.  
  19841. Sets the authentication. 
  19842.  
  19843. public:
  19844. _set_authentication();
  19845.  
  19846.  
  19847. ΓòÉΓòÉΓòÉ 10.3.15. DatastoreBase::_set_datastore_name ΓòÉΓòÉΓòÉ
  19848.  
  19849. Sets the datastore name that is used when a connection is established. 
  19850.  
  19851. public:
  19852. _set_datastore_name();
  19853.  
  19854.  
  19855. ΓòÉΓòÉΓòÉ 10.3.16. DatastoreBase::_set_datastore_type ΓòÉΓòÉΓòÉ
  19856.  
  19857. Sets the datastore type. 
  19858.  
  19859. public:
  19860. _set_datastore_type();
  19861.  
  19862.  
  19863. ΓòÉΓòÉΓòÉ 10.3.17. DatastoreBase::_set_user_name ΓòÉΓòÉΓòÉ
  19864.  
  19865. Sets the user name. 
  19866.  
  19867. public:
  19868. _set_user_name();
  19869.  
  19870.  
  19871. ΓòÉΓòÉΓòÉ 10.4. DatastoreDB2 ΓòÉΓòÉΓòÉ
  19872.  
  19873. Description 
  19874.  
  19875. Derivation 
  19876.  
  19877. Public Functions 
  19878.  
  19879. To close all the panels in a chapter, double click on this panel's system menu. 
  19880.  
  19881.  
  19882. ΓòÉΓòÉΓòÉ <hidden> Derivation - DatastoreDB2 ΓòÉΓòÉΓòÉ
  19883.  
  19884. SOMObject
  19885.   Γöé
  19886. DatastoreBase
  19887.   Γöé
  19888. DatastoreDB2
  19889.  
  19890. Inherited by none. 
  19891.  
  19892.  
  19893. ΓòÉΓòÉΓòÉ <hidden> Class Description - DatastoreDB2 ΓòÉΓòÉΓòÉ
  19894.  
  19895. Header File: sdsmcdb.idl 
  19896.  
  19897. Use DatastoreDB2 with persistent objects that were generated using the CLI 
  19898. option to access DB2 version 1.2 or 2.1 CLI. This class can also be used with 
  19899. embedded SQL. If the user of the application has the authority to use dynamic 
  19900. SQL, the application can be built using IDatastoreDB2, even when generated as 
  19901. embedded SQL. To access DB2 version 1.2 or 2.1 static embedded SQL, use 
  19902. Datastore. 
  19903.  
  19904. Windows Information 
  19905.  
  19906. Data Access Builder does not support DB2 version 1.2 on Windows platforms. 
  19907.  
  19908.  
  19909. ΓòÉΓòÉΓòÉ <hidden> Public Functions - DatastoreDB2 ΓòÉΓòÉΓòÉ
  19910.  
  19911. Database Connection
  19912. connect_string
  19913.  
  19914. Queries
  19915. get_connect_string
  19916. get_driver_prompt
  19917. _get_access_mode
  19918. _get_auto_commit
  19919. _get_isolation_level
  19920.  
  19921. State Modifiers
  19922. set_connect_string
  19923. set_driver_prompt
  19924. _set_access_mode
  19925. _set_auto_commit
  19926. _set_isolation_level
  19927.  
  19928.  
  19929. ΓòÉΓòÉΓòÉ <hidden> DatastoreDB2 - Database Connection ΓòÉΓòÉΓòÉ
  19930.  
  19931. These methods are used to connect to a datastore. 
  19932.  
  19933.  
  19934. ΓòÉΓòÉΓòÉ <hidden> DatastoreDB2 - Queries ΓòÉΓòÉΓòÉ
  19935.  
  19936. These methods are used to access information about an object. 
  19937.  
  19938.  
  19939. ΓòÉΓòÉΓòÉ <hidden> DatastoreDB2 - State Modifiers ΓòÉΓòÉΓòÉ
  19940.  
  19941. These methods are used to modify the state of an object. 
  19942.  
  19943.  
  19944. ΓòÉΓòÉΓòÉ 10.4.1. DatastoreDB2::connect_string ΓòÉΓòÉΓòÉ
  19945.  
  19946. Connects to a datastore using the specified input parameters. If a connection 
  19947. already exists, performs a disconnect, and then reconnects using the current 
  19948. settings. The values of user_name and authentication are not saved. 
  19949.  
  19950. public:
  19951. void
  19952.   connect_string( in string datastore_name,
  19953.                   in string connect_stringi,
  19954.                   in string user_name,
  19955.                   in string authentication);
  19956.  
  19957. Exceptions 
  19958.  
  19959. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  19960. ΓöéConnectFailed       ΓöéSet when a database connection attempt  Γöé
  19961. Γöé                    Γöéfails.                                  Γöé
  19962. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  19963. ΓöéDatastoreAccessErrorΓöéSet when an error occurs during an      Γöé
  19964. Γöé                    Γöéattempt to access data in the datastore.Γöé
  19965. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  19966.  
  19967.  
  19968. ΓòÉΓòÉΓòÉ 10.4.2. DatastoreDB2::get_connect_string ΓòÉΓòÉΓòÉ
  19969.  
  19970. Returns the current connect string setting. This string, which enables a user 
  19971. to specify additional connect string keywords and values, is concatenated with 
  19972. DSN=<value> (datastore_name), UID=<value> (user_name), and PWD=<value> 
  19973. (authentication), to form the connect string for the SQLDriverConnect call. For 
  19974. example: 
  19975.  
  19976. "DSN=SAMPLE; UID=STUDENT; PWD=student1; AUTOCOMMIT=0; CONNECTTYPE=1;"
  19977.  
  19978. public:
  19979. string get_connect_string();
  19980.  
  19981.  
  19982. ΓòÉΓòÉΓòÉ 10.4.3. DatastoreDB2::get_driver_prompt ΓòÉΓòÉΓòÉ
  19983.  
  19984. Returns the current driver prompt parameter setting. 
  19985.  
  19986. public:
  19987. long get_driver_prompt();
  19988.  
  19989.  
  19990. ΓòÉΓòÉΓòÉ 10.4.4. DatastoreDB2::set_connect_string ΓòÉΓòÉΓòÉ
  19991.  
  19992. Sets the connect string. 
  19993.  
  19994. public:
  19995. void set_connect_string(in string connect_string);
  19996.  
  19997.  
  19998. ΓòÉΓòÉΓòÉ 10.4.5. DatastoreDB2::set_driver_prompt ΓòÉΓòÉΓòÉ
  19999.  
  20000. Enables a user to set the driver prompt parameter, and to pass in a window 
  20001. handle. Valid values are: 
  20002.  
  20003.      DAX_DRIVER_PROMPT 
  20004.       Dialog enabling the user to enter information needed to logon is always 
  20005.       initiated. 
  20006.  
  20007.      DAX_DRIVER_COMPLETE 
  20008.       Dialog is only initiated if there is insufficent information in the 
  20009.       connection string. 
  20010.  
  20011.      DAX_DRIVER_COMPLETE_REQ 
  20012.       Dialog is only initiated if there is insufficent information in the 
  20013.       connection string. Only mandatory information is requested. 
  20014.  
  20015.      DAX_DRIVER_NOPROMPT (Default) 
  20016.       The user is not prompted for any information. 
  20017.  
  20018.   public:
  20019.   void set_driver_prompt(in long option, in void* hwnd);
  20020.  
  20021.  
  20022. ΓòÉΓòÉΓòÉ 10.4.6. DatastoreDB2::_get_access_mode ΓòÉΓòÉΓòÉ
  20023.  
  20024. Returns the current access mode setting. 
  20025.  
  20026. public:
  20027. _get_access_mode();
  20028.  
  20029.  
  20030. ΓòÉΓòÉΓòÉ 10.4.7. DatastoreDB2::_get_auto_commit ΓòÉΓòÉΓòÉ
  20031.  
  20032. Returns true if the autocommit mode is enabled; otherwise, returns false. 
  20033.  
  20034. public:
  20035. _get_auto_commit();
  20036.  
  20037.  
  20038. ΓòÉΓòÉΓòÉ 10.4.8. DatastoreDB2::_get_isolation_level ΓòÉΓòÉΓòÉ
  20039.  
  20040. Returns the current isolation level setting. 
  20041.  
  20042. public:
  20043. _get_isolation_level();
  20044.  
  20045.  
  20046. ΓòÉΓòÉΓòÉ 10.4.9. DatastoreDB2::_set_access_mode ΓòÉΓòÉΓòÉ
  20047.  
  20048. Enables a user to set the access mode. Valid values are: 
  20049.  
  20050.      DAX_READONLY 
  20051.       Access mode is read-only. 
  20052.  
  20053.      DAX_READWRITE (Default) 
  20054.       Access mode is updateable. 
  20055.  
  20056.   public:
  20057.   _set_access_mode();
  20058.  
  20059.  
  20060. ΓòÉΓòÉΓòÉ 10.4.10. DatastoreDB2::_set_auto_commit ΓòÉΓòÉΓòÉ
  20061.  
  20062. Enables or disables the autocommit mode. Valid values are: 
  20063.  
  20064.      DAX_AUTOCOMMIT_ON 
  20065.  
  20066.      DAX_AUTOCOMMIT_OFF (Default) 
  20067.  
  20068.   public:
  20069.   _set_auto_commit();
  20070.  
  20071.  
  20072. ΓòÉΓòÉΓòÉ 10.4.11. DatastoreDB2::_set_isolation_level ΓòÉΓòÉΓòÉ
  20073.  
  20074. Enables a user to set the isolation level. Valid values are: 
  20075.  
  20076.      DAX_READ_UNCOMMITTED 
  20077.       Permits an application to access uncommitted changes caused by other 
  20078.       transactions. 
  20079.  
  20080.      DAX_READ_COMMITTED 
  20081.       Ensures that the current row of every updateable cursor is not changed by 
  20082.       other application processes. 
  20083.  
  20084.      DAX_REPEATABLE_READ 
  20085.       Keeps a lock on all rows accessed since the last commit point. 
  20086.  
  20087.      DAX_SERIALIZABLE 
  20088.       Data affected by pending transactions is not available to other 
  20089.       transactions. 
  20090.  
  20091.      DAX_DATABASE_DEFAULT (Default) 
  20092.       The default isolation level for the specified database product. 
  20093.  
  20094.   public:
  20095.   _set_isolation_level();
  20096.  
  20097.  
  20098. ΓòÉΓòÉΓòÉ 10.5. DatastoreDB2Factory ΓòÉΓòÉΓòÉ
  20099.  
  20100. Description 
  20101.  
  20102. Derivation 
  20103.  
  20104. Public Functions 
  20105.  
  20106. To close all the panels in a chapter, double click on this panel's system menu. 
  20107.  
  20108.  
  20109. ΓòÉΓòÉΓòÉ <hidden> Derivation - DatastoreDB2Factory ΓòÉΓòÉΓòÉ
  20110.  
  20111. SOMObject
  20112.   Γöé
  20113. SOMClass
  20114.   Γöé
  20115. DatastoreDB2Factory
  20116.  
  20117. Inherited by none. 
  20118.  
  20119.  
  20120. ΓòÉΓòÉΓòÉ <hidden> Class Description - DatastoreDB2Factory ΓòÉΓòÉΓòÉ
  20121.  
  20122. Header File: sdsmcdb.idl 
  20123.  
  20124. DatastoreDB2Factory is the metaclass for the DatastoreDB2 class; see 
  20125. DatastoreDB2. 
  20126.  
  20127.  
  20128. ΓòÉΓòÉΓòÉ <hidden> Public Functions - DatastoreDB2Factory ΓòÉΓòÉΓòÉ
  20129.  
  20130. Constructors
  20131. create_object
  20132. create_object_defaults
  20133.  
  20134.  
  20135. ΓòÉΓòÉΓòÉ <hidden> DatastoreDB2Factory - Constructors ΓòÉΓòÉΓòÉ
  20136.  
  20137. These methods are used to create a DatastoreDB2 object. 
  20138.  
  20139.  
  20140. ΓòÉΓòÉΓòÉ 10.5.1. DatastoreDB2Factory::create_object ΓòÉΓòÉΓòÉ
  20141.  
  20142. Use this method to create a DatastoreDB2 object. Initializes datastore_name and 
  20143. connect_string to empty strings. 
  20144.  
  20145. public:
  20146. DatastoreDB2 create_object();
  20147.  
  20148.  
  20149. ΓòÉΓòÉΓòÉ 10.5.2. DatastoreDB2Factory::create_object_defaults ΓòÉΓòÉΓòÉ
  20150.  
  20151. Use this method to create a DatastoreDB2 object. Initializes datastore_name and 
  20152. connect_string to the values specified in the call. 
  20153.  
  20154. public:
  20155. DatastoreDB2
  20156.   create_object_defaults( in string datastore_name,
  20157.                           in string connect_string);
  20158.  
  20159.  
  20160. ΓòÉΓòÉΓòÉ 10.6. DatastoreFactory ΓòÉΓòÉΓòÉ
  20161.  
  20162. Description 
  20163.  
  20164. Derivation 
  20165.  
  20166. Public Functions 
  20167.  
  20168. To close all the panels in a chapter, double click on this panel's system menu. 
  20169.  
  20170.  
  20171. ΓòÉΓòÉΓòÉ <hidden> Derivation - DatastoreFactory ΓòÉΓòÉΓòÉ
  20172.  
  20173. SOMObject
  20174.   Γöé
  20175. SOMClass
  20176.   Γöé
  20177. DatastoreFactory
  20178.  
  20179. Inherited by none. 
  20180.  
  20181.  
  20182. ΓòÉΓòÉΓòÉ <hidden> Class Description - DatastoreFactory ΓòÉΓòÉΓòÉ
  20183.  
  20184. Header File: sdsmcon.idl 
  20185.  
  20186. DatastoreFactory is the metaclass for the Datastore class; see Datastore. 
  20187.  
  20188.  
  20189. ΓòÉΓòÉΓòÉ <hidden> Public Functions - DatastoreFactory ΓòÉΓòÉΓòÉ
  20190.  
  20191. Constructors
  20192. create_object
  20193. create_object_defaults
  20194.  
  20195.  
  20196. ΓòÉΓòÉΓòÉ <hidden> DatastoreFactory - Constructors ΓòÉΓòÉΓòÉ
  20197.  
  20198. These methods are used to create a Datastore object. 
  20199.  
  20200.  
  20201. ΓòÉΓòÉΓòÉ 10.6.1. DatastoreFactory::create_object ΓòÉΓòÉΓòÉ
  20202.  
  20203. Use this method to create a Datastore object. Initializes datastore_name, 
  20204. user_name, and authentication to empty strings. 
  20205.  
  20206. public:
  20207. Datastore create_object();
  20208.  
  20209.  
  20210. ΓòÉΓòÉΓòÉ 10.6.2. DatastoreFactory::create_object_defaults ΓòÉΓòÉΓòÉ
  20211.  
  20212. Use this method to create a Datastore object. Initializes datastore_name, 
  20213. user_name, and authentication to the values specified in the call. 
  20214.  
  20215. public:
  20216. Datastore
  20217.   create_object_defaults( in string datastore_name,
  20218.                           in string user_name,
  20219.                           in string authentication);
  20220.  
  20221.  
  20222. ΓòÉΓòÉΓòÉ 10.7. DatastoreODBC ΓòÉΓòÉΓòÉ
  20223.  
  20224. Description 
  20225.  
  20226. Derivation 
  20227.  
  20228. Public Functions 
  20229.  
  20230. To close all the panels in a chapter, double click on this panel's system menu. 
  20231.  
  20232.  
  20233. ΓòÉΓòÉΓòÉ <hidden> Derivation - DatastoreODBC ΓòÉΓòÉΓòÉ
  20234.  
  20235. SOMObject
  20236.   Γöé
  20237. DatastoreBase
  20238.   Γöé
  20239. DatastoreODBC
  20240.  
  20241. Inherited by none. 
  20242.  
  20243.  
  20244. ΓòÉΓòÉΓòÉ <hidden> Class Description - DatastoreODBC ΓòÉΓòÉΓòÉ
  20245.  
  20246. Header File: sdsmcod.idl 
  20247.  
  20248. Use DatastoreODBC with persistent objects that were generated using the ODBC 
  20249. option to access databases that are managed through ODBC. 
  20250.  
  20251.  
  20252. ΓòÉΓòÉΓòÉ <hidden> Public Functions - DatastoreODBC ΓòÉΓòÉΓòÉ
  20253.  
  20254. Database Connection
  20255. connect_string
  20256.  
  20257. Queries
  20258. get_connect_string
  20259. get_driver_prompt
  20260. _get_access_mode
  20261. _get_auto_commit
  20262. _get_isolation_level
  20263.  
  20264. State Modifiers
  20265. set_connect_string
  20266. set_driver_prompt
  20267. _set_access_mode
  20268. _set_auto_commit
  20269. _set_isolation_level
  20270.  
  20271.  
  20272. ΓòÉΓòÉΓòÉ <hidden> DatastoreODBC - Database Connection ΓòÉΓòÉΓòÉ
  20273.  
  20274. These methods are used to connect to a datastore. 
  20275.  
  20276.  
  20277. ΓòÉΓòÉΓòÉ <hidden> DatastoreODBC - Queries ΓòÉΓòÉΓòÉ
  20278.  
  20279. These methods are used to access information about an object. 
  20280.  
  20281.  
  20282. ΓòÉΓòÉΓòÉ <hidden> DatastoreODBC - State Modifiers ΓòÉΓòÉΓòÉ
  20283.  
  20284. These methods are used to modify the state of an object. 
  20285.  
  20286.  
  20287. ΓòÉΓòÉΓòÉ 10.7.1. DatastoreODBC::connect_string ΓòÉΓòÉΓòÉ
  20288.  
  20289. Connects to a datastore using the specified input parameters. If a connection 
  20290. already exists, performs a disconnect, and then reconnects using the current 
  20291. settings. The values of user_name and authentication are not saved. 
  20292.  
  20293. public:
  20294. void
  20295.   connect_string( in string datastore_name,
  20296.                   in string connect_stringi,
  20297.                   in string user_name,
  20298.                   in string authentication);
  20299.  
  20300. Exceptions 
  20301.  
  20302. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  20303. ΓöéConnectFailed       ΓöéSet when a database connection attempt  Γöé
  20304. Γöé                    Γöéfails.                                  Γöé
  20305. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  20306. ΓöéDatastoreAccessErrorΓöéSet when an error occurs during an      Γöé
  20307. Γöé                    Γöéattempt to access data in the datastore.Γöé
  20308. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  20309.  
  20310.  
  20311. ΓòÉΓòÉΓòÉ 10.7.2. DatastoreODBC::get_connect_string ΓòÉΓòÉΓòÉ
  20312.  
  20313. Returns the current connect string setting. This string, which enables a user 
  20314. to specify additional connect string keywords and values, is concatenated with 
  20315. DSN=<value> (datastore_name), UID=<value> (user_name), and PWD=<value> 
  20316. (authentication), to form the connect string for the SQLDriverConnect call. For 
  20317. example: 
  20318.  
  20319. "DSN=SAMPLE; UID=STUDENT; PWD=student1; AUTOCOMMIT=0; CONNECTTYPE=1;"
  20320.  
  20321. public:
  20322. string get_connect_string();
  20323.  
  20324.  
  20325. ΓòÉΓòÉΓòÉ 10.7.3. DatastoreODBC::get_driver_prompt ΓòÉΓòÉΓòÉ
  20326.  
  20327. Returns the current driver prompt parameter setting. 
  20328.  
  20329. public:
  20330. long get_driver_prompt();
  20331.  
  20332.  
  20333. ΓòÉΓòÉΓòÉ 10.7.4. DatastoreODBC::set_connect_string ΓòÉΓòÉΓòÉ
  20334.  
  20335. Sets the connect string. 
  20336.  
  20337. public:
  20338. void set_connect_string(in string connect_string);
  20339.  
  20340.  
  20341. ΓòÉΓòÉΓòÉ 10.7.5. DatastoreODBC::set_driver_prompt ΓòÉΓòÉΓòÉ
  20342.  
  20343. Enables a user to set the driver prompt parameter, and to pass in a window 
  20344. handle. Valid values are: 
  20345.  
  20346.      DAX_DRIVER_PROMPT 
  20347.       Dialog enabling the user to enter information needed to logon is always 
  20348.       initiated. 
  20349.  
  20350.      DAX_DRIVER_COMPLETE 
  20351.       Dialog is only initiated if there is insufficent information in the 
  20352.       connection string. 
  20353.  
  20354.      DAX_DRIVER_COMPLETE_REQ 
  20355.       Dialog is only initiated if there is insufficent information in the 
  20356.       connection string. Only mandatory information is requested. 
  20357.  
  20358.      DAX_DRIVER_NOPROMPT (Default) 
  20359.       The user is not prompted for any information. 
  20360.  
  20361.  A description of the logon dialog box can be found in the appropriate database 
  20362.  section of the supported ODBC drivers chapter of the VisualAge C++ User's 
  20363.  Guide. 
  20364.  
  20365.   public:
  20366.   void set_driver_prompt(in long option, in void* hwnd);
  20367.  
  20368.  
  20369. ΓòÉΓòÉΓòÉ 10.7.6. DatastoreODBC::_get_access_mode ΓòÉΓòÉΓòÉ
  20370.  
  20371. Returns the current access mode setting. 
  20372.  
  20373. public:
  20374. _get_access_mode();
  20375.  
  20376.  
  20377. ΓòÉΓòÉΓòÉ 10.7.7. DatastoreODBC::_get_auto_commit ΓòÉΓòÉΓòÉ
  20378.  
  20379. Returns true if the autocommit mode is enabled; otherwise, returns false. 
  20380.  
  20381. public:
  20382. _get_auto_commit();
  20383.  
  20384.  
  20385. ΓòÉΓòÉΓòÉ 10.7.8. DatastoreODBC::_get_isolation_level ΓòÉΓòÉΓòÉ
  20386.  
  20387. Returns the current isolation level setting. 
  20388.  
  20389. public:
  20390. _get_isolation_level();
  20391.  
  20392.  
  20393. ΓòÉΓòÉΓòÉ 10.7.9. DatastoreODBC::_set_access_mode ΓòÉΓòÉΓòÉ
  20394.  
  20395. Enables a user to set the access mode. Valid values are: 
  20396.  
  20397.      DAX_READONLY 
  20398.       Access mode is read-only. 
  20399.  
  20400.      DAX_READWRITE (Default) 
  20401.       Access mode is updateable. 
  20402.  
  20403.   public:
  20404.   _set_access_mode();
  20405.  
  20406.  
  20407. ΓòÉΓòÉΓòÉ 10.7.10. DatastoreODBC::_set_auto_commit ΓòÉΓòÉΓòÉ
  20408.  
  20409. Enables or disables the autocommit mode. Valid values are: 
  20410.  
  20411.      DAX_AUTOCOMMIT_ON 
  20412.  
  20413.      DAX_AUTOCOMMIT_OFF (Default) 
  20414.  
  20415.   public:
  20416.   _set_auto_commit();
  20417.  
  20418.  
  20419. ΓòÉΓòÉΓòÉ 10.7.11. DatastoreODBC::_set_isolation_level ΓòÉΓòÉΓòÉ
  20420.  
  20421. Enables a user to set the isolation level. Valid values are: 
  20422.  
  20423.      DAX_READ_UNCOMMITTED 
  20424.       Permits an application to access uncommitted changes caused by other 
  20425.       transactions. 
  20426.  
  20427.      DAX_READ_COMMITTED 
  20428.       Ensures that the current row of every updateable cursor is not changed by 
  20429.       other application processes. 
  20430.  
  20431.      DAX_REPEATABLE_READ 
  20432.       Keeps a lock on all rows accessed since the last commit point. 
  20433.  
  20434.      DAX_SERIALIZABLE 
  20435.       Data affected by pending transactions is not available to other 
  20436.       transactions. 
  20437.  
  20438.      DAX_DATABASE_DEFAULT (Default) 
  20439.       The default isolation level for the specified database product. 
  20440.  
  20441.   public:
  20442.   _set_isolation_level();
  20443.  
  20444.  
  20445. ΓòÉΓòÉΓòÉ 10.8. DatastoreODBCFactory ΓòÉΓòÉΓòÉ
  20446.  
  20447. Description 
  20448.  
  20449. Derivation 
  20450.  
  20451. Public Functions 
  20452.  
  20453. To close all the panels in a chapter, double click on this panel's system menu. 
  20454.  
  20455.  
  20456. ΓòÉΓòÉΓòÉ <hidden> Derivation - DatastoreODBCFactory ΓòÉΓòÉΓòÉ
  20457.  
  20458. SOMObject
  20459.   Γöé
  20460. SOMClass
  20461.   Γöé
  20462. DatastoreODBCFactory
  20463.  
  20464. Inherited by none. 
  20465.  
  20466.  
  20467. ΓòÉΓòÉΓòÉ <hidden> Class Description - DatastoreODBCFactory ΓòÉΓòÉΓòÉ
  20468.  
  20469. Header File: sdsmcod.idl 
  20470.  
  20471. DatastoreODBCFactory is the metaclass for the DatastoreODBC class; see 
  20472. DatastoreODBC. 
  20473.  
  20474.  
  20475. ΓòÉΓòÉΓòÉ <hidden> Public Functions - DatastoreODBCFactory ΓòÉΓòÉΓòÉ
  20476.  
  20477. Constructors
  20478. create_object
  20479. create_object_defaults
  20480.  
  20481.  
  20482. ΓòÉΓòÉΓòÉ <hidden> DatastoreODBCFactory - Constructors ΓòÉΓòÉΓòÉ
  20483.  
  20484. These methods are used to create a DatastoreODBC object. 
  20485.  
  20486.  
  20487. ΓòÉΓòÉΓòÉ 10.8.1. DatastoreODBCFactory::create_object ΓòÉΓòÉΓòÉ
  20488.  
  20489. Use this method to create a DatastoreODBC object. Initializes datastore_name 
  20490. and connect_string to empty strings. 
  20491.  
  20492. public:
  20493. DatastoreODBC create_object();
  20494.  
  20495.  
  20496. ΓòÉΓòÉΓòÉ 10.8.2. DatastoreODBCFactory::create_object_defaults ΓòÉΓòÉΓòÉ
  20497.  
  20498. Use this method to create a DatastoreODBC object. Initializes datastore_name 
  20499. and connect_string to the values specified in the call. 
  20500.  
  20501. public:
  20502. DatastoreODBC
  20503.   create_object_defaults( in string datastore_name,
  20504.                           in string connect_string);
  20505.  
  20506.  
  20507. ΓòÉΓòÉΓòÉ 10.9. PersistentObject ΓòÉΓòÉΓòÉ
  20508.  
  20509. Description 
  20510.  
  20511. Derivation 
  20512.  
  20513. Public Functions 
  20514.  
  20515. To close all the panels in a chapter, double click on this panel's system menu. 
  20516.  
  20517.  
  20518. ΓòÉΓòÉΓòÉ <hidden> Derivation - PersistentObject ΓòÉΓòÉΓòÉ
  20519.  
  20520. SOMObject
  20521.   Γöé
  20522. PersistentObject
  20523.  
  20524. Inherited by none. 
  20525.  
  20526.  
  20527. ΓòÉΓòÉΓòÉ <hidden> Class Description - PersistentObject ΓòÉΓòÉΓòÉ
  20528.  
  20529. Header File: spersist.idl 
  20530.  
  20531. The PersistentObject class provides the basic data manipulation operations that 
  20532. a client can call directly to retrieve, update, add, or delete rows from a 
  20533. table. It is the abstract base class for some of the parts generated by the 
  20534. tool. 
  20535.  
  20536. The Data Access Builder generates classes derived from this class. For more 
  20537. information, see the Open Class Library User's Guide. 
  20538.  
  20539.  
  20540. ΓòÉΓòÉΓòÉ <hidden> Public Functions - PersistentObject ΓòÉΓòÉΓòÉ
  20541.  
  20542. Data Manipulation
  20543. add
  20544. del
  20545. retrieve
  20546. update
  20547.  
  20548.  
  20549. ΓòÉΓòÉΓòÉ <hidden> PersistentObject - Data Manipulation ΓòÉΓòÉΓòÉ
  20550.  
  20551. These methods are used to retrieve, update, add, or delete rows from a table. 
  20552.  
  20553.  
  20554. ΓòÉΓòÉΓòÉ 10.9.1. PersistentObject::add ΓòÉΓòÉΓòÉ
  20555.  
  20556. In the generated part, the derived class adds a row to a table using the data 
  20557. attribute values set in the object. The object should be uniquely identified by 
  20558. the data identifier. Attention: If the identifier is not unique, the object may 
  20559. not be retrievable. 
  20560.  
  20561. public:
  20562. void add();
  20563.  
  20564. Exceptions 
  20565.  
  20566. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  20567. ΓöéDataObjectAlreadyExiΓöéSet when the data object specified in anΓöé
  20568. Γöé                    Γöéadd operation already exists in the     Γöé
  20569. Γöé                    Γöédatastore.                              Γöé
  20570. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  20571.  
  20572.  
  20573. ΓòÉΓòÉΓòÉ 10.9.2. PersistentObject::del ΓòÉΓòÉΓòÉ
  20574.  
  20575. In the generated part, the derived class deletes a row from a table using the 
  20576. data identifier set in the object. The composition of the data identifier is 
  20577. defined for the concrete class. Attention: If the identifier is not unique, 
  20578. several rows may be deleted. In this case, catch the DatastoreAccessError 
  20579. exception, and rollback as required. 
  20580.  
  20581. public:
  20582. void del();
  20583.  
  20584. Exceptions 
  20585.  
  20586. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  20587. ΓöéDataObjectNotFound  ΓöéSet when the data object specified in a Γöé
  20588. Γöé                    Γöéretrieve, update, or delete operation   Γöé
  20589. Γöé                    Γöécannot be found in the datastore.       Γöé
  20590. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  20591.  
  20592.  
  20593. ΓòÉΓòÉΓòÉ 10.9.3. PersistentObject::retrieve ΓòÉΓòÉΓòÉ
  20594.  
  20595. In the generated part, the derived class retrieves a row from a table using the 
  20596. data identifier set in the object. The composition of the data identifier is 
  20597. defined by the concrete class. The data identifier must be set in the object 
  20598. before calling retrieve. If the identifier is not unique, this function simply 
  20599. retrieves the first row of the table. 
  20600.  
  20601. public:
  20602. void retrieve();
  20603.  
  20604. Exceptions 
  20605.  
  20606. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  20607. ΓöéDataObjectNotFound  ΓöéSet when the data object specified in a Γöé
  20608. Γöé                    Γöéretrieve, update, or delete operation   Γöé
  20609. Γöé                    Γöécannot be found in the datastore.       Γöé
  20610. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  20611.  
  20612.  
  20613. ΓòÉΓòÉΓòÉ 10.9.4. PersistentObject::update ΓòÉΓòÉΓòÉ
  20614.  
  20615. In the generated part, the derived class updates a row in a table using the 
  20616. data identifier set in the object. The composition of the data identifier is 
  20617. defined by the concrete class. Attention: If the identifier is not unique, 
  20618. several rows may be updated. In this case, catch the DatastoreAccessError 
  20619. exception, and rollback as required. 
  20620.  
  20621. public:
  20622. void update();
  20623.  
  20624.  
  20625. ΓòÉΓòÉΓòÉ 10.10. POFactory ΓòÉΓòÉΓòÉ
  20626.  
  20627. Description 
  20628.  
  20629. Derivation 
  20630.  
  20631. Public Functions 
  20632.  
  20633. To close all the panels in a chapter, double click on this panel's system menu. 
  20634.  
  20635.  
  20636. ΓòÉΓòÉΓòÉ <hidden> Derivation - POFactory ΓòÉΓòÉΓòÉ
  20637.  
  20638. SOMObject
  20639.   Γöé
  20640. SOMClass
  20641.   Γöé
  20642. POFactory
  20643.  
  20644. Inherited by none. 
  20645.  
  20646.  
  20647. ΓòÉΓòÉΓòÉ <hidden> Class Description - POFactory ΓòÉΓòÉΓòÉ
  20648.  
  20649. Header File: spersist.idl 
  20650.  
  20651. The POFactory class provides operations to deal with collections of rows from a 
  20652. table. It is the metaclass for the PersistentObject class; see 
  20653. PersistentObject. 
  20654.  
  20655.  
  20656. ΓòÉΓòÉΓòÉ <hidden> Public Functions - POFactory ΓòÉΓòÉΓòÉ
  20657.  
  20658. Data Manipulation
  20659. retrieveAll
  20660. select
  20661.  
  20662.  
  20663. ΓòÉΓòÉΓòÉ <hidden> POFactory - Data Manipulation ΓòÉΓòÉΓòÉ
  20664.  
  20665. These methods are used to retrieve rows from a table. 
  20666.  
  20667.  
  20668. ΓòÉΓòÉΓòÉ 10.10.1. POFactory::retrieveAll ΓòÉΓòÉΓòÉ
  20669.  
  20670. Retrieves all the rows from a table. 
  20671.  
  20672. public:
  20673. sequence < PersistentObject > retrieveAll();
  20674.  
  20675.  
  20676. ΓòÉΓòÉΓòÉ 10.10.2. POFactory::select ΓòÉΓòÉΓòÉ
  20677.  
  20678. In the generated part, the derived class retrieves all the rows from a table 
  20679. that match the criteria specified by the clause string, an SQL where clause. 
  20680. The keyword is added by the class library code. The clause may be followed by 
  20681. additional parameters, as permitted in select clauses by the datastore. 
  20682.  
  20683. public:
  20684. sequence < PersistentObject > select(in string clause);
  20685.  
  20686.  
  20687. ΓòÉΓòÉΓòÉ 10.10.3. Database Access Builder SOM Exceptions ΓòÉΓòÉΓòÉ
  20688.  
  20689. The following are the SOM exceptions in the Database Access Builder: 
  20690.  
  20691.  da_exception 
  20692.            A structure comprised of all the information that is contained in a 
  20693.            Database Access Builder SOM exception. 
  20694.  ConnectFailed 
  20695.            Set when a database connection attempt fails. 
  20696.  DatastoreAccessError 
  20697.            Set when an error occurs during an attempt to access data in the 
  20698.            datastore. 
  20699.  DatastoreConnectionInUse 
  20700.            Set when a connection is attempted using a connection that is 
  20701.            already in use. 
  20702.  DatastoreConnectionNotOpen 
  20703.            Set when an operation that requires a connection is attempted before 
  20704.            a connection has been established. An example is a call to 
  20705.            disconnect before a connection was made. 
  20706.  DatastoreLogoffFailed 
  20707.            Set when a logoff fails. 
  20708.  DatastoreLogonFailed 
  20709.            Set when a logon attempt fails. 
  20710.  DataObjectAlreadyExists 
  20711.            Set when the data object specified in an add operation already 
  20712.            exists in the datastore. 
  20713.  DataObjectAttributeError 
  20714.            Set when an attempt is made to set an attribute with an invalid 
  20715.            value. An example is setting a string attribute longer than the 
  20716.            database permits. 
  20717.  DataObjectInvalid 
  20718.            Set when an attempt to update or to delete an object results in 
  20719.            changes to more than one row in the datastore. 
  20720.  DataObjectNotFound 
  20721.            Set when the data object specified in a retrieve, update, or delete 
  20722.            operation cannot be found in the datastore. 
  20723.  DisconnectError 
  20724.            Set when a disconnection error occurs. 
  20725.  
  20726.  
  20727. ΓòÉΓòÉΓòÉ 10.10.4. Header File ΓòÉΓòÉΓòÉ
  20728.  
  20729. The Database Access Builder SOM exceptions are declared in sdsexc.idl. 
  20730.  
  20731.  
  20732. ΓòÉΓòÉΓòÉ 10.10.5. da_exception Structure ΓòÉΓòÉΓòÉ
  20733.  
  20734. #define da_exception {            \
  20735.         long error_number;        \
  20736.         char error_code[8];       \
  20737.         char error_state[8];      \
  20738.         BOOLEAN error_avail;      \
  20739.         char error_text[256];     \
  20740.         }
  20741.  
  20742. The following diagnostic information is passed in an exception: 
  20743.  
  20744.  error_number Identifier for the exception. 
  20745.  
  20746.  error_code Sqlca field that contains the sqlcode. 
  20747.  
  20748.  error_state Sqlca field that contains the sqlstate. 
  20749.  
  20750.  error_avail A Boolean flag to indicate whether a request to access the 
  20751.            database has been issued. 
  20752.  
  20753.  error_text Text describing the error. 
  20754.