home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Linux / Divers / freedraft.tar.gz / freedraft.tar / FREEdraft-050298 / DATAENGINE / geombank.h < prev    next >
C/C++ Source or Header  |  1998-04-29  |  2KB  |  77 lines

  1. //geombank.h
  2.  
  3. // Copyright (C) 1997,1998  Cliff Johnson                                       //
  4. //                                                                         //
  5. // This program is free software; you can redistribute it and/or           //
  6. // modify it under the terms of the GNU  General Public                    //
  7. // License as published by the Free Software Foundation; either            //
  8. // version 2 of the License, or (at your option) any later version.        //
  9. //                                                                         //
  10. // This software is distributed in the hope that it will be useful,        //
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of          //
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU       //
  13. // General Public License for more details.                                //
  14. //                                                                         //
  15. // You should have received a copy of the GNU General Public License       //
  16. // along with this software (see COPYING); if not, write to the        //
  17. // Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //
  18.  
  19. // GeomBank is where the data actually "lives" 
  20.  
  21. // GeomBank keeps track of each entity by 
  22. // assigning a unique 'handle'
  23. // to each entity as it is created. 
  24. //
  25. //
  26. // handle = bank.Create(Geom*)
  27. //
  28. // or, more practically...
  29. //
  30. // handle = bank.Create(new Point(1.,1.),POINT)    // to create an entity
  31. // handle = bank.Create(new Line(Point(), Point(1,1,0) ),LINE);
  32. //
  33. // and 
  34. //
  35. // bool bank.destroy(handle h);             // to kill an entity
  36. //
  37. // meanwhile, the handle a has evolved into a class
  38. // among itself, referencing a number and hiding its pointer..
  39. // of course this means that all actual geometric types are
  40. // derived from a single type... geom
  41. //
  42. // which means that the flow of applications will be
  43. //
  44. // 1 ) Create an entity.
  45. // 2 ) Register that entity with the canvas.
  46. //
  47. //  When the canvas redraws, it has the handle, and thus a pointer for instant access. 
  48. //
  49.  
  50. #ifndef GEOMBANK_H
  51. #define GEOMBANK_H
  52.  
  53. #include <list.h>      //HASA
  54.  
  55. #include <handle.h>  //ITO
  56.  
  57. class BankException;
  58.  
  59. class GeomBank
  60. {
  61. private:
  62.  
  63.     list<Handle> handleArray;
  64.  
  65. public:
  66.     Handle Create(Geom* gx);
  67.     bool Destroy(const Handle& h);
  68.  
  69. // diagnostic
  70.     void Print(ostream& os);
  71.  
  72.     Handle GetHandleFromPointer(const Geom* gx) const throw (BankException);
  73. };
  74.  
  75.  
  76. #endif
  77.