home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / IDIOMS.ZIP / ETRINGL.H < prev    next >
C/C++ Source or Header  |  1991-12-04  |  2KB  |  61 lines

  1. /* Copyright (c) 1992 by AT&T Bell Laboratories. */
  2. /* Advanced C++ Programming Styles and Idioms */
  3. /* James O. Coplien */
  4. /* All rights reserved. */
  5.  
  6. //************************************************************//
  7. //                                                            //
  8. //     F I L E :    E T R I . H                               //
  9. //                                                            //
  10. //         Interface for class Triangle                       //
  11. //                                                            //
  12. //************************************************************//
  13.  
  14. // This is the interface for the code implementing the
  15. // semantics for the geometric shape, Triangle
  16.  
  17. #define _TRIANGLE_H
  18. #ifndef _SHAPEREP_H
  19. #include "eshaprp.h"
  20. #endif
  21. #ifndef _COORDINATE_H
  22. #include "ecoord.h"
  23. #endif
  24.  
  25. class Triangle: public ShapeRep {
  26. public:
  27.     // exemplar constructors
  28.     Shape make();
  29.     Shape make(Coordinate, Coordinate, Coordinate);
  30.  
  31.     // memory management
  32.     void *operator new(size_t);
  33.     void operator delete(void *);
  34.     void gc(size_t = 0);
  35.  
  36.     // user application semantics
  37.     void draw();
  38.     void rotate(double);
  39.     void move(Coordinate);
  40.  
  41.     // class routines
  42.     Triangle(Exemplar);
  43.     Triangle();
  44.     static void init();
  45. private:
  46.     // these should never be called
  47.     Shape make(Coordinate);
  48.     Shape make(Coordinate, Coordinate);
  49. private:
  50.     // instance state variables
  51.     Coordinate p1, p2, p3;
  52. private:
  53.     // memory management data
  54.     static char *heap;
  55.     static size_t poolInitialized;
  56.     enum { PoolSize = 10 };
  57. };
  58.  
  59. // Triangle exemplar pointer declaration
  60. extern ShapeRep *triangle;
  61.