home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 4 / FreshFish_May-June1994.bin / bbs / gnu / libg++-2.5.3-bin.lha / info / libg++.info-4 (.txt) < prev    next >
GNU Info File  |  1994-02-27  |  51KB  |  1,140 lines

  1. This is Info file libg++.info, produced by Makeinfo-1.55 from the input
  2. file ./libg++.texi.
  3. START-INFO-DIR-ENTRY
  4. * Libg++::                      The g++ class library.
  5. END-INFO-DIR-ENTRY
  6.    This file documents the features and implementation of The GNU C++
  7. library
  8.    Copyright (C) 1988, 1991, 1992 Free Software Foundation, Inc.
  9.    Permission is granted to make and distribute verbatim copies of this
  10. manual provided the copyright notice and this permission notice are
  11. preserved on all copies.
  12.    Permission is granted to copy and distribute modified versions of
  13. this manual under the conditions for verbatim copying, provided also
  14. that the section entitled "GNU Library General Public License" is
  15. included exactly as in the original, and provided that the entire
  16. resulting derived work is distributed under the terms of a permission
  17. notice identical to this one.
  18.    Permission is granted to copy and distribute translations of this
  19. manual into another language, under the above conditions for modified
  20. versions, except that the section entitled "GNU Library General Public
  21. License" and this permission notice may be included in translations
  22. approved by the Free Software Foundation instead of in the original
  23. English.
  24. File: libg++.info,  Node: Data,  Next: Curses,  Prev: Random,  Up: Top
  25. Data Collection
  26. ***************
  27.    Libg++ currently provides two classes for *data collection* and
  28. analysis of the collected data.
  29. SampleStatistic
  30. ===============
  31.    Class `SampleStatistic' provides a means of accumulating samples of
  32. `double' values and providing common sample statistics.
  33.    Assume declaration of `double x'.
  34. `SampleStatistic a;'
  35.      declares and initializes a.
  36. `a.reset();'
  37.      re-initializes a.
  38. `a += x;'
  39.      adds sample x.
  40. `int n = a.samples();'
  41.      returns the number of samples.
  42. `x = a.mean;'
  43.      returns the means of the samples.
  44. `x = a.var()'
  45.      returns the sample variance of the samples.
  46. `x = a.stdDev()'
  47.      returns the sample standard deviation of the samples.
  48. `x = a.min()'
  49.      returns the minimum encountered sample.
  50. `x = a.max()'
  51.      returns the maximum encountered sample.
  52. `x = a.confidence(int p)'
  53.      returns the p-percent (0 <= p < 100) confidence interval.
  54. `x = a.confidence(double p)'
  55.      returns the p-probability (0 <= p < 1) confidence interval.
  56. SampleHistogram
  57. ===============
  58.    Class `SampleHistogram' is a derived class of `SampleStatistic' that
  59. supports collection and display of samples in bucketed intervals. It
  60. supports the following in addition to `SampleStatisic' operations.
  61. `SampleHistogram h(double lo, double hi, double width);'
  62.      declares and initializes h to have buckets of size width from lo
  63.      to hi.  If the optional argument width is not specified, 10
  64.      buckets are created. The first bucket and also holds samples less
  65.      than lo, and the last one holds samples greater than hi.
  66. `int n = h.similarSamples(x)'
  67.      returns the number of samples in the same bucket as x.
  68. `int n = h.inBucket(int i)'
  69.      returns the number of samples in  bucket i.
  70. `int b = h.buckets()'
  71.      returns the number of buckets.
  72. `h.printBuckets(ostream s)'
  73.      prints bucket counts on ostream s.
  74. `double bound = h.bucketThreshold(int i)'
  75.      returns the upper bound of bucket i.
  76. File: libg++.info,  Node: Curses,  Next: List,  Prev: Data,  Up: Top
  77. Curses-based classes
  78. ********************
  79.    The `CursesWindow' class is a repackaging of standard curses library
  80. features into a class. It relies on `curses.h'.
  81.    The supplied `curses.h' is a fairly conservative declaration of
  82. curses library features, and does not include features like "screen" or
  83. X-window support. It is, for the most part, an adaptation, rather than
  84. an improvement of C-based `curses.h' files. The only substantive
  85. changes are the declarations of many functions as inline functions
  86. rather than macros, which was done solely to allow overloading.
  87.    The `CursesWindow' class encapsulates curses window functions within
  88. a class. Only those functions that control windows are included:
  89. Terminal control functions and macros like `cbreak' are not part of the
  90. class.  All `CursesWindows' member functions have names identical to
  91. the corresponding curses library functions, except that the "w" prefix
  92. is generally dropped. Descriptions of these functions may be found in
  93. your local curses library documentation.
  94.    A `CursesWindow' may be declared via
  95. `CursesWindow w(WINDOW* win)'
  96.      attaches w to the existing WINDOW* win. This is constructor is
  97.      normally used only in the following special case.
  98. `CursesWindow w(stdscr)'
  99.      attaches w to the default curses library standard screen window.
  100. `CursesWindow w(int lines, int cols, int begin_y, int begin_x)'
  101.      attaches to an allocated curses window with the indicated size and
  102.      screen position.
  103. `CursesWindow sub(CursesWindow& w,int l,int c,int by,int bx,char ar='a')'
  104.      attaches to a subwindow of w created via the curses `subwin'
  105.      command.  If ar is sent as `r', the origin (by, bx) is relative to
  106.      the parent window, else it is absolute.
  107.    The class maintains a static counter that is used in order to
  108. automatically call the curses library `initscr' and `endscr' functions
  109. at the proper times. These need not, and should not be called
  110. "manually".
  111.    `CursesWindow's maintain a tree of their subwindows. Upon
  112. destruction of a `CursesWindow', all of their subwindows are also
  113. invalidated if they had not previously been destroyed.
  114.    It is possible to traverse trees of subwindows via the following
  115. member functions
  116. `CursesWindow* w.parent()'
  117.      returns a pointer to the parent of the subwindow, or 0 if there is
  118.      none.
  119. `CursesWindow* w.child()'
  120.      returns the first child subwindow of the window, or 0 if there is
  121.      none.
  122. `CursesWindow* w.sibling()'
  123.      returns the next sibling of the subwindow, or 0 if there is none.
  124.    For example, to call some function `visit' for all subwindows of a
  125. window, you could write
  126.      void traverse(CursesWindow& w)
  127.      {
  128.        visit(w);
  129.        if (w.child() != 0) traverse(*w.child);
  130.        if (w.sibling() != 0) traverse(*w.sibling);
  131.      }
  132. File: libg++.info,  Node: List,  Next: LinkList,  Prev: Curses,  Up: Top
  133. List classes
  134. ************
  135.    The files `g++-include/List.hP' and `g++-include/List.ccP' provide
  136. pseudo-generic Lisp-type List classes.  These lists are homogeneous
  137. lists, more similar to lists in statically typed functional languages
  138. like ML than Lisp, but support operations very similar to those found
  139. in Lisp.  Any particular kind of list class may be generated via the
  140. `genclass' shell command. However, the implementation assumes that the
  141. base class supports an equality operator `=='.  All equality tests use
  142. the `==' operator, and are thus equivalent to the use of `equal', not
  143. `eq' in Lisp.
  144.    All list nodes are created dynamically, and managed via reference
  145. counts.  `List' variables are actually pointers to these list nodes.
  146. Lists may also be traversed via Pixes, as described in the section
  147. describing Pixes. *Note Pix::
  148.    Supported operations are mirrored closely after those in Lisp.
  149. Generally, operations with functional forms are constructive,
  150. functional operations, while member forms (often with the same name)
  151. are sometimes procedural, possibly destructive operations.
  152.    As with Lisp, destructive operations are supported. Programmers are
  153. allowed to change head and tail fields in any fashion, creating
  154. circular structures and the like. However, again as with Lisp, some
  155. operations implicitly assume that they are operating on pure lists, and
  156. may enter infinite loops when presented with improper lists. Also, the
  157. reference-counting storage management facility may fail to reclaim
  158. unused circularly-linked nodes.
  159.    Several Lisp-like higher order functions are supported (e.g., `map').
  160. Typedef declarations for the required functional forms are provided int
  161. the `.h' file.
  162.    For purposes of illustration, assume the specification of class
  163. `intList'.  Common Lisp versions of supported operations are shown in
  164. brackets for comparison purposes.
  165. Constructors and assignment
  166. ===========================
  167. `intList a;           [ (setq a nil) ]'
  168.      Declares a to be a nil intList.
  169. `intList b(2);        [ (setq b (co