home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / IDIOMS.ZIP / EV3TRI.H < prev    next >
C/C++ Source or Header  |  1991-12-04  |  2KB  |  52 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 V 3 T R I . H                           //
  9. //                                                            //
  10. //         Data structures for version 3 Triangle class       //
  11. //                                                            //
  12. //************************************************************//
  13.  
  14. #define _TRIANGLE_H
  15. #ifndef _SHAPEREP_H
  16. #include "eshaprp.h"
  17. #endif
  18. #ifndef _COORDINATE_H
  19. #include "ecoord.h"
  20. #endif
  21.  
  22. // This is the declaration of the NEW (Version 3) triangle
  23. // class--it has a color attribute
  24.  
  25. class Triangle: public ShapeRep {
  26. public:
  27.     Shape make();
  28.     Shape make(Coordinate, Coordinate, Coordinate);
  29.     Triangle();
  30.     void draw();
  31.     void move(Coordinate);
  32.     void rotate(double);
  33.     void *operator new(size_t);
  34.     void operator delete(void *);
  35.     void gc(size_t = 0);
  36.     Thing *cutover();
  37.     Triangle(Exemplar);
  38.     static void init();
  39. private:
  40.     static void poolInit(size_t);
  41.     Shape make(Coordinate) { return *aShape; }
  42.     Shape make(Coordinate, Coordinate) { return *aShape; }
  43.     Coordinate p1, p2, p3;
  44.     enum Color { Black, White } color;
  45. private:
  46.     static char *heap;
  47.     static size_t poolInitialized;
  48.     enum { PoolSize = 10 };
  49. };
  50.  
  51. extern ShapeRep *triangle;
  52.