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 >
Wrap
C/C++ Source or Header
|
1998-04-29
|
2KB
|
77 lines
//geombank.h
// Copyright (C) 1997,1998 Cliff Johnson //
// //
// This program is free software; you can redistribute it and/or //
// modify it under the terms of the GNU General Public //
// License as published by the Free Software Foundation; either //
// version 2 of the License, or (at your option) any later version. //
// //
// This software is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
// General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this software (see COPYING); if not, write to the //
// Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //
// GeomBank is where the data actually "lives"
// GeomBank keeps track of each entity by
// assigning a unique 'handle'
// to each entity as it is created.
//
//
// handle = bank.Create(Geom*)
//
// or, more practically...
//
// handle = bank.Create(new Point(1.,1.),POINT) // to create an entity
// handle = bank.Create(new Line(Point(), Point(1,1,0) ),LINE);
//
// and
//
// bool bank.destroy(handle h); // to kill an entity
//
// meanwhile, the handle a has evolved into a class
// among itself, referencing a number and hiding its pointer..
// of course this means that all actual geometric types are
// derived from a single type... geom
//
// which means that the flow of applications will be
//
// 1 ) Create an entity.
// 2 ) Register that entity with the canvas.
//
// When the canvas redraws, it has the handle, and thus a pointer for instant access.
//
#ifndef GEOMBANK_H
#define GEOMBANK_H
#include <list.h> //HASA
#include <handle.h> //ITO
class BankException;
class GeomBank
{
private:
list<Handle> handleArray;
public:
Handle Create(Geom* gx);
bool Destroy(const Handle& h);
// diagnostic
void Print(ostream& os);
Handle GetHandleFromPointer(const Geom* gx) const throw (BankException);
};
#endif